/* AutoBonding dashboard theme, layered on top of Pico CSS v2. */

:root {
    --ab-font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --ab-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;
    --ab-radius: 10px;
    --ab-radius-sm: 6px;

    --ab-bg: #f6f7fb;
    --ab-surface: #ffffff;
    --ab-surface-2: #f1f3f8;
    --ab-border: #e3e6ee;
    --ab-text: #141a2a;
    --ab-muted: #5f6880;
    --ab-accent: #2563eb;
    --ab-accent-soft: #e5edff;
    --ab-teal: #0f9f8f;

    --ab-ok: #15803d;
    --ab-ok-soft: #dcfce7;
    --ab-err: #b91c1c;
    --ab-err-soft: #fee2e2;
    --ab-warn: #a16207;
    --ab-warn-soft: #fef3c7;
    --ab-info: #1d4ed8;
    --ab-info-soft: #dbeafe;
    --ab-neutral-soft: #eceef3;

    --ab-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}

:root[data-theme="dark"] {
    --ab-bg: #0d111a;
    --ab-surface: #151a26;
    --ab-surface-2: #1b2130;
    --ab-border: #262e40;
    --ab-text: #e6e9f2;
    --ab-muted: #94a0b8;
    --ab-accent: #6d9bff;
    --ab-accent-soft: #1c2a4a;
    --ab-teal: #2dd4bf;

    --ab-ok: #4ade80;
    --ab-ok-soft: #12301f;
    --ab-err: #f87171;
    --ab-err-soft: #3a1717;
    --ab-warn: #fbbf24;
    --ab-warn-soft: #362a0d;
    --ab-info: #93b4ff;
    --ab-info-soft: #18264a;
    --ab-neutral-soft: #222838;

    --ab-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --ab-bg: #0d111a;
        --ab-surface: #151a26;
        --ab-surface-2: #1b2130;
        --ab-border: #262e40;
        --ab-text: #e6e9f2;
        --ab-muted: #94a0b8;
        --ab-accent: #6d9bff;
        --ab-accent-soft: #1c2a4a;
        --ab-teal: #2dd4bf;
        --ab-ok: #4ade80;
        --ab-ok-soft: #12301f;
        --ab-err: #f87171;
        --ab-err-soft: #3a1717;
        --ab-warn: #fbbf24;
        --ab-warn-soft: #362a0d;
        --ab-info: #93b4ff;
        --ab-info-soft: #18264a;
        --ab-neutral-soft: #222838;
        --ab-shadow: 0 1px 2px rgba(0, 0, 0, .4);
    }
}

/* Map onto Pico so forms/buttons/tables pick up the palette. */
:root,
:root[data-theme="dark"],
:root[data-theme="light"] {
    --pico-font-family: var(--ab-font);
    --pico-font-size: 15px;
    --pico-border-radius: var(--ab-radius-sm);
    --pico-background-color: var(--ab-bg);
    --pico-color: var(--ab-text);
    --pico-muted-color: var(--ab-muted);
    --pico-muted-border-color: var(--ab-border);
    --pico-card-background-color: var(--ab-surface);
    --pico-card-sectioning-background-color: var(--ab-surface);
    --pico-card-box-shadow: var(--ab-shadow);
    --pico-primary: var(--ab-accent);
    --pico-primary-background: var(--ab-accent);
    --pico-primary-border: var(--ab-accent);
    --pico-primary-hover: var(--ab-accent);
    --pico-primary-hover-background: color-mix(in srgb, var(--ab-accent) 85%, black);
    --pico-primary-hover-border: color-mix(in srgb, var(--ab-accent) 85%, black);
    --pico-primary-focus: color-mix(in srgb, var(--ab-accent) 30%, transparent);
    --pico-table-border-color: var(--ab-border);
    --pico-code-background-color: var(--ab-surface-2);
    --pico-form-element-background-color: var(--ab-surface);
    --pico-form-element-border-color: var(--ab-border);
    --pico-form-element-spacing-vertical: .55rem;
    --pico-form-element-spacing-horizontal: .8rem;
    --pico-spacing: 1rem;
    --pico-typography-spacing-vertical: 1rem;
}

html { scroll-padding-top: 5rem; }
body {
    background: var(--ab-bg);
    color: var(--ab-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
h1, h2, h3, h4 { color: var(--ab-text); letter-spacing: -0.01em; }
h1 { font-size: 1.6rem; font-weight: 650; }
h2 { font-size: 1.25rem; font-weight: 650; }
h3 { font-size: 1.05rem; font-weight: 600; }
code, pre, kbd, .mono { font-family: var(--ab-mono); }
.muted { color: var(--ab-muted); }
.nowrap { white-space: nowrap; }
.visually-hidden {
    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: 50;
    background: color-mix(in srgb, var(--ab-surface) 88%, transparent);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--ab-border);
}
.topbar-inner {
    max-width: 1240px; margin: 0 auto; padding: .55rem 1.25rem;
    display: flex; align-items: center; gap: 1.25rem;
}
.brand {
    display: flex; align-items: center; gap: .55rem;
    font-weight: 700; color: var(--ab-text); text-decoration: none; white-space: nowrap;
}
.brand img { width: 28px; height: 28px; }
.navlinks { display: flex; gap: .15rem; margin: 0; padding: 0; list-style: none; flex-wrap: wrap; }
.navlinks li { list-style: none; margin: 0; padding: 0; }
.navlinks a {
    display: block; padding: .4rem .7rem; border-radius: var(--ab-radius-sm);
    color: var(--ab-muted); text-decoration: none; font-size: .9rem; font-weight: 500;
}
.navlinks a:hover { color: var(--ab-text); background: var(--ab-surface-2); }
.navlinks a[aria-current="page"] { color: var(--ab-accent); background: var(--ab-accent-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: .6rem; }
.topbar-search { margin: 0; }
.topbar-search input[type="search"] {
    margin: 0; width: 15rem; height: 2.2rem; padding-top: 0; padding-bottom: 0; font-size: .875rem;
}
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2.2rem; height: 2.2rem; padding: 0; margin: 0;
    border-radius: var(--ab-radius-sm); border: 1px solid var(--ab-border);
    background: var(--ab-surface); color: var(--ab-muted); cursor: pointer;
}
.icon-btn:hover { color: var(--ab-text); background: var(--ab-surface-2); }
.user-menu { position: relative; margin: 0; }
.user-menu > summary {
    list-style: none; cursor: pointer; display: flex; align-items: center; gap: .45rem;
    padding: .25rem .55rem .25rem .25rem; border-radius: 999px; border: 1px solid var(--ab-border);
    font-size: .85rem; color: var(--ab-text);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary::after { display: none; }
.avatar {
    width: 1.7rem; height: 1.7rem; border-radius: 50%; display: grid; place-items: center;
    background: var(--ab-accent-soft); color: var(--ab-accent); font-weight: 700; font-size: .8rem;
}
.user-menu .menu {
    position: absolute; right: 0; top: calc(100% + .4rem); min-width: 11rem;
    background: var(--ab-surface); border: 1px solid var(--ab-border); border-radius: var(--ab-radius);
    box-shadow: 0 10px 30px rgba(16, 24, 40, .15); padding: .35rem; z-index: 60;
}
.user-menu .menu a {
    display: block; padding: .45rem .65rem; border-radius: var(--ab-radius-sm);
    color: var(--ab-text); text-decoration: none; font-size: .875rem;
}
.user-menu .menu a:hover { background: var(--ab-surface-2); }

main.page { max-width: 1240px; width: 100%; margin: 0 auto; padding: 1.75rem 1.25rem 3rem; flex: 1; }
.site-footer {
    border-top: 1px solid var(--ab-border); color: var(--ab-muted); font-size: .8rem;
    padding: 1rem 1.25rem; text-align: center;
}

/* ---- Page header --------------------------------------------------- */
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
    flex-wrap: wrap; margin-bottom: 1.5rem;
}
.page-header h1 { margin: 0; }
.page-header p { margin: .25rem 0 0; color: var(--ab-muted); }
.page-header .actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumb { font-size: .85rem; margin-bottom: .35rem; }
.breadcrumb a { color: var(--ab-muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--ab-accent); }

/* ---- Cards --------------------------------------------------------- */
article, .card {
    background: var(--ab-surface); border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius); box-shadow: var(--ab-shadow);
    padding: 1.25rem; margin-bottom: 1.25rem;
}
article > header, .card > header {
    margin: -1.25rem -1.25rem 1rem; padding: .9rem 1.25rem;
    background: transparent; border-bottom: 1px solid var(--ab-border);
    display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap;
}
article > header a, .card > header a { text-decoration: none; }
article > header h2, article > header h3, .card > header h2, .card > header h3 { margin: 0; }
article > footer, .card > footer {
    margin: 1rem -1.25rem -1.25rem; padding: .9rem 1.25rem;
    background: transparent; border-top: 1px solid var(--ab-border);
}
.card-flush { padding: 0; }
.card-flush > header { margin: 0; }
.card-flush > footer { margin: 0; }
.grid-2 { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---- Stats --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin-bottom: 1.5rem; }
.stat {
    display: block; background: var(--ab-surface); border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius); padding: .95rem 1.1rem; box-shadow: var(--ab-shadow);
    text-decoration: none; color: inherit; transition: border-color .15s, transform .15s;
}
a.stat:hover { border-color: var(--ab-accent); transform: translateY(-1px); }
.stat .label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ab-muted); font-weight: 600; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--ab-muted); }
.stat.ok .value { color: var(--ab-ok); }
.stat.err .value { color: var(--ab-err); }
.stat.warn .value { color: var(--ab-warn); }
.stat.info .value { color: var(--ab-accent); }

/* ---- Tables -------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; margin: 0; font-size: .875rem; border-collapse: collapse; }
table.data th {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--ab-muted); font-weight: 600; background: var(--ab-surface-2);
    padding: .6rem .9rem; border-bottom: 1px solid var(--ab-border); white-space: nowrap;
}
table.data td {
    padding: .65rem .9rem; border-bottom: 1px solid var(--ab-border);
    vertical-align: middle; background: transparent;
}
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: var(--ab-surface-2); }
table.data a.row-link { color: var(--ab-text); text-decoration: none; font-weight: 600; }
table.data a.row-link:hover { color: var(--ab-accent); }
table.data .id { font-family: var(--ab-mono); font-size: .78rem; color: var(--ab-muted); }
table.data td.actions { text-align: right; white-space: nowrap; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--ab-muted); }

/* ---- Pills / badges / flags --------------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .6rem;
    border-radius: 999px; font-size: .75rem; font-weight: 600; white-space: nowrap;
    background: var(--ab-neutral-soft); color: var(--ab-muted); line-height: 1.4;
}
.pill::before { content: ''; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-completed, .pill-ok { background: var(--ab-ok-soft); color: var(--ab-ok); }
.pill-failed, .pill-err { background: var(--ab-err-soft); color: var(--ab-err); }
.pill-pending, .pill-warn { background: var(--ab-warn-soft); color: var(--ab-warn); }
.pill-processing, .pill-running, .pill-queued, .pill-info { background: var(--ab-info-soft); color: var(--ab-info); }
.pill-processing::before, .pill-running::before, .pill-queued::before { animation: ab-pulse 1.2s ease-in-out infinite; }
@keyframes ab-pulse { 50% { opacity: .25; } }

.tag {
    display: inline-block; padding: .05rem .4rem; border-radius: 4px; font-size: .68rem;
    font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    border: 1px solid var(--ab-border); color: var(--ab-muted); vertical-align: middle;
}
.tag-debug { border-color: color-mix(in srgb, var(--ab-warn) 50%, transparent); color: var(--ab-warn); }

.flag {
    display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; font-weight: 600;
    white-space: nowrap; padding: .15rem .5rem; border-radius: var(--ab-radius-sm);
}
.flag svg { width: .95rem; height: .95rem; flex: none; }
.flag-yes { color: var(--ab-teal); background: color-mix(in srgb, var(--ab-teal) 14%, transparent); }
.flag-no { color: var(--ab-muted); opacity: .75; }

/* ---- Buttons ------------------------------------------------------- */
.btn {
    display: inline-flex; align-items: center; gap: .4rem; justify-content: center;
    padding: .45rem .9rem; font-size: .875rem; font-weight: 600; margin: 0; width: auto;
    border-radius: var(--ab-radius-sm); text-decoration: none; cursor: pointer;
    border: 1px solid var(--ab-accent); background: var(--ab-accent); color: #fff; line-height: 1.3;
}
.btn:hover { filter: brightness(1.08); color: #fff; }
/* Pico's button[type=submit] { width: 100% } outranks .btn. */
button.btn { width: auto; }
.btn-ghost { background: var(--ab-surface); color: var(--ab-text); border-color: var(--ab-border); }
.btn-ghost:hover { background: var(--ab-surface-2); color: var(--ab-text); filter: none; }
.btn-sm { padding: .28rem .6rem; font-size: .78rem; }
.btn svg { width: 1rem; height: 1rem; flex: none; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; }
form.inline { display: inline; margin: 0; }

/* ---- Filters toolbar ----------------------------------------------- */
.toolbar {
    display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)) auto;
    gap: .6rem; align-items: end; padding: 1rem 1.25rem; border-bottom: 1px solid var(--ab-border);
}
.toolbar label { font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--ab-muted); font-weight: 600; margin: 0; }
.toolbar input, .toolbar select { margin: .25rem 0 0; font-size: .875rem; height: 2.4rem; padding-top: 0; padding-bottom: 0; }
.toolbar .toolbar-actions { display: flex; gap: .4rem; }
@media (max-width: 960px) { .toolbar { grid-template-columns: 1fr 1fr; } }
.result-summary {
    display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem;
    padding: .6rem 1.25rem; font-size: .82rem; color: var(--ab-muted); border-bottom: 1px solid var(--ab-border);
}
.seg { display: inline-flex; border: 1px solid var(--ab-border); border-radius: var(--ab-radius-sm); overflow: hidden; }
.seg a { padding: .25rem .7rem; font-size: .8rem; text-decoration: none; color: var(--ab-muted); }
.seg a + a { border-left: 1px solid var(--ab-border); }
.seg a[aria-current="true"] { background: var(--ab-accent-soft); color: var(--ab-accent); font-weight: 600; }

.pagination {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    padding: .75rem 1.25rem; border-top: 1px solid var(--ab-border); font-size: .85rem; color: var(--ab-muted);
}
.pagination .pages { display: flex; gap: .35rem; }

/* ---- Messages ------------------------------------------------------ */
.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: .5rem; }
.messages li {
    list-style: none; padding: .7rem 1rem; border-radius: var(--ab-radius-sm); font-size: .9rem;
    border: 1px solid var(--ab-border); background: var(--ab-surface);
}
.messages li.success { border-color: color-mix(in srgb, var(--ab-ok) 40%, transparent); background: var(--ab-ok-soft); color: var(--ab-ok); }
.messages li.error { border-color: color-mix(in srgb, var(--ab-err) 40%, transparent); background: var(--ab-err-soft); color: var(--ab-err); }
.messages li.info { border-color: color-mix(in srgb, var(--ab-info) 40%, transparent); background: var(--ab-info-soft); color: var(--ab-info); }

/* ---- Key/value list ------------------------------------------------ */
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .55rem 1.25rem; margin: 0; font-size: .9rem; }
dl.kv dt { color: var(--ab-muted); font-weight: 500; }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
pre.logs {
    background: var(--ab-surface-2); border: 1px solid var(--ab-border); border-radius: var(--ab-radius-sm);
    padding: .9rem; max-height: 22rem; overflow: auto; white-space: pre-wrap; font-size: .78rem; margin: 0;
}
.error-box {
    background: var(--ab-err-soft); color: var(--ab-err); border-radius: var(--ab-radius-sm);
    padding: .75rem 1rem; font-size: .875rem; margin-bottom: 1rem;
}

/* ---- Galleries ----------------------------------------------------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.gallery.small { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.gallery figure {
    margin: 0; border: 1px solid var(--ab-border); border-radius: var(--ab-radius);
    overflow: hidden; background: #fff; cursor: zoom-in; transition: border-color .15s, box-shadow .15s;
}
.gallery figure:hover { border-color: var(--ab-accent); box-shadow: 0 4px 14px rgba(16, 24, 40, .12); }
.gallery img { display: block; width: 100%; height: auto; }
.gallery figcaption {
    font-size: .8rem; padding: .45rem .7rem; color: var(--ab-muted); background: var(--ab-surface);
    border-top: 1px solid var(--ab-border); font-weight: 600;
}
.file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .5rem; }
.file-item {
    display: flex; justify-content: space-between; align-items: center; gap: .5rem;
    padding: .5rem .7rem; border: 1px solid var(--ab-border); border-radius: var(--ab-radius-sm);
    font-size: .82rem; background: var(--ab-surface-2);
}
.file-item a { font-weight: 600; text-decoration: none; font-size: .78rem; }

.lightbox {
    position: fixed; inset: 0; z-index: 1000; background: rgba(6, 9, 16, .92);
    display: none; align-items: center; justify-content: center; flex-direction: column; gap: .75rem;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 6px; background: #fff; }
.lightbox .caption { color: #e6e9f2; font-size: .9rem; }
.lightbox button {
    position: absolute; background: rgba(255, 255, 255, .12); border: 1px solid rgba(255, 255, 255, .25);
    color: #fff; width: 3rem; height: 3rem; border-radius: 50%; font-size: 1.4rem; padding: 0; margin: 0;
    display: grid; place-items: center;
}
.lightbox button:hover { background: rgba(255, 255, 255, .22); }
.lightbox .lb-close { top: 1.25rem; right: 1.25rem; }
.lightbox .lb-prev { left: 1.25rem; top: 50%; transform: translateY(-50%); }
.lightbox .lb-next { right: 1.25rem; top: 50%; transform: translateY(-50%); }

/* ---- Auth ---------------------------------------------------------- */
.auth-card { max-width: 400px; margin: 3rem auto; }
.auth-card .brand { justify-content: center; font-size: 1.15rem; margin-bottom: .5rem; }
.auth-card .brand img { width: 40px; height: 40px; }
.auth-card-wide { max-width: 480px; }
.auth-title { text-align: center; font-size: 1.35rem; margin: .25rem 0 .35rem; }
.auth-alt { text-align: center; font-size: .875rem; margin: 1rem 0 0; }
.field-error { color: var(--ab-err); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.notice {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .8rem 1.1rem; margin-bottom: 1.25rem; border-radius: var(--ab-radius-sm); font-size: .9rem;
    border: 1px solid color-mix(in srgb, var(--ab-info) 40%, transparent); background: var(--ab-info-soft); color: var(--ab-info);
}
.notice .btn { flex: none; }
.request-message { min-width: 14rem; max-width: 28rem; font-size: .85rem; }

/* ---- Landing ------------------------------------------------------- */
.landing main.page { max-width: 1120px; }
.hero {
    display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center;
    padding: 3.5rem 0 3rem;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; padding-top: 1.5rem; } .hero-art { order: -1; } }
.eyebrow {
    display: inline-flex; align-items: center; gap: .45rem; font-size: .78rem; font-weight: 600;
    color: var(--ab-accent); background: var(--ab-accent-soft); padding: .3rem .7rem; border-radius: 999px;
}
.hero h1 { font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.1; margin: 1rem 0; font-weight: 750; }
.hero h1 .accent {
    background: linear-gradient(90deg, var(--ab-accent), var(--ab-teal));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { font-size: 1.1rem; color: var(--ab-muted); max-width: 36rem; }
.hero .cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.75rem; }
.hero .cta .btn { padding: .7rem 1.3rem; font-size: .95rem; }
.hero-art { display: grid; place-items: center; position: relative; }
.hero-art::before {
    content: ''; position: absolute; width: 85%; aspect-ratio: 1; border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--ab-accent) 22%, transparent), transparent 70%);
}
.hero-art img { position: relative; width: min(320px, 70%); filter: drop-shadow(0 20px 40px rgba(37, 99, 235, .25)); }
.video-section { margin: 0 0 3rem; text-align: center; scroll-margin-top: 5rem; }
.video-section h2 { font-size: 1.6rem; margin-bottom: .35rem; }
.video-section > p { margin: 0 auto 1.25rem; max-width: 36rem; }
.video-frame {
    border-radius: 14px; overflow: hidden; background: #05070c; border: 1px solid var(--ab-border);
    box-shadow: 0 24px 60px rgba(16, 24, 40, .22); aspect-ratio: 16 / 9;
}
.video-frame video { display: block; width: 100%; height: 100%; background: #05070c; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1rem 0 3rem; }
.feature { padding: 1.4rem; margin: 0; }
.feature .step {
    width: 2rem; height: 2rem; display: grid; place-items: center; border-radius: 8px;
    background: var(--ab-accent-soft); color: var(--ab-accent); font-weight: 700; margin-bottom: .8rem;
}
.feature h3 { margin-bottom: .4rem; }
.feature p { color: var(--ab-muted); font-size: .92rem; margin: 0; }

/* ---- 3D viewer ----------------------------------------------------- */
body.viewer-page { height: 100vh; overflow: hidden; }
.viewer-shell { flex: 1; min-height: 0; display: flex; }
.viewer-panel {
    width: 300px; flex: none; overflow-y: auto; background: var(--ab-surface);
    border-right: 1px solid var(--ab-border); display: flex; flex-direction: column;
}
.vp-head { padding: 1rem 1.1rem .9rem; border-bottom: 1px solid var(--ab-border); }
.vp-head h2 { font-size: 1.05rem; margin: .2rem 0 .5rem; }
.vp-section { padding: .85rem 1.1rem; border-bottom: 1px solid var(--ab-border); }
.vp-section h4 {
    font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ab-muted);
    margin: 0 0 .55rem; display: flex; justify-content: space-between; align-items: center;
}
.vp-links { text-transform: none; letter-spacing: 0; font-weight: 500; }
.vp-links a { text-decoration: none; }
.vp-row { display: flex; align-items: center; gap: .5rem; font-size: .875rem; margin: 0 0 .35rem; cursor: pointer; }
.vp-row input[type="checkbox"] { margin: 0; flex: none; }
.vp-row .count { margin-left: auto; color: var(--ab-muted); font-size: .75rem; font-variant-numeric: tabular-nums; }
.vp-field { display: block; font-size: .8rem; color: var(--ab-muted); margin-bottom: .55rem; }
.vp-field select { margin: .25rem 0 0; height: 2.1rem; padding-top: 0; padding-bottom: 0; font-size: .85rem; }
.vp-field input[type="range"] { margin: .35rem 0 0; }
.vp-note { font-size: .8rem; margin: 0; }
.swatch { width: .8rem; height: .8rem; border-radius: 50%; flex: none; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.tooth-arch { font-size: .72rem; color: var(--ab-muted); margin: .3rem 0 .3rem; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .4rem; }
.chip {
    font-size: .75rem; font-weight: 600; padding: .15rem .45rem; border-radius: 5px; margin: 0; width: auto;
    border: 1px solid var(--ab-border); background: var(--ab-surface-2); color: var(--ab-text); cursor: pointer;
    font-variant-numeric: tabular-nums; line-height: 1.4;
}
.chip:hover { border-color: var(--ab-accent); }
.chip[aria-pressed="true"] { background: var(--ab-accent); border-color: var(--ab-accent); color: #fff; }
.sel-title { font-weight: 650; margin-bottom: .4rem; }
table.coords { font-size: .75rem; margin: 0; width: 100%; }
table.coords td { padding: .2rem .3rem; border-bottom: 1px solid var(--ab-border); background: transparent; }
table.coords td.c { font-family: var(--ab-mono); text-align: right; white-space: nowrap; }
.vp-footer { padding: .85rem 1.1rem; display: flex; gap: .5rem; flex-wrap: wrap; margin-top: auto; }

.viewer-stage { flex: 1; min-width: 0; position: relative; background: var(--ab-bg); }
.viewer-stage canvas { display: block; width: 100%; height: 100%; outline: none; }
.vs-views {
    position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); z-index: 5;
    display: flex; gap: 0; border: 1px solid var(--ab-border); border-radius: var(--ab-radius-sm);
    overflow: hidden; background: var(--ab-surface); box-shadow: var(--ab-shadow);
}
.vs-views button {
    margin: 0; padding: .35rem .75rem; font-size: .78rem; font-weight: 600; border: 0; border-radius: 0;
    background: transparent; color: var(--ab-muted); width: auto; white-space: nowrap;
}
.vs-views button + button { border-left: 1px solid var(--ab-border); }
.vs-views button:hover { background: var(--ab-surface-2); color: var(--ab-text); }
.vs-hint {
    position: absolute; bottom: .75rem; left: 50%; transform: translateX(-50%); z-index: 5;
    font-size: .75rem; color: var(--ab-muted); background: color-mix(in srgb, var(--ab-surface) 85%, transparent);
    padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--ab-border); white-space: nowrap; pointer-events: none;
}
.vs-selection {
    position: absolute; left: .9rem; bottom: 3rem; z-index: 6; width: min(300px, calc(100% - 1.8rem));
    max-height: 55%; overflow: auto; background: var(--ab-surface); border: 1px solid var(--ab-border);
    border-radius: var(--ab-radius); box-shadow: 0 8px 24px rgba(16, 24, 40, .14); padding: .7rem .85rem;
}
.vs-selection[hidden] { display: none; }
.vs-selection-head {
    display: flex; justify-content: space-between; align-items: center; font-size: .7rem;
    text-transform: uppercase; letter-spacing: .06em; color: var(--ab-muted); font-weight: 600; margin-bottom: .3rem;
}
.vs-selection-head a { text-decoration: none; font-size: 1.1rem; line-height: 1; color: var(--ab-muted); }
.vs-loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 10; background: var(--ab-bg); }
.vs-loading[hidden] { display: none; }
.vs-loading-box { width: min(320px, 80%); text-align: center; }
.vs-loading-label { font-size: .875rem; color: var(--ab-muted); margin-bottom: .6rem; }
.vs-loading-label.error { color: var(--ab-err); }
.vs-bar { height: 6px; border-radius: 999px; background: var(--ab-surface-2); overflow: hidden; border: 1px solid var(--ab-border); }
.vs-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--ab-accent), var(--ab-teal)); transition: width .15s; }

@media (max-width: 760px) {
    body.viewer-page { height: auto; overflow: auto; }
    .viewer-shell { flex-direction: column; }
    .viewer-panel { width: 100%; max-height: none; border-right: 0; border-bottom: 1px solid var(--ab-border); order: 2; }
    .viewer-stage { height: 70vh; order: 1; }
    .vs-views { flex-wrap: wrap; max-width: 95%; }
    .vs-hint { display: none; }
    .topbar-search input[type="search"] { width: 9rem; }
}
