/* ==========================================================
           Medisto · Subscription calculator
           Self-contained page styles (no external stylesheet needed)
           ========================================================== */
        :root {
            --bg: #f4f8f7;
            --bg-accent: #e6f3ef;
            --surface: #ffffff;
            --surface-2: #f7fbfa;
            --surface-3: #eef6f3;
            --ink: #0e2724;
            --ink-2: #3b5550;
            --muted: #6a7f7a;
            --line: #e0ebe7;
            --line-strong: #cadfd8;
            --brand: #0a7f71;
            --brand-600: #086f63;
            --brand-700: #065a51;
            --brand-50: #e8f6f2;
            --brand-100: #d2eee6;
            --gold: #b7791f;
            --gold-bg: #fff8e6;
            --gold-line: #f3dfa5;
            --focus: #38bfae;
            --radius-lg: 22px;
            --radius-md: 14px;
            --radius-sm: 10px;
            --shadow-sm: 0 1px 2px rgba(14, 39, 36, .05);
            --shadow-md: 0 1px 2px rgba(14, 39, 36, .04), 0 14px 40px -12px rgba(10, 80, 68, .14);
            --shadow-lg: 0 2px 4px rgba(14, 39, 36, .05), 0 30px 60px -20px rgba(6, 70, 60, .30);
            --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }

        @media (prefers-color-scheme: dark) {
            :root {
                --bg: #0a1715;
                --bg-accent: #0d2723;
                --surface: #112320;
                --surface-2: #0f1f1c;
                --surface-3: #15302b;
                --ink: #e8f4f1;
                --ink-2: #b6cdc7;
                --muted: #86a09a;
                --line: #1e3631;
                --line-strong: #2a4a43;
                --brand: #34c4b1;
                --brand-600: #2bb09e;
                --brand-700: #1f9a89;
                --brand-50: #12302b;
                --brand-100: #17413a;
                --gold: #f0c36a;
                --gold-bg: #2b2412;
                --gold-line: #54451d;
                --focus: #5fe0cf;
                --shadow-sm: none;
                --shadow-md: 0 14px 40px -12px rgba(0, 0, 0, .55);
                --shadow-lg: 0 30px 60px -20px rgba(0, 0, 0, .7);
            }
        }

        *, *::before, *::after { box-sizing: border-box; }
        html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
        body {
            margin: 0;
            font: 15px/1.6 var(--font);
            color: var(--ink);
            background: var(--bg);
            -webkit-font-smoothing: antialiased;
            text-rendering: optimizeLegibility;
        }
        h1, h2, p { margin: 0; }
        button { font: inherit; color: inherit; cursor: pointer; }
        .d-none { display: none !important; }
        .container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 24px; }
        :focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
        .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

        /* ---------- Top bar ---------- */
        .topbar {
            position: sticky; top: 0; z-index: 20;
            background: color-mix(in srgb, var(--surface) 86%, transparent);
            backdrop-filter: saturate(1.4) blur(14px);
            -webkit-backdrop-filter: saturate(1.4) blur(14px);
            border-bottom: 1px solid var(--line);
        }
        .topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; gap: 16px; }
        .brand { display: flex; align-items: center; gap: 11px; font-size: 22px; font-weight: 800; letter-spacing: -.04em; color: var(--ink); }
        .brand-mark {
            display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #fff;
            background: linear-gradient(145deg, #12a594 0%, #065a51 100%);
            box-shadow: 0 6px 14px -4px rgba(8, 111, 99, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
        }
        .brand-suffix { color: var(--brand); }
        .topbar-meta { display: flex; align-items: center; gap: 18px; }
        .brand-note { color: var(--muted); font-size: 13px; font-weight: 500; }

        @media (max-width: 700px) { .brand-note { display: none; } }

        /* ---------- Hero ---------- */
        .hero {
            position: relative; overflow: hidden; border-bottom: 1px solid var(--line);
            background:
                radial-gradient(900px 340px at 85% -20%, color-mix(in srgb, var(--brand) 18%, transparent), transparent 70%),
                radial-gradient(600px 300px at 0% 0%, var(--bg-accent), transparent 70%),
                var(--bg);
        }
        .hero::before {
            content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
            background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
            background-size: 44px 44px;
            -webkit-mask-image: radial-gradient(ellipse 70% 120% at 80% 0%, #000 0%, transparent 70%);
            mask-image: radial-gradient(ellipse 70% 120% at 80% 0%, #000 0%, transparent 70%);
        }
        .hero-inner { position: relative; padding-block: 52px 76px; max-width: 760px; }
        .eyebrow { display: inline-flex; align-items: center; gap: 9px; font-size: 11.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--brand); }
        .eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: currentColor; }
        h1 { margin-top: 14px; font-size: clamp(30px, 4.4vw, 48px); line-height: 1.08; font-weight: 800; letter-spacing: -.035em; color: var(--ink); }
        .leadcopy { margin-top: 14px; max-width: 580px; font-size: 17px; line-height: 1.6; color: var(--ink-2); }
        .hero-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;}
        .location {
            display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border-radius: 999px;
            font-size: 12.5px; font-weight: 700; color: var(--brand-700); background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow-sm);
        }
        @media (prefers-color-scheme: dark) { .location { color: var(--brand); } }
        .location svg { flex: none; }
        #adminLink {
            display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 650; color: var(--brand-700); text-decoration: none;
            padding: 6px 4px; border-bottom: 1.5px solid transparent; transition: border-color .15s;
        }
        #adminLink:hover { border-color: currentColor; }
        @media (prefers-color-scheme: dark) { #adminLink { color: var(--brand); } }
        .trust { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: 26px; padding: 0; list-style: none; }
        .trust li { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; color: var(--ink-2); }
        .trust svg { color: var(--brand); flex: none; }

        /* ---------- Layout ---------- */
        main { position: relative; padding-bottom: 28px; }
        .main-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; margin-top: 20px; align-items: start; }
        @media (min-width: 992px) { .main-layout { grid-template-columns: minmax(0, 1fr) 400px; gap: 28px; } }

        .surface { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-md); padding: 36px; }
        @media (max-width: 600px) { .surface { padding: 22px 18px; border-radius: 18px; } .container { padding-inline: 16px; } }

        .section-heading { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 22px; }
        .step {
            display: grid; place-items: center; flex: none; width: 38px; height: 38px; border-radius: 12px; font-size: 13px; font-weight: 800; letter-spacing: .02em;
            color: #fff; background: linear-gradient(145deg, #12a594, #086f63); box-shadow: 0 6px 14px -6px rgba(8, 111, 99, .6);
        }
        @media (prefers-color-scheme: dark) { .step { color: #05201c; background: linear-gradient(145deg, #5fe0cf, #2bb09e); } }
        .section-heading h2 { font-size: 20px; line-height: 1.3; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
        .section-heading p { margin-top: 3px; font-size: 14px; color: var(--muted); }
        .divider { height: 1px; border: 0; background: var(--line); margin: 34px 0; }

        /* ---------- Duration selector ---------- */
        .mode-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
        @media (max-width: 767px) { .mode-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
        .mode {
            position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-height: 92px; padding: 16px 16px 14px; text-align: left;
            background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
            transition: border-color .18s, background-color .18s, box-shadow .18s, transform .18s;
        }
        .mode:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(10, 100, 86, .45); }
        .mode:active { transform: translateY(0); }
        .mode-name { font-size: 15px; font-weight: 750; color: var(--ink); letter-spacing: -.01em; }
        .mode small { display: inline-block; margin-top: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; color: var(--brand-700); background: var(--brand-50); }
        @media (prefers-color-scheme: dark) { .mode small { color: var(--brand); } }
        .mode-radio {
            position: absolute; top: 14px; right: 14px; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface);
            display: grid; place-items: center; transition: all .18s;
        }
        .mode-radio::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform .18s; }
        .mode.active { border-color: var(--brand); background: linear-gradient(180deg, var(--brand-50), var(--surface)); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
        .mode.active .mode-radio { background: var(--brand); border-color: var(--brand); }
        .mode.active .mode-radio::after { transform: scale(1); }
        @media (prefers-color-scheme: dark) { .mode.active .mode-radio::after { background: #05201c; } }
        .mode.active small { color: #fff; background: var(--brand); }
        @media (prefers-color-scheme: dark) { .mode.active small { color: #05201c; } }

        /* ---------- Organization info (rendered by plan.js) ---------- */
        .org-info {
            display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 20px; padding: 18px 20px; margin-bottom: 18px;
            background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-md);
        }
        .org-field span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
        .org-field strong { display: block; margin-top: 2px; font-size: 13.5px; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
        @media (max-width: 767px) { .org-info { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

        .notice {
            grid-column: 1 / -1; display: block; margin: 0; padding: 12px 14px; border-radius: var(--radius-sm); font-size: 13px; line-height: 1.5; font-weight: 500;
            color: var(--gold); background: var(--gold-bg); border: 1px solid var(--gold-line);
        }
        #quoteWarning { margin-top: 16px; }
        #orgInfo .notice { margin-top: 0; }

        /* ---------- Configuration rows ---------- */
        .config-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
        .config-item { display: flex; align-items: center; gap: 18px; padding: 22px 22px; transition: background-color .15s; }
        .config-item:hover { background: var(--surface-2); }
        .config-item + .config-item { border-top: 1px solid var(--line); }
        .config-icon { display: grid; place-items: center; flex: none; width: 50px; height: 50px; border-radius: 14px; color: var(--brand-700); background: var(--brand-50); border: 1px solid var(--brand-100); }
        @media (prefers-color-scheme: dark) { .config-icon { color: var(--brand); } }
        .config-copy { flex: 1; min-width: 0; }
        .config-copy label { display: block; font-size: 15.5px; font-weight: 700; letter-spacing: -.01em; color: var(--ink); }
        .config-copy p { margin-top: 3px; max-width: 420px; font-size: 13.5px; line-height: 1.5; color: var(--muted); }

        .count-control { display: inline-flex; align-items: center; flex: none; padding: 4px; gap: 2px; background: var(--surface-3); border: 1px solid var(--line-strong); border-radius: 14px; }
        .count-control button {
            display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 10px; color: var(--brand-700); background: var(--surface);
            box-shadow: 0 1px 2px rgba(14, 39, 36, .08), 0 0 0 1px var(--line); transition: background-color .15s, color .15s, transform .1s, box-shadow .15s;
        }
        @media (prefers-color-scheme: dark) { .count-control button { color: var(--brand); } }
        .count-control button:not(:disabled):hover { color: #fff; background: var(--brand); box-shadow: 0 6px 14px -6px rgba(8, 111, 99, .7); }
        @media (prefers-color-scheme: dark) { .count-control button:not(:disabled):hover { color: #05201c; } }
        .count-control button:not(:disabled):active { transform: scale(.94); }
        .count-control button:disabled { color: var(--muted); opacity: .45; background: transparent; box-shadow: none; cursor: not-allowed; }
        .count-control strong { min-width: 52px; text-align: center; font-size: 19px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink); }

        .included-note {
            display: flex; align-items: flex-start; gap: 12px; margin-top: 18px; padding: 15px 18px; font-size: 13.5px; line-height: 1.55; color: var(--ink-2);
            background: var(--brand-50); border: 1px solid var(--brand-100); border-radius: var(--radius-md);
        }
        .included-note strong { color: var(--ink); font-weight: 700; }
        .note-icon { display: grid; place-items: center; flex: none; width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; color: #fff; background: var(--brand); }
        @media (prefers-color-scheme: dark) { .note-icon { color: #05201c; } }

        .status { display: flex; align-items: center; gap: 9px; min-height: 22px; margin-top: 20px; font-size: 12.5px; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
        .status::before { content: ""; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 18%, transparent); }

        @media (max-width: 600px) {
            .config-item { flex-wrap: wrap; padding: 18px 16px; gap: 14px; }
            .config-icon { width: 42px; height: 42px; border-radius: 12px; }
            .config-copy { flex: 1 1 calc(100% - 70px); }
            .count-control { margin-left: 56px; }
            .section-heading { gap: 12px; }
        }

        /* ---------- Payment summary ---------- */
        .summary-wrap { position: relative; }
        @media (min-width: 992px) { .summary-wrap { position: sticky; top: 90px; } }
        .summary { padding: 0; overflow: hidden; box-shadow: var(--shadow-lg); }
        .summary-head {
            position: relative; padding: 28px 30px 26px; color: #fff; overflow: hidden;
            background: radial-gradient(420px 220px at 100% 0%, rgba(95, 224, 207, .30), transparent 70%), linear-gradient(155deg, #0b6b60 0%, #08463f 100%);
        }
        .summary-head::after {
            content: ""; position: absolute; right: -40px; bottom: -60px; width: 180px; height: 180px; border-radius: 50%; border: 28px solid rgba(255, 255, 255, .05); pointer-events: none;
        }
        .summary-head .eyebrow { color: #8fe9dc; }
        .summary-head h2 { margin-top: 8px; font-size: 24px; font-weight: 800; letter-spacing: -.03em; color: #fff; }
        .pill {
            display: inline-flex; align-items: center; margin: 12px 0 22px; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
            color: #d6fbf4; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .18);
        }
        .subtotal-label { font-size: 13px; font-weight: 600; color: rgba(255, 255, 255, .72); }
        .monthly { margin-top: 2px; font-size: clamp(36px, 4.4vw, 46px); line-height: 1.1; font-weight: 800; letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: #fff; overflow-wrap: anywhere; }
        .muted { margin-top: 6px; font-size: 12.5px; color: rgba(255, 255, 255, .66); }

        .summary-body { padding: 26px 30px 28px; }
        .group-title { margin: 0 0 4px; font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
        .summary-body .group-title:not(:first-child) { margin-top: 22px; }
        .summary-line { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 9px 0; font-size: 14px; }
        .summary-line + .summary-line { border-top: 1px dashed var(--line); }
        .summary-line span { color: var(--ink-2); }
        .summary-line small { color: var(--muted); font-size: 12px; margin-left: 4px; }
        .summary-line b { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--ink); text-align: right; }
        #setupSavings, #subDiscount { color: var(--brand-700); }
        @media (prefers-color-scheme: dark) { #setupSavings, #subDiscount { color: var(--brand); } }

        .total-row {
            display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 24px; padding: 18px 20px; border-radius: var(--radius-md);
            background: linear-gradient(135deg, var(--brand-50), var(--brand-100)); border: 1px solid var(--brand-100);
        }
        .total-row span { display: block; font-size: 14px; font-weight: 750; color: var(--ink); }
        .total-row small { display: block; margin-top: 2px; max-width: 170px; font-size: 11.5px; line-height: 1.4; color: var(--ink-2); }
        .total-row strong { font-size: 27px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--brand-700); white-space: nowrap; }
        @media (prefers-color-scheme: dark) { .total-row strong { color: var(--brand); } }
        .saved { margin-top: 14px; font-size: 13px; font-weight: 650; color: var(--brand-700); text-align: center; }
        .saved:empty { display: none; }
        @media (prefers-color-scheme: dark) { .saved { color: var(--brand); } }
        .disclaimer { display: flex; gap: 10px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.6; color: var(--muted); }
        .disclaimer svg { flex: none; margin-top: 2px; }
        @media (max-width: 380px) { .total-row { flex-direction: column; align-items: flex-start; } .summary-head, .summary-body { padding-inline: 20px; } }

        .recharge-action { width:100%; border:0; border-radius:12px; padding:15px 20px; background:var(--brand); color:#fff; font-weight:800; font-size:15px; transition:background .15s, transform .15s; }
        .recharge-action:hover:not(:disabled) { background:var(--brand-700); transform:translateY(-1px); }
        .recharge-action:disabled { opacity:.55; cursor:not-allowed; }
        .checkout-message { margin-top:12px; font-size:13px; line-height:1.5; color:var(--ink-2); overflow-wrap:anywhere; }
        .checkout-message.error { color:#b42318; }
        /* ---------- Footer ---------- */
        .footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 20px; margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }

        @media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
        @media print { .topbar, .hero::before, .count-control button, .footer { display: none !important; } .main-layout { margin-top: 0; } .summary-wrap { position: static; } .surface { box-shadow: none; } }