@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700;900&family=DM+Mono:wght@300;400;500&display=swap');

/* ─── Theme tokens ─── edit platform/theme-tokens.json, then: npm run tokens ── */
/* [TOKENS:public-dark:start] */
:root {
    --bg:        #0a0c0a;
    --surface:   #131713;
    --card:      #1a201a;
    --border:    #2c3c2c;
    --green:     #7acc3a;
    --green-lt:  #8ade4e;
    --green-bg:  #131713;
    --gold:      #d4b55a;
    --red:       #e06848;
    --text:      #f0ece0;
    --muted:     #b8b4a8;
    --dim:       #9a9590;
    --white:     #1a201a;
    --radius:    8px;
    --shadow:    0 2px 16px rgba(0,0,0,.5);
    --font:      'DM Mono', 'Courier New', monospace;
    --font-display: 'Playfair Display', Georgia, serif;
}
/* [TOKENS:public-dark:end] */

/* [TOKENS:public-light:start] */
[data-theme="light"] {
    --bg:        #fafaf8;
    --surface:   #f2f2ef;
    --card:      #ffffff;
    --border:    #d4d4cc;
    --green:     #166534;
    --green-lt:  #15803d;
    --green-bg:  #adf5bc;
    --gold:      #92400e;
    --red:       #dc2626;
    --text:      #111827;
    --muted:     #374151;
    --dim:       #6b7280;
    --white:     #ffffff;
    --shadow:    0 1px 4px rgba(0,0,0,.06), 0 2px 12px rgba(0,0,0,.04);
}
/* [TOKENS:public-light:end] */

/* ─── Reset + Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: var(--font); color: var(--text); background: var(--bg); line-height: 1.6; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--green-lt); }
img { max-width: 100%; }

/* ─── Scrollbar ──────────────────────────────────────────────────────── */
::-webkit-scrollbar             { width: 4px; height: 4px; }
::-webkit-scrollbar-track       { background: var(--bg); }
::-webkit-scrollbar-thumb       { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--dim); }

/* ─── Utility ────────────────────────────────────────────────────────── */
.container   { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); font-size: .9rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.hidden { display: none !important; }
.mb-3 { margin-bottom: 1.5rem; }

/* ─── Buttons ────────────────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: .65rem 1.5rem;
    border-radius: var(--radius);
    font-size: .9rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: all .2s;
    text-align: center;
    white-space: nowrap;
    letter-spacing: .02em;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--green); color: #0a0c0a; border-color: var(--green); }
.btn-primary:hover { background: var(--green-lt); border-color: var(--green-lt); text-decoration: none; color: #0a0c0a; }
.btn-outline { background: transparent; color: var(--green); border-color: var(--green); }
.btn-outline:hover { background: rgba(122,204,58,.12); text-decoration: none; }
.btn-lg { padding: .9rem 2.25rem; font-size: 1rem; }
.btn-full { display: block; width: 100%; }

/* ─── Navigation ─────────────────────────────────────────────────────── */
.nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
}
.nav__inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}
.nav__logo { color: var(--text); font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; letter-spacing: -.3px; }
.nav__logo span { color: var(--gold); }
.nav__links { display: flex; gap: 1.5rem; align-items: center; }
.nav__links a { color: var(--muted); font-size: .88rem; }
.nav__links a:hover { color: var(--text); text-decoration: none; }
.nav__links .btn { padding: .35rem .9rem; font-size: .85rem; background: var(--gold); color: #0a0c0a; border-color: var(--gold); }
.nav__links .btn:hover { background: #e0c46a; border-color: #e0c46a; }
.nav__drop-wrap { position: relative; display: flex; align-items: center; }
.nav__drop-trigger { color: var(--muted); font-size: .88rem; cursor: pointer; white-space: nowrap; }
.nav__drop-trigger::after { content: ' ▾'; font-size: .72rem; opacity: .7; }
.nav__drop-trigger:hover { color: var(--text); text-decoration: none; }
.nav__drop {
    position: absolute; top: 100%; left: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: .5rem 0;
    min-width: 170px; box-shadow: var(--shadow);
    z-index: 300;
    visibility: hidden; opacity: 0; pointer-events: none;
    transition: opacity .15s ease, visibility .15s ease;
    transition-delay: .18s;
}
.nav__drop-wrap:hover .nav__drop {
    visibility: visible; opacity: 1; pointer-events: auto;
    transition-delay: 0s;
}
.nav__drop a { display: block; padding: .55rem 1.1rem; color: var(--muted); font-size: .85rem; white-space: nowrap; }
.nav__drop a:hover { color: var(--text); background: rgba(255,255,255,.04); text-decoration: none; }

/* ─── Cards ──────────────────────────────────────────────────────────── */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: var(--shadow);
}

/* ─── Forms ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: .4rem; font-size: .88rem; color: var(--muted); letter-spacing: .03em; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: .65rem .9rem;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    font-size: .9rem;
    font-family: var(--font);
    transition: border-color .2s;
    background: var(--surface);
    color: var(--text);
}
.form-group input::placeholder { color: var(--dim); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--green);
}
.form-group select option { background: var(--surface); color: var(--text); }
.form-hint { font-size: .82rem; color: var(--dim); margin-top: .25rem; }

/* ─── Alerts ─────────────────────────────────────────────────────────── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: var(--radius);
    font-size: .9rem;
    margin-bottom: 1rem;
}
.alert-success { background: rgba(122,204,58,.12); color: var(--green-lt); border: 1px solid rgba(122,204,58,.3); }
.alert-error   { background: rgba(224,104,72,.12); color: #f08060; border: 1px solid rgba(224,104,72,.3); }
.alert-info    { background: rgba(212,181,90,.12); color: var(--gold); border: 1px solid rgba(212,181,90,.3); }

/* ─── Hero ───────────────────────────────────────────────────────────── */
.hero {
    background: linear-gradient(135deg, #0a0c0a 0%, #101410 60%, #131713 100%);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 80px 20px 64px;
    text-align: center;
}
.hero h1 { font-family: var(--font-display); font-size: clamp(2rem, 5vw, 3rem); font-weight: 700; line-height: 1.2; margin-bottom: 1rem; }
.hero h1 span { color: var(--green); }
.hero p { font-size: 1rem; color: var(--muted); max-width: 600px; margin: 0 auto 2rem; }
.hero__cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }

/* ─── Section ────────────────────────────────────────────────────────── */
.section { padding: 64px 20px; }
.section--grey { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section__title { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--text); margin-bottom: .5rem; }
.section__sub   { color: var(--muted); margin-bottom: 2.5rem; font-size: .95rem; }

/* ─── Grid ───────────────────────────────────────────────────────────── */
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }

/* ─── Pricing ────────────────────────────────────────────────────────── */
.price-card {
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    background: var(--card);
    transition: border-color .2s, box-shadow .2s;
}
.price-card:hover { border-color: var(--green); box-shadow: 0 4px 20px rgba(122,204,58,.15); }
.price-card--featured { border-color: var(--green); background: rgba(122,204,58,.06); }
.price-card__amount { font-size: 2.5rem; font-weight: 700; font-family: var(--font-display); color: var(--green); }
.price-card__amount sup { font-size: 1rem; vertical-align: top; margin-top: .6rem; display: inline-block; }
.price-card__label { font-size: .82rem; color: var(--dim); margin-bottom: 1rem; }
.price-card__name { font-size: 1.1rem; font-weight: 500; color: var(--text); margin-bottom: .4rem; }
.price-card ul { list-style: none; margin: 1rem 0; text-align: left; }
.price-card ul li { padding: .3rem 0; font-size: .88rem; color: var(--muted); }
.price-card ul li::before { content: '✓ '; color: var(--green); font-weight: 700; }

/* ─── Money-back badge ───────────────────────────────────────────────── */
.guarantee {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(212,181,90,.08);
    border: 1.5px solid rgba(212,181,90,.4);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    max-width: 600px;
    margin: 0 auto;
}
.guarantee__icon { font-size: 2rem; flex-shrink: 0; }
.guarantee__text strong { display: block; font-size: 1rem; margin-bottom: .2rem; color: var(--gold); }
.guarantee__text span { font-size: .88rem; color: var(--muted); }

/* ─── Auth page ──────────────────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    background: var(--bg);
}
.auth-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 100%;
    max-width: 420px;
}
.auth-box h1 { font-family: var(--font-display); font-size: 1.5rem; color: var(--text); margin-bottom: .25rem; }
.auth-box .auth-logo { font-family: var(--font-display); font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 1.5rem; display: block; }
.auth-box .auth-logo span { color: var(--gold); }
.divider { text-align: center; position: relative; margin: 1.25rem 0; color: var(--dim); font-size: .85rem; }
.divider::before { content: ''; position: absolute; left: 0; top: 50%; width: 40%; height: 1px; background: var(--border); }
.divider::after  { content: ''; position: absolute; right: 0; top: 50%; width: 40%; height: 1px; background: var(--border); }

/* ─── Dashboard ──────────────────────────────────────────────────────── */
.dashboard { min-height: 100vh; background: var(--bg); }
.dashboard__header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    padding: 1.25rem 20px;
}
.dashboard__header .container { display: flex; align-items: center; justify-content: space-between; }
.dashboard__body { padding: 2rem 20px; }
.report-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--border); }
.report-table th { background: var(--surface); color: var(--muted); padding: .7rem 1rem; text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid var(--border); }
.report-table td { padding: .7rem 1rem; border-bottom: 1px solid var(--border); font-size: .9rem; color: var(--text); }
.report-table tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: .2rem .55rem; border-radius: 4px; font-size: .75rem; font-weight: 500; letter-spacing: .03em; }
.badge-delivered { background: rgba(122,204,58,.15); color: var(--green-lt); }
.badge-paid      { background: rgba(212,181,90,.15); color: var(--gold); }
.badge-pending   { background: rgba(154,149,144,.15); color: var(--dim); }

/* ─── Stats strip ────────────────────────────────────────────────────── */
.stats { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 2rem; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem 1.5rem; flex: 1; min-width: 160px; }
.stat-card__value { font-family: var(--font-display); font-size: 1.8rem; font-weight: 700; color: var(--green); }
.stat-card__label { font-size: .8rem; color: var(--dim); margin-top: .2rem; letter-spacing: .04em; }

/* ─── Footer ─────────────────────────────────────────────────────────── */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    color: var(--muted);
    padding: 2.5rem 20px;
    margin-top: 4rem;
    font-size: .88rem;
}
.footer__inner { max-width: 1100px; margin: 0 auto; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1.5rem; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); text-decoration: none; }

/* ─── Spinner ────────────────────────────────────────────────────────── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(122,204,58,.2);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: .5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Light mode overrides ───────────────────────────────────────────── */

/* Gradients */
[data-theme="light"] .hero {
    background: linear-gradient(160deg, #f0f7f1 0%, #f6f8f4 60%, #fafaf8 100%);
}
[data-theme="light"] .estimator-hero {
    background: linear-gradient(160deg, #f0f7f1 0%, #f6f8f4 100%);
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

/* Buttons — primary needs white text on dark green */
[data-theme="light"] .btn-primary { color: #ffffff; }
[data-theme="light"] .btn-primary:hover { color: #ffffff; }
[data-theme="light"] .btn-outline:hover { background: rgba(22,101,52,.08); }

/* Nav CTA button — white text on amber */
[data-theme="light"] .nav__links .btn { color: #ffffff; }
[data-theme="light"] .nav__links .btn:hover { background: #7c3510; border-color: #7c3510; color: #ffffff; }

/* Alerts — proper contrast on light backgrounds */
[data-theme="light"] .alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}
[data-theme="light"] .alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}
[data-theme="light"] .alert-info {
    background: #fffbeb;
    color: #92400e;
    border-color: #fde68a;
}

/* Badges */
[data-theme="light"] .badge-delivered {
    background: #dcfce7;
    color: #166534;
}
[data-theme="light"] .badge-paid {
    background: #fef3c7;
    color: #92400e;
}
[data-theme="light"] .badge-pending {
    background: #f3f4f6;
    color: #4b5563;
}

/* Misc */
[data-theme="light"] .price-card:hover { box-shadow: 0 4px 20px rgba(22,101,52,.12); }
[data-theme="light"] .spinner { border-color: rgba(22,101,52,.2); border-top-color: var(--green); }

/* ─── Theme toggle button ────────────────────────────────────────────── */
.theme-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1.5px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    box-shadow: var(--shadow);
    z-index: 999;
    transition: border-color .2s, transform .2s, box-shadow .2s;
    padding: 0;
    line-height: 1;
}
.theme-toggle:hover {
    border-color: var(--green);
    transform: scale(1.1);
    box-shadow: 0 4px 16px rgba(0,0,0,.2);
}

/* ─── Hamburger button (hidden on desktop) ───────────────────────────── */
.nav__hamburger {
    display: none;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    padding: .35rem .55rem;
    cursor: pointer;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1;
    margin-left: auto;
}
.nav__hamburger:hover { border-color: var(--gold); color: var(--gold); }

/* ─── Responsive ─────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nav { position: relative; }
    .nav__hamburger { display: flex; align-items: center; justify-content: center; }
    .nav__links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem 1.5rem;
        gap: .9rem;
        z-index: 200;
        box-shadow: 0 8px 24px rgba(0,0,0,.35);
    }
    .nav__links.open { display: flex; }
    .nav__drop { position: static; visibility: visible; opacity: 1; pointer-events: auto;
                 box-shadow: none; border: none; background: none; padding: 0 0 0 1rem; }
    .nav__drop-wrap { flex-direction: column; align-items: flex-start; width: 100%; }
    .nav__drop a { padding: .35rem 0; }
}

@media (max-width: 640px) {
    .hero { padding: 48px 16px 40px; }
    .section { padding: 40px 16px; }
    .auth-box { padding: 1.75rem; }
    .report-table th:nth-child(3), .report-table td:nth-child(3) { display: none; }
}
