@charset "utf-8";

/* ==========================================================================
   5-Star Review Widget ROI Calculator
   One dark theme, one set of tokens. Tailwind (CDN) handles layout utilities;
   everything visual (colour, surfaces, form controls, responsive behaviour)
   lives here so the two can't fight each other.
   Font: Inter is loaded by <link> in the HTML (no @import = no blocking).
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Surfaces */
    --bg:            #0f172a;   /* page            */
    --surface:       #1e293b;   /* cards           */
    --surface-inset: #0f172a;   /* inputs, thead   */
    --border:        #334155;
    --border-soft:   #2b3a50;

    /* Text (contrast on --surface: 14.6 / 11.9 / 5.7 : 1) */
    --text:          #f1f5f9;
    --text-muted:    #cbd5e1;
    --text-subtle:   #94a3b8;

    /* Brand + data colours */
    --brand:         #22c55e;
    --brand-strong:  #16a34a;
    --brand-deep:    #15803d;
    --emerald:       #34d399;
    --amber:         #fbbf24;
    --track:         #475569;

    --radius:        1rem;
    --radius-sm:     0.625rem;
    --ring:          0 0 0 3px rgba(34, 197, 94, 0.45);
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    background: var(--bg);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img, svg, canvas { max-width: 100%; }

/* Page shell: respects notches / home-indicator, and mobile browser chrome */
.app-shell {
    min-height: 100vh;
    min-height: 100dvh;
    padding-top:    max(2rem, env(safe-area-inset-top));
    padding-bottom: max(2rem, env(safe-area-inset-bottom));
    padding-left:   max(1rem, env(safe-area-inset-left));
    padding-right:  max(1rem, env(safe-area-inset-right));
}
@media (min-width: 640px)  { .app-shell { padding-left: max(1.5rem, env(safe-area-inset-left)); padding-right: max(1.5rem, env(safe-area-inset-right)); } }
@media (min-width: 1024px) { .app-shell { padding-left: max(2rem, env(safe-area-inset-left));   padding-right: max(2rem, env(safe-area-inset-right)); } }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.hero-title {
    font-size: clamp(1.625rem, 5.2vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--text);
    text-wrap: balance;
}
.hero-sub {
    font-size: clamp(0.95rem, 2.4vw, 1.125rem);
    color: var(--text-subtle);
    text-wrap: pretty;
}
.pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.875rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-align: left;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(1rem, 3.5vw, 2rem);
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
    min-width: 0;
}
.card--compact { padding: clamp(1rem, 3vw, 1.5rem); }

.card-title {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */
.field-label { font-weight: 500; color: var(--text); font-size: 0.9375rem; line-height: 1.3; }
.field-hint  { font-size: 0.75rem; color: var(--text-subtle); }

.num-box {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    width: 7.5rem;
    min-height: 2.5rem;
    padding: 0 0.625rem;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
.num-box--sm { width: 6.5rem; }
.num-box:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.num-box--accent { border-color: rgba(34, 197, 94, 0.55); }
.num-box .affix { color: var(--text-subtle); font-size: 0.8125rem; }

.num-box input {
    width: 100%;
    min-width: 0;
    background: transparent;
    border: 0;
    outline: 0;
    padding: 0;
    text-align: right;
    font: inherit;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand);
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
    appearance: textfield;
}
.num-box input::-webkit-outer-spin-button,
.num-box input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.text-field {
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-inset);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font: inherit;
    font-size: 1rem;
    transition: border-color .15s, box-shadow .15s;
}
.text-field::placeholder { color: var(--text-subtle); opacity: 1; }
.text-field:focus { outline: 0; border-color: var(--brand); box-shadow: var(--ring); }

/* Custom range slider styling */
input[type=range] {
    --pct: 0%;
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 1.75rem;
    margin: 0;
    background: transparent;
    cursor: pointer;
    touch-action: pan-y;
}
input[type=range]:focus { outline: none; }

input[type="range"]::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 999px;
    background: #334155;
    transition: background 0.2s;
}
input[type="range"]::-moz-range-track {
    height: 8px;
    border-radius: 999px;
    background: #334155;
}
input[type="range"]::-moz-range-progress {
    height: 8px;
    border-radius: 999px;
    background: var(--brand);
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    margin-top: -8px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 1px var(--brand), 0 2px 8px rgba(0, 0, 0, 0.5);
    transition: transform .1s ease, box-shadow .15s;
}
input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--brand);
    border: 3px solid var(--surface);
    box-shadow: 0 0 0 1px var(--brand), 0 2px 8px rgba(0, 0, 0, 0.5);
}
input[type="range"]:hover::-webkit-slider-thumb  { transform: scale(1.1); }
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 1px var(--brand), var(--ring); }
input[type="range"]:focus-visible::-moz-range-thumb     { box-shadow: 0 0 0 1px var(--brand), var(--ring); }

.scale { display: flex; justify-content: space-between; gap: 0.5rem; font-size: 0.75rem; color: var(--text-subtle); }

.uplift-group {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: var(--radius);
    padding: clamp(0.875rem, 3vw, 1rem);
}
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.18);
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   KPI cards
   -------------------------------------------------------------------------- */
.kpi {
    position: relative;
    overflow: hidden;
    text-align: center;
    container-type: inline-size;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.125rem 1rem 1.25rem;
    min-width: 0;
}
.kpi::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4px;
    background: var(--kpi-accent, var(--brand));
}
.kpi-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-subtle); margin-bottom: 0.25rem; }
.kpi-value {
    font-size: 1.75rem;
    font-size: clamp(1.25rem, 13cqw, 1.875rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--kpi-accent, var(--brand));
    font-variant-numeric: tabular-nums;
    overflow-wrap: anywhere;
}
.kpi-sub { font-size: 0.75rem; color: var(--text-subtle); margin-top: 0.25rem; }
.kpi--green   { --kpi-accent: var(--brand); }
.kpi--emerald { --kpi-accent: var(--emerald); }
.kpi--amber   { --kpi-accent: var(--amber); }

/* --------------------------------------------------------------------------
   Chart
   -------------------------------------------------------------------------- */
.chart-wrap { position: relative; height: clamp(13rem, 42vw, 17rem); }

/* --------------------------------------------------------------------------
   Table 
   -------------------------------------------------------------------------- */
.roi-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; color: var(--text-muted); }
.roi-table th {
    padding: 0.625rem 0.75rem;
    background: var(--surface-inset);
    border-bottom: 1px solid var(--border);
    color: var(--text-subtle);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
}
.roi-table th.is-brand { color: var(--brand); }
.roi-table th.is-end, .roi-table td.is-end { text-align: right; }
.roi-table td { padding: 0.75rem; border-bottom: 1px solid var(--border-soft); font-variant-numeric: tabular-nums; }
.roi-table tbody tr:last-child td { border-bottom: 0; }
.roi-table td.metric  { color: var(--text); font-weight: 500; }
.roi-table td.is-with { color: var(--brand); font-weight: 700; }
.roi-table td.is-gain { color: var(--emerald); font-weight: 600; }

@media (max-width: 639.98px) {
    .roi-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .roi-table, .roi-table tbody, .roi-table tr, .roi-table td { display: block; width: 100%; }
    .roi-table tr { padding: 0.75rem 0; border-bottom: 1px solid var(--border-soft); }
    .roi-table tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
    .roi-table td { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: 0.25rem 0; border: 0; text-align: right !important; }
    .roi-table td::before { content: attr(data-label); color: var(--text-subtle); font-weight: 400; text-align: left; }
    .roi-table td.metric { display: block; text-align: left !important; font-size: 1rem; padding-bottom: 0.375rem; }
    .roi-table td.metric::before { content: none; }
}

/* --------------------------------------------------------------------------
   Call-to-action
   -------------------------------------------------------------------------- */
.cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: clamp(1.125rem, 4vw, 1.75rem);
    border-radius: var(--radius);
    background: linear-gradient(110deg, #15803d 0%, #047857 100%);
    color: #fff;
    box-shadow: 0 10px 30px rgba(2, 6, 23, 0.35);
}
.cta h4 { font-size: clamp(1.125rem, 3.4vw, 1.375rem); font-weight: 700; line-height: 1.25; }
.cta p  { color: #ecfdf5; font-size: 0.875rem; margin-top: 0.25rem; }
@media (min-width: 640px) { .cta { flex-direction: row; align-items: center; justify-content: space-between; } }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.75rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9375rem;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    border: 0;
    cursor: pointer;
    transition: background-color .15s, transform .15s;
}
.btn:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.btn--dark    { background: #0f172a; color: #fff; }
.btn--dark:hover { background: #020617; transform: translateY(-1px); }
.btn--brand   { background: var(--brand); color: #052e16; width: 100%; }
.btn--brand:hover { background: #4ade80; }
.btn--brand:focus-visible { outline-color: var(--brand); }
@media (max-width: 639.98px) { .cta .btn { width: 100%; } }
@media (min-width: 640px)    { .cta .btn { flex-shrink: 0; white-space: nowrap; } }

/* --------------------------------------------------------------------------
   Modal
   -------------------------------------------------------------------------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
    background: rgba(2, 6, 23, 0.8);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
    overflow-y: auto;
}
.modal.is-open { opacity: 1; pointer-events: auto; }
.modal-panel {
    position: relative;
    width: 100%;
    max-width: 28rem;
    margin: auto;
    padding: clamp(1.25rem, 4vw, 1.5rem);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.6);
}
.modal-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 2.75rem;
    height: 2.75rem;
    display: grid;
    place-items: center;
    background: transparent;
    border: 0;
    border-radius: 50%;
    color: var(--text-subtle);
    font-size: 1.125rem;
    cursor: pointer;
}
.modal-close:hover { color: var(--text); background: rgba(148, 163, 184, 0.15); }
.modal-close:focus-visible { outline: 0; box-shadow: var(--ring); }

.divider { border-color: var(--border); }
::selection { background: var(--brand); color: #052e16; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (max-width: 380px) {
    .num-box { width: 6.75rem; }
    .kpi { padding: 1rem 0.75rem 1.125rem; }
}