/* =========================================================================
   Site Recon — theme tokens and component styles
   Tailwind (CDN) supplies utilities; this file holds the palette (dark and
   light), the reusable pieces (cards, chips, buttons, grids) and every
   responsive rule, so the template stays readable.
   Colours are space-separated RGB triplets so Tailwind can add opacity.
   ========================================================================= */

:root,
html[data-theme="dark"] {
    color-scheme: dark;
    --ti-950: 12 7 9;
    --ti-900: 20 12 15;
    --ti-850: 28 16 21;
    --ti-800: 37 21 28;
    --ti-750: 47 26 35;
    --ti-700: 58 32 44;
    --ti-600: 84 45 62;
    --ti-500: 117 62 86;
    --cherry-50: 255 241 243;
    --cherry-100: 255 228 232;
    --cherry-200: 254 205 214;
    --cherry-300: 253 164 181;
    --cherry-400: 251 113 139;
    --cherry-500: 244 63 99;
    --cherry-600: 225 29 72;
    --cherry-700: 190 18 60;
    --cherry-800: 159 18 57;
    --cherry-900: 136 19 55;
    --cherry-950: 76 5 25;
    --text-strong: 255 255 255;
    --chip-ok: 52 211 153;
    --chip-warn: 251 191 36;
    --chip-bad: 251 113 133;
    --chip-info: 96 165 250;
    --chip-accent: 253 164 181;
    --chip-muted: 209 213 219;
    --muted: 156 163 175;
}

html[data-theme="light"] {
    color-scheme: light;
    --ti-950: 251 245 247;
    --ti-900: 255 255 255;
    --ti-850: 249 240 243;
    --ti-800: 255 255 255;
    --ti-750: 243 230 235;
    --ti-700: 236 217 223;
    --ti-600: 214 184 196;
    --ti-500: 190 150 166;
    --cherry-50: 76 5 25;
    --cherry-100: 136 19 55;
    --cherry-200: 159 18 57;
    --cherry-300: 190 18 60;
    --cherry-400: 225 29 72;
    --cherry-500: 244 63 99;
    --cherry-600: 225 29 72;
    --cherry-700: 244 63 99;
    --cherry-800: 253 164 181;
    --cherry-900: 254 205 214;
    --cherry-950: 255 228 232;
    --text-strong: 42 17 24;
    --chip-ok: 4 120 87;
    --chip-warn: 180 83 9;
    --chip-bad: 190 18 60;
    --chip-info: 29 78 216;
    --chip-accent: 190 18 60;
    --chip-muted: 74 48 57;
    --muted: 122 93 104;
}

/* Tailwind colour utilities that are not variable-based need a light twin. */
html[data-theme="light"] .text-white {
    color: rgb(var(--text-strong));
}

html[data-theme="light"] .text-gray-100,
html[data-theme="light"] .text-gray-200 {
    color: #3d2530;
}

html[data-theme="light"] .text-gray-300 {
    color: #4a3039;
}

html[data-theme="light"] .text-gray-400 {
    color: #7a5d68;
}

html[data-theme="light"] .text-gray-500 {
    color: #8a6e79;
}

html[data-theme="light"] .text-emerald-400 {
    color: #047857;
}

html[data-theme="light"] .text-amber-400,
html[data-theme="light"] .text-amber-300 {
    color: #b45309;
}

html[data-theme="light"] .text-amber-200,
html[data-theme="light"] .text-amber-200\/90 {
    color: #92400e;
}

html[data-theme="light"] .text-rose-400 {
    color: #be123c;
}

html[data-theme="light"] .text-sky-400 {
    color: #0369a1;
}

html[data-theme="light"] .bg-amber-950\/30 {
    background-color: #fffbeb;
}

html[data-theme="light"] .bg-titanium-950 {
    background-color: rgb(var(--ti-950));
}

html[data-theme="light"] ::selection {
    background: #fecdd6;
    color: #4c0519;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    padding-left: env(safe-area-inset-left);
    /* clear notches / rounded corners */
    padding-right: env(safe-area-inset-right);
    transition: background-color .2s, color .2s;
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- Icons ------------------------------------------------------------ */
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    vertical-align: middle;
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
    /* clips the ligature name while the font loads */
    box-sizing: content-box;
    /* so the width below is the glyph box, not glyph + padding */
    width: 1em;
    /* reserve the icon box so nothing shifts when the font arrives */
    max-width: 1.5em;
    white-space: nowrap;
}

/* theme.js adds .icons-wait until the icon font has loaded (or 4 s pass), so a slow connection
   shows empty icon slots instead of fragments of the ligature names ("rada", "ligh"...). */
html.icons-wait .material-symbols-outlined {
    color: transparent !important;
}

.material-symbols-outlined.fill {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ---- Scrollbars & focus ------------------------------------------------ */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: rgb(var(--ti-900));
}

::-webkit-scrollbar-thumb {
    background: rgb(var(--ti-600));
    border-radius: 9999px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgb(var(--cherry-500));
}

:focus-visible {
    outline: 2px solid rgb(var(--cherry-400));
    outline-offset: 2px;
}

.search-bar:focus-within :focus-visible {
    outline: none;
}

/* ---- Page shell -------------------------------------------------------- */
.shell {
    width: 100%;
    max-width: 80rem;
    margin-inline: auto;
    padding-inline: 1rem;
}

@media (min-width: 640px) {
    .shell {
        padding-inline: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .shell {
        padding-inline: 2rem;
    }
}

.subnav {
    border-bottom: 1px solid rgb(var(--ti-600) / .3);
    background: rgb(var(--ti-900) / .6);
    position: relative;
    z-index: 20;
}

.subnav-inner {
    display: flex;
    gap: 0.25rem;
    overflow-x: auto;
    padding-block: 0.375rem;
    scrollbar-width: none;
}

.subnav-inner::-webkit-scrollbar {
    display: none;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 2.25rem;
    padding: 0 0.875rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 600;
    white-space: nowrap;
    color: rgb(var(--muted));
    border: 1px solid transparent;
    transition: color .15s, background-color .15s;
}

.nav-link:hover {
    color: rgb(var(--text-strong));
    background: rgb(var(--ti-750) / .7);
}

.nav-link[aria-current="page"] {
    color: rgb(var(--text-strong));
    background: rgb(var(--ti-750));
    border-color: rgb(var(--ti-600) / .6);
}

.nav-link .material-symbols-outlined {
    font-size: 1.15rem;
    color: rgb(var(--cherry-400));
}

.nav-badge {
    min-width: 1.15rem;
    height: 1.15rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background: rgb(var(--cherry-600));
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 9999px;
    color: rgb(var(--cherry-300));
    background: rgb(var(--ti-800));
    border: 1px solid rgb(var(--ti-600) / .4);
    cursor: pointer;
    transition: background-color .15s, border-color .15s;
}

.icon-btn:hover {
    background: rgb(var(--ti-750));
    border-color: rgb(var(--cherry-500) / .5);
}

.icon-btn .material-symbols-outlined {
    font-size: 1.15rem;
}

/* ---- Search ------------------------------------------------------------ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem;
    border-radius: 9999px;
    background: rgb(var(--ti-800) / .9);
    border: 1px solid rgb(var(--ti-600) / .6);
    box-shadow: 0 0 35px -5px rgba(244, 63, 99, 0.25);
    transition: border-color .2s, box-shadow .2s;
}

.search-bar:hover {
    border-color: rgb(var(--cherry-700) / .7);
}

.search-bar:focus-within {
    border-color: rgb(var(--cherry-500));
    box-shadow: 0 0 0 4px rgba(244, 63, 99, 0.2), 0 0 35px -5px rgba(244, 63, 99, 0.25);
}

.search-bar input {
    flex: 1 1 auto;
    min-width: 0;
    background: transparent;
    color: rgb(var(--text-strong));
    font-size: 1rem;
    outline: none;
    padding: 0.5rem 0.5rem 0.5rem 0.75rem;
    text-overflow: ellipsis;
}

.search-bar input::placeholder {
    color: #6b7280;
}

.search-bar .btn-submit {
    flex: 0 0 auto;
}

@media (max-width: 420px) {
    .search-bar .btn-submit .btn-label {
        display: none;
    }

    .search-bar .btn-submit {
        padding-inline: 0.9rem;
    }
}

.field {
    width: 100%;
    min-height: 2.75rem;
    padding: 0 1rem;
    border-radius: 1rem;
    font-size: 1rem;
    color: rgb(var(--text-strong));
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .6);
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.field::placeholder {
    color: #6b7280;
}

.field:focus {
    border-color: rgb(var(--cherry-500));
    box-shadow: 0 0 0 3px rgba(244, 63, 99, .2);
}

select.field {
    appearance: none;
    padding-right: 2rem;
    background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
    background-position: calc(100% - 1.1rem) 50%, calc(100% - 0.8rem) 50%;
    background-size: 0.3rem 0.3rem;
    background-repeat: no-repeat;
}

.field-sm {
    min-height: 2.25rem;
    font-size: 0.8125rem;
    border-radius: 9999px;
    padding: 0 0.875rem;
}

.form-row {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .form-row.two {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
        align-items: end;
    }
}

.form-label {
    display: block;
    margin-bottom: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgb(var(--muted));
}

/* ---- Buttons ----------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2.5rem;
    padding: 0 1rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: rgb(var(--text-strong));
    background: rgb(var(--ti-750));
    border: 1px solid rgb(var(--ti-600) / .6);
    cursor: pointer;
    transition: background-color .15s, border-color .15s, transform .1s;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    background: rgb(var(--ti-700));
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: .7;
    cursor: progress;
}

.btn .material-symbols-outlined {
    font-size: 1.1rem;
}

.btn-primary {
    color: #fff;
    background: rgb(var(--cherry-600));
    border-color: transparent;
    box-shadow: 0 0 15px -2px rgba(244, 63, 99, 0.35);
}

.btn-primary:hover {
    background: rgb(var(--cherry-500));
}

.btn-danger:hover {
    border-color: rgba(244, 63, 94, .6);
    color: rgb(var(--chip-bad));
}

.btn-pill {
    border-radius: 9999px;
    min-height: 2.25rem;
    padding: 0 0.875rem;
}

.btn-submit {
    min-height: 2.75rem;
    padding: 0 1.5rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    color: #fff;
    border: 0;
    background: linear-gradient(90deg, rgb(var(--cherry-500)), rgb(var(--cherry-600)));
    box-shadow: 0 0 15px -2px rgba(244, 63, 99, 0.35);
}

.btn-submit:hover {
    background: linear-gradient(90deg, rgb(var(--cherry-400)), rgb(var(--cherry-500)));
}

form.inline {
    display: contents;
}

.quick-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    line-height: 1;
    color: rgb(var(--chip-muted));
    background: rgb(var(--ti-800));
    border: 1px solid rgb(var(--ti-600) / .4);
    cursor: pointer;
    transition: border-color .15s, background-color .15s;
}

.quick-chip:hover {
    background: rgb(var(--ti-750));
    border-color: rgba(244, 63, 99, 0.5);
}

/* The remove "x" is drawn with two CSS lines (not a font glyph, which sits low), centred in a round hit-area. */
.quick-chip .x {
    position: relative;
    display: inline-block;
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-right: -0.25rem;
    border-radius: 9999px;
    font-size: 0;
    line-height: 0;
    color: rgb(var(--chip-muted));
    opacity: .65;
    transition: opacity .15s, background-color .15s, color .15s;
}

.quick-chip .x::before,
.quick-chip .x::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 0.5rem;
    height: 1.5px;
    border-radius: 1px;
    background: currentColor;
}

.quick-chip .x::before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.quick-chip .x::after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.quick-chip .x:hover {
    opacity: 1;
    color: rgb(var(--chip-bad));
    background: rgb(var(--chip-bad) / .12);
}

/* "Clear" has no x, so give it the same height and an even, centred label. */
.quick-chip[data-action="clear-recent"] {
    min-width: 4rem;
    padding: 0 1rem;
}

.recent[hidden] {
    display: none;
}

/* ---- Cards ------------------------------------------------------------- */
.card {
    min-width: 0;
    padding: 1rem;
    border-radius: 1.5rem;
    background: rgb(var(--ti-800));
    border: 1px solid rgb(var(--ti-600) / .4);
    box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
}

@media (min-width: 640px) {
    .card {
        padding: 1.25rem;
    }
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid rgb(var(--ti-600) / .3);
}

.card-head .title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.card-head h3 {
    font-size: 0.875rem;
    font-weight: 700;
    color: rgb(var(--text-strong));
    margin: 0;
}

.card-head .meta {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: rgb(var(--muted));
    font-family: 'JetBrains Mono', ui-monospace, monospace;
}

.card-note {
    font-size: 0.6875rem;
    line-height: 1.5;
    color: rgb(var(--muted));
    margin: 0 0 0.75rem;
}

.empty-note {
    padding: 1.25rem 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    color: rgb(var(--muted));
}

.page-head {
    max-width: 48rem;
    margin-inline: auto;
    text-align: center;
    display: grid;
    gap: 0.5rem;
}

.page-head h2 {
    font-size: 1.625rem;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: -.01em;
    color: rgb(var(--text-strong));
    margin: 0;
}

@media (min-width: 640px) {
    .page-head h2 {
        font-size: 2rem;
    }
}

.page-head p {
    font-size: 0.875rem;
    color: rgb(var(--muted));
    margin: 0;
}

.hero-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
    border-radius: 1.5rem;
    background: linear-gradient(135deg, rgb(var(--ti-850)), rgb(var(--ti-800)) 50%, rgb(var(--ti-850)));
    border: 1px solid rgb(var(--ti-600) / .5);
    box-shadow: 0 0 35px -5px rgba(244, 63, 99, 0.25);
}

@media (min-width: 640px) {
    .hero-card {
        padding: 1.5rem;
    }
}

.hero-layout {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 1024px) {
    .hero-layout {
        grid-template-columns: minmax(0, 1fr) 21rem;
        align-items: center;
    }
}

.hero-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (min-width: 640px) and (max-width: 1023px) {
    .hero-actions {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 639px),
(min-width: 1024px) {
    .hero-actions> :last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }
}

/* ---- Chips / badges ---------------------------------------------------- */
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    min-height: 1.5rem;
    padding: 0.125rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    border: 1px solid transparent;
}

.chip .material-symbols-outlined {
    font-size: 0.95rem;
}

.chip--ok {
    color: rgb(var(--chip-ok));
    background: rgb(var(--chip-ok) / .10);
    border-color: rgb(var(--chip-ok) / .30);
}

.chip--warn {
    color: rgb(var(--chip-warn));
    background: rgb(var(--chip-warn) / .10);
    border-color: rgb(var(--chip-warn) / .30);
}

.chip--bad {
    color: rgb(var(--chip-bad));
    background: rgb(var(--chip-bad) / .10);
    border-color: rgb(var(--chip-bad) / .30);
}

.chip--info {
    color: rgb(var(--chip-info));
    background: rgb(var(--chip-info) / .10);
    border-color: rgb(var(--chip-info) / .30);
}

.chip--accent {
    color: rgb(var(--chip-accent));
    background: rgb(var(--chip-accent) / .15);
    border-color: rgb(var(--chip-accent) / .30);
}

.chip--muted {
    color: rgb(var(--chip-muted));
    background: rgb(var(--ti-700) / .6);
    border-color: rgb(var(--ti-600) / .5);
}

.chip--sm {
    min-height: 1.25rem;
    padding: 0 0.5rem;
    font-size: 0.6875rem;
}

.text-ok {
    color: rgb(var(--chip-ok));
}

.text-warn {
    color: rgb(var(--chip-warn));
}

.text-bad {
    color: rgb(var(--chip-bad));
}

.text-info {
    color: rgb(var(--chip-info));
}

.grade {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    border-radius: 0.75rem;
    font-weight: 800;
    font-size: 1rem;
    border: 1px solid transparent;
}

.grade--ok {
    color: rgb(var(--chip-ok));
    background: rgb(var(--chip-ok) / .12);
    border-color: rgb(var(--chip-ok) / .3);
}

.grade--warn {
    color: rgb(var(--chip-warn));
    background: rgb(var(--chip-warn) / .12);
    border-color: rgb(var(--chip-warn) / .3);
}

.grade--bad {
    color: rgb(var(--chip-bad));
    background: rgb(var(--chip-bad) / .12);
    border-color: rgb(var(--chip-bad) / .3);
}

.grade--lg {
    min-width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    border-radius: 1rem;
}

/* segmented filter */
.seg {
    display: inline-flex;
    padding: 0.1875rem;
    border-radius: 9999px;
    background: rgb(var(--ti-900));
    border: 1px solid rgb(var(--ti-600) / .5);
}

.seg button {
    min-height: 1.75rem;
    padding: 0 0.75rem;
    border: 0;
    border-radius: 9999px;
    background: transparent;
    font-size: 0.6875rem;
    font-weight: 600;
    color: rgb(var(--muted));
    cursor: pointer;
}

.seg button[aria-pressed="true"] {
    background: rgb(var(--cherry-600));
    color: #fff;
}

/* ---- Metric tiles ------------------------------------------------------ */
.metric-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (min-width: 640px) {
    .metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (min-width: 1280px) {
    .metric-grid {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

.metric {
    min-width: 0;
    padding: 0.875rem 1rem;
    border-radius: 1.5rem;
    background: rgb(var(--ti-800));
    border: 1px solid rgb(var(--ti-600) / .4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.5rem;
}

.metric-label {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: rgb(var(--muted));
}

.metric-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.metric-value {
    font-size: 1.125rem;
    font-weight: 700;
    color: rgb(var(--text-strong));
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.metric-value.is-text {
    font-size: 0.9375rem;
}

.metric-note {
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgb(var(--muted));
    margin-top: 0.125rem;
}

/* ---- Results layout ---------------------------------------------------- */
.results {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .results {
        gap: 1.5rem;
    }
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-width: 0;
}

.main-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
    .main-grid {
        gap: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        align-items: start;
    }
}

.insight-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 640px) {
    .insight-grid {
        gap: 1.5rem;
    }
}

/* Two balanced columns (cards flow top-to-bottom, so uneven heights leave no gaps). */
@media (min-width: 768px) {
    .insight-grid {
        display: block;
        column-count: 2;
        column-gap: 1.5rem;
    }

    .insight-grid>.card {
        break-inside: avoid;
        margin-bottom: 1.5rem;
    }

    /* A column-spanning card loses the previous card's bottom margin at the break, so it carries its own gap. */
    .insight-grid>.span-all {
        column-span: all;
        margin-top: 1.5rem;
    }
}

/* ---- Technologies ------------------------------------------------------ */
.tech-list {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
    .tech-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 1024px) {
    .tech-list {
        grid-template-columns: minmax(0, 1fr);
    }
}

.tech-item {
    min-width: 0;
    padding: 0.875rem;
    border-radius: 1rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    transition: border-color .2s;
}

.tech-item:hover {
    border-color: rgba(244, 63, 99, 0.5);
}

.tech-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.tech-id {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.tech-icon {
    width: 2.5rem;
    height: 2.5rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1rem;
    background: rgb(var(--ti-800));
    border: 1px solid rgb(var(--ti-600) / .4);
}

.tech-name {
    font-size: 0.875rem;
    font-weight: 700;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
}

.tech-role {
    font-size: 0.6875rem;
    font-weight: 500;
    color: rgb(var(--cherry-400));
}

.tech-cat {
    flex-shrink: 0;
    max-width: 45%;
    font-size: 0.625rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: rgb(var(--muted));
    background: rgb(var(--ti-700) / .6);
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tech-desc {
    font-size: 0.75rem;
    line-height: 1.55;
    color: rgb(var(--chip-muted));
    margin: 0.5rem 0 0;
}

.tech-conf {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
    min-width: 0;
    margin-top: 0.5rem;
    font-size: 0.625rem;
}

.tech-conf .badge {
    flex-shrink: 0;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    border: 1px solid;
}

.tech-conf .why {
    color: #6b7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    flex: 1 1 8rem;
}

/* ---- Rows & lists ------------------------------------------------------ */
.kv {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid rgb(var(--ti-600) / .2);
}

.kv:last-child {
    border-bottom: 0;
}

.kv .k {
    flex: 0 0 auto;
    max-width: 40%;
    font-size: 0.6875rem;
    color: rgb(var(--muted));
}

.kv .v {
    min-width: 0;
    font-size: 0.75rem;
    color: rgb(var(--text-strong));
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    text-align: right;
    overflow-wrap: anywhere;
}

.scroll-list {
    max-height: 15rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

/* Rows keep their natural height and the list scrolls; without this a capped flex column squashes them. */
.scroll-list>* {
    flex-shrink: 0;
}

.item-row {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.75rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.75rem;
}

.mono-row {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    background: rgb(var(--ti-900));
    border: 1px solid rgb(var(--ti-600) / .3);
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem;
    border-radius: 0.75rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
}

.check .detail {
    font-size: 0.6875rem;
    line-height: 1.5;
    color: rgb(var(--muted));
    overflow-wrap: anywhere;
}

[data-filter="issues"] .check[data-status="pass"],
[data-filter="issues"] .check[data-status="info"] {
    display: none;
}

.sub-chip {
    display: inline-flex;
    max-width: 100%;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.6875rem;
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
}

.change {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.625rem;
    border-radius: 0.75rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.75rem;
}

.change .t {
    font-weight: 600;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
}

.change .d {
    color: rgb(var(--muted));
    font-size: 0.6875rem;
    overflow-wrap: anywhere;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.stat {
    padding: 0.5rem 0.625rem;
    border-radius: 0.75rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    min-width: 0;
}

.stat b {
    display: block;
    font-size: 0.9375rem;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
}

.stat span {
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: rgb(var(--muted));
}

/* ---- Tree viewer ------------------------------------------------------- */
.tabs {
    display: flex;
    width: 100%;
    padding: 0.25rem;
    gap: 0.25rem;
    border-radius: 9999px;
    background: rgb(var(--ti-900));
    border: 1px solid rgb(var(--ti-600) / .5);
    font-size: 0.75rem;
}

@media (min-width: 640px) {
    .tabs {
        width: fit-content;
    }
}

.tab {
    flex: 1 1 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    min-height: 2rem;
    padding: 0 1rem;
    border-radius: 9999px;
    font-weight: 500;
    white-space: nowrap;
    color: rgb(var(--muted));
    background: transparent;
    border: 0;
    cursor: pointer;
    transition: color .15s, background-color .15s;
}

.tab:hover {
    color: rgb(var(--text-strong));
}

.tab[aria-selected="true"] {
    color: #fff;
    font-weight: 600;
    background: rgb(var(--cherry-600));
    box-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.tree-tools {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.tree-tools .grow {
    flex: 1 1 12rem;
    position: relative;
}

.tree-tools .grow input {
    padding-left: 2.25rem;
}

.tree-tools .grow .material-symbols-outlined {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: rgb(var(--cherry-400));
    pointer-events: none;
}

.tree-tools .count {
    font-size: 0.6875rem;
    color: rgb(var(--muted));
}

.tree-box {
    min-height: 12rem;
    max-height: min(60vh, 34rem);
    overflow: auto;
    padding: 1rem;
    border-radius: 1rem;
    background: rgb(var(--ti-950));
    border: 1px solid rgb(var(--ti-600) / .4);
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: 0.75rem;
    line-height: 1.6;
    color: rgb(var(--chip-muted));
    -webkit-overflow-scrolling: touch;
}

.tree-box pre {
    margin: 0;
    white-space: pre;
    color: rgb(var(--cherry-300));
    font: inherit;
    width: max-content;
    min-width: 100%;
}

.js-tree pre {
    display: none;
}

.tree-ui {
    display: none;
}

.js-tree .tree-ui.is-active {
    display: block;
    width: max-content;
    min-width: 100%;
}

.tree-ui ul {
    list-style: none;
    margin: 0;
    padding-left: 1.1rem;
    border-left: 1px dashed rgb(var(--ti-600) / .7);
}

.tree-ui>ul {
    padding-left: 0;
    border-left: 0;
}

.tree-ui li {
    margin: 0;
    padding: 0.05rem 0;
    color: rgb(var(--cherry-300));
}

.tree-ui li.leaf::before {
    content: "•";
    display: inline-block;
    width: 1.1rem;
    color: rgb(var(--ti-500));
}

.tree-ui summary {
    cursor: pointer;
    list-style: none;
    color: rgb(var(--text-strong));
    font-weight: 600;
    user-select: none;
}

.tree-ui summary::-webkit-details-marker {
    display: none;
}

.tree-ui summary::before {
    content: "▸";
    display: inline-block;
    width: 1.1rem;
    color: rgb(var(--cherry-400));
    transition: transform .12s;
}

.tree-ui details[open]>summary::before {
    transform: rotate(90deg);
}

.tree-ui mark {
    background: rgb(var(--cherry-500) / .35);
    color: inherit;
    border-radius: 0.2rem;
    padding: 0 0.1rem;
}

.tree-ui .nomatch {
    color: rgb(var(--muted));
    padding: 0.5rem 0;
}

.info-note {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem;
    border-radius: 1rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.75rem;
    color: rgb(var(--muted));
}

.card-foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 1rem;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.6875rem;
    color: rgb(var(--muted));
}

/* ---- Banners ----------------------------------------------------------- */
.banner {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 1.5rem;
    font-size: 0.75rem;
}

@media (min-width: 640px) {
    .banner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.banner--warn {
    background: rgb(var(--chip-warn) / .1);
    border: 1px solid rgb(var(--chip-warn) / .4);
    color: rgb(var(--text-strong));
}

.banner--ok {
    background: rgb(var(--chip-ok) / .1);
    border: 1px solid rgb(var(--chip-ok) / .35);
    color: rgb(var(--text-strong));
}

.banner--bad {
    background: rgb(var(--chip-bad) / .1);
    border: 1px solid rgb(var(--chip-bad) / .35);
    color: rgb(var(--text-strong));
}

.banner--info {
    background: rgb(var(--chip-info) / .1);
    border: 1px solid rgb(var(--chip-info) / .35);
    color: rgb(var(--text-strong));
}

.banner code,
.card code {
    font-family: 'JetBrains Mono', ui-monospace, monospace;
    font-size: .95em;
    overflow-wrap: anywhere;
}

/* ---- Compare ----------------------------------------------------------- */
.cmp-sites {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 640px) {
    .cmp-sites {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.cmp-site {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    min-width: 0;
}

.cmp-site .host {
    font-weight: 700;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
}

.cmp-site .sub {
    font-size: 0.75rem;
    color: rgb(var(--muted));
}

.cmp-table {
    display: grid;
}

.cmp-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgb(var(--ti-600) / .2);
}

.cmp-row:last-child {
    border-bottom: 0;
}

.cmp-label {
    grid-column: 1 / -1;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: rgb(var(--muted));
    margin-bottom: 0.125rem;
}

.cmp-cell {
    min-width: 0;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.cmp-cell.win {
    background: rgb(var(--chip-ok) / .12);
    color: rgb(var(--chip-ok));
    font-weight: 700;
}

.cmp-head {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgb(var(--ti-600) / .4);
    font-size: 0.75rem;
    font-weight: 700;
    color: rgb(var(--cherry-300));
}

.cmp-head span {
    overflow-wrap: anywhere;
    padding: 0 0.5rem;
}

.cmp-head span:first-child {
    display: none;
}

@media (min-width: 640px) {

    .cmp-row,
    .cmp-head {
        grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr);
        align-items: center;
    }

    .cmp-label {
        grid-column: auto;
        margin: 0;
    }

    .cmp-head span:first-child {
        display: block;
    }
}

.cmp-cols {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .cmp-cols {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.cmp-cols h4 {
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: rgb(var(--muted));
    margin: 0 0 0.5rem;
}

.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.diff-row {
    background: rgb(var(--cherry-500) / .06);
    border-radius: 0.5rem;
}

/* ---- History / watch --------------------------------------------------- */
.bars {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 3.5rem;
    padding: 0.25rem 0;
}

.bars i {
    flex: 1 1 0;
    min-width: 4px;
    max-width: 1.25rem;
    border-radius: 3px 3px 0 0;
    background: rgb(var(--cherry-500));
    opacity: .85;
}

.bars i.ok {
    background: rgb(var(--chip-ok));
}

.bars i.warn {
    background: rgb(var(--chip-warn));
}

.bars i.bad {
    background: rgb(var(--chip-bad));
}

.entry {
    display: grid;
    gap: 0.75rem;
}

.entry+.entry {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgb(var(--ti-600) / .3);
}

.entry-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}

.row-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
}

.row-card .main {
    min-width: 0;
    flex: 1 1 14rem;
}

.row-card .url {
    font-weight: 600;
    color: rgb(var(--text-strong));
    overflow-wrap: anywhere;
    font-size: 0.875rem;
}

.row-card .sub {
    font-size: 0.6875rem;
    color: rgb(var(--muted));
}

.row-card .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.75rem;
    background: rgb(var(--ti-850));
    border: 1px solid rgb(var(--ti-600) / .3);
    font-size: 0.75rem;
}

.feed-item.unseen {
    border-color: rgb(var(--cherry-500) / .5);
}

.feed-item .msg {
    min-width: 0;
    overflow-wrap: anywhere;
    color: rgb(var(--text-strong));
}

.feed-item .when {
    font-size: 0.6875rem;
    color: rgb(var(--muted));
}

.two-col {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
    .two-col {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        align-items: start;
        gap: 1.5rem;
    }
}

/* ---- Loading ----------------------------------------------------------- */
#loading-spinner[hidden] {
    display: none;
}

/* ---- Print / save as PDF ------------------------------------------------ */
@media print {
    @page {
        margin: 12mm;
    }

    body {
        background: #fff !important;
    }

    header,
    .subnav,
    footer,
    #scan-form,
    #loading-spinner,
    .recent,
    .no-print,
    .hero-actions,
    .tree-tools,
    .seg,
    .tabs,
    .quick-chip,
    .page-search {
        display: none !important;
    }

    .fixed {
        display: none !important;
    }

    .shell {
        max-width: none;
        padding-inline: 0;
    }

    .card,
    .hero-card,
    .metric,
    .banner {
        box-shadow: none !important;
        break-inside: avoid;
    }

    .hero-layout {
        grid-template-columns: 1fr;
    }

    .main-grid,
    .insight-grid {
        grid-template-columns: 1fr 1fr;
    }

    .scroll-list,
    .tree-box {
        max-height: none !important;
        overflow: visible !important;
    }

    .tree-box pre {
        white-space: pre-wrap;
    }

    .js-tree pre {
        display: block;
    }

    .js-tree .tree-ui {
        display: none !important;
    }

    [data-filter="issues"] .check {
        display: flex !important;
    }

    a {
        color: inherit;
        text-decoration: none;
    }
}

/* grade trend line (history page) */
.trend {
    width: 100%;
    height: 96px;
    display: block;
    margin: .25rem 0 .5rem;
    overflow: visible;
}

.trend .grid {
    stroke: currentColor;
    opacity: .12;
    stroke-width: 1;
}

.trend .line {
    stroke: currentColor;
    opacity: .55;
    stroke-width: 2;
    vector-effect: non-scaling-stroke;
    stroke-linejoin: round;
}

.trend .dot {
    stroke: var(--trend-ring, #0c0709);
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.trend .dot.ok {
    fill: #34d399;
}

.trend .dot.warn {
    fill: #fbbf24;
}

.trend .dot.bad {
    fill: #fb7185;
}