/* ───── Shared tokens ───── */
:root {
    --brand-navy: #1f2d5c;
    --brand-mid: #2f5da8;
    --brand-sky: #4f8bd9;
    --bg: #f7f8fb;
    --bg-2: #eef1f6;
    --bg-3: #e3e7ef;
    --ink: #14213f;
    --ink-soft: #3b4a6b;
    --ink-faint: #8089a0;
    --line: #d9deea;
    --accent: var(--brand-mid);
    --accent-soft: #dfe7f5;
    --danger: #b54848;
    --highlight-bg: #e6edf9;
    --highlight-fg: var(--brand-navy);
    --highlight-stripe: var(--brand-mid);
    --hover: #ecf0f7;
    --list-bg: 238, 241, 246;
    --list-bg-solid: #eef1f6;
    --measure: 68ch;
    --list-w: 380px;
    --list-opacity: 0.78;
    --reader-font: 18px;
    --serif: "Source Serif 4", Georgia, serif;
    --sans: "Inter", system-ui, sans-serif;
    --mono: "JetBrains Mono", ui-monospace, monospace;
}
*,
*::before,
*::after {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
}
body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* ───── Page visibility ───── */
#page-login,
#page-reader {
    display: none;
}
html[data-page="login"] #page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}
html[data-page="reader"] #page-reader {
    display: block;
}
html[data-page="reader"] body {
    overflow: hidden;
}

/* ───── Login styles ───── */
.card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 36px 32px 28px;
    box-shadow:
        0 1px 2px rgba(20, 30, 60, 0.04),
        0 12px 40px rgba(20, 30, 60, 0.06);
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 28px;
}
.brand img {
    width: 32px;
    height: 32px;
    border-radius: 7px;
    display: block;
}
.brand .name {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 18px;
    letter-spacing: -0.005em;
    color: var(--ink);
}
.card h1 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    letter-spacing: -0.01em;
    margin: 0 0 6px;
    color: var(--ink);
}
.sub {
    color: var(--ink-faint);
    font-size: 14px;
    margin: 0 0 22px;
}
.field {
    margin-bottom: 14px;
}
.field label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-soft);
    margin-bottom: 6px;
}
.field input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    font: inherit;
    font-size: 14px;
    color: var(--ink);
    transition:
        border-color 0.15s,
        background 0.15s;
}
.field input:focus {
    outline: 0;
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(47, 93, 168, 0.12);
}
.field input::placeholder {
    color: var(--ink-faint);
}
.btn {
    width: 100%;
    height: 40px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: #fff;
    font: inherit;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition:
        background 0.15s,
        transform 0.05s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn:hover {
    background: #28508f;
}
.btn:active {
    transform: translateY(1px);
}
.btn:disabled {
    opacity: 0.6;
    cursor: default;
}
.spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: none;
}
.btn.loading .spinner {
    display: inline-block;
}
.btn.loading .label {
    opacity: 0.8;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.error {
    margin-top: 12px;
    padding: 9px 12px;
    background: #fbeaea;
    border: 1px solid #ecc6c6;
    color: var(--danger);
    border-radius: 7px;
    font-size: 13px;
    display: none;
}
.error.show {
    display: block;
}
.view {
    animation: fade 0.25s ease-out;
}
@keyframes fade {
    from {
        opacity: 0;
        transform: translateY(4px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ───── Reader styles ───── */
.scroller {
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(26, 26, 25, 0.18) transparent;
}
.scroller::-webkit-scrollbar {
    width: 8px;
}
.scroller::-webkit-scrollbar-track {
    background: transparent;
}
.scroller::-webkit-scrollbar-thumb {
    background: rgba(26, 26, 25, 0.18);
    border-radius: 999px;
    border: 2px solid transparent;
    background-clip: content-box;
}
.scroller::-webkit-scrollbar-thumb:hover {
    background: rgba(26, 26, 25, 0.32);
    background-clip: content-box;
    border: 2px solid transparent;
}
.app {
    display: flex;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    position: relative;
}
.reader {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    position: relative;
}
.progress {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 2px;
    background: var(--bg-3);
    z-index: 10;
    pointer-events: none;
}
.progress > i {
    display: block;
    height: 100%;
    background: var(--accent);
    width: var(--p, 0%);
    transition: width 0.15s linear;
}
.reader-scroll {
    flex: 1;
    min-height: 0;
    padding: 56px 56px 40vh;
    display: flex;
    justify-content: center;
}
.reader-inner {
    width: 100%;
    max-width: var(--measure);
    position: relative;
    isolation: isolate;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}
.reader-inner::before {
    content: "";
    position: absolute;
    top: 0;
    left: -400%;
    width: 800%;
    height: 100%;
    background-image: url("watermark-tile.svg");
    background-repeat: repeat;
    background-size: 320px 160px;
    opacity: 0.1;
    pointer-events: none;
    user-select: none;
    z-index: -1;
}
.reader .meta {
    color: var(--ink-faint);
    font-size: 13px;
    margin-bottom: 10px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.reader .meta .dot {
    color: var(--line);
}
.reader h1.title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: clamp(34px, 3.4vw, 46px);
    line-height: 1.1;
    letter-spacing: -0.01em;
    margin: 0 0 12px;
    color: var(--ink);
}
.reader .byline {
    color: var(--ink-soft);
    font-size: 14px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.byline .av {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-3);
    object-fit: cover;
    flex: none;
}
.reader article {
    font-family: var(--serif);
    font-size: var(--reader-font);
    line-height: 1.7;
    color: #2a2823;
    text-wrap: pretty;
    overflow-wrap: anywhere;
}
.reader article > * + * {
    margin-top: 1em;
}
.reader article h2 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 26px;
    line-height: 1.25;
    margin-top: 1.6em;
}
.reader article h3 {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 21px;
    margin-top: 1.4em;
}
.reader article p {
    margin: 0;
    margin-bottom: 1.5em;
}
.reader article p img {
    width: 100%;
}
.reader article blockquote {
    margin: 1.4em 0;
    padding: 4px 0 4px 20px;
    border-left: 3px solid var(--ink);
    font-style: italic;
    color: var(--ink-soft);
    font-size: 19px;
}
.reader article a {
    color: var(--ink);
    text-decoration: underline;
    text-decoration-color: var(--ink-faint);
    text-underline-offset: 3px;
}
.reader article a:hover {
    text-decoration-color: var(--accent);
    color: var(--accent);
}
.reader article code {
    font-family: var(--mono);
    font-size: 0.92em;
    background: var(--bg-2);
    padding: 1px 5px;
    border-radius: 4px;
}
.reader article hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: 2em 0;
}
.list {
    flex: none;
    width: var(--list-w);
    border-left: 1px solid var(--line);
    background: rgba(var(--list-bg), var(--list-opacity));
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    transition: background 0.18s;
}
.list:hover {
    background: rgba(var(--list-bg), 1);
}
.list-head {
    border-bottom: 1px solid var(--line);
    flex: none;
}
.list-head .row1 {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
}
.search {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    height: 32px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    transition:
        border-color 0.15s,
        background 0.15s;
}
.search:focus-within {
    border-color: var(--ink-soft);
}
.search svg {
    color: var(--ink-faint);
    flex: none;
}
.search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    color: var(--ink);
}
.search input::placeholder {
    color: var(--ink-faint);
}
.kbd {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--ink-faint);
    background: var(--bg-2);
    border: 1px solid var(--line);
    padding: 1px 5px;
    border-radius: 4px;
}
.userbtn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex: none;
    padding: 0;
    overflow: hidden;
}
.userbtn:hover {
    background: var(--bg-2);
}
.userbtn .avatar {
    width: 100%;
    height: 100%;
    border-radius: 4px;
    background: var(--bg-3);
    object-fit: cover;
    display: block;
}
.tabs {
    display: flex;
    gap: 18px;
    padding: 0 14px;
    height: 38px;
    align-items: center;
}
.tab {
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-faint);
    padding: 0 0 8px;
    margin-top: 8px;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s;
}
.tab:hover {
    color: var(--ink-soft);
}
.tab[aria-selected="true"] {
    color: var(--ink);
    border-bottom-color: var(--ink);
}
.list-scroll {
    flex: 1;
    min-height: 0;
}
.group-head {
    position: sticky;
    top: 0;
    z-index: 1;
    background: rgba(var(--list-bg), 0.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
}
.item {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    cursor: pointer;
    border-bottom: 1px solid var(--line);
    background: transparent;
    transition: background 0.12s;
    position: relative;
}
.item:hover {
    background: rgba(255, 255, 255, 0.55);
}
.item .thumb {
    width: 56px;
    height: 56px;
    border-radius: 6px;
    flex: none;
    background-color: var(--bg-3);
    border: 1px solid var(--line);
    object-fit: cover;
}
.item .body {
    flex: 1;
    min-width: 0;
}
.item .pubmeta {
    font-size: 11px;
    color: var(--ink-faint);
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.item .pubmeta b {
    color: var(--ink-soft);
    font-weight: 600;
}
.item .ititle {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.25;
    color: var(--ink);
    margin: 0 0 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    letter-spacing: -0.005em;
}
.item .snippet {
    font-size: 12.5px;
    line-height: 1.4;
    color: var(--ink-soft);
    margin: 0 0 6px;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.item .footmeta {
    display: flex;
    gap: 10px;
    font-size: 11px;
    color: var(--ink-faint);
    align-items: center;
}
.item.active {
    background: var(--highlight-bg);
    color: var(--highlight-fg);
}
.item.active .ititle {
    color: var(--highlight-fg);
}
.item.active .snippet,
.item.active .pubmeta,
.item.active .footmeta {
    color: var(--ink-soft);
}
.item.active .pubmeta b {
    color: var(--highlight-fg);
    font-weight: 600;
}
.item.active .thumb {
    border-color: var(--brand-mid);
}
.item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--highlight-stripe);
}
.item.active:hover {
    background: var(--highlight-bg);
}
.logo {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: block;
    flex: none;
    object-fit: cover;
}
.list-foot {
    flex: none;
    border-top: 1px solid var(--line);
    padding: 8px 10px;
    font-size: 11px;
    color: var(--ink-faint);
    display: flex;
    gap: 6px;
    align-items: center;
    background: rgba(var(--list-bg), 0.85);
    backdrop-filter: blur(6px);
}
.list-foot .kbd {
    font-size: 9.5px;
}
.iconbtn {
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--ink-soft);
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background 0.12s,
        border-color 0.12s,
        color 0.12s;
    padding: 0;
}
.iconbtn:hover {
    background: var(--bg-2);
    border-color: var(--line);
    color: var(--ink);
}
.iconbtn:disabled {
    opacity: 0.35;
    cursor: default;
}
.iconbtn:disabled:hover {
    background: transparent;
    border-color: transparent;
}
.toolgroup {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--bg);
    padding: 1px;
    gap: 1px;
}
.toolgroup .iconbtn {
    width: 24px;
    height: 22px;
    border-radius: 5px;
}
.foot-spacer {
    flex: 1;
}
.foot-count {
    white-space: nowrap;
}
.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
    color: var(--ink-faint);
    font-size: 15px;
}
.mobile-back {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: var(--accent);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    margin: 8px 0 0 8px;
    align-self: flex-start;
    max-width: calc(100vw - 32px);
    min-width: 0;
}
.mobile-back span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.mobile-back:hover {
    background: var(--bg-2);
}
.htmx-request#article-content,
.htmx-request#list-scroll {
    opacity: 0.55;
    transition: opacity 0.15s;
}
.list-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 16px;
}
.list-loading-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}
.list-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--line);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ───── Reader bottom bar (mobile only; base styles before media query so mobile overrides win) ───── */
.reader-bar {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    background: var(--bg);
}
.reader-bar .foot-spacer {
    flex: 1;
}

@media (max-width: 1079px) {
    .app {
        display: block;
        position: fixed;
        inset: 0;
        overflow: hidden;
    }
    .list {
        width: 100% !important;
        height: 100%;
        border-left: none;
        background: var(--list-bg-solid) !important;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        position: relative;
        z-index: 1;
    }
    .list:hover {
        background: var(--list-bg-solid) !important;
    }
    .reader {
        position: fixed;
        inset: 0;
        z-index: 100;
        background: var(--bg);
        transform: translateX(100%);
        transition: transform 0.26s cubic-bezier(0.32, 0.72, 0.26, 1);
        box-shadow: -8px 0 30px rgba(20, 30, 60, 0.18);
        will-change: transform;
    }
    .app[data-view="reader"] .reader {
        transform: translateX(0);
    }
    .reader.dragging {
        transition: none;
    }
    .mobile-back {
        display: inline-flex;
    }
    .reader-scroll {
        padding: 16px 20px 40vh;
    }
    .reader h1.title {
        font-size: clamp(26px, 6vw, 34px);
    }
    .app {
        --measure: min(60ch, 100%) !important;
    }
    /* Natural-height bottom bar (matches .list-foot sizing). 44px = 28px iconbtn + 8px×2 padding. */
    :root {
        --mobile-bar-h: 44px;
    }
    .reader-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 200;
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }
    .list-foot {
        display: none;
    }
    .list-scroll {
        padding-bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom));
    }
    .reader .progress {
        bottom: calc(var(--mobile-bar-h) + env(safe-area-inset-bottom));
    }
    .desktop-tools {
        display: none;
    }
    .cmv3-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ───── Comments ───── */
.comments-section {
    margin-top: 48px;
    padding-top: 32px;
    padding-bottom: 64px;
    border-top: 1px solid var(--line);
    font-family: var(--sans);
}
.comments-header {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    margin-bottom: 24px;
}
.comment {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}
.comment-av {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    flex: none;
    background: var(--bg-3);
    object-fit: cover;
}
.comment-body {
    flex: 1;
    min-width: 0;
}
.comment-meta {
    font-size: 13px;
    margin-bottom: 5px;
    line-height: 1.3;
}
.comment-meta b {
    color: var(--ink);
    font-weight: 600;
}
.comment-meta span {
    color: var(--ink-faint);
}
.comment-quote {
    background: var(--bg-2);
    border-left: 2px solid var(--line);
    padding: 5px 10px;
    border-radius: 0 6px 6px 0;
    margin-bottom: 6px;
    font-size: 12.5px;
    color: var(--ink-soft);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.comment-quote-author {
    font-weight: 600;
    margin-right: 4px;
}
.comment-quote-text {
    color: var(--ink-faint);
}
.comment-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink-soft);
    word-break: break-word;
    margin: 0;
}
.comment-photo {
    margin-top: 8px;
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

/* ───── Tanya Q&A styles ───── */
.tanya-meta {
    display: flex;
    gap: 8px;
    font-size: 11px;
    color: var(--ink-faint);
    align-items: center;
    flex-wrap: wrap;
    margin: 2px 0 4px;
}
.tanya-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    letter-spacing: 0.04em;
}
.tanya-badge.answered {
    background: #d4edda;
    color: #1a6630;
}
.tanya-badge.pending {
    background: var(--bg-2);
    color: var(--ink-faint);
}
.tanya-mentors {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ───── Crash Meter v3 dashboard ───── */
.cmv3-dashboard {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.cmv3-scroll {
    flex: 1;
    min-height: 0;
    padding: 0 14px 24px;
    overflow-y: auto;
}
.cmv3-sticky {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgb(var(--list-bg));
}
.cmv3-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}
.cmv3-header-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}
.cmv3-header-credit {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: var(--ink-faint);
}
.cmv3-header-credit a {
    color: var(--ink-faint);
    text-decoration: underline;
}
.cmv3-score-display {
    display: flex;
    align-items: baseline;
    gap: 4px;
}
.cmv3-score-num {
    font-size: 22px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.cmv3-score-denom {
    font-size: 12px;
    color: var(--ink-faint);
}
.cmv3-score-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 6px;
}
.cmv3-score-badge.safe {
    background: #d4edda;
    color: #1a6630;
}
.cmv3-score-badge.caution {
    background: #fef3cd;
    color: #856404;
}
.cmv3-score-badge.danger {
    background: #ffe0cc;
    color: #993c1d;
}
.cmv3-score-badge.extreme {
    background: #f8d7da;
    color: #721c24;
}

.cmv3-chart-section {
    margin-bottom: 8px;
}
.cmv3-chart-label {
    font-size: 11px;
    color: var(--ink-faint);
    margin-bottom: 4px;
}
.cmv3-chart-section canvas {
    width: 100% !important;
    height: 200px !important;
}
.cmv3-divider {
    border-top: 1px solid var(--line);
    margin: 8px 0;
}
.cmv3-dots-section {
    display: none;
}

.cmv3-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 12px 0;
}
.cmv3-metric-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.cmv3-metric-row:last-child {
    grid-template-columns: 1fr;
}
.cmv3-metric {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px;
}
.cmv3-metric-label {
    font-size: 10px;
    color: var(--ink-faint);
    margin-bottom: 2px;
}
.cmv3-metric-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}
.cmv3-metric-status {
    font-size: 10px;
    font-weight: 500;
    margin-top: 1px;
}
.cmv3-metric-status.ok {
    color: #5cb85c;
}
.cmv3-metric-status.warn {
    color: #e24b4a;
}
.cmv3-metric-desc {
    font-size: 9px;
    color: var(--ink-faint);
    margin-top: 3px;
    line-height: 1.3;
}

.cmv3-indicators {
    margin-top: 8px;
    margin-bottom: 32px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.cmv3-ind-section {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 6px 8px 4px;
}
.cmv3-ind-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}
.cmv3-ind-section canvas {
    width: 100% !important;
    height: 120px !important;
}
.cmv3-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 56px 16px;
}

/* ───── Dark theme ───── */
:root[data-theme="dark"] {
    --bg: #0c1426;
    --bg-2: #142036;
    --bg-3: #1c2a45;
    --ink: #e6ecf7;
    --ink-soft: #aab5cd;
    --ink-faint: #6c7997;
    --line: #243353;
    --accent: var(--brand-sky);
    --highlight-bg: #1c2e54;
    --highlight-fg: #f0f5ff;
    --highlight-stripe: var(--brand-sky);
    --hover: #16223a;
    --list-bg: 16, 26, 48;
    --list-bg-solid: #101a30;
}
:root[data-theme="dark"] .comment-quote {
    background: var(--bg-2);
    border-left-color: var(--line);
}
:root[data-theme="dark"] .tanya-badge.answered {
    background: #1a3d24;
    color: #5abf74;
}
:root[data-theme="dark"] .reader article {
    color: #cfd7e8;
}
:root[data-theme="dark"] .reader-inner::before {
    filter: invert(1);
    opacity: 0.05;
}
:root[data-theme="dark"] .reader article blockquote {
    color: var(--ink-soft);
    border-left-color: var(--brand-sky);
}
:root[data-theme="dark"] .cmv3-score-badge.safe {
    background: #1a3d24;
    color: #5abf74;
}
:root[data-theme="dark"] .cmv3-score-badge.caution {
    background: #3d3520;
    color: #d4a84e;
}
:root[data-theme="dark"] .cmv3-score-badge.danger {
    background: #3d2520;
    color: #d47a4e;
}
:root[data-theme="dark"] .cmv3-score-badge.extreme {
    background: #3d2020;
    color: #d44e4e;
}
:root[data-theme="dark"] .card {
    background: #142036;
    border-color: var(--line);
}
:root[data-theme="dark"] .field input {
    background: var(--bg-2);
    color: var(--ink);
    border-color: var(--line);
}
:root[data-theme="dark"] .field input:focus {
    background: var(--bg-3);
}
