/* =========================================================
   BILLBEAM — CONSOLIDATED CORE STYLESHEET
   Full replacement for static/style.css
   Built to support:
   - base.html
   - invoices dashboard
   - public invoice portal
   - pricing
   - settings / auth / forms
   - preview / send email / clients / payments / legal pages
   ========================================================= */

/* =========================
   TOKENS / ROOT
   ========================= */

:root {
    --accent: #3A8BFF;
    --accent-dark: #151B54;
    --accent-light: #FCDC2A;

    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;
    --info: #2563eb;

    --bg-light: #f6f8fc;
    --bg-light-2: #ffffff;
    --bg-dark: #020617;
    --bg-dark-2: #0f172a;
    --card-light: rgba(255, 255, 255, 0.82);
    --card-dark: rgba(2, 6, 23, 0.72);

    --text-light: #0f172a;
    --text-dark: #e5e7eb;
    --muted-light: #64748b;
    --muted-dark: #94a3b8;

    --border-light: rgba(15, 23, 42, 0.08);
    --border-dark: rgba(148, 163, 184, 0.22);

    --shadow-sm: 0 8px 20px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 18px 40px rgba(15, 23, 42, 0.10);
    --shadow-lg: 0 28px 70px rgba(15, 23, 42, 0.16);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;

    --container-max: 1200px;
}

/* =========================
   RESET / BASE
   ========================= */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

html,
body {
    height: auto;
    min-height: 100%;
}

body {
    margin: 0;
    font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text-light);
    background:
        radial-gradient(circle at top left, rgba(58, 139, 255, 0.10), transparent 34%),
        radial-gradient(circle at bottom right, rgba(252, 220, 42, 0.10), transparent 28%),
        linear-gradient(180deg, #f7f9fd 0%, #eef3fb 100%);
    opacity: 1;
    transition:
        background 0.25s ease,
        color 0.25s ease,
        opacity 0.25s ease-in-out;
    overflow-x: hidden;
}

body.dark {
    color: var(--text-dark);
    background:
        radial-gradient(circle at top left, rgba(58, 139, 255, 0.12), transparent 28%),
        radial-gradient(circle at bottom right, rgba(252, 220, 42, 0.06), transparent 22%),
        linear-gradient(180deg, #020617 0%, #0b1222 100%);
}

body.fade-out {
    opacity: 0;
}

body.fade-exit {
    opacity: 0;
    transition: opacity 0.2s ease;
}

body::before {
    content: "";
    position: fixed;
    top: -180px;
    right: -180px;
    width: 420px;
    height: 420px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(252, 220, 42, 0.24), transparent 70%);
    z-index: -2;
    pointer-events: none;
}

body::after {
    content: "";
    position: fixed;
    left: var(--x, 50%);
    top: var(--y, 50%);
    width: 280px;
    height: 280px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.14), transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a {
    color: inherit;
    text-decoration: none;
    transition: opacity 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

a:hover {
    opacity: 0.9;
}

img {
    max-width: 100%;
    display: block;
}

main,
.main,
.main-content {
    min-height: auto;
    padding-bottom: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 36px 20px 28px;
    animation: fadeIn 0.4s ease-in-out;
}

.container::before,
.container::after {
    content: "";
    position: absolute;
    z-index: -1;
    pointer-events: none;
}

.container::before {
    width: 220px;
    height: 220px;
    top: -50px;
    left: -60px;
    border-radius: 46% 54% 57% 43%;
    opacity: 0.34;
    background:
        radial-gradient(circle at 20% 25%, rgba(58, 139, 255, 0.38), transparent 60%),
        radial-gradient(circle at 80% 75%, rgba(129, 140, 248, 0.42), transparent 70%);
}

.container::after {
    width: 250px;
    height: 250px;
    right: -80px;
    bottom: -80px;
    border-radius: 55% 45% 60% 40%;
    opacity: 0.32;
    background:
        radial-gradient(circle at 25% 78%, rgba(56, 189, 248, 0.34), transparent 60%),
        radial-gradient(circle at 70% 18%, rgba(244, 114, 182, 0.28), transparent 70%);
}

body.dark .container::before,
body.dark .container::after {
    opacity: 0.42;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes doodleFloat {
    0% { transform: translateY(0) rotate(0deg); opacity: 0.82; }
    50% { transform: translateY(-8px) rotate(1deg); opacity: 0.96; }
    100% { transform: translateY(4px) rotate(-1deg); opacity: 0.88; }
}

/* =========================
   TYPOGRAPHY
   ========================= */

.logo,
.preview-brand-name,
.hero-left h1,
.footer-brand {
    font-family: "Space Grotesk", sans-serif;
}

.logo {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

h1, h2, h3, h4 {
    margin-top: 0;
    line-height: 1.18;
}

p {
    line-height: 1.6;
}

.muted-text {
    color: var(--muted-light);
}

body.dark .muted-text {
    color: var(--muted-dark);
}

/* =========================
   NAVBAR
   ========================= */

.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 14px 22px 14px 58px;
    background: rgba(255, 255, 255, 0.74);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    backdrop-filter: blur(14px);
    box-shadow: 0 8px 30px rgba(15, 23, 42, 0.04);
}

body.dark .navbar {
    background: rgba(2, 6, 23, 0.74);
    border-bottom-color: rgba(148, 163, 184, 0.10);
    box-shadow: 0 12px 34px rgba(0, 0, 0, 0.35);
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding-left: 6px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav-right a {
    position: relative;
    font-size: 14px;
    font-weight: 500;
    color: inherit;
}

.nav-right a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: currentColor;
    opacity: 0.65;
    transition: width 0.18s ease;
}

.nav-right a:hover::after {
    width: 100%;
}

.nav-user-pill,
.client-view-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    font-size: 13px;
    background: rgba(15, 23, 42, 0.05);
    border: 1px solid rgba(148, 163, 184, 0.32);
}

body.dark .nav-user-pill,
body.dark .client-view-pill {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.46);
}

.plan-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: linear-gradient(135deg, rgba(58, 139, 255, 0.16), rgba(252, 220, 42, 0.18));
    border: 1px solid rgba(58, 139, 255, 0.18);
}

/* =========================
   LANGUAGE TOGGLE
   ========================= */

.lang-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    border: 1px solid rgba(148, 163, 184, 0.4);
}

body.dark .lang-toggle {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(148, 163, 184, 0.72);
}

.lang-toggle a,
.lang-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: inherit;
    opacity: 0.72;
    transition: all 0.15s ease;
}

.lang-toggle a:hover,
.lang-pill:hover {
    opacity: 1;
}

.lang-toggle a.active,
.lang-pill.active {
    opacity: 1;
    background: var(--accent);
    color: #ffffff;
}

body.dark .lang-toggle a.active,
body.dark .lang-pill.active {
    background: var(--accent-light);
    color: #020617;
}

/* =========================
   BUTTONS
   ========================= */

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    background: var(--accent);
    color: #ffffff;
    border: 2px solid transparent;
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.16);
    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease,
        background 0.18s ease,
        border-color 0.18s ease,
        opacity 0.18s ease;
}

button:hover,
.btn:hover {
    transform: translateY(-2px);
    background: var(--accent-dark);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
}

button:active,
.btn:active {
    transform: scale(0.98);
}

button:disabled,
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.66;
    transform: none !important;
    box-shadow: none !important;
}

.btn-brand {
    background: var(--accent-dark);
    color: #ffffff;
}

.btn-secondary {
    background: #eef2f7;
    color: #111827;
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: none;
}

.btn-secondary:hover {
    background: #dfe6f1;
    color: #0f172a;
}

body.dark .btn-secondary {
    background: #111827;
    color: #e5e7eb;
    border-color: rgba(148, 163, 184, 0.34);
}

body.dark .btn-secondary:hover {
    background: #1f2937;
}

.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }

.btn-info { background: var(--info); }
.btn-info:hover { background: #1d4ed8; }

.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }

.btn-edit { background: #64748b; }
.btn-edit:hover { background: #475569; }

.btn-compact {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
}

.btn-wide {
    width: 100%;
}

.btn-pdf::before {
    content: "⬇";
    font-size: 0.85em;
}

/* =========================
   FORM ELEMENTS
   ========================= */

label {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
    font-weight: 600;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #dbe3ef;
    background: #ffffff;
    color: #111827;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(58, 139, 255, 0.14);
}

textarea {
    resize: vertical;
    min-height: 110px;
}

body.dark input,
body.dark select,
body.dark textarea {
    background: #020617;
    color: var(--text-dark);
    border-color: rgba(148, 163, 184, 0.42);
}

body.dark input::placeholder,
body.dark textarea::placeholder {
    color: rgba(148, 163, 184, 0.84);
}

/* =========================
   FORM SHELL / GLASS
   ========================= */

.form-wrapper {
    position: relative;
    padding: 34px;
    margin-bottom: 42px;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.42);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(16px);
    transition: transform 0.24s ease;
}

.form-wrapper:hover {
    transform: translateY(-3px);
}

.form-wrapper::before {
    content: "";
    position: absolute;
    top: -24px;
    left: 12px;
    width: 150px;
    height: 72px;
    border-radius: 999px;
    background:
        linear-gradient(90deg, rgba(21, 27, 84, 0.14), transparent 70%),
        radial-gradient(circle at 100% 0, rgba(59, 130, 246, 0.32), transparent 70%);
    opacity: 0.44;
    pointer-events: none;
}

body.dark .form-wrapper {
    background: rgba(15, 23, 42, 0.72);
    border-color: rgba(148, 163, 184, 0.12);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.56);
}

.fade-in-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.6s ease forwards;
}

.form-actions {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* =========================
   TABLES
   ========================= */

table {
    width: 100%;
    border-collapse: collapse;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin-top: 1.75rem;
    margin-bottom: 2.75rem;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

body.dark .table-wrapper {
    background: #020617;
    border-color: rgba(148, 163, 184, 0.7);
    box-shadow: 0 22px 50px rgba(0, 0, 0, 0.82);
}

.modern-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.modern-table thead,
.modern-table thead tr,
.modern-table thead th {
    background: #151B54 !important;
    color: #ffffff !important;
    border: none !important;
    opacity: 1 !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
}

body.dark .modern-table thead,
body.dark .modern-table thead tr,
body.dark .modern-table thead th {
    background: #0a0e2a !important;
    color: #ffffff !important;
}

.modern-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 12px;
}

.modern-table tbody td {
    padding: 11px 16px;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    vertical-align: middle;
}

body.dark .modern-table tbody td {
    border-bottom-color: rgba(148, 163, 184, 0.08);
}

.modern-table tbody tr:nth-child(odd) {
    background: #ffffff;
}

.modern-table tbody tr:nth-child(even) {
    background: #f5f7fb;
}

body.dark .modern-table tbody tr:nth-child(odd) {
    background: rgba(15, 23, 42, 0.92);
}

body.dark .modern-table tbody tr:nth-child(even) {
    background: rgba(15, 23, 42, 0.98);
}

.modern-table tbody tr:hover {
    background: rgba(21, 27, 84, 0.06);
}

body.dark .modern-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.action-buttons .btn {
    padding: 6px 10px;
    font-size: 0.8rem;
    border-radius: 10px;
    white-space: nowrap;
}

.row-paid {
    border-left: 4px solid #16a34a;
}

.row-overdue {
    border-left: 4px solid #dc2626;
}

.row-sent {
    border-left: 4px solid #0ea5e9;
}

.row-draft {
    border-left: 4px solid #94a3b8;
}

.table-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-top: 10px;
    margin-bottom: 8px;
}

.table-section-header h2 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

.table-section-header p {
    margin: 3px 0 0;
    font-size: 13px;
    color: #4b5563;
    opacity: 0.92;
}

.table-meta {
    font-size: 12px;
    color: #6b7280;
    opacity: 0.85;
}

body.dark .table-section-header h2 { color: #e5e7eb; }
body.dark .table-section-header p { color: #9ca3af; }
body.dark .table-meta { color: #9ca3af; }

/* =========================
   BADGES / PILLS
   ========================= */

.badge,
.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge.paid,
.status-pill.paid,
.status-pill-paid {
    background: rgba(22, 163, 74, 0.14);
    color: #166534;
}

.badge.overdue,
.status-pill.overdue,
.status-pill-overdue {
    background: rgba(220, 38, 38, 0.14);
    color: #b91c1c;
}

.badge.sent,
.status-pill.sent,
.status-pill-sent {
    background: rgba(37, 99, 235, 0.14);
    color: #1d4ed8;
}

.badge.draft {
    background: rgba(148, 163, 184, 0.18);
    color: #475569;
}

body.dark .badge.paid,
body.dark .status-pill.paid,
body.dark .status-pill-paid {
    background: rgba(22, 163, 74, 0.24);
    color: #bbf7d0;
}

body.dark .badge.overdue,
body.dark .status-pill.overdue,
body.dark .status-pill-overdue {
    background: rgba(220, 38, 38, 0.24);
    color: #fecaca;
}

body.dark .badge.sent,
body.dark .status-pill.sent,
body.dark .status-pill-sent {
    background: rgba(37, 99, 235, 0.24);
    color: #bfdbfe;
}

body.dark .badge.draft {
    background: rgba(148, 163, 184, 0.24);
    color: #e5e7eb;
}

/* =========================
   DASHBOARD HEADER / KPI
   ========================= */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.dashboard-header h1 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.dashboard-cards,
.dashboard-cards.enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.dashboard-cards,
.chart-card,
.table-wrapper {
    animation: fadeUp 0.6s ease forwards;
    opacity: 0;
}

.dashboard-cards { animation-delay: 0.1s; }
.chart-card { animation-delay: 0.2s; }
.table-wrapper { animation-delay: 0.3s; }

.card {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
}

.card.kpi {
    padding: 22px;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.22);
    transition: transform 0.24s ease, box-shadow 0.24s ease;
}

.card.kpi:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28);
}

.card.kpi::after {
    content: "";
    position: absolute;
    top: 0;
    left: -120%;
    width: 70%;
    height: 100%;
    background: linear-gradient(110deg, transparent, rgba(255,255,255,0.22), transparent);
    transition: 0.7s;
}

.card.kpi:hover::after {
    left: 140%;
}

.card.kpi.orange { background: linear-gradient(135deg, #f97316, #c2410c); }
.card.kpi.green  { background: linear-gradient(135deg, #10b981, #047857); }
.card.kpi.blue   { background: linear-gradient(135deg, #2563eb, #1e40af); }
.card.kpi.purple { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
.card.kpi.teal   { background: linear-gradient(135deg, #14b8a6, #0f766e); }
.card.kpi.red    { background: linear-gradient(135deg, #ef4444, #b91c1c); }

.card.kpi h2,
.kpi-number {
    margin: 0 0 6px;
    font-size: 28px;
    font-weight: 800;
}

.card.kpi p {
    margin: 0;
    font-size: 14px;
    opacity: 0.94;
}

.kpi-live-label {
    display: inline-block;
    margin-top: 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.78;
}

.status-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 22px 0 24px;
}

.status-item {
    padding: 8px 15px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
}

.status-item.paid  { background: rgba(16,185,129,0.15); color: #166534; }
.status-item.sent  { background: rgba(59,130,246,0.15); color: #1d4ed8; }
.status-item.draft { background: rgba(249,115,22,0.15); color: #c2410c; }

body.dark .status-item.paid  { color: #bbf7d0; }
body.dark .status-item.sent  { color: #bfdbfe; }
body.dark .status-item.draft { color: #fed7aa; }

/* =========================
   SEARCH BAR
   ========================= */

.search-bar.modern {
    margin-bottom: 22px;
}

.search-bar.modern form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-bar.modern input {
    flex: 1 1 260px;
}

/* =========================
   CHARTS / ANALYTICS
   ========================= */

.charts-row,
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    align-items: stretch;
    margin-top: 20px;
    margin-bottom: 30px;
}

.chart-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px 16px 12px;
    border-radius: 18px;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.06);
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.14);
    overflow: hidden;
    height: auto;
}

body.dark .chart-card {
    background: #020617;
    border-color: rgba(148, 163, 184, 0.55);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.9);
}

.chart-card.brand-accent {
    border-top: 4px solid #151B54;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 2px;
}

.chart-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.chart-sub {
    font-size: 12px;
    opacity: 0.75;
}

.chart-card canvas,
.chart-canvas {
    position: static !important;
    display: block;
    width: 100% !important;
    height: 220px !important;
}

.chart-scroll-x,
.chart-scroll-inner {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 6px;
}

.chart-scroll-x .wide-chart,
.chart-scroll-inner .wide-chart,
.chart-canvas.wide {
    min-width: 720px;
}

.chart-scroll-inner::-webkit-scrollbar,
.chart-scroll-x::-webkit-scrollbar {
    height: 6px;
}

.chart-scroll-inner::-webkit-scrollbar-thumb,
.chart-scroll-x::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.72);
    border-radius: 999px;
}

.chart-ai-hint {
    margin-top: 4px;
    font-size: 11px;
    opacity: 0.78;
}

/* =========================
   LEADERBOARD / TOP CLIENTS
   ========================= */

.leaderboard,
.top-clients-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.chart-card .leaderboard,
.top-clients-card .leaderboard {
    max-height: 220px;
    overflow-y: auto;
    padding-right: 4px;
}

.chart-card .leaderboard::-webkit-scrollbar,
.top-clients-card .leaderboard::-webkit-scrollbar {
    width: 6px;
}

.chart-card .leaderboard::-webkit-scrollbar-thumb,
.top-clients-card .leaderboard::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.75);
}

.top-clients-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-item,
.top-client-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}

.leader-left {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1 1 60%;
}

.leader-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rank {
    padding: 4px 8px;
    border-radius: 8px;
    background: #151B54;
    color: #ffffff;
    font-size: 12px;
    font-weight: 700;
}

.client-name,
.top-client-name {
    font-size: 14px;
    font-weight: 700;
}

.leader-right,
.top-client-amount {
    white-space: nowrap;
    font-size: 14px;
    font-weight: 800;
}

.leader-meta,
.top-client-meta {
    font-size: 11px;
    opacity: 0.74;
}

.progress-bar,
.top-client-bar {
    width: 100%;
    height: 6px;
    margin-top: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.18);
}

.progress-fill,
.top-client-bar-fill {
    height: 100%;
    border-radius: 999px;
    background: #151B54;
    transition: width 0.5s ease;
}

/* =========================
   HERO
   ========================= */

.hero {
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 40px;
    padding: 72px 40px;
    margin-bottom: 54px;
    border-radius: 24px;
    color: #ffffff;
    background:
        radial-gradient(circle at 18% 20%, rgba(96, 165, 250, 0.34), transparent 28%),
        radial-gradient(circle at 82% 18%, rgba(59, 130, 246, 0.28), transparent 26%),
        linear-gradient(135deg, #3A8BFF 0%, #2563eb 34%, #151B54 72%, #0f172a 100%);
    box-shadow:
        0 24px 70px rgba(21, 27, 84, 0.30),
        0 0 0 1px rgba(147, 197, 253, 0.12),
        0 0 80px rgba(59, 130, 246, 0.18);
    isolation: isolate;
}

/* soft blue aura behind whole hero */
.hero::before {
    content: "";
    position: absolute;
    inset: -20% -10% auto auto;
    width: 380px;
    height: 380px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(96, 165, 250, 0.34) 0%, rgba(59, 130, 246, 0.18) 32%, transparent 72%);
    filter: blur(10px);
    z-index: 0;
    pointer-events: none;
}

/* secondary glow for depth */
.hero::after {
    content: "";
    position: absolute;
    left: -80px;
    bottom: -120px;
    width: 320px;
    height: 320px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.22) 0%, rgba(59, 130, 246, 0.12) 42%, transparent 74%);
    filter: blur(8px);
    z-index: 0;
    pointer-events: none;
}

.hero-left,
.hero-right {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
}

.hero-left h1 {
    margin-bottom: 15px;
    font-size: 42px;
    font-weight: 800;
    letter-spacing: 0.02em;
    line-height: 1.08;
    color: #ffffff;
    text-shadow: 0 6px 22px rgba(15, 23, 42, 0.24);
}

.hero-left p {
    margin-bottom: 24px;
    font-size: 18px;
    line-height: 1.65;
    color: rgba(255, 255, 255, 0.92);
    max-width: 620px;
}

.hero-right {
    display: flex;
    justify-content: center;
}

.mock-card {
    width: 280px;
    padding: 30px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.24), rgba(255,255,255,0.10));
    border: 1px solid rgba(255,255,255,0.22);
    backdrop-filter: blur(20px);
    box-shadow:
        0 20px 50px rgba(2, 6, 23, 0.30),
        0 0 40px rgba(96, 165, 250, 0.14);
}

/* optional hero CTA polish */
.hero .btn,
.hero .hero-cta,
.hero a.btn {
    box-shadow:
        0 14px 30px rgba(15, 23, 42, 0.22),
        0 0 24px rgba(59, 130, 246, 0.16);
}

/* mobile */
@media (max-width: 768px) {
    .hero {
        flex-direction: column !important;
        align-items: stretch;
        gap: 18px;
        padding: 40px 20px;
        text-align: center;
    }

    .hero-left,
    .hero-right {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-left h1 {
        font-size: 28px;
    }

    .hero-left p {
        font-size: 16px;
        margin-left: auto;
        margin-right: auto;
    }

    .mock-card {
        width: 100%;
        max-width: 350px;
        margin: 8px auto 0;
    }
}

.home-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 24px;
    margin-bottom: 38px;
}

.home-stats .card {
    width: 240px;
    text-align: center;
    animation: floatIn 0.6s ease forwards;
    opacity: 0;
}

.home-stats .card:nth-child(1) { animation-delay: 0.2s; }
.home-stats .card:nth-child(2) { animation-delay: 0.4s; }

@keyframes floatIn {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================
   FLOATING BUTTON / FAB
   ========================= */

.floating-btn {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1500;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 14px 30px rgba(0,0,0,0.24);
    font-size: 28px;
    opacity: 0;
    transform: scale(0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.28s ease;
}

.floating-btn.show {
    opacity: 1;
    transform: scale(1);
}

/* =========================
   SIDEBAR / HAMBURGER / OVERLAY
   ========================= */

.hamburger {
    position: fixed;
    top: 20px;
    left: 16px;
    z-index: 1200;
    width: 20px;
    height: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
}

.hamburger span {
    width: 100%;
    height: 3px;
    border-radius: 3px;
    background: #111827;
    transition: all 0.28s ease;
}

body.dark .hamburger span {
    background: #f3f4f6;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

.sidebar {
    position: fixed;
    top: 0;
    left: -260px;
    z-index: 1100;
    width: 240px;
    height: 100%;
    padding-top: 80px;
    background: #1f2937;
    box-shadow: 4px 0 20px rgba(0,0,0,0.25);
    transition: left 0.32s ease;
}

.sidebar.active {
    left: 0;
}

.sidebar::before {
    content: "";
    position: absolute;
    top: 70px;
    left: 0;
    width: 4px;
    height: 120px;
    border-radius: 0 999px 999px 0;
    opacity: 0.72;
    background: linear-gradient(180deg, #6366f1, #22c55e);
}

.sidebar-header {
    position: absolute;
    top: 20px;
    left: 25px;
    font-size: 14px;
    color: #9ca3af;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.sidebar-link {
    display: block;
    padding: 14px 25px;
    color: #f3f4f6;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    background: #374151;
    padding-left: 32px;
}

.sidebar-link.active {
    background: linear-gradient(90deg, var(--accent), var(--accent-dark));
    color: #ffffff;
}

.overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.40);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.overlay.active {
    opacity: 1;
    visibility: visible;
}

.theme-toggle {
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(255,255,255,0.88);
    box-shadow: none;
    font-size: 14px;
}

body.dark .theme-toggle {
    background: rgba(15,23,42,0.92);
    color: #e5e7eb;
    border-color: rgba(148,163,184,0.72);
}

/* =========================
   REVEAL / EMPTY / ALERT
   ========================= */

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.7s ease;
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

.empty-state {
    text-align: center;
    padding: 70px 20px;
    opacity: 0.9;
}

.empty-state h3 {
    margin-bottom: 10px;
    font-size: 22px;
}

.empty-state p {
    margin-bottom: 20px;
}

.alert-overdue {
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 600;
    border: 1px solid rgba(148,163,184,0.4);
}

/* =========================
   PRICING
   ========================= */

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.pricing-card {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 20px 18px 18px;
    border-radius: 20px;
    color: #f8fafc;
    border: none;
}

.pricing-card.pricing-free {
    background: #0f766e;
    box-shadow: 0 20px 50px rgba(15,118,110,0.42);
}

.pricing-card.pricing-pro {
    background: #1d4ed8;
    box-shadow: 0 20px 50px rgba(37,99,235,0.48);
}

.pricing-card.pricing-enterprise {
    background: #6d28d9;
    box-shadow: 0 20px 50px rgba(109,40,217,0.46);
}

body.dark .pricing-card.pricing-free,
body.dark .pricing-card.pricing-pro,
body.dark .pricing-card.pricing-enterprise {
    box-shadow: 0 22px 60px rgba(0,0,0,0.88);
}

.pricing-current {
    outline: 2px solid rgba(255,255,255,0.22);
    outline-offset: 0;
}

.pricing-card-header {
    margin-bottom: 10px;
}

.pricing-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.pricing-name {
    font-size: 19px;
    font-weight: 800;
}

.pricing-price .amount {
    font-size: 22px;
    font-weight: 900;
}

.pricing-tagline {
    margin: 4px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.pricing-features {
    list-style: none;
    padding: 0;
    margin: 12px 0 8px;
    font-size: 13px;
}

.pricing-features li {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 7px;
}

.feature-bullet {
    color: #d9f99d;
    font-weight: 800;
}

.pricing-pill {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    line-height: 1.1 !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.pricing-pill.current,
.pricing-pill.recommended,
body.dark .pricing-pill.current,
body.dark .pricing-pill.recommended {
    background: rgba(252, 211, 77, 0.30) !important;
    border: 1px solid rgba(252, 211, 77, 0.85) !important;
    color: #0b1120 !important;
    box-shadow: 0 10px 25px rgba(252, 211, 77, 0.18) !important;
}

.pricing-ai-callout {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    font-size: 12px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.14);
}

.pricing-ai-callout ul {
    margin: 6px 0 0 18px;
    padding: 0;
}

.pricing-ai-callout li {
    margin-bottom: 3px;
}

.pricing-cta {
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px dashed rgba(255,255,255,0.24);
}

.pricing-note {
    display: block;
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.9;
}

/* =========================
   PUBLIC INVOICE PORTAL
   ========================= */

.public-portal {
    position: relative;
    isolation: isolate;
}

.public-portal::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    opacity: 0.32;
    background-image:
        radial-gradient(circle at 15% 20%, rgba(21,27,84,0.18), transparent 55%),
        radial-gradient(circle at 85% 15%, rgba(59,130,246,0.18), transparent 55%),
        radial-gradient(circle at 25% 85%, rgba(249,115,22,0.16), transparent 55%),
        radial-gradient(circle at 80% 80%, rgba(20,184,166,0.16), transparent 55%);
    mix-blend-mode: multiply;
}

body.dark .public-portal::before {
    opacity: 0.24;
    mix-blend-mode: screen;
}

.public-top-banner {
    max-width: 1100px;
    margin: 8px auto 0;
    padding: 0 18px;
}

.public-top-banner-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 14px;
    border-radius: 16px;
    font-size: 13px;
    background: rgba(255,255,255,0.74);
    border: 1px solid rgba(15,23,42,0.07);
    box-shadow: 0 14px 34px rgba(15,23,42,0.04);
    backdrop-filter: blur(10px);
}

body.dark .public-top-banner-inner {
    background: rgba(2,6,23,0.72);
    border-color: rgba(148,163,184,0.18);
    box-shadow: 0 18px 40px rgba(2,6,23,0.7);
}

.public-hero {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    gap: 18px;
    margin-bottom: 18px;
}

.public-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}

.public-hero-left,
.public-hero-right,
.public-card {
    border-radius: 18px;
    padding: 18px;
    background: rgba(255,255,255,0.78);
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 14px 30px rgba(0,0,0,0.08);
    backdrop-filter: blur(14px);
}

body.dark .public-hero-left,
body.dark .public-hero-right,
body.dark .public-card {
    background: rgba(2,6,23,0.66);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 40px rgba(0,0,0,0.7);
}

.public-card-wide {
    margin-bottom: 18px;
}

.public-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.public-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid rgba(0,0,0,0.10);
}

.public-title {
    font-size: 18px;
    font-weight: 800;
}

.public-subtitle {
    font-size: 13px;
    opacity: 0.72;
}

.public-inv-meta .inv-label {
    margin-top: 8px;
    font-size: 18px;
    font-weight: 800;
}

.inv-dates {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 6px;
    font-size: 13px;
    opacity: 0.82;
}

.dot {
    opacity: 0.5;
}

.public-status-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.status-note {
    font-size: 12px;
    opacity: 0.75;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.summary-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.72;
}

.summary-amount {
    font-size: 30px;
    font-weight: 900;
}

.summary-breakdown .row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-top: 1px solid rgba(0,0,0,0.06);
}

body.dark .summary-breakdown .row {
    border-top-color: rgba(255,255,255,0.08);
}

.summary-actions {
    display: grid;
    gap: 10px;
    margin-top: 6px;
}

.summary-actions .btn {
    width: 100%;
    box-sizing: border-box;
}

.summary-foot {
    font-size: 12px;
    opacity: 0.76;
}

.card-title {
    margin-bottom: 10px;
    font-weight: 800;
}

.client-sub {
    margin-top: 4px;
    font-size: 13px;
    opacity: 0.75;
}

.mini-hint {
    margin-top: 12px;
    font-size: 12px;
    opacity: 0.72;
}

.snapshot {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.snap-item {
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.06);
}

body.dark .snap-item {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

.snap-label {
    font-size: 12px;
    opacity: 0.7;
}

.snap-value {
    margin-top: 4px;
    font-size: 14px;
    font-weight: 800;
}

.public-table-wrap {
    overflow-x: auto;
}

.public-table {
    width: 100%;
    border-collapse: collapse;
    border-radius: 14px;
    overflow: hidden;
}

.public-table thead th {
    background: var(--accent);
    color: #fff;
    padding: 12px 14px;
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.public-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(0,0,0,0.06);
}

body.dark .public-table td {
    border-bottom-color: rgba(255,255,255,0.08);
}

.public-table tbody tr:nth-child(even) {
    background: rgba(0,0,0,0.02);
}

body.dark .public-table tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.03);
}

.public-table tfoot td {
    background: rgba(0,0,0,0.03);
}

body.dark .public-table tfoot td {
    background: rgba(255,255,255,0.04);
}

.right { text-align: right; }
.muted { opacity: 0.72; }

.timeline {
    margin-top: 8px;
}

.timeline-item {
    display: grid;
    grid-template-columns: 14px 1fr;
    gap: 10px;
    padding: 10px 0;
}

.timeline-dot {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(21,27,84,0.12);
}

.timeline-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.timeline-sub {
    margin-top: 4px;
    font-size: 13px;
}

.note-block {
    margin-top: 10px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(0,0,0,0.06);
}

body.dark .note-block {
    background: rgba(255,255,255,0.04);
    border-color: rgba(255,255,255,0.08);
}

.note-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    opacity: 0.72;
}

.note-text {
    margin-top: 6px;
    font-size: 14px;
}

.trust-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.trust-pill {
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: rgba(21,27,84,0.10);
}

body.dark .trust-pill {
    background: rgba(255,255,255,0.06);
}

.powered-by {
    margin: 14px 0 6px;
    text-align: center;
    font-size: 12px;
    opacity: 0.75;
}

/* stamp doodle */
.public-stamp-doodle {
    position: absolute;
    top: 10px;
    right: 18px;
    width: 120px;
    height: 120px;
    opacity: 0.40;
    pointer-events: none;
    z-index: 0;
}

.public-stamp-svg {
    width: 100%;
    height: 100%;
    fill: none;
    stroke: rgba(21, 27, 84, 0.7);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 10px 24px rgba(15, 23, 42, 0.35));
    transform: rotate(-12deg);
}

body.dark .public-stamp-svg {
    stroke: rgba(191, 219, 254, 0.95);
    filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.8));
}

/* =========================
   PREVIEW / CHECKLIST / LEGAL / GENERIC CONTENT
   ========================= */

.preview-banner {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: rgba(255,255,255,0.76);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: var(--shadow-sm);
}

body.dark .preview-banner {
    background: rgba(15,23,42,0.76);
    border-color: rgba(148,163,184,0.14);
}

.preview-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(249, 115, 22, 0.16);
    color: #c2410c;
    font-size: 12px;
    font-weight: 800;
}

.invoice-preview-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 0.9fr);
    gap: 20px;
}

.invoice-preview-card,
.preview-sidebar,
.checklist-card {
    background: rgba(255,255,255,0.80);
    border-radius: 20px;
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

body.dark .invoice-preview-card,
body.dark .preview-sidebar,
body.dark .checklist-card {
    background: rgba(15,23,42,0.74);
    border-color: rgba(148,163,184,0.14);
}

.invoice-preview-card { padding: 24px; }
.preview-sidebar { padding: 20px; }

.invoice-preview-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.preview-logo {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    object-fit: cover;
}

.preview-brand-name {
    margin: 0 0 4px;
    font-size: 24px;
    font-weight: 800;
}

.preview-subtitle {
    margin: 0;
    font-size: 13px;
    opacity: 0.76;
}

.invoice-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 12px;
}

.meta-label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    opacity: 0.72;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.meta-value {
    font-size: 14px;
    font-weight: 700;
}

.invoice-section {
    margin-top: 24px;
}

.invoice-section.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.section-title {
    margin-bottom: 8px;
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    opacity: 0.76;
}

.client-main {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 800;
}

.client-line {
    margin: 3px 0;
    font-size: 14px;
    opacity: 0.86;
}

.client-notes {
    margin-top: 8px;
    font-size: 13px;
    opacity: 0.78;
}

.preview-table-wrapper {
    overflow-x: auto;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
}

.preview-table th,
.preview-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(15,23,42,0.08);
}

body.dark .preview-table th,
body.dark .preview-table td {
    border-bottom-color: rgba(148,163,184,0.10);
}

.preview-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(15,23,42,0.08);
    font-weight: 800;
}

.preview-total-amount {
    font-size: 22px;
}

.small-print p {
    margin: 8px 0;
    font-size: 14px;
}

.preview-tip,
.preview-footer-text {
    font-size: 14px;
    opacity: 0.86;
}

.preview-checklist {
    padding-left: 18px;
    margin: 14px 0;
}

.preview-checklist li {
    margin-bottom: 6px;
    font-size: 14px;
}

.checklist-shell {
    max-width: 980px;
    margin: 24px auto 10px;
}

.checklist-header {
    position: relative;
    margin-bottom: 22px;
}

.checklist-header h1 {
    margin-bottom: 6px;
    font-size: 1.7rem;
}

.checklist-header p {
    max-width: 580px;
    font-size: 0.96rem;
    opacity: 0.86;
}

.checklist-tag {
    position: absolute;
    top: 0;
    right: 0;
    padding: 4px 8px;
    border-radius: 999px;
    border: 1px solid rgba(148,163,184,0.6);
    font-size: 0.75rem;
    opacity: 0.8;
}

.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.checklist-card {
    padding: 16px 16px 12px;
    font-size: 0.92rem;
}

.checklist-card h2 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.checklist-card ul {
    padding-left: 18px;
    margin: 0;
}

.checklist-card li + li {
    margin-top: 4px;
}

.checklist-footer {
    margin-top: 14px;
    font-size: 0.82rem;
    opacity: 0.78;
}

/* generic content pages */
.page-shell,
.legal-shell {
    max-width: 920px;
    margin: 0 auto;
}

.page-card,
.legal-card {
    padding: 28px;
    border-radius: 20px;
    background: rgba(255,255,255,0.82);
    border: 1px solid rgba(15,23,42,0.08);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(14px);
}

body.dark .page-card,
body.dark .legal-card {
    background: rgba(15,23,42,0.76);
    border-color: rgba(148,163,184,0.14);
}

.page-eyebrow,
.legal-eyebrow {
    margin-bottom: 8px;
    font-size: 12px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    opacity: 0.74;
}

.page-lead,
.legal-lead {
    font-size: 15px;
    opacity: 0.84;
    max-width: 760px;
}

.legal-card h2,
.page-card h2 {
    margin-top: 28px;
    margin-bottom: 10px;
    font-size: 20px;
}

.legal-card h3,
.page-card h3 {
    margin-top: 22px;
    margin-bottom: 8px;
    font-size: 16px;
}

.legal-card ul,
.legal-card ol,
.page-card ul,
.page-card ol {
    padding-left: 20px;
}

.legal-card li,
.page-card li {
    margin-bottom: 7px;
}

.legal-muted,
.page-muted {
    font-size: 13px;
    opacity: 0.74;
}

/* =========================
   AI HELPER WIDGET
   ========================= */

.ai-helper {
    position: fixed;
    right: 24px;
    bottom: 90px;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.ai-helper-toggle {
    width: 52px;
    height: 52px;
    border-radius: 999px;
    border: none;
    font-size: 24px;
    background: var(--accent);
    color: #ffffff;
    box-shadow: 0 16px 35px rgba(0,0,0,0.35);
}

.ai-helper-toggle:hover {
    transform: translateY(-2px) scale(1.03);
    background: var(--accent-light);
    color: #111827;
}

body.dark .ai-helper-toggle {
    background: #1f2937;
    color: #ffffff;
}

.ai-helper-panel {
    display: none;
    flex-direction: column;
    width: 320px;
    max-height: 420px;
    margin-bottom: 10px;
    overflow: hidden;
    border-radius: 18px;
    background: rgba(255,255,255,0.98);
    border: 1px solid rgba(148,163,184,0.4);
    box-shadow: 0 22px 50px rgba(15,23,42,0.35);
}

.ai-helper.open .ai-helper-panel {
    display: flex;
}

body.dark .ai-helper-panel {
    background: #020617;
    border-color: rgba(148,163,184,0.7);
}

.ai-helper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    color: #ffffff;
    background: linear-gradient(135deg, #151B54, #1d4ed8);
    border-bottom: 1px solid rgba(148,163,184,0.4);
}

.ai-helper-title span {
    font-size: 14px;
    font-weight: 800;
}

.ai-helper-title small {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    opacity: 0.86;
}

.ai-helper-close {
    padding: 2px 4px;
    background: transparent;
    box-shadow: none;
    font-size: 18px;
    color: #e5e7eb;
}

.ai-helper-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
    background: radial-gradient(circle at top left, rgba(148,163,184,0.15), transparent 55%);
}

.ai-message {
    margin-bottom: 6px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.45;
}

.ai-message-system {
    background: rgba(148,163,184,0.15);
    color: #111827;
}

body.dark .ai-message-system {
    background: rgba(15,23,42,0.9);
    color: #e5e7eb;
}

.ai-message-user {
    margin-left: 40px;
    color: #ffffff;
    background: #151B54;
}

body.dark .ai-message-user {
    background: #1f2937;
}

.ai-message-assistant {
    margin-right: 40px;
    color: #111827;
    background: rgba(37,99,235,0.07);
}

body.dark .ai-message-assistant {
    color: #e5e7eb;
    background: rgba(37,99,235,0.25);
}

.ai-helper-form {
    display: flex;
    gap: 6px;
    padding: 8px;
    border-top: 1px solid rgba(148,163,184,0.4);
    background: rgba(249,250,251,0.95);
}

body.dark .ai-helper-form {
    background: #020617;
}

.ai-helper-form input[type="text"] {
    flex: 1;
    min-width: 0;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 13px;
}

.ai-helper-send {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
}

/* =========================
   WELCOME MODAL / LOADER
   ========================= */

.welcome-modal {
    position: fixed !important;
    inset: 0 !important;
    z-index: 100000 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.65) !important;
}

.hidden {
    display: none !important;
}

.welcome-content {
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    background: #ffffff;
    box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}

body.dark .welcome-content {
    background: #1f2937;
    color: #e5e7eb;
}

.loader {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: #ffffff;
    animation: fadeLoader 0.5s ease forwards;
}

body.dark .loader {
    background: #020617;
}

@keyframes fadeLoader {
    to { opacity: 0; visibility: hidden; }
}

/* =========================
   FOOTER
   ========================= */

.footer,
footer,
.site-footer,
.app-footer {
    position: static !important;
    inset: auto !important;
    width: 100%;
    margin-top: 3rem;
    clear: both;
    z-index: 0 !important;
}

.footer {
    padding: 30px 18px 42px;
}

.footer-shell {
    max-width: 1100px;
    margin: 0 auto;
    padding: 22px 20px 18px;
    border-radius: 22px;
    background: rgba(255,255,255,0.70);
    border: 1px solid rgba(15,23,42,0.06);
    box-shadow:
        0 14px 40px rgba(15, 23, 42, 0.05),
        0 0 0 1px rgba(15, 23, 42, 0.015);
    backdrop-filter: blur(12px);
}

body.dark .footer-shell {
    background: rgba(2, 6, 23, 0.72);
    border-color: rgba(148,163,184,0.22);
    box-shadow:
        0 18px 46px rgba(2, 6, 23, 0.75),
        0 0 0 1px rgba(59,130,246,0.08);
}

.footer-topline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.footer-brand-mark {
    width: 12px;
    height: 12px;
    flex: 0 0 auto;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    box-shadow: 0 0 18px rgba(58,139,255,0.25);
}

.footer-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.footer-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    background: rgba(15,23,42,0.04);
    border: 1px solid rgba(148,163,184,0.25);
}

body.dark .footer-chip {
    background: rgba(15,23,42,0.75);
    border-color: rgba(148,163,184,0.34);
}

.footer-divider {
    width: 100%;
    height: 1px;
    margin: 14px 0 12px;
    background: linear-gradient(90deg, transparent, rgba(148,163,184,0.35), transparent);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin: 6px 0 10px;
    font-size: 13px;
    opacity: 0.92;
}

.footer-links a:hover {
    text-decoration: underline;
}

.footer-meta {
    display: grid;
    gap: 8px;
    justify-items: center;
}

.footer-note {
    max-width: 860px;
    margin: 0 auto;
    text-align: center;
    font-size: 12px;
    line-height: 1.55;
    opacity: 0.76;
}

.footer-copy {
    text-align: center;
    font-size: 12px;
    opacity: 0.68;
}

/* =========================
   DOODLES
   ========================= */

.bg-doodles {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.doodle {
    position: absolute;
    fill: none;
    stroke: rgba(21, 27, 84, 0.55);
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 18px 40px rgba(15, 23, 42, 0.18));
    animation: doodleFloat 22s ease-in-out infinite alternate;
}

body.dark .doodle {
    stroke: rgba(191, 219, 254, 0.85);
    filter: drop-shadow(0 18px 40px rgba(15, 23, 42, 0.75));
}

.doodle-top-right {
    top: 40px;
    right: -10px;
    width: 320px;
    max-width: 40vw;
    transform: rotate(-5deg);
}

.doodle-bottom-left {
    bottom: -10px;
    left: -30px;
    width: 260px;
    max-width: 36vw;
    transform: rotate(6deg);
}

.doodle-mid-right {
    top: 55%;
    right: -40px;
    width: 240px;
    max-width: 32vw;
    transform: translateY(-50%) rotate(10deg);
}

/* =========================
   SMALL COMPONENTS
   ========================= */

.remove-cell {
    width: 40px;
    text-align: center;
    vertical-align: middle;
}

.btn-remove-row {
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    line-height: 1;
    color: #9ca3af;
}

.btn-remove-row:hover {
    color: #ef4444;
    transform: scale(1.1);
    background: transparent;
    box-shadow: none;
}

body.dark .btn-remove-row {
    color: #6b7280;
}

body.dark .btn-remove-row:hover {
    color: #fca5a5;
}

.inline-error,
.inline-success {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
}

.inline-error {
    background: #fee2e2;
    color: #b91c1c;
    border: 1px solid #dc2626;
}

.inline-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #16a34a;
}

body.dark .inline-error {
    background: rgba(127, 29, 29, 0.35);
    color: #fecaca;
    border-color: rgba(248, 113, 113, 0.45);
}

body.dark .inline-success {
    background: rgba(20, 83, 45, 0.35);
    color: #bbf7d0;
    border-color: rgba(74, 222, 128, 0.4);
}

/* =========================
   RESPONSIVE
   ========================= */

@media (max-width: 1100px) {
    .doodle-top-right {
        width: 260px;
        right: -30px;
        opacity: 0.8;
    }

    .doodle-bottom-left {
        width: 220px;
        left: -50px;
        opacity: 0.7;
    }

    .doodle-mid-right {
        width: 200px;
        right: -40px;
        opacity: 0.75;
    }
}

@media (max-width: 900px) {
    .public-hero,
    .public-grid,
    .invoice-preview-shell,
    .invoice-section.two-col {
        grid-template-columns: 1fr;
    }

    .invoice-meta {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 28px 14px 22px;
    }

    .navbar {
        padding: 14px 22px 14px 48px;
    }

    .hero {
        flex-direction: column !important;
        align-items: stretch;
        gap: 18px;
        padding: 40px 20px;
        text-align: center;
    }

    .hero-left,
    .hero-right {
        width: 100% !important;
        max-width: 100% !important;
    }

    .hero-left h1 {
        font-size: 28px;
    }

    .hero-left p {
        font-size: 16px;
    }

    .hero-left .hero-cta {
        display: inline-flex;
        justify-content: center;
        align-items: center;
        max-width: 100%;
        margin-top: 16px;
        margin-left: auto;
        margin-right: auto;
        padding-inline: 18px;
    }

    .mock-card {
        width: 100%;
        max-width: 350px;
        margin: 8px auto 0;
    }

    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .chart-card canvas,
    .chart-canvas {
        height: 190px !important;
    }

    .table-wrapper {
        padding-bottom: 1rem;
    }

    .leader-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .leader-right {
        align-items: flex-start;
    }

    .ai-helper-panel {
        width: calc(100vw - 32px);
    }

    .footer-shell {
        padding: 18px 16px 16px;
    }

    .footer-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .public-top-banner {
        padding: 0 14px;
    }

    .public-top-banner-inner {
        padding: 12px;
    }

    .form-wrapper {
        padding: 24px 18px;
    }
}

@media (max-width: 640px) {
    .public-stamp-doodle {
        width: 90px;
        height: 90px;
        top: 4px;
        right: 10px;
        opacity: 0.32;
    }
}

@media (max-width: 600px) {
    .bg-doodles {
        opacity: 0.42;
    }
}

@media (max-width: 520px) {
    .pricing-grid,
    .dashboard-cards,
    .dashboard-cards.enhanced,
    .charts-row,
    .charts-grid,
    .checklist-grid {
        grid-template-columns: 1fr;
    }

    .search-bar.modern form,
    .form-actions,
    .quick-actions,
    .status-summary {
        width: 100%;
    }

    .form-actions .btn,
    .quick-actions .btn {
        width: 100%;
    }
}