:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-soft: #fafbff;
    --ink: #182032;
    --muted: #667085;
    --line: #e5e7ef;
    --brand: #6d3df5;
    --brand-dark: #5426d9;
    --brand-soft: #f0ebff;
    --accent: #e83e8c;
    --success: #087a55;
    --success-soft: #e9f8f1;
    --warning: #a15c06;
    --warning-soft: #fff6df;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --shadow-sm: 0 1px 2px rgba(24, 32, 50, .04);
    --shadow: 0 18px 55px rgba(35, 25, 66, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0c1019;
    --surface: #151b27;
    --surface-soft: #111722;
    --ink: #eef1f7;
    --muted: #9ba6ba;
    --line: #293244;
    --brand: #8b6cff;
    --brand-dark: #b5a2ff;
    --brand-soft: #28213f;
    --success: #54d6a4;
    --success-soft: #133429;
    --warning: #f3b65d;
    --warning-soft: #3a2b16;
    --danger: #ff8f86;
    --danger-soft: #3d1d20;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .22);
    --shadow: 0 18px 55px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    min-width: 320px;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% -10%, rgba(109, 61, 245, .08), transparent 30rem),
        var(--bg);
    font-size: 15px;
    line-height: 1.6;
}
button, input, select, textarea { font: inherit; }
a { color: var(--brand-dark); text-underline-offset: 3px; }
a:hover { color: var(--brand); }
svg { display: block; }

.skip-link {
    position: fixed;
    top: .75rem;
    left: .75rem;
    z-index: 100;
    transform: translateY(-160%);
    padding: .7rem 1rem;
    border-radius: .65rem;
    color: white;
    background: var(--ink);
}
.skip-link:focus { transform: translateY(0); }

.site-header {
    position: sticky;
    top: 0;
    z-index: 40;
    border-bottom: 1px solid rgba(229, 231, 239, .85);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(16px);
}
html[data-theme="dark"] .site-header { border-bottom-color: rgba(41, 50, 68, .9); background: rgba(12, 16, 25, .88); }
.nav-shell {
    width: min(1180px, calc(100% - 2rem));
    min-height: 72px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}
.brand {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    color: var(--ink);
    font-size: 1rem;
    font-weight: 760;
    letter-spacing: -.02em;
    text-decoration: none;
}
.brand-mark {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    color: white;
    background: linear-gradient(145deg, var(--brand), var(--accent));
    box-shadow: 0 7px 18px rgba(109, 61, 245, .25);
}
.nav-actions { display: flex; align-items: center; gap: .35rem; }
.nav-link {
    padding: .6rem .8rem;
    border-radius: .65rem;
    color: #475467;
    font-weight: 650;
    text-decoration: none;
}
html[data-theme="dark"] .nav-link { color: var(--muted); }
.nav-link:hover, .nav-link[aria-current="page"] {
    color: var(--ink);
    background: #f5f3ff;
}
html[data-theme="dark"] .nav-link:hover, html[data-theme="dark"] .nav-link[aria-current="page"] { background: var(--brand-soft); }
.theme-toggle {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: .7rem;
    color: var(--muted);
    background: var(--surface);
    cursor: pointer;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--brand); }
.theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: block; }
.nav-user {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-left: .5rem;
    padding-left: .8rem;
    border-left: 1px solid var(--line);
}
.avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-weight: 800;
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2.75rem 0 4.5rem;
}
.page-shell.auth-shell {
    min-height: calc(100vh - 73px);
    display: grid;
    align-items: center;
    padding-top: 2rem;
    padding-bottom: 3rem;
}
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.eyebrow {
    margin: 0 0 .5rem;
    color: var(--brand-dark);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .11em;
    text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 {
    margin-bottom: .65rem;
    font-size: clamp(2rem, 5vw, 3.45rem);
    line-height: 1.08;
    letter-spacing: -.045em;
}
.dashboard-title { font-size: clamp(1.85rem, 4vw, 2.65rem); }
h2 { margin-bottom: .55rem; font-size: 1.25rem; line-height: 1.3; letter-spacing: -.025em; }
h3 { margin-bottom: .35rem; font-size: 1rem; }
.lead { max-width: 690px; color: #566176; font-size: 1.08rem; }
.muted { color: var(--muted); }
.fine-print { color: var(--muted); font-size: .82rem; }

.card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}
.card-pad { padding: 1.4rem; }
.card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.4rem;
    border-bottom: 1px solid var(--line);
}
.card-head p, .card-head h2 { margin-bottom: 0; }
.card-body { padding: 1.4rem; }

.button {
    min-height: 43px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .7rem 1rem;
    border: 1px solid transparent;
    border-radius: .75rem;
    color: white;
    background: var(--brand);
    box-shadow: 0 8px 18px rgba(109, 61, 245, .18);
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform .15s ease, background .15s ease, box-shadow .15s ease;
}
.button:hover {
    color: white;
    background: var(--brand-dark);
    box-shadow: 0 10px 24px rgba(109, 61, 245, .26);
    transform: translateY(-1px);
}
.button:focus-visible, input:focus-visible, a:focus-visible {
    outline: 3px solid rgba(109, 61, 245, .25);
    outline-offset: 2px;
}
.button-secondary {
    color: var(--ink);
    background: var(--surface);
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}
.button-secondary:hover { color: var(--ink); background: var(--surface-soft); }
.button-quiet {
    min-height: auto;
    padding: .55rem .75rem;
    color: #475467;
    background: transparent;
    border: 0;
    box-shadow: none;
}
.button-quiet:hover { color: var(--ink); background: var(--surface-soft); box-shadow: none; transform: none; }
.button-block { width: 100%; }
.inline-form { display: inline; margin: 0; }

.alert {
    width: min(1180px, calc(100% - 2rem));
    display: flex;
    gap: .75rem;
    margin: 1rem auto 0;
    padding: .85rem 1rem;
    border: 1px solid #b8e7d3;
    border-radius: .8rem;
    color: #086445;
    background: var(--success-soft);
}
.alert svg { flex: 0 0 auto; margin-top: .15rem; }
.alert-error {
    border-color: #ffc9c3;
    color: var(--danger);
    background: var(--danger-soft);
}
.error-list { margin: .4rem 0 0; padding-left: 1.15rem; }

.auth-grid {
    width: min(990px, 100%);
    margin: 0 auto;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, .85fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}
.auth-aside {
    position: relative;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 3.5rem);
    color: white;
    background: linear-gradient(145deg, #211642, #5632c6 60%, #a53390);
}
.auth-aside::after {
    content: "";
    position: absolute;
    right: -7rem;
    bottom: -7rem;
    width: 18rem;
    height: 18rem;
    border: 1px solid rgba(255,255,255,.18);
    border-radius: 50%;
    box-shadow: 0 0 0 45px rgba(255,255,255,.045), 0 0 0 90px rgba(255,255,255,.03);
}
.auth-aside h1 { max-width: 470px; font-size: clamp(2rem, 4vw, 3rem); }
.auth-aside p { max-width: 470px; color: rgba(255,255,255,.76); }
.benefit-list { display: grid; gap: 1rem; margin-top: 2.25rem; }
.benefit {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: .75rem;
    color: rgba(255,255,255,.92);
    font-weight: 650;
}
.benefit-icon {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 9px;
    background: rgba(255,255,255,.1);
}
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 5vw, 3.5rem); }
.auth-panel h1 { margin-bottom: .4rem; font-size: 1.8rem; }
.auth-panel .button { margin-top: .5rem; }
.auth-switch { margin: 1.5rem 0 0; text-align: center; }
.form-group { margin-top: 1.05rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
label { display: block; margin-bottom: .4rem; color: var(--ink); font-size: .88rem; font-weight: 720; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: .72rem .85rem;
    border: 1px solid var(--line);
    border-radius: .72rem;
    color: var(--ink);
    background: var(--surface);
    box-shadow: inset 0 1px 2px rgba(16,24,40,.03);
}
select { appearance: auto; }
textarea { resize: vertical; }
input[type="file"] { padding: .55rem; }
input::placeholder { color: #98a2b3; }
input[aria-invalid="true"] { border-color: #ef8b81; }
.field-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .4rem;
}
.field-meta label { margin: 0; }
.field-error { margin: .35rem 0 0; color: var(--danger); font-size: .82rem; }
.turnstile-wrap, .cf-turnstile { min-height: 65px; }

.hero {
    position: relative;
    overflow: hidden;
    min-height: 520px;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
    align-items: center;
    gap: 2.5rem;
    padding: clamp(2rem, 6vw, 4.5rem);
    border: 1px solid var(--line);
    border-radius: 28px;
    background: linear-gradient(135deg, white 35%, #f6f2ff);
    box-shadow: var(--shadow);
}
html[data-theme="dark"] .hero { background: linear-gradient(135deg, var(--surface) 35%, #1d1730); }
html[data-theme="dark"] .lead { color: var(--muted); }
html[data-theme="dark"] .visual-card { border-color: rgba(255,255,255,.08); background: rgba(21,27,39,.9); }
html[data-theme="dark"] .visual-line { background: #333b4c; }
.hero-copy { position: relative; z-index: 2; }
.hero-copy h1 { max-width: 700px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.75rem; }
.hero-proof { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 2rem; color: var(--muted); font-size: .85rem; }
.proof-item { display: flex; align-items: center; gap: .4rem; }
.hero-visual { position: relative; min-height: 360px; }
.visual-orbit {
    position: absolute;
    inset: 8% 0;
    border: 1px solid rgba(109, 61, 245, .16);
    border-radius: 50%;
    transform: rotate(-12deg);
}
.visual-card {
    position: absolute;
    width: min(300px, 85%);
    padding: 1.15rem;
    border: 1px solid rgba(255,255,255,.7);
    border-radius: 18px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 22px 55px rgba(51, 34, 92, .16);
    backdrop-filter: blur(10px);
}
.visual-card.primary { top: 16%; left: 7%; transform: rotate(-3deg); }
.visual-card.secondary { right: 0; bottom: 12%; transform: rotate(4deg); }
.visual-thumb {
    height: 130px;
    margin-bottom: 1rem;
    border-radius: 12px;
    background:
        linear-gradient(135deg, rgba(232,62,140,.2), rgba(109,61,245,.25)),
        linear-gradient(45deg, #efeafe, #fff);
}
.visual-line { height: 8px; margin-top: .55rem; border-radius: 10px; background: #e8e5f0; }
.visual-line.short { width: 55%; }
.sync-row { display: flex; align-items: center; gap: .75rem; }
.sync-node { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: white; background: var(--brand); }
.sync-line { flex: 1; height: 2px; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.sync-check { color: var(--success); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.25rem; }
.feature-card { padding: 1.35rem; }
.feature-icon { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 1rem; border-radius: 12px; color: var(--brand-dark); background: var(--brand-soft); }

.dashboard-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.stat-card { padding: 1.2rem; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--brand-dark); background: var(--brand-soft); }
.stat-value { margin: .9rem 0 .1rem; font-size: 1.75rem; font-weight: 800; line-height: 1; letter-spacing: -.04em; }
.stat-label { color: var(--muted); font-size: .83rem; }
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .27rem .55rem; border-radius: 999px; color: var(--success); background: var(--success-soft); font-size: .72rem; font-weight: 760; }
.badge-neutral { color: #5f6674; background: #f0f1f4; }
.badge-warning { color: var(--warning); background: var(--warning-soft); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(290px, .75fr); gap: 1rem; margin-top: 1rem; }
.stack { display: grid; gap: 1rem; }
.setup-list { display: grid; gap: .9rem; }
.setup-item { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: .85rem; padding: .9rem; border: 1px solid var(--line); border-radius: 12px; }
.step-number { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--brand-dark); background: var(--brand-soft); font-weight: 800; }
.setup-item.complete .step-number { color: white; background: var(--success); }
.setup-copy h3, .setup-copy p { margin: 0; }
.setup-copy p { color: var(--muted); font-size: .82rem; }
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { display: flex; gap: .8rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.activity-item:first-child { padding-top: 0; }
.activity-item:last-child { padding-bottom: 0; border: 0; }
.activity-dot { width: 9px; height: 9px; flex: 0 0 auto; margin-top: .45rem; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px var(--success-soft); }
.empty-state { padding: 1.6rem 1rem; text-align: center; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 1rem; border-radius: 14px; color: var(--brand-dark); background: var(--brand-soft); }
.detail-list { display: grid; gap: 0; margin: 0; }
.detail-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 0; border-bottom: 1px solid var(--line); }
.detail-row:first-child { padding-top: 0; }
.detail-row:last-child { padding-bottom: 0; border: 0; }
.detail-row dt { color: var(--muted); }
.detail-row dd { margin: 0; font-weight: 720; text-align: right; }
.progress { height: 8px; overflow: hidden; border-radius: 999px; background: #eceef3; }
.progress-bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.section-spacer { margin-top: 1rem; }
.admin-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.admin-content { grid-template-columns: minmax(0, 1.6fr) minmax(300px, .72fr); }
.admin-tabs { display:flex;flex-wrap:wrap;gap:.35rem;padding:.55rem;border:1px solid var(--line);border-radius:14px;background:var(--surface); }
.customer-tabs { position:sticky;top:82px;z-index:20;margin-bottom:1rem;box-shadow:var(--shadow-sm); }
.sync-summary { display:flex;flex-wrap:wrap;gap:.5rem; }
.secret-control { display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:.5rem; }
.admin-actions { display:flex;align-items:center;gap:.5rem;min-width:240px; }
.admin-actions select { min-width:140px; }
.pagination-wrap { margin-top:1rem; }
.pagination-wrap nav > div:first-child { display:none; }
.pagination-wrap nav > div:last-child { display:flex;justify-content:space-between;align-items:center;gap:1rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th {
    padding: .75rem 1.4rem;
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    background: var(--surface-soft);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}
td { padding: .95rem 1.4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbff; }
html[data-theme="dark"] tbody tr:hover { background: #1a2130; }
.table-empty { padding: 2rem; color: var(--muted); text-align: center; }
code { padding: .2rem .4rem; border-radius: .4rem; color: #49349b; background: var(--brand-soft); font-size: .78rem; }
.empty-state.compact { padding: .75rem 0; }
.payment-method, .payment-future {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .9rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface-soft);
}
.payment-method p, .payment-future p { margin: .2rem 0 0; }
.payment-future { justify-content: flex-start; margin-top: 1rem; opacity: .82; }
.bank-details { display: grid; gap: .55rem; margin: 1rem 0 0; padding: .9rem; border: 1px dashed var(--line); border-radius: 12px; }
.bank-details div { display: flex; justify-content: space-between; gap: 1rem; }
.bank-details dt { color: var(--muted); }
.bank-details dd { margin: 0; text-align: right; font-weight: 700; }
.payment-note { margin: .9rem 0 0; padding: .75rem; border-left: 3px solid var(--brand); background: var(--brand-soft); }
.payment-divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; }
.payment-divider::before, .payment-divider::after { content: ""; height: 1px; background: var(--border); flex: 1; }

.site-footer { padding: 0 1rem 2rem; color: var(--muted); text-align: center; font-size: .8rem; }
.footer-links { display:inline-flex;flex-wrap:wrap;gap:.75rem;margin-left:1rem; }
.legal-page { width:min(820px,100%);margin:0 auto; }
.legal-page h2 { margin-top:1.6rem; }

html[data-theme="dark"] .button-quiet { color: var(--muted); }
html[data-theme="dark"] .alert { border-color: #245744; color: var(--success); }
html[data-theme="dark"] .alert-error { border-color: #693238; color: var(--danger); }
html[data-theme="dark"] .badge-neutral { color: var(--muted); background: var(--surface-soft); }
html[data-theme="dark"] .progress { background: var(--line); }
html[data-theme="dark"] code { color: var(--brand-dark); }

@media (max-width: 900px) {
    .auth-grid, .hero { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .hero { min-height: auto; }
    .hero-visual { min-height: 310px; }
    .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .admin-content { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .nav-shell { min-height: 64px; }
    .brand span:last-child { display: none; }
    .nav-user { margin-left: 0; padding-left: .35rem; border-left: 0; }
    .nav-user .avatar { display: none; }
    .nav-link { padding: .55rem .62rem; font-size: .88rem; }
    .page-shell { padding-top: 1.75rem; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .hero { padding: 1.5rem; border-radius: 20px; }
    .hero-visual { min-height: 280px; margin-top: -.5rem; }
    .visual-card { width: 82%; }
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
    .stat-card { padding: 1rem; }
    .stat-value { font-size: 1.5rem; }
    .card-head, .card-body, .card-pad { padding: 1rem; }
    .setup-item { grid-template-columns: 34px minmax(0, 1fr); }
    .setup-item > .badge { grid-column: 2; justify-self: start; }
    .form-row { grid-template-columns: 1fr; gap: 0; }
    .auth-panel { padding: 1.5rem; }
    .auth-grid { border-radius: 18px; }
    .alert { font-size: .88rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
