:root {
    --bg: #0b1220;
    --bg-soft: #101a2e;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --ink: #0f172a;
    --ink-soft: #475569;
    --muted: #94a3b8;
    --line: #e2e8f0;
    --primary: #0f766e;
    --primary-600: #0d9488;
    --primary-700: #115e59;
    --accent: #22c55e;
    --danger: #dc2626;
    --warn: #d97706;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(2, 12, 27, 0.08);
    --shadow-lg: 0 24px 60px rgba(2, 12, 27, 0.16);
    --maxw: 1140px;
    --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--surface-2);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary-600); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }

/* ---------------- Nav ---------------- */
.nav {
    position: sticky; top: 0; z-index: 40;
    background: rgba(11, 18, 32, 0.92);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.nav__inner {
    max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
    height: 64px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-weight: 800; font-size: 18px; }
.brand:hover { text-decoration: none; }
.brand__mark { color: var(--accent); font-size: 16px; }
.brand__name span { color: var(--accent); }
.nav__links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav__links a, .nav__links button.linklike {
    color: #cbd5e1; padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: 14px;
    background: none; border: none; cursor: pointer; font-family: inherit;
}
.nav__links a:hover, .nav__links button.linklike:hover { color: #fff; background: rgba(255,255,255,0.08); text-decoration: none; }
.nav__links a.active { color: #fff; background: rgba(34, 197, 94, 0.16); }
.nav__toggle { display: none; margin-left: auto; background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; }

/* ---------------- Buttons ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 20px; border-radius: 10px; font-weight: 600; font-size: 14px;
    border: 1px solid transparent; cursor: pointer; font-family: inherit; transition: .15s ease;
    text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn--primary { background: var(--primary); color: #fff; }
.btn--primary:hover { background: var(--primary-700); color: #fff; }
.btn--accent { background: var(--accent); color: #06301a; }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.25); }
.btn--outline { background: #fff; color: var(--ink); border-color: var(--line); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------------- Layout ---------------- */
.section { max-width: var(--maxw); margin: 0 auto; padding: 64px 20px; }
.section--narrow { max-width: 720px; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 700; color: var(--primary-600); }
h1, h2, h3 { color: var(--ink); line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(30px, 5vw, 52px); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 18px; font-weight: 700; }
.lead { font-size: 18px; color: var(--ink-soft); }

/* ---------------- Hero ---------------- */
.hero {
    background: radial-gradient(1200px 500px at 70% -10%, rgba(34,197,94,0.18), transparent 60%),
                linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: #e6edf6;
}
.hero__inner { max-width: var(--maxw); margin: 0 auto; padding: 84px 20px 96px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
.hero h1 { color: #fff; }
.hero .lead { color: #b6c2d4; }
.hero__badge { display: inline-flex; gap: 8px; align-items: center; background: rgba(34,197,94,0.14); color: #86efac; border: 1px solid rgba(34,197,94,0.3); padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; margin-bottom: 20px; }
.hero__cta { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero__art { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; padding: 18px; box-shadow: var(--shadow-lg); }
.hero__art pre { margin: 0; }

/* code block */
pre.code { background: #0b1220; color: #d6e2f0; border: 1px solid rgba(255,255,255,0.08); border-radius: 12px; padding: 16px 18px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.7; }
pre.code .k { color: #7dd3fc; } pre.code .s { color: #86efac; } pre.code .c { color: #64748b; }
.codewrap { position: relative; }
.codewrap .copy { position: absolute; top: 10px; right: 10px; }

/* ---------------- Cards / features ---------------- */
.grid { display: grid; gap: 22px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.card__icon { width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center; background: rgba(15,118,110,0.1); color: var(--primary); font-size: 20px; margin-bottom: 14px; }
.center { text-align: center; }
.section__head { max-width: 640px; margin: 0 auto 40px; text-align: center; }

/* ---------------- Pricing ---------------- */
.plans { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; max-width: 820px; margin: 0 auto; }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.plan--featured { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,118,110,0.12), var(--shadow); }
.plan__price { font-size: 34px; font-weight: 800; }
.plan ul { list-style: none; padding: 0; margin: 18px 0 24px; }
.plan li { padding: 7px 0 7px 26px; position: relative; color: var(--ink-soft); }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }

/* ---------------- Forms ---------------- */
.form { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--ink); }
.field input, .field select, .field textarea {
    width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
    font-family: inherit; font-size: 14px; color: var(--ink); background: #fff; transition: .15s;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary-600); box-shadow: 0 0 0 3px rgba(15,118,110,0.12); }
.field textarea { min-height: 120px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.phone-row { display: grid; grid-template-columns: 150px 1fr; gap: 10px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------------- Alerts / badges ---------------- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; border: 1px solid; }
.alert--ok { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert--err { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert--info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge--ok { background: #dcfce7; color: #166534; }
.badge--muted { background: #eef2f7; color: #475569; }

/* ---------------- Dashboard ---------------- */
.dash { max-width: var(--maxw); margin: 0 auto; padding: 40px 20px 72px; }
.dash__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 26px; flex-wrap: wrap; }
.tabs button { background: none; border: none; padding: 12px 16px; font-family: inherit; font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .tab-link { padding: 12px 16px; font-size: 14px; font-weight: 600; color: var(--primary); text-decoration: none; border-bottom: 2px solid transparent; align-self: center; }
.tabs .tab-link:hover { border-bottom-color: var(--primary); }
.stat { display: flex; gap: 20px; flex-wrap: wrap; }
.stat .card { flex: 1; min-width: 200px; }
.stat .big { font-size: 30px; font-weight: 800; }
.meter { height: 10px; background: #eef2f7; border-radius: 999px; overflow: hidden; margin-top: 10px; }
.meter > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.qr { display: grid; place-items: center; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 12px; width: max-content; }
.reccodes { font-family: var(--mono); font-size: 14px; columns: 2; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 16px 20px; }

/* ---------------- Admin tables ---------------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { margin-left: auto; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
table.tbl th, table.tbl td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: var(--surface-2); }
table.tbl th a { color: inherit; text-decoration: none; white-space: nowrap; cursor: pointer; }
table.tbl th a:hover { color: var(--primary); }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover, table.tbl tr:hover { background: #fafcfe; }
.btn--sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge--warn { background: #fef3c7; color: #92400e; }
.badge--danger { background: #fee2e2; color: #991b1b; }
.keybox { font-family: var(--mono); font-size: 14px; background: var(--surface-2); border: 1px dashed var(--primary); border-radius: 10px; padding: 12px 16px; word-break: break-all; }
select.mini { padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-family: inherit; font-size: 13px; }

/* ---------------- Collapsible panel (details/summary) ---------------- */
details.block-collapse { padding: 0; overflow: hidden; }
details.block-collapse > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 24px; font-weight: 700; color: var(--ink); user-select: none;
}
details.block-collapse > summary::-webkit-details-marker { display: none; }
details.block-collapse > summary:hover { color: var(--primary); }
details.block-collapse > summary .chev { color: var(--muted); transition: transform .2s ease; font-size: 12px; }
details.block-collapse[open] > summary .chev { transform: rotate(180deg); }
details.block-collapse > form { padding: 0 24px 20px; }

/* ---------------- Admin shell (server-rendered, same palette) ---------------- */
.admin-shell { display: flex; min-height: calc(100vh - 64px); }
.admin-side { width: 240px; flex-shrink: 0; background: var(--bg); color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 14px; }
.admin-side .brand { color: #fff; margin-bottom: 22px; padding: 0 8px; }
.admin-side nav { display: flex; flex-direction: column; gap: 4px; }
.admin-side nav a { color: #cbd5e1; padding: 10px 12px; border-radius: 8px; font-weight: 500; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.admin-side nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.admin-side nav a.active { background: rgba(34,197,94,0.16); color: #fff; }
.admin-side .side-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 14px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.admin-side .side-foot a { color: #93c5b8; }
.admin-main { flex: 1; padding: 28px 32px; background: var(--surface-2); min-width: 0; }
.admin-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.admin-badge { background: rgba(34,197,94,0.14); color: var(--primary-700); border: 1px solid #a7f3d0; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.nav-badge { background: var(--accent); color: #06301a; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 700; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1000px 400px at 50% -10%, rgba(34,197,94,0.14), transparent), var(--bg-soft); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .brand { display: flex; justify-content: center; margin-bottom: 18px; }
@media (max-width: 820px) {
    .admin-shell { flex-direction: column; }
    .admin-side { width: auto; }
    .admin-side nav { flex-direction: row; flex-wrap: wrap; }
    .admin-side .side-foot { margin: 12px 0 0; }
}

/* ---------------- Footer ---------------- */
.footer { background: var(--bg); color: #cbd5e1; margin-top: 40px; }
.footer__inner { max-width: var(--maxw); margin: 0 auto; padding: 44px 20px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 20px; align-items: start; }
.footer__inner .brand__mark { color: var(--accent); }
.footer__links { display: flex; gap: 20px; justify-content: flex-end; flex-wrap: wrap; }
.footer__links a { color: #cbd5e1; }
.footer__copy { grid-column: 1 / -1; border-top: 1px solid rgba(255,255,255,0.08); padding-top: 18px; margin: 8px 0 0; }

/* ---------------- Toast ---------------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: .25s; z-index: 60; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------------- Responsive ---------------- */
@media (max-width: 860px) {
    .hero__inner { grid-template-columns: 1fr; }
    .grid--3, .grid--2, .plans, .footer__inner { grid-template-columns: 1fr; }
    .footer__links { justify-content: flex-start; }
    .nav__toggle { display: block; }
    .nav__links { display: none; position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--bg); padding: 10px; gap: 2px; border-bottom: 1px solid rgba(255,255,255,0.08); }
    .nav__links.open { display: flex; }
    .row2, .phone-row { grid-template-columns: 1fr; }
    /* The admin top nav has no JS toggle, so keep its links visible and wrapping. */
    .nav__links--static { display: flex; position: static; flex-direction: row; flex-wrap: wrap; background: transparent; padding: 0; border: none; }
}
