/* ═══════════════════════════════════════════════════════
   NYHETSDESK — Pro Newsroom Dashboard
   ═══════════════════════════════════════════════════════ */

/* ─── Design Tokens ─── */
:root,
[data-theme="light"] {
    --bg: #f0f0ec;
    --bg-surface: #ffffff;
    --bg-raised: #f8f8f5;
    --bg-inset: #e8e8e4;
    --text: #111;
    --text-2: #555;
    --text-3: #888;
    --accent: #1a56db;
    --accent-soft: #e8effc;
    --border: #ddd;
    --border-light: #eee;
    --red: #dc2626;
    --green: #16a34a;
    --orange: #ea580c;
    --yellow: #ca8a04;
    --shadow: 0 1px 3px rgba(0,0,0,.06);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.08);
    --radius: 6px;
    --radius-lg: 10px;
    --topbar-h: 52px;
    --ribbon-h: 40px;
    --ribbon-sub-h: 36px;
    --nav-h: calc(var(--ribbon-h) + var(--ribbon-sub-h));
    --transition: 150ms ease;
}

[data-theme="dark"] {
    --bg: #0d0d0d;
    --bg-surface: #1a1a1a;
    --bg-raised: #222;
    --bg-inset: #111;
    --text: #e5e5e5;
    --text-2: #aaa;
    --text-3: #666;
    --accent: #5b8def;
    --accent-soft: #1a2744;
    --border: #333;
    --border-light: #2a2a2a;
    --red: #ef4444;
    --green: #22c55e;
    --orange: #f97316;
    --yellow: #eab308;
    --shadow: 0 1px 3px rgba(0,0,0,.3);
    --shadow-lg: 0 4px 16px rgba(0,0,0,.4);
}

/* System preference fallback (before JS sets data-theme) */
@media (prefers-color-scheme: dark) {
    html:not([data-theme]) {
        --bg: #0d0d0d;
        --bg-surface: #1a1a1a;
        --bg-raised: #222;
        --bg-inset: #111;
        --text: #e5e5e5;
        --text-2: #aaa;
        --text-3: #666;
        --accent: #5b8def;
        --accent-soft: #1a2744;
        --border: #333;
        --border-light: #2a2a2a;
        --red: #ef4444;
        --green: #22c55e;
        --orange: #f97316;
        --yellow: #eab308;
        --shadow: 0 1px 3px rgba(0,0,0,.3);
        --shadow-lg: 0 4px 16px rgba(0,0,0,.4);
    }
}

/* Source colors */
:root {
    --c-dn: #c41e3a;
    --c-svt: #1b6d40;
    --c-aftonbladet: #dd2a30;
    --c-expressen: #0076be;
    --c-svd: #003366;
    --c-sr: #004f9f;
    --c-di: #d4541c;
    --c-gp: #1a5276;
    --c-sydsvenskan: #2e4053;
    --c-tv4: #e74c3c;
    --c-google-news: #4285f4;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ─── Topbar ─── */
.topbar {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topbar-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1000;
    box-shadow: var(--shadow);
}

.topbar__left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.topbar__brand {
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--text);
}
.topbar__brand span { color: var(--accent); }

.topbar__live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--red);
    letter-spacing: 0.06em;
}

.pulse {
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(220,38,38,.6); }
    50% { opacity: .6; box-shadow: 0 0 0 6px rgba(220,38,38,0); }
}

.topbar__center { flex: 1; max-width: 480px; margin: 0 1rem; }

.search-global {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute; left: 10px;
    color: var(--text-3);
    pointer-events: none;
}

.search-global input {
    width: 100%;
    padding: 6px 12px 6px 34px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    color: var(--text);
    font-size: 0.85rem;
    transition: border var(--transition);
}
.search-global input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-surface);
}

.spin {
    display: none;
    position: absolute; right: 10px;
    width: 14px; height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .5s linear infinite;
}
.spin.htmx-request { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar__right {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.topbar-btn {
    position: relative;
    background: none; border: none;
    color: var(--text-2);
    padding: 6px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}
.topbar-btn:hover { background: var(--bg-inset); color: var(--text); }

.topbar-btn__badge {
    position: absolute; top: 0; right: 0;
    width: 16px; height: 16px;
    background: var(--red);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ─── Breaking Banner ─── */
.breaking-banner {
    position: fixed;
    top: var(--topbar-h);
    left: 0; right: 0;
    background: var(--red);
    color: #fff;
    padding: 6px 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 999;
    font-size: 0.85rem;
    animation: slideDown .3s ease-out;
}

.breaking-banner--flash {
    animation: flashBg 0.5s ease-in-out 3;
}

@keyframes flashBg {
    0%, 100% { background: var(--red); }
    50% { background: #7f1d1d; }
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.breaking-banner__label {
    font-weight: 800;
    letter-spacing: 0.08em;
    white-space: nowrap;
}
.breaking-banner__text { flex: 1; font-weight: 500; }
.breaking-banner__close {
    background: none; border: none; color: #fff;
    font-size: 1.2rem; cursor: pointer; padding: 0 4px;
    opacity: .7;
}
.breaking-banner__close:hover { opacity: 1; }

/* ─── Source Ribbon ─── */
.ribbon {
    position: fixed;
    top: var(--topbar-h);
    left: 0; right: 0;
    height: var(--ribbon-h);
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 1rem;
    overflow-x: auto;
    z-index: 998;
    scrollbar-width: none;
}
.ribbon::-webkit-scrollbar { display: none; }

.ribbon__btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--bg);
    color: var(--text-2);
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--transition);
}
.ribbon__btn:hover { border-color: var(--accent); color: var(--accent); }
.ribbon__btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ribbon__spacer { flex: 1; }
.ribbon__btn--special {
    display: flex; align-items: center; gap: 4px;
    border-style: dashed;
}

/* Två-nivå-navigation: topp-kategorier + underliggande källor */
.ribbon--top .ribbon__btn {
    font-size: 0.78rem;
    padding: 5px 14px;
}
.ribbon--sub {
    top: calc(var(--topbar-h) + var(--ribbon-h));
    height: var(--ribbon-sub-h);
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.ribbon__btn--sub {
    font-size: 0.68rem;
    padding: 3px 9px;
    opacity: 0.92;
}

/* ─── Layout ─── */
.layout {
    display: flex;
    margin-top: calc(var(--topbar-h) + var(--nav-h));
    min-height: calc(100vh - var(--topbar-h) - var(--nav-h));
}

/* ─── Side Panels ─── */
.panel {
    width: 380px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--topbar-h) - var(--nav-h));
    position: sticky;
    top: calc(var(--topbar-h) + var(--nav-h));
    overflow-y: auto;
    animation: slideIn .2s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.panel__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0;
    background: var(--bg-surface);
    z-index: 1;
}
.panel__header h3 { font-size: 0.9rem; font-weight: 700; }
.panel__close {
    background: none; border: none; color: var(--text-3);
    font-size: 1.2rem; cursor: pointer;
}
.panel__body { padding: 0.75rem 1rem; flex: 1; overflow-y: auto; }

/* ─── Main Feed ─── */
.main-content {
    flex: 1;
    padding: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}

.feed { display: flex; flex-direction: column; gap: 6px; }

.feed__loadmore {
    padding: 1rem;
    text-align: center;
}

/* ─── Cards ─── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 10px 14px;
    transition: all var(--transition);
    position: relative;
}
.card:hover { box-shadow: var(--shadow); border-color: var(--border); }
.card--selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.card--read { opacity: 0.55; }
.card--read:hover { opacity: 0.8; }

.card--breaking {
    border-left: 3px solid var(--red);
    background: color-mix(in srgb, var(--red) 4%, var(--bg-surface));
}

.card--new {
    animation: cardNew .4s ease-out;
    border-left: 3px solid var(--accent);
}

@keyframes cardNew {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.card__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
    font-size: 0.72rem;
}

.badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 3px;
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #fff;
    background: var(--text-3);
}

.badge--dn { background: var(--c-dn); }
.badge--svt { background: var(--c-svt); }
.badge--aftonbladet { background: var(--c-aftonbladet); }
.badge--expressen { background: var(--c-expressen); }
.badge--svd { background: var(--c-svd); }
.badge--sr { background: var(--c-sr); }
.badge--di { background: var(--c-di); }
.badge--gp { background: var(--c-gp); }
.badge--sydsvenskan { background: var(--c-sydsvenskan); }
.badge--tv4 { background: var(--c-tv4); }
.badge--google-news { background: var(--c-google-news); }
.badge--hd { background: #6c3483; }
.badge--barometern { background: #1e8449; }
.badge--nwt { background: #2874a6; }
.badge--dagen { background: #7d6608; }
.badge--nyheter-idag { background: #c0392b; }
.badge--the-local { background: #1a5276; }
.badge--breaking { background: var(--red); animation: pulse 1.5s infinite; }

.card__section { color: var(--text-3); }
.card__time { color: var(--text-3); margin-left: auto; }

.card__title {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 2px;
}
.card__title a { color: var(--text); text-decoration: none; }
.card__title a:hover { color: var(--accent); }

.card__summary {
    font-size: 0.8rem;
    color: var(--text-2);
    line-height: 1.4;
    margin-bottom: 4px;
}

.card__actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}
.card:hover .card__actions { opacity: 1; }

.btn-icon {
    background: none; border: none;
    color: var(--text-3);
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-inset); color: var(--accent); }
.btn-icon.active { color: var(--accent); }
.btn-icon.active svg { fill: var(--accent); }

/* ─── Stats Panel ─── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 1rem;
}

.stat {
    background: var(--bg-raised);
    border-radius: var(--radius);
    padding: 10px;
    text-align: center;
}
.stat--alert { background: color-mix(in srgb, var(--red) 10%, var(--bg-raised)); }

.stat__value {
    display: block;
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}
.stat--alert .stat__value { color: var(--red); }

.stat__label {
    font-size: 0.68rem;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.stats-section {
    margin-bottom: 1rem;
}
.stats-section h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-3);
    margin-bottom: 8px;
}

/* Source bars */
.source-bars { display: flex; flex-direction: column; gap: 4px; }

.source-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
}
.source-bar__label { width: 80px; flex-shrink: 0; color: var(--text-2); font-weight: 500; }
.source-bar__track {
    flex: 1; height: 6px;
    background: var(--bg-inset);
    border-radius: 3px;
    overflow: hidden;
}
.source-bar__fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width .5s ease;
}
.source-bar__count { width: 30px; text-align: right; color: var(--text-3); font-size: 0.7rem; }

/* Trending */
.trending-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: baseline;
}
.trend-word {
    cursor: pointer;
    color: var(--accent);
    transition: color var(--transition);
    font-weight: 500;
}
.trend-word:hover { color: var(--text); text-decoration: underline; }
.trend-word sup { font-size: 0.6em; color: var(--text-3); margin-left: 1px; }

/* Histogram */
.histogram {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 60px;
}
.histogram__bar {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
}
.histogram__fill {
    width: 100%;
    background: var(--accent);
    border-radius: 2px 2px 0 0;
    min-height: 1px;
    transition: height .5s ease;
}
.histogram__label {
    font-size: 0.5rem;
    color: var(--text-3);
    margin-top: 2px;
}

/* ─── Feed Health Table ─── */
.health-table {
    width: 100%;
    font-size: 0.72rem;
    border-collapse: collapse;
}
.health-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid var(--border);
    color: var(--text-3);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.65rem;
    letter-spacing: 0.04em;
}
.health-table td {
    padding: 4px 8px;
    border-bottom: 1px solid var(--border-light);
}
.health--error { background: color-mix(in srgb, var(--red) 5%, transparent); }

.health-dot {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}
.health-dot--ok { background: var(--green); }
.health-dot--error { background: var(--red); }

/* ─── Alerts Panel ─── */
.alert-form {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.alert-form input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    color: var(--text);
    font-size: 0.8rem;
}
.alert-form input:focus { outline: none; border-color: var(--accent); }
.alert-form button {
    padding: 6px 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-weight: 700;
}

.alert-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 10px;
    background: var(--bg-raised);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 0.8rem;
}
.alert-item button {
    background: none; border: none;
    color: var(--text-3); cursor: pointer;
    font-size: 1rem;
}
.alert-item button:hover { color: var(--red); }

.alert-matches { margin-top: 12px; }
.alert-match-item {
    padding: 6px 10px;
    background: color-mix(in srgb, var(--orange) 8%, var(--bg-raised));
    border-left: 3px solid var(--orange);
    border-radius: var(--radius);
    margin-bottom: 4px;
    font-size: 0.78rem;
    animation: cardNew .3s ease-out;
}
.alert-match-item a { color: var(--accent); }

/* ─── Buttons ─── */
.btn {
    padding: 8px 16px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
}
.btn--outline {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-2);
}
.btn--outline:hover { border-color: var(--accent); color: var(--accent); }

/* ─── Modal ─── */
.modal {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal__content {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 480px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}
.modal__content h3 { margin-bottom: 1rem; }

.shortcuts-table {
    width: 100%;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
.shortcuts-table td { padding: 4px 8px; }
.shortcuts-table td:first-child { text-align: right; white-space: nowrap; }

kbd {
    display: inline-block;
    padding: 2px 6px;
    background: var(--bg-inset);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
}

/* ─── Toast Notifications ─── */
.toasts {
    position: fixed;
    bottom: 1rem; right: 1rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    z-index: 3000;
    pointer-events: none;
}

.toast {
    padding: 10px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    box-shadow: var(--shadow-lg);
    transform: translateX(120%);
    transition: transform .3s ease;
    pointer-events: auto;
    max-width: 360px;
}
.toast--visible { transform: translateX(0); }
.toast--breaking { border-left: 3px solid var(--red); font-weight: 600; }
.toast--alert { border-left: 3px solid var(--orange); }

/* ─── Screen Reader Only ─── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ─── Topbar User ─── */
.topbar__user {
    font-size: 0.75rem;
    color: var(--text-3);
    padding: 2px 8px;
    background: var(--bg-inset);
    border-radius: 12px;
}

/* ─── Checkbox Labels ─── */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.75rem;
    color: var(--text-2);
    white-space: nowrap;
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 16px; height: 16px;
    accent-color: var(--accent);
}

/* ─── Panel Hints ─── */
.panel__hint {
    font-size: 0.75rem;
    color: var(--text-3);
    margin-bottom: 8px;
    font-style: italic;
}

/* ─── Empty State ─── */
.empty {
    text-align: center;
    padding: 3rem;
    color: var(--text-3);
    font-size: 0.9rem;
}

/* ─── Auth Pages ─── */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
}

.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow-lg);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.form-group label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-2);
}

.form-group input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-inset);
    color: var(--text);
    font-size: 0.9rem;
    transition: border var(--transition);
}
.form-group input:focus {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
    border-color: var(--accent);
}

.btn--full { width: 100%; padding: 10px; margin-top: 0.5rem; }

.auth-error {
    padding: 10px;
    background: color-mix(in srgb, var(--red) 10%, var(--bg-raised));
    border: 1px solid var(--red);
    border-radius: var(--radius);
    color: var(--red);
    font-size: 0.85rem;
    font-weight: 500;
}

.auth-footer {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.82rem;
    color: var(--text-3);
}
.auth-footer a { color: var(--accent); text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* ─── WCAG Focus Indicators ─── */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.topbar-btn:focus-visible,
.ribbon__btn:focus-visible,
.btn:focus-visible,
.btn-icon:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 10000;
    font-size: 0.85rem;
    transition: top .2s;
}
.skip-link:focus {
    top: 0;
}

/* Ensure minimum touch target 44x44px (WCAG 2.5.8) */
.topbar-btn { min-width: 36px; min-height: 36px; }
.ribbon__btn { min-height: 32px; }
.btn-icon { min-width: 32px; min-height: 32px; }

/* ─── Reader Mode ─── */
.reader-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,0.6);
    display: flex; justify-content: center; align-items: start;
    padding: 2rem; overflow-y: auto;
    backdrop-filter: blur(2px);
}

.reader {
    background: var(--bg-surface); color: var(--text);
    max-width: 680px; width: 100%;
    border-radius: 12px; padding: 2.5rem;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    position: relative;
    line-height: 1.8; font-size: 1.05rem;
}

.reader__header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1.5rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.reader__source {
    font-weight: 700; color: var(--accent);
    text-transform: uppercase; font-size: 0.85rem; letter-spacing: 0.05em;
}

.reader__original {
    color: var(--text-3); font-size: 0.85rem; margin-left: 1rem;
    text-decoration: none;
}
.reader__original:hover { text-decoration: underline; }

.reader__close {
    background: none; border: none; font-size: 1.8rem;
    color: var(--text-3); cursor: pointer; padding: 0 0.3rem;
    line-height: 1;
}
.reader__close:hover { color: var(--text); }

.reader__title {
    font-size: 1.7rem; line-height: 1.3; margin: 0 0 1.5rem 0;
    font-weight: 800; letter-spacing: -0.01em;
}

.reader__meta {
    color: var(--text-3); font-size: 0.9rem;
    margin-bottom: 1.5rem; padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
    line-height: 1.8;
}

.reader__author { color: var(--text); font-weight: 600; }
.reader__section { text-transform: uppercase; font-size: 0.8rem; letter-spacing: 0.05em; }

.reader__tag {
    background: var(--bg-inset); color: var(--text-2);
    padding: 2px 8px; border-radius: 3px; font-size: 0.8rem;
}

.reader__body { color: var(--text-2); }
.reader__body p { margin: 0 0 1.2em 0; }

.reader__loading { color: var(--text-3); font-style: italic; }
.reader__error { color: var(--red); font-style: italic; }

@media (max-width: 768px) {
    .reader-overlay { padding: 0; }
    .reader { border-radius: 0; padding: 1.5rem; min-height: 100vh; }
    .reader__title { font-size: 1.4rem; }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
    .panel { width: 100%; position: fixed; left: 0; right: 0; z-index: 1000; }
    .topbar__center { display: none; }
    .main-content { padding: 0.5rem; }
}

/* ─── Reduced Motion ─── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ─── High Contrast Mode ─── */
@media (forced-colors: active) {
    .badge, .source-bar__fill, .histogram__fill {
        forced-color-adjust: none;
    }
}
