/* ===================================================================
   Lead Accounting+ Portal — design system
   Clean, modern, professional, subtly animated.
   =================================================================== */

:root {
    --bg: #f5f6fb;
    --surface: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e6e8f0;
    --brand: #4f46e5;
    --brand-2: #7c3aed;
    --brand-soft: #eef0ff;
    --ok: #059669;
    --ok-soft: #ecfdf5;
    --warn: #d97706;
    --warn-soft: #fffbeb;
    --bad: #dc2626;
    --bad-soft: #fef2f2;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
    --shadow-lg: 0 4px 12px rgba(15, 23, 42, .06), 0 24px 48px -16px rgba(79, 70, 229, .18);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Plus Jakarta Sans', var(--font);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 15px;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0 0 .5em; }
a { color: var(--brand); text-decoration: none; }
a:hover { opacity: .9; }
img { max-width: 100%; }
.muted { color: var(--muted); }

/* ---------- animated background orbs ---------- */
.bg-orbs { position: fixed; inset: 0; overflow: hidden; z-index: -1; pointer-events: none; }
.bg-orbs i {
    position: absolute; border-radius: 50%; filter: blur(70px); opacity: .35;
    animation: drift 22s ease-in-out infinite alternate;
}
.bg-orbs i:nth-child(1) { width: 420px; height: 420px; background: #c7d2fe; top: -120px; left: -80px; }
.bg-orbs i:nth-child(2) { width: 360px; height: 360px; background: #e9d5ff; bottom: -100px; right: -60px; animation-delay: -7s; }
.bg-orbs i:nth-child(3) { width: 260px; height: 260px; background: #bae6fd; top: 40%; left: 55%; animation-delay: -14s; }
@keyframes drift {
    from { transform: translate(0, 0) scale(1); }
    to   { transform: translate(60px, -40px) scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- reveal animation ---------- */
.reveal, .card, .stat, .table-card, .plan-card {
    animation: fadeUp .5s cubic-bezier(.2, .7, .3, 1) both;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: none; }
}

/* ---------- brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-size: 18px; color: var(--ink); font-weight: 600; }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand img.logo-full { width: auto; height: 36px; border-radius: 0; }
.sidebar .brand img.logo-full { height: 32px; }
.brand b { background: linear-gradient(90deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-dark { color: #e2e8f0; }

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border-radius: 10px; border: 1px solid transparent;
    font: 600 14px var(--font); cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s;
    white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary {
    color: #fff; background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .5);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .55); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #fff; border-color: #cbd5e1; }
.btn-danger { background: var(--bad); color: #fff; }
.btn-ok { background: var(--ok); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: wait; }

/* ---------- forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: #334155; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
    width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
    background: #fff; font: 500 14px var(--font); color: var(--ink); outline: none;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79, 70, 229, .12);
}
textarea { min-height: 90px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

/* OTP boxes */
.otp-row { display: flex; gap: 10px; justify-content: center; margin: 18px 0; }
.otp-row input {
    width: 48px; height: 56px; text-align: center; font-size: 22px; font-weight: 700;
    border-radius: 12px;
}

/* ---------- flash ---------- */
.flash {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 500;
    animation: fadeUp .35s both;
}
.flash-ok { background: var(--ok-soft); color: #065f46; border: 1px solid #a7f3d0; }
.flash-err { background: var(--bad-soft); color: #991b1b; border: 1px solid #fecaca; }
.flash-x { background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }
.flash-x:hover { opacity: 1; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-bad { background: var(--bad-soft); color: var(--bad); }
.badge-brand { background: var(--brand-soft); color: var(--brand); }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* ---------- cards ---------- */
.card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 24px;
}
.card + .card { margin-top: 20px; }
.card h3 { font-size: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.card-head h3 { margin: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 22px; }
.stat {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px 20px; position: relative; overflow: hidden;
    transition: transform .2s, box-shadow .2s;
}
.stat:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.stat::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
    background: linear-gradient(90deg, var(--brand), var(--brand-2));
}
.stat small { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.stat b { display: block; font-size: 28px; font-family: var(--font-display); margin-top: 6px; }
.stat.stat-warn::after { background: linear-gradient(90deg, #f59e0b, #f97316); }
.stat.stat-ok::after { background: linear-gradient(90deg, #10b981, #059669); }

/* ---------- tables ---------- */
.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-card .card-head { padding: 18px 20px 0; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th {
    text-align: left; padding: 12px 16px; color: var(--muted); font-size: 12px;
    text-transform: uppercase; letter-spacing: .05em; border-bottom: 1px solid var(--line);
    background: #fafbff; white-space: nowrap;
}
table.data td { padding: 12px 16px; border-bottom: 1px solid #f1f3f9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr { transition: background .15s; }
table.data tbody tr:hover { background: #f8f9ff; }
.table-empty { padding: 40px; text-align: center; color: var(--muted); }

/* compact data table (wide lists that must fit one screen) */
table.data.compact { font-size: 12.5px; }
table.data.compact th { padding: 8px 10px; font-size: 10.5px; }
table.data.compact td { padding: 7px 10px; }
table.data.compact .badge { font-size: 11px; padding: 2px 8px; }
.cell-main { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; max-width: 220px; white-space: nowrap; }
.cell-sub { display: block; color: var(--muted); font-size: 11px; margin-top: 1px; white-space: nowrap; }

/* ---------- pagination ---------- */
.pager { display: flex; gap: 8px; padding: 14px 16px; justify-content: flex-end; }

/* ===================================================================
   PUBLIC (landing) LAYOUT
   =================================================================== */
.public-body { min-height: 100vh; display: flex; flex-direction: column; }
.topnav {
    display: flex; justify-content: space-between; align-items: center;
    padding: 18px clamp(20px, 6vw, 72px);
}
.topnav nav { display: flex; align-items: center; gap: 22px; }
.topnav nav > a { font-weight: 600; color: var(--ink); font-size: 14px; }
.public-main { flex: 1; padding: 0 clamp(20px, 6vw, 72px) 60px; }
.footer {
    display: flex; justify-content: space-between; padding: 22px clamp(20px, 6vw, 72px);
    border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; background: #fff;
}

/* hero */
.hero { text-align: center; padding: clamp(48px, 9vh, 110px) 0 30px; max-width: 860px; margin: 0 auto; }
.hero .eyebrow {
    display: inline-block; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
    background: var(--brand-soft); color: var(--brand); margin-bottom: 20px;
}
.hero h1 { font-size: clamp(34px, 5.5vw, 58px); line-height: 1.08; margin-bottom: 18px; }
.hero h1 span {
    background: linear-gradient(90deg, var(--brand), var(--brand-2), #db2777);
    background-size: 200%; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: hue 8s linear infinite alternate;
}
@keyframes hue { to { background-position: 100%; } }
.hero p { font-size: 17px; color: var(--muted); max-width: 620px; margin: 0 auto 30px; }
.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-cta .btn { padding: 13px 26px; font-size: 15px; }

/* features */
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; margin: 56px auto; max-width: 1050px; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); transition: transform .2s, box-shadow .2s; }
.feature:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.feature .ico { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); font-size: 20px; margin-bottom: 14px; }
.feature h3 { font-size: 15px; margin-bottom: 6px; }
.feature p { color: var(--muted); font-size: 13.5px; margin: 0; }

/* plans */
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 20px; max-width: 1050px; margin: 20px auto 40px; }
.plan-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; box-shadow: var(--shadow); position: relative; transition: transform .2s, box-shadow .2s; }
.plan-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.plan-card.popular { border: 2px solid var(--brand); }
.plan-card .pop-tag { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; font-size: 11px; font-weight: 700; padding: 4px 14px; border-radius: 999px; letter-spacing: .04em; }
.plan-card h3 { font-size: 17px; }
.plan-price { font-family: var(--font-display); font-size: 34px; font-weight: 800; margin: 8px 0 2px; }
.plan-price small { font-size: 13px; color: var(--muted); font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; margin: 18px 0 22px; }
.plan-card li { padding: 7px 0; font-size: 14px; color: #334155; }
.plan-card li::before { content: "✓"; color: var(--ok); font-weight: 700; margin-right: 9px; }

/* ===================================================================
   AUTH LAYOUT
   =================================================================== */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-wrap { width: 100%; max-width: 440px; }
.auth-brand { justify-content: center; width: 100%; margin-bottom: 22px; }
.auth-card {
    background: rgba(255, 255, 255, .9); backdrop-filter: blur(12px);
    border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 32px;
}
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .sub { color: var(--muted); font-size: 14px; margin: 0 0 22px; }
.auth-links { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-links a { font-weight: 600; }

/* login tabs */
.tabs { display: grid; grid-template-columns: 1fr 1fr; background: #eef0f7; padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.tabs button {
    border: 0; background: transparent; padding: 9px; border-radius: 9px; font: 600 14px var(--font);
    color: var(--muted); cursor: pointer; transition: all .2s;
}
.tabs button.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* processing spinner */
.spinner {
    width: 52px; height: 52px; margin: 10px auto 22px; border-radius: 50%;
    border: 4px solid var(--brand-soft); border-top-color: var(--brand);
    animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.progress-note { text-align: center; color: var(--muted); min-height: 22px; transition: opacity .3s; }

/* ===================================================================
   APP (portal) LAYOUT
   =================================================================== */
.app-body { display: flex; min-height: 100vh; background: var(--bg); }
.sidebar {
    width: 256px; flex-shrink: 0; display: flex; flex-direction: column;
    background: linear-gradient(180deg, #0d1326, #131a33);
    padding: 22px 16px; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { margin: 4px 8px 26px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
    color: #94a3b8; font-weight: 500; font-size: 14px; transition: all .18s;
}
.side-nav a i { font-style: normal; width: 20px; text-align: center; opacity: .9; }
.side-nav a:hover { color: #e2e8f0; background: rgba(255, 255, 255, .06); }
.side-nav a.active {
    color: #fff; background: linear-gradient(90deg, rgba(79, 70, 229, .9), rgba(124, 58, 237, .75));
    box-shadow: 0 8px 18px -8px rgba(79, 70, 229, .6);
}
.side-user {
    display: flex; align-items: center; gap: 10px; padding: 12px 8px 4px;
    border-top: 1px solid rgba(255, 255, 255, .08); margin-top: 14px;
}
.avatar {
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
    background: linear-gradient(120deg, var(--brand), var(--brand-2)); color: #fff; font-weight: 700;
}
.side-user-info { flex: 1; min-width: 0; }
.side-user-info b { display: block; color: #e2e8f0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-info small { color: #64748b; font-size: 11.5px; }
.side-logout { color: #94a3b8; font-size: 17px; }
.side-logout:hover { color: #f87171; }

.app-main { flex: 1; padding: 30px clamp(18px, 3.5vw, 44px); max-width: 1200px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-head h1 { font-size: 24px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.side-toggle { display: none; }
@media (max-width: 900px) {
    .side-toggle {
        display: block; position: fixed; top: 14px; left: 14px; z-index: 60;
        background: #fff; border: 1px solid var(--line); border-radius: 10px;
        width: 42px; height: 42px; font-size: 18px; cursor: pointer; box-shadow: var(--shadow);
    }
    .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .25s; }
    .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .4); }
    .app-main { padding-top: 70px; }
}

/* key/value grid (detail pages) */
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.kv div { background: #fafbff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kv small { display: block; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; margin-bottom: 4px; }
.kv b { font-size: 14.5px; word-break: break-all; font-weight: 600; }

/* secret reveal */
.secret { cursor: pointer; user-select: none; }
.secret[data-hidden="1"] b { filter: blur(5px); }
.secret::after { content: "click to reveal"; display: block; font-size: 10.5px; color: var(--brand); margin-top: 3px; }
.secret[data-hidden="0"]::after { content: ""; }

/* plan chooser (upgrade page) */
.choose-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.choose-plan {
    border: 2px solid var(--line); border-radius: 14px; padding: 18px; cursor: pointer;
    background: #fff; transition: all .18s; position: relative;
}
.choose-plan:hover { border-color: #c7d2fe; }
.choose-plan.selected { border-color: var(--brand); background: var(--brand-soft); box-shadow: 0 10px 24px -12px rgba(79, 70, 229, .4); }
.choose-plan h4 { margin: 0 0 4px; font-size: 15px; }
.choose-plan .p { font-family: var(--font-display); font-weight: 800; font-size: 22px; }
.choose-plan .p small { font-size: 12px; color: var(--muted); font-weight: 500; }
.choose-plan .inc { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.choose-plan input { position: absolute; opacity: 0; }

.billing-toggle { display: inline-flex; background: #eef0f7; border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 18px; }
.billing-toggle label { padding: 7px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--muted); cursor: pointer; transition: all .18s; }
.billing-toggle input { display: none; }
.billing-toggle input:checked + span { }
.billing-toggle label.on { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* pay summary */
.pay-summary { max-width: 520px; margin: 0 auto; }
.pay-lines { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 18px 0; }
.pay-lines div { display: flex; justify-content: space-between; padding: 11px 16px; border-bottom: 1px solid #f1f3f9; font-size: 14px; }
.pay-lines div:last-child { border: 0; }
.pay-lines .total { background: var(--brand-soft); font-weight: 700; font-size: 16px; }
.pay-lines .credit { color: var(--ok); }

/* steps (reset help) */
.steps { display: flex; gap: 8px; margin-bottom: 22px; }
.steps span { flex: 1; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 8px; border-radius: 8px; background: #eef0f7; }
.steps span.on { background: var(--brand-soft); color: var(--brand); }
.steps span.done { background: var(--ok-soft); color: var(--ok); }

/* profile-completion nudge */
.nudge {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    background: var(--bad-soft); border: 1px solid #fecaca; border-radius: var(--radius);
    padding: 14px 18px; margin-bottom: 20px; animation: fadeUp .4s both;
}
.nudge b { color: #991b1b; font-size: 14.5px; }
.nudge p { margin: 2px 0 0; color: #b91c1c; font-size: 13px; }
.nudge > div { flex: 1; min-width: 220px; }
.nudge-dot {
    width: 12px; height: 12px; border-radius: 50%; background: var(--bad); flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(220, 38, 38, .5); animation: pulse 1.6s infinite;
}
.dot-red {
    width: 8px; height: 8px; border-radius: 50%; background: #f87171; margin-left: auto;
    box-shadow: 0 0 0 0 rgba(248, 113, 113, .6); animation: pulse 1.6s infinite;
}
@keyframes pulse {
    70% { box-shadow: 0 0 0 7px rgba(220, 38, 38, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* misc */
.divider { height: 1px; background: var(--line); margin: 22px 0; }
.right { text-align: right; }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 13px; }
.inline-form { display: inline; }
.mt0 { margin-top: 0; }
.mb0 { margin-bottom: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }
