:root {
    color-scheme: dark;
    --bg: #090b0d;
    --surface: #14181d;
    --surface-2: #181c22;
    --surface-3: #1d2229;
    --border: #46515e;
    --border-strong: #46515e;
    --text: #f5f7fa;
    --muted: #ccd3dc;
    --muted-light: #e8edf3;
    --accent: #ffa333;
    --accent-soft: #3a2817;
    --danger: #ffb4b4;
    --success: #9bd8ac;
    --font-sans: Inter, "Segoe UI", Arial, sans-serif;
    --font-mono: "Cascadia Mono", "Courier New", monospace;
    --content: 1320px;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 16px;
    --header-border: #23272d;
    --header-bg: #080a0c;
    --menu-shadow: #0006;
    --action-hover: #ffb35a;
    --success-border: #365f40;
    --success-alert: #a7d7b2;
    --danger-border: #6f3636;
    --danger-alert: #f3abab;
    --on-accent: #111;
    --button-hover: #ffa94b;
    --brand-ink: #131516;
    --input-icon: #666c68;
    --accent-border-hover: #76542f;
    --card-border: #2d333b;
    --card-start: #161a20;
    --card-end: #101318;
    --warning: #e7a64d;
    --warning-border: #5d4529;
    --danger-card-border: #633a3d;
    --chart-end: #0f1216;
    --chart-grid: #282e36;
    --chart-point: #111419;
    --avatar-accent: #392717;
    --avatar-neutral: #20242c;
    --avatar-neutral-text: #d9dce0;
    --role-border: #775128;
    --selected-border: #7b542d;
    --selected-bg: #1d1915;
    --tag-bg: #242c36;
    --danger-bg: #3b2025;
    --summary-text: #e4e6e5;
    --action-bg: #ffa333;
}

:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --surface-3: #e8edf3;
    --border: #b8c2ce;
    --border-strong: #8996a6;
    --text: #202936;
    --muted: #526173;
    --muted-light: #344152;
    --accent: #955000;
    --accent-soft: #fff0dc;
    --danger: #a32828;
    --success: #24613b;
    --header-border: #d5dbe3;
    --header-bg: #ffffff;
    --menu-shadow: #1b293326;
    --action-hover: #ffb35a;
    --success-border: #83b894;
    --success-alert: #24613b;
    --danger-border: #d59898;
    --danger-alert: #a32828;
    --on-accent: #111;
    --button-hover: #ffa94b;
    --brand-ink: #131516;
    --input-icon: #596573;
    --accent-border-hover: #b17835;
    --card-border: #cfd6df;
    --card-start: #ffffff;
    --card-end: #f0f3f7;
    --warning: #915200;
    --warning-border: #cba269;
    --danger-card-border: #d59898;
    --chart-end: #f4f6f9;
    --chart-grid: #ccd4df;
    --chart-point: #ffffff;
    --avatar-accent: #fff0dc;
    --avatar-neutral: #e5eaf0;
    --avatar-neutral-text: #344152;
    --role-border: #b17835;
    --selected-border: #b17835;
    --selected-bg: #fff3e2;
    --tag-bg: #e9eef4;
    --danger-bg: #fff0f0;
    --summary-text: #344152;
}


* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100vh; margin: 0; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
a { color: var(--muted-light); text-decoration: none; transition: color .15s ease, border-color .15s ease; }
a:hover { color: var(--accent); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .55rem; font-size: 2rem; line-height: 1.2; letter-spacing: -.02em; }
.muted { color: var(--muted); }

/* Shared shell */
.rich-text-field .ql-toolbar.ql-snow, .rich-text-field .ql-container.ql-snow { border-color: var(--border); background: var(--surface); color: var(--text); }
.rich-text-field .ql-editor { min-height: 180px; font: 1rem/1.6 var(--font-sans); }
.rich-text-field .ql-snow .ql-stroke { stroke: var(--text); }
.rich-text-field .ql-snow .ql-fill { fill: var(--text); }
.rich-text-field .ql-toolbar button:focus-visible { outline: 2px solid var(--accent); }
.rich-text-field .ql-snow .ql-tooltip { left: 0 !important; background: var(--surface-2); color: var(--text); border-color: var(--border); white-space: normal; max-width: 100%; z-index: 5; }
.rich-text-field .ql-snow .ql-tooltip input { color: var(--text); background: var(--surface); max-width: 100%; }
.rich-text-field .ql-snow .ql-tooltip::before { content: 'Lien :'; }
.rich-text-field .ql-snow .ql-tooltip a.ql-action::after { content: 'Modifier'; }
.rich-text-field .ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: 'Enregistrer'; }
.rich-text-field .ql-snow .ql-tooltip a.ql-remove::before { content: 'Retirer'; }
.rich-text-output { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.rich-text-output p { margin: 0 0 1em; }
.rich-text-output ul, .rich-text-output ol { padding-left: 1.7em; margin: 0 0 1em; }
.rich-text-output a, .rich-text-field .ql-editor a { color: var(--accent); text-decoration: underline; }
.article-visual { display: block; width: 100%; max-height: 440px; object-fit: contain; margin: 1.5rem auto; }
.article-image-preview { display: block; max-width: 100%; width: 280px; max-height: 180px; object-fit: contain; margin-bottom: 1rem; }

.site-header {
    min-height: 58px;
    display: flex;
    align-items: stretch;
    gap: 2rem;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--header-border);
    background: var(--header-bg);
}
.nav-brand {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .65rem;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .2em;
}
.nav-brand-logo { display: block; flex: 0 0 40px; width: 40px; height: 40px; object-fit: contain; }
.main-nav {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: stretch;
    gap: .15rem;
    flex-wrap: wrap;
}
.main-nav::-webkit-scrollbar { display: none; }
.nav-item {
    position: relative;
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: .5rem;
    padding: 0 1rem;
    color: var(--muted);
    white-space: nowrap;
}
.main-nav > .nav-account { margin-left: auto; }
.main-nav > .nav-item, .nav-group > summary { min-height: 58px; }
.nav-group { position: relative; }
.nav-group > summary { cursor: pointer; list-style: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-chevron { transition: transform .15s ease; }
.nav-group[open] .nav-chevron { transform: rotate(180deg); }
.nav-submenu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 30;
    width: max-content;
    max-width: calc(100vw - 2rem);
    padding: .35rem;
    border: 1px solid var(--border-strong);
    background: var(--surface);
    box-shadow: 0 10px 24px var(--menu-shadow);
}
.nav-submenu--admin { left: auto; right: 0; max-height: min(70vh, 32rem); overflow-y: auto; }
.nav-submenu .nav-item { min-height: 44px; padding: .65rem .8rem; white-space: normal; }
.nav-submenu .nav-item:hover, .nav-submenu [aria-current] { background: var(--surface-3); color: var(--text); }
.main-nav .nav-deposit { align-self: center; min-height: 38px; margin: .5rem; border: 1px solid var(--accent); background: var(--action-bg); color: var(--on-accent); font-weight: 600; }
.main-nav .nav-deposit:hover, .main-nav .nav-deposit.is-active { color: var(--on-accent); background: var(--action-hover); }
.main-nav :is(a, summary):focus-visible { outline: 2px solid var(--accent); outline-offset: -3px; }
@media (max-width: 1200px) {
    .site-header { flex-direction: column; gap: 0; }
    .nav-brand { min-height: 54px; }
}
@media (max-width: 760px) {
    .main-nav > .nav-account { margin-left: 0; }
    .main-nav > .nav-item, .nav-group > summary { min-height: 46px; }
    .nav-group { position: static; }
    .main-nav { position: relative; }
    .nav-submenu { top: auto; left: .5rem; right: .5rem; width: auto; max-width: none; }
}
.nav-item::after { content: ""; position: absolute; right: 1rem; bottom: -1px; left: 1rem; height: 2px; background: transparent; }
.nav-item:hover, .nav-item.is-active { color: var(--text); }
.nav-item.is-active::after { background: var(--accent); }
.nav-item--disabled { cursor: not-allowed; opacity: .58; }
.nav-item--disabled:hover { color: var(--muted); }
.page { width: min(calc(100% - 2rem), var(--content)); margin: 3.5rem auto 6rem; }
.surface { border: 1px solid var(--border); background: var(--surface); }
.section-kicker {
    margin: 0 0 1.2rem;
    color: var(--muted);
    font-family: var(--font-mono);
    font-size: .72rem;
    letter-spacing: .18em;
    text-transform: uppercase;
}
.section-kicker--accent { color: var(--accent); }
.page-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 2rem; }
.flash-stack { position: relative; z-index: 5; width: min(calc(100% - 2rem), var(--content)); margin: 1rem auto 0; }
.flash-stack:empty { display: none; }
.alert { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid var(--border-strong); background: var(--surface-2); }
.alert-success { border-color: var(--success-border); color: var(--success-alert); }
.alert-error { border-color: var(--danger-border); color: var(--danger-alert); }
.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: .45rem;
    min-height: 42px;
    padding: .7rem 1.15rem;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}
.button--primary { background: var(--action-bg); color: var(--on-accent); }
.button--primary:hover { background: var(--button-hover); color: var(--on-accent); }
.button--block { width: 100%; }
.back-link { align-self: flex-start; color: var(--muted); }

/* Brand and authentication */
.auth-body {
    background-color: var(--bg);
}
.auth-page { width: min(calc(100% - 2rem), 520px); min-height: 100vh; margin: auto; padding: 2.25rem 0 2rem; }
.auth-brand { display: flex; justify-content: center; margin-bottom: 2.8rem; }
.brand-lockup { display: flex; flex-direction: column; align-items: center; text-align: center; }
.brand-mark { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 1.35rem; background: var(--action-bg); color: var(--brand-ink); }
.brand-mark svg { width: 27px; height: 27px; }
.brand-copy { display: flex; flex-direction: column; }
.brand-copy strong { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.02em; }
.brand-copy small { margin-top: .45rem; color: var(--muted); font-size: 1rem; }
.auth-card { padding: 2.25rem; }
.auth-card h1 { font-size: 1.35rem; }
.auth-card--centered { text-align: center; }
.auth-link { display: block; margin-top: 1.7rem; text-align: center; text-decoration: underline; text-underline-offset: 3px; }
.auth-footer { margin: 2rem 0 0; color: var(--muted); font-family: var(--font-mono); font-size: .72rem; letter-spacing: .08em; text-align: center; }
.auth-footer span { padding: 0 .45rem; }
.auth-page--reset { display: flex; flex-direction: column; justify-content: center; gap: 2rem; max-width: 500px; }
.auth-page--reset .auth-card { width: 100%; }
.intro-copy { margin-bottom: 1.6rem; line-height: 1.55; }
.success-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 1.3rem; background: var(--accent-soft); color: var(--accent); font-size: 1.7rem; }

/* Forms */
.stack-form { display: flex; flex-direction: column; gap: 1.15rem; }
.field-group > label, .stack-form label, .form-card label { display: block; margin: 0 0 .5rem; color: var(--muted); font-size: .92rem; }
.input-shell { display: flex; align-items: center; min-height: 50px; border: 1px solid var(--border-strong); background: var(--surface-2); }
.input-shell:focus-within { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240, 154, 53, .12); }
.input-shell svg { flex: 0 0 20px; width: 20px; height: 20px; margin-left: .85rem; fill: none; stroke: var(--input-icon); stroke-width: 1.5; }
.input-shell input { border: 0; background: transparent; }
input, select, textarea {
    width: 100%;
    min-height: 46px;
    padding: .72rem .85rem;
    border: 1px solid var(--border-strong);
    border-radius: 0;
    outline: none;
    background: var(--surface-2);
    color: var(--text);
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(240, 154, 53, .12); }
/* The shell already marks focus around both the icon and the input. */
.input-shell input:focus { border: 0; box-shadow: none; outline: none; }
input[type="checkbox"] { width: 16px; min-height: 16px; accent-color: var(--accent); }
.stack-form > div > div { margin-bottom: .8rem; }
.stack-form ul { margin: .4rem 0 0; padding-left: 1.2rem; color: var(--danger); font-size: .83rem; }
.form-card { padding: 2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid--checks { margin: 1rem 0; }
.check-card { padding: .9rem 1rem; border: 1px solid var(--border); background: var(--surface-2); }
.check-card > div { display: flex; align-items: center; gap: .5rem; }
.check-card label { margin: 0; }
.password-box { margin-top: 1rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1.2rem; margin-top: 1rem; }
.back-link--page { display: inline-block; margin-bottom: 2rem; }
.form-heading { margin-bottom: 1.5rem; }
.source-form-intro { margin: 0 0 1.75rem; color: var(--muted); font-size: .85rem; }
.source-form-section { min-width: 0; margin: 0 0 2rem; padding: 0 0 1.75rem; border: 0; border-bottom: 1px solid var(--border); }
.source-form-section legend { padding: 0; color: var(--text); font-size: 1.15rem; font-weight: 650; }
.source-section-help { margin: .5rem 0 1.25rem; color: var(--muted); font-size: .88rem; line-height: 1.6; }
.source-form-section > div + div { margin-top: 1.25rem; }
.source-form .form-grid > div { min-width: 0; }
.source-form .help-text { margin-top: .5rem; color: var(--muted); font-size: .82rem; line-height: 1.6; }
.source-form textarea { resize: vertical; line-height: 1.6; }
.source-form ul { padding-left: 1.25rem; color: var(--danger); font-size: .88rem; }
.source-activation { padding: 1rem; background: var(--surface-2); border: 1px solid var(--border); }
.source-activation-control { display: flex; align-items: center; gap: .65rem; }
.source-activation-control input { flex-shrink: 0; }
.source-activation-control label { margin: 0; color: var(--text); cursor: pointer; }
.source-activation .source-section-help { margin-bottom: 0; }
.source-form .form-actions { margin-top: 1.75rem; flex-wrap: wrap; }

/* Dashboard */
.personal-watch { display: grid; gap: 1.5rem; margin-top: 2rem; }
.personal-watch-section { padding: 1.5rem; min-width: 0; }
.personal-watch-section h2 { margin: 0; }
.personal-watch-article { border-top: 1px solid var(--border); padding: 1rem 0; }
.personal-watch-links { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1rem; }
.personal-watch-links a { color: var(--accent); }
.folder-edit { margin-top: 1rem; }
.folder-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; gap: 1rem; }
.folder-card { padding: 1.25rem; }
.folder-card-heading { display: flex; align-items: flex-start; gap: .85rem; }
.folder-card-icon { display: grid; place-items: center; flex: 0 0 44px; height: 44px; border-radius: .4rem; color: var(--accent); background: var(--accent-soft); }
.folder-card-icon svg { display: block; width: 27px; height: 27px; }
.folder-card-title { min-width: 0; }
.folder-card-title h2 { font-size: 1.15rem; line-height: 1.4; overflow-wrap: anywhere; }
.folder-card-title h2 a { color: var(--text); }
.folder-card-title h2 a:hover { color: var(--accent); }
.folder-card .folder-count { margin: .25rem 0 0; font-size: .875rem; }
.folder-grid > p { grid-column: 1 / -1; }
@media (max-width: 1099px) {
    .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
    .folder-grid { grid-template-columns: minmax(0, 1fr); }
}
.folder-edit summary, .article-folders summary { cursor: pointer; font-weight: 650; }
.folder-edit form { margin-top: 1rem; }
.folder-choices { display: grid; gap: .75rem; max-height: 320px; overflow-y: auto; }
.folder-choices label { display: flex; align-items: center; gap: .65rem; overflow-wrap: anywhere; }
.folder-choices input { flex-shrink: 0; }
.article-folders { margin: 1.5rem 0; }
.personal-folders li { margin: .75rem 0; overflow-wrap: anywhere; }
.welcome-block { margin-bottom: 2.5rem; }
.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dashboard-card { display: grid; grid-template-columns: 42px 1fr; gap: .2rem 1rem; padding: 1.25rem; color: var(--text); }
.dashboard-card:hover { border-color: var(--accent-border-hover); color: var(--text); text-decoration: none; }
.dashboard-card .dashboard-icon { grid-row: span 2; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.dashboard-card strong { align-self: end; }
.dashboard-card small { color: var(--muted); }
.dashboard-insights { position: relative; margin-top: 3.8rem; padding-top: 1.6rem; border-top: 1px solid var(--border); }
.dashboard-section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1rem; }
.dashboard-section-head .section-kicker { margin-bottom: .65rem; }
.dashboard-section-head h2 { margin: 0; font-size: 1.35rem; letter-spacing: -.02em; }
.dashboard-section-head > small { color: var(--muted); font-family: var(--font-mono); font-size: .66rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.kpi-card {
    --card-accent: var(--accent);
    position: relative;
    display: flex;
    min-height: 154px;
    overflow: hidden;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.15rem;
    border-color: var(--card-border);
    background: linear-gradient(145deg, var(--card-start) 0%, var(--card-end) 72%);
    box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
    color: var(--text);
    transition: transform .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.kpi-card::before { position: absolute; top: 0; right: 0; left: 0; height: 2px; background: linear-gradient(90deg, var(--card-accent), transparent 72%); content: ""; opacity: .85; }
.kpi-card::after { position: absolute; top: -55px; right: -55px; width: 150px; height: 150px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--card-accent) 18%, transparent), transparent 68%); content: ""; pointer-events: none; }
.kpi-card:hover { z-index: 1; border-color: color-mix(in srgb, var(--card-accent) 60%, var(--card-border)); box-shadow: 0 18px 38px rgba(0, 0, 0, .3); color: var(--text); transform: translateY(-3px); }
.kpi-card .kpi-symbol { position: absolute; top: 1rem; right: 1rem; display: grid; width: 34px; height: 34px; place-items: center; border: 1px solid color-mix(in srgb, var(--card-accent) 40%, transparent); background: color-mix(in srgb, var(--card-accent) 10%, transparent); color: var(--card-accent); font-family: var(--font-mono); font-size: .9rem; }
.kpi-card .kpi-label { max-width: calc(100% - 38px); color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .02em; }
.kpi-card > strong { margin: .7rem 0 .45rem; color: var(--text); font-family: var(--font-mono); font-size: clamp(2rem, 3.3vw, 2.65rem); font-variant-numeric: tabular-nums; line-height: 1; letter-spacing: -.07em; }
.kpi-card > small { color: var(--muted); font-family: var(--font-mono); font-size: .6rem; line-height: 1.4; }
.kpi-card--warning { --card-accent: var(--warning); border-color: var(--warning-border); }
.kpi-card--danger { --card-accent: var(--danger); border-color: var(--danger-card-border); }
.kpi-card--danger > strong { color: var(--danger); }
.kpi-card .kpi-status { margin-top: 1.15rem; font-family: var(--font-sans); font-size: 1.05rem; line-height: 1.25; letter-spacing: 0; }
.kpi-status--success { color: var(--success) !important; }
.kpi-status--partial, .kpi-status--failure { color: var(--danger) !important; }
.dashboard-analysis-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(210px, 1fr); gap: .85rem; margin-top: .85rem; }
.view-chart-card { min-width: 0; padding: 1.25rem; border-color: var(--card-border); background: linear-gradient(145deg, var(--surface), var(--chart-end)); box-shadow: 0 12px 30px rgba(0, 0, 0, .16); }
.chart-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.chart-heading .section-kicker { margin-bottom: .45rem; }
.chart-heading > div > strong { font-size: 1.05rem; }
.chart-heading > small { max-width: 250px; color: var(--muted); font-size: .68rem; line-height: 1.4; text-align: right; }
.view-chart { display: block; width: 100%; height: auto; margin-top: .75rem; overflow: visible; }
.chart-grid-line { stroke: var(--chart-grid); stroke-width: 1; stroke-dasharray: 4 5; }
.chart-axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-area { fill: url(#chart-area-gradient); }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-dasharray: 1; stroke-dashoffset: 0; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 5px rgba(240, 154, 53, .28)); }
.chart-point { fill: var(--chart-point); stroke: var(--accent); stroke-width: 3; }
.chart-value { fill: var(--text); font-family: var(--font-mono); font-size: 11px; text-anchor: middle; }
.chart-label { fill: var(--muted); font-family: var(--font-mono); font-size: 10px; text-anchor: middle; }
.dashboard-side-kpis { display: grid; grid-template-rows: 1fr 1fr; gap: .75rem; }
.kpi-card--wide { min-height: 0; }
.dashboard-insights.is-visible .kpi-card { animation: kpi-enter .52s cubic-bezier(.2, .75, .3, 1) both; animation-delay: calc(var(--delay, 0) * 55ms); }
.dashboard-insights.is-visible .chart-line { animation: chart-draw 1.15s .2s ease-out both; }
.dashboard-insights.is-visible .chart-area { animation: chart-fade .8s .55s ease-out both; }
.dashboard-insights.is-visible .chart-point { animation: chart-point .35s .85s ease-out both; transform-box: fill-box; transform-origin: center; }
@keyframes kpi-enter { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes chart-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes chart-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes chart-point { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }

/* Account */
.logout-link { display: flex; gap: .55rem; color: var(--muted); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.profile-card { display: flex; align-items: center; gap: 1rem; padding: 1.4rem; }
.avatar { display: grid; flex: 0 0 auto; place-items: center; width: 52px; height: 52px; background: var(--action-bg); color: var(--on-accent); font-size: 1.25rem; font-weight: 700; }
.avatar--small { width: 34px; height: 34px; background: var(--avatar-accent); color: var(--accent); font-size: .9rem; }
.avatar--neutral { background: var(--avatar-neutral); color: var(--avatar-neutral-text); }
.profile-copy, .user-identity { display: flex; flex-direction: column; gap: .2rem; }
.profile-copy span, .user-identity span { color: var(--muted); font-family: var(--font-mono); font-size: .75rem; }
.profile-copy .role-label { color: var(--accent); text-transform: uppercase; }
.account-section { margin-top: 2.5rem; }
.empty-state { padding: 1.3rem; color: var(--muted); }
.empty-state p, .empty-copy { margin: 0; }

/* Users */
.page-heading--users { align-items: center; }
.user-section { margin-top: 2rem; }
.user-list { padding: 0 1.1rem; }
.user-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; min-height: 76px; border-bottom: 1px solid var(--border); }
.user-row:last-child { border-bottom: 0; }
.role-badge { padding: .25rem .55rem; border: 1px solid var(--role-border); color: var(--accent); font-family: var(--font-mono); font-size: .68rem; text-transform: uppercase; }
.row-action { color: var(--muted); font-size: .82rem; }
.user-card-list { display: flex; flex-direction: column; gap: .65rem; }
.subscriber-card { padding: 1.15rem; }
.subscriber-head { display: flex; align-items: center; gap: 1rem; }
.subscriber-actions { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.subscriber-actions form { margin: 0; }
.user-admin-actions { flex-wrap: wrap; justify-content: flex-end; }
.user-delete-form { display: flex; align-items: flex-end; gap: .65rem; }
.user-delete-form label { display: flex; flex-direction: column; gap: .25rem; color: var(--muted); font-family: var(--font-mono); font-size: .65rem; }
.user-delete-form select { min-width: 180px; padding: .45rem .6rem; border: 1px solid var(--border); background: var(--surface-soft); color: var(--text); }
.icon-danger { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.icon-danger:hover { color: var(--danger); }
.subscription-preview { display: flex; justify-content: space-between; margin-top: 1rem; padding-top: .8rem; border-top: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; }
.subscription-preview small { color: var(--muted); letter-spacing: 0; text-transform: none; }
.is-disabled { border-style: dashed; }
.user-identity small { color: var(--danger); }

/* Digest administration */
.digest-hint { margin: .4rem 0 0; font-size: .82rem; }
.digest-manual-send { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; margin-top: 1.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.digest-manual-send p { max-width: 480px; margin: .35rem 0 0; font-size: .8rem; line-height: 1.45; }
.digest-manual-send form { flex: 0 0 auto; margin: 0; }
.digest-history { margin-top: 2.5rem; }
.digest-run-list { display: flex; flex-direction: column; gap: .7rem; }
.digest-run { padding: 1.15rem; }
.digest-run-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.digest-run-head > div { display: flex; flex-direction: column; gap: .25rem; }
.digest-run-head span { color: var(--muted); font-family: var(--font-mono); font-size: .7rem; }
.run-status { padding: .25rem .55rem; border: 1px solid var(--border-strong); text-transform: uppercase; }
.run-status--success { border-color: var(--success-border); color: var(--success) !important; }
.run-status--partial, .run-status--failure { border-color: var(--danger-border); color: var(--danger) !important; }
.digest-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; margin-top: 1rem; }
.digest-stats span { padding: .7rem; border: 1px solid var(--border); color: var(--muted); font-size: .78rem; }
.digest-stats strong { display: block; margin-bottom: .25rem; color: var(--text); font-size: 1.1rem; }
.digest-errors { margin-top: 1rem; color: var(--muted-light); font-size: .78rem; }
.digest-errors summary { cursor: pointer; color: var(--danger); }
.digest-errors li { margin-top: .45rem; line-height: 1.45; }

/* Categories and subscriptions */
.category-create, .subscription-form { padding: 1.5rem; }
.inline-form { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 1rem; }
.inline-form > div { margin: 0; }
.category-create .inline-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
.category-create .help-text { color: var(--muted); font-size: .85rem; }
.inline-form label { display: block; margin-bottom: .5rem; color: var(--muted-light); font-size: .9rem; }
.inline-form ul { margin: .4rem 0 0; color: var(--danger); }
.category-section { margin-top: 2.5rem; }
.category-list { display: flex; flex-direction: column; gap: .65rem; }
.category-row { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 1rem; padding: 1.5rem; }
.category-icon { display: grid; place-items: center; width: 38px; height: 38px; background: var(--accent-soft); color: var(--accent); }
.category-copy { display: flex; flex-direction: column; gap: .25rem; }
.category-copy span { color: var(--muted); font-family: var(--font-mono); font-size: .7rem; }
.category-actions { display: flex; align-items: center; gap: 1rem; }
.category-actions form { margin: 0; }
.text-button { padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: .82rem; }
.text-button:hover { color: var(--accent); }
.subscription-form > .muted { margin-bottom: 1.3rem; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.choice-card { display: flex; align-items: center; gap: .85rem; min-height: 68px; padding: .85rem 1rem; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--selected-border); background: var(--selected-bg); }
.choice-card input { flex: 0 0 auto; }
.choice-card span { display: flex; min-width: 0; flex-direction: column; gap: .2rem; }
.choice-card small { overflow: hidden; color: var(--muted); font-family: var(--font-mono); font-size: .68rem; text-overflow: ellipsis; }

/* Article administration */
.article-list { display: flex; flex-direction: column; gap: 1rem; }
.article-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; padding: 1.5rem; }
.article-main { min-width: 0; }
.article-title { color: var(--text); font-size: 1.3125rem; font-weight: 650; line-height: 1.4; overflow-wrap: anywhere; }
.article-title:hover { color: var(--accent); }
.article-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .8rem; margin-top: .65rem; color: var(--muted); font-family: var(--font-sans); font-size: .9375rem; line-height: 1.5; }
.danger-copy { color: var(--danger); }
.tag-list { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .75rem; }
.tag { padding: .3rem .65rem; border: 1px solid var(--border-strong); background: var(--tag-bg); color: var(--muted-light); font-family: var(--font-sans); font-size: .875rem; line-height: 1.5; overflow-wrap: anywhere; }
.article-actions { display: flex; align-items: center; align-self: start; flex-wrap: wrap; gap: .5rem; }
.article-actions form { margin: 0; }
.article-actions :is(.row-action, .text-button) { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: .5rem .65rem; font-size: 1rem; line-height: 1.5; }
.article-actions .row-action { color: var(--accent); }
.article-actions .article-edit { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); }
.article-actions .article-remove { color: var(--danger); }
.article-actions .article-reactivate { color: var(--accent); }
.article-actions :is(.row-action, .text-button):hover { background: var(--surface-3); text-decoration: underline; text-underline-offset: 3px; }
.article-actions .article-edit:hover { border-color: var(--accent); color: var(--accent); }
.article-meta .danger-copy { padding: .2rem .55rem; border: 1px solid var(--danger); background: var(--danger-bg); color: var(--danger); font-weight: 600; }
.page--articles .article-meta > span + span:not(.danger-copy)::before { content: "·"; margin-right: .8rem; }
@media (min-width: 761px) and (max-width: 1000px) {
    .page--articles .article-row { grid-template-columns: 1fr; }
}
.watch-proposal { grid-template-columns: minmax(0, 1fr); gap: .75rem; }
.watch-proposal .article-actions { justify-content: flex-end; }
.watch-toolbar { margin-bottom: 1rem; padding: 1rem; }
.watch-toolbar__heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .8rem; }
.watch-toolbar__heading strong { color: var(--text); font-size: .9rem; }
.watch-source-link { color: var(--accent); font-size: .78rem; }
.watch-source-link:hover { text-decoration: underline; text-underline-offset: .2rem; }
.watch-filters { display: flex; flex-wrap: wrap; gap: .5rem; }
.watch-filter { padding: .52rem .75rem; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--muted-light); font-size: .78rem; }
.watch-filter:hover { border-color: var(--accent); color: var(--accent); }
.watch-filter.is-current { border-color: var(--accent); background: var(--action-bg); color: var(--on-accent); font-weight: 700; }
.watch-toolbar__help { margin: .8rem 0 0; font-size: .75rem; }
.article-form-card { padding: 1.7rem; }
.article-form-heading .muted { max-width: 760px; line-height: 1.6; }
.article-form-shortcuts { display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; margin-top: 1.2rem; }
.article-form-shortcuts a { padding: .35rem 0; border-bottom: 1px solid var(--border); font-size: .82rem; }
.article-form-shortcuts a:hover { border-color: var(--accent); }
.article-workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 1.5rem; align-items: start; }
.article-workspace-main, .article-workspace-sidebar { display: grid; gap: 1.25rem; min-width: 0; }
.article-workspace section[id] { scroll-margin-top: 1.5rem; }
.article-workspace .form-card { min-width: 0; }
.article-panel-heading { margin-bottom: 1.4rem; }
.article-panel-heading h2 { margin-bottom: .4rem; font-size: 1.2rem; line-height: 1.35; }
.article-panel-heading .section-kicker { margin-bottom: .55rem; }
.article-panel-heading .muted { margin-bottom: 0; font-size: .85rem; line-height: 1.55; }
.article-panel-heading--compact { margin-bottom: 1rem; }
.article-fields { display: grid; gap: 1.25rem; }
.article-reference-grid { grid-template-columns: minmax(0, 1fr) minmax(180px, .65fr); }
.article-reference-grid > div { min-width: 0; }
.article-optional { margin-left: .5rem; color: var(--muted); font-size: .75rem; font-weight: 400; }
.article-workspace .article-content-field .ql-editor { min-height: 360px; }
.article-workspace .article-summary-field .ql-editor { min-height: 180px; }
.article-workspace .article-summary-field textarea { min-height: 180px; }
.article-summary-field { margin-top: 1.7rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.article-summary-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 1rem; }
.article-summary-actions span { font-size: .75rem; }
.article-workspace .button { white-space: normal; line-height: 1.4; text-align: center; }
.article-workspace .help-text, .article-workspace .form-help { font-size: .8rem; line-height: 1.5; }
.article-tools-panel, .article-categories-panel { padding: 1.25rem; }
.article-tools-panel h3 { margin: 0 0 .5rem; font-size: .92rem; }
.article-url-tool > .muted { font-size: .8rem; line-height: 1.6; }
.article-url-tool > .button { width: 100%; }
.article-tools-panel .ocr-panel { margin: 1.1rem 0 0; padding: 1.3rem 0 0; border: 0; border-top: 1px solid var(--border); background: transparent; }
.article-tools-panel .ocr-copy .muted { line-height: 1.6; }
.article-tools-panel .ocr-dropzone { padding: .9rem; }
.article-tools-panel .ocr-dropzone-hint { flex-direction: column; align-items: flex-start; gap: .45rem; font-size: .82rem; line-height: 1.5; }
.article-tools-panel .ocr-controls { grid-template-columns: minmax(0, 1fr); }
.article-tools-panel .ocr-file { min-width: 0; padding: .4rem; font-size: .75rem; }
.article-tools-panel .ocr-file::file-selector-button { margin-right: .4rem; padding: .4rem; }
.article-tools-panel .ocr-option { display: flex; align-items: flex-start; gap: .6rem; margin: .9rem 0; font-size: .76rem; line-height: 1.5; }
.article-tools-panel .ocr-option input { margin-top: .15rem; }
.article-tools-panel .ocr-actions { display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.article-tools-panel .button--quiet { border-color: transparent; color: var(--muted); background: transparent; font-size: .8rem; }
.article-tools-panel .button--quiet:hover { border-color: var(--border); color: var(--text); }
.article-tools-panel .ocr-preview { max-height: 220px; }
.article-tool-note { margin: .75rem 0 0; font-size: .72rem; line-height: 1.5; }
.article-workspace .fetch-status { overflow-wrap: anywhere; line-height: 1.6; }
.article-workspace .fetch-status:empty { display: none; }
.article-categories-panel fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.article-categories-panel legend { margin-bottom: .7rem; padding: 0; color: var(--muted); font-size: .82rem; }
.article-categories-panel .choice-grid { grid-template-columns: minmax(0, 1fr); max-height: 420px; overflow-y: auto; overscroll-behavior: contain; scrollbar-gutter: stable; gap: .45rem; padding: 3px; }
.article-categories-panel .choice-card { display: flex; align-items: flex-start; min-height: 44px; margin: 0; padding: .75rem; gap: .7rem; font-size: .8rem; line-height: 1.5; }
.article-categories-panel .choice-card strong { font-weight: 500; overflow-wrap: anywhere; }
.article-categories-panel .choice-card input { margin: .15rem 0 0; }
.article-categories-panel .choice-card:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }
.article-categories-panel .choice-card:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.article-savebar { position: sticky; bottom: 1rem; z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 1.25rem; margin-top: 1.5rem; padding: 1rem 1.4rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.article-savebar > p { max-width: 390px; margin: 0; font-size: .8rem; line-height: 1.5; }
.article-savebar .form-actions { flex-shrink: 0; margin: 0; }
@media (max-width: 1050px) {
    .article-workspace-grid { grid-template-columns: minmax(0, 1fr) 310px; gap: 1rem; }
    .article-workspace .article-form-card { padding: 1.25rem; }
    .article-reference-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 850px) {
    .article-workspace-grid { grid-template-columns: minmax(0, 1fr); }
    .article-savebar { position: static; flex-wrap: wrap; }
    .article-savebar .form-actions { margin-left: auto; }
    .article-workspace .article-content-field .ql-editor { min-height: 260px; }
}
@media (max-width: 520px) {
    .article-savebar { padding: 1rem; }
    .article-savebar .form-actions { width: 100%; justify-content: space-between; gap: .7rem; }
    .article-summary-actions .button { width: 100%; }
}
.article-form-card textarea { min-height: 280px; resize: vertical; line-height: 1.5; }
.article-category-field > label { display: block; margin-bottom: .5rem; color: var(--muted); font-size: .92rem; }
.article-url-field > label { display: block; margin-bottom: .5rem; color: var(--muted); font-size: .92rem; }
.url-fetch-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .7rem; }
.button--secondary { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); white-space: nowrap; }
.button--secondary:hover { border-color: var(--accent); color: var(--accent); }
.button:disabled { cursor: wait; opacity: .6; }
.fetch-status { min-height: 1.1rem; margin: .45rem 0 0; color: var(--muted); font-size: .75rem; }
.fetch-status.is-error { color: var(--danger); }
.fetch-status.is-success { color: var(--success); }
.duplicate-check { margin: -.2rem 0 .2rem; padding: .8rem 1rem; border: 1px solid var(--border); background: rgba(255, 255, 255, .02); }
.duplicate-check[hidden] { display: none; }
.duplicate-check p { margin: 0; font-size: .85rem; }
.duplicate-check ul { display: grid; gap: .55rem; margin: .65rem 0 0; padding: 0; list-style: none; }
.duplicate-check li { display: grid; gap: .14rem; }
.duplicate-check a { width: fit-content; color: var(--text); font-weight: 700; text-decoration: underline; text-decoration-color: rgba(243, 154, 47, .55); text-underline-offset: .2rem; }
.duplicate-check__details { color: var(--muted); font-size: .72rem; }
.duplicate-check.is-warning { border-color: rgba(243, 154, 47, .65); background: rgba(243, 154, 47, .07); }
.duplicate-check.is-blocking,
.duplicate-check.is-error { border-color: var(--danger); background: rgba(255, 95, 95, .07); color: var(--danger); }
.duplicate-check.is-clear { border-color: rgba(86, 201, 138, .55); color: var(--success); }
.duplicate-check.is-pending { color: var(--muted); }
.ocr-panel { margin: .4rem 0 1.4rem; padding: 1.1rem; border: 1px solid var(--border); background: rgba(255, 255, 255, .012); }
.ocr-dropzone { margin-top: 1rem; padding: 1rem; border: 1px dashed var(--border-strong); background: rgba(255, 255, 255, .018); outline: none; transition: border-color .18s ease, background .18s ease, box-shadow .18s ease; }
.ocr-dropzone:focus, .ocr-dropzone:focus-within { border-color: var(--accent); box-shadow: 0 0 0 1px rgba(241, 148, 36, .25); }
.ocr-dropzone.is-dragging { border-color: var(--accent); background: rgba(241, 148, 36, .08); box-shadow: inset 0 0 0 1px var(--accent); }
.ocr-dropzone-hint { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin: 0; color: var(--text); }
.ocr-dropzone-hint span { color: var(--muted); font-size: .78rem; }
.ocr-copy p { margin: 0; }
.ocr-copy .muted { margin-top: .35rem; font-size: .82rem; }
.ocr-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .7rem; margin-top: .8rem; }
.ocr-actions { display: flex; flex-wrap: wrap; gap: .55rem; }
.ocr-file { padding: .55rem; }
.ocr-file::file-selector-button { margin-right: .8rem; padding: .48rem .7rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); cursor: pointer; }
.ocr-option { display: flex; align-items: center; gap: .55rem; margin-top: .8rem; color: var(--muted); font-size: .78rem; }
.ocr-option input { flex: 0 0 auto; width: 16px; min-height: 16px; }
.ocr-preview { display: block; max-width: 100%; max-height: 300px; margin-top: 1rem; border: 1px solid var(--border); object-fit: contain; object-position: top left; }
.ocr-progress { width: 100%; height: 8px; margin-top: .8rem; accent-color: var(--accent); }
.ocr-preview[hidden], .ocr-progress[hidden] { display: none; }
.article-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; }
.article-detail-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .7rem; }
.article-detail-actions form { margin: 0; }
.article-detail-head h1 { max-width: 760px; font-size: 1.75rem; }
.tag-list--detail { margin: 1.4rem 0; }
.article-content { padding: 1.6rem; color: var(--text); line-height: 1.7; white-space: normal; }
.article-content p { margin: 0; }
.article-summary { margin-bottom: 1rem; padding: 1.35rem 1.6rem; border-left: 3px solid var(--accent); color: var(--summary-text); line-height: 1.65; }
.article-summary p { margin: .5rem 0 0; }
.article-summary small { display: block; margin-top: .8rem; color: var(--muted); }
.personal-note { margin-bottom: 1rem; padding: 1.35rem 1.6rem; }
.personal-note > div { margin-bottom: 1rem; }
.personal-note > div p { margin-bottom: .35rem; }
.personal-note label { display: block; margin-bottom: .5rem; color: var(--muted-light); font-size: .85rem; }
.personal-note-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .75rem; }
.personal-note-actions small { color: var(--muted); }
.source-link { display: inline-block; margin-top: 1.2rem; color: var(--accent); }

/* Search catalog */
.catalog-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1.5rem; align-items: start; }
.catalog-sidebar { grid-column: 2; grid-row: 1; min-width: 0; }
.catalog-results { grid-column: 1; grid-row: 1; min-width: 0; }
.catalog-filter-toggle { display: none; padding: 1rem; cursor: pointer; font-weight: 650; }
.catalog-filter-count { color: var(--accent); font-size: .8rem; white-space: nowrap; }
.catalog-filter-heading { margin: 1.25rem 1.25rem 0; font-size: 1rem; }
.catalog-sidebar .date-filters { grid-template-columns: minmax(0, 1fr); }
.catalog-sidebar .date-filters > div { min-width: 0; }
.catalog-sidebar .filter-category-grid { flex-direction: column; flex-wrap: nowrap; max-height: 300px; }
.catalog-sidebar .filter-category-grid input { flex-shrink: 0; }
.catalog-sidebar .filter-category-grid span { overflow-wrap: anywhere; }
.catalog-sidebar .filter-actions { flex-direction: column-reverse; align-items: stretch; text-align: center; }
.catalog-results .catalog-summary { margin-top: 0; }
.catalog-results .catalog-card { grid-template-columns: minmax(0, 1fr); }
.catalog-results .catalog-card-actions { justify-content: flex-end; }
@media (max-width: 1099px) {
    .catalog-layout { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
    .catalog-sidebar, .catalog-results { grid-column: 1; grid-row: auto; }
    .catalog-filter-toggle { display: list-item; list-style-position: inside; }
    .catalog-filter-heading { display: none; }
}
.catalog-filters { padding: 1.25rem; }
.catalog-filters label, .catalog-filters legend { color: var(--muted-light); font-size: .78rem; }
.search-field label { display: block; margin-bottom: .45rem; }
.filter-categories { margin: 1rem 0; padding: 0; border: 0; }
.filter-categories legend { margin-bottom: .55rem; }
.filter-category-grid { display: flex; flex-wrap: wrap; gap: .4rem; max-height: 110px; overflow-y: auto; }
.filter-category-grid label { display: flex; align-items: center; gap: .35rem; padding: .35rem .5rem; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.filter-category-grid label:has(input:checked) { border-color: var(--selected-border); color: var(--accent); }
.filter-category-grid input { width: 14px; min-height: 14px; }
.favorite-filter { display: inline-flex; align-items: center; gap: .5rem; margin: 0 0 1rem; padding: .55rem .7rem; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; }
.favorite-filter:has(input:checked) { border-color: var(--selected-border); color: var(--accent); }
.favorite-filter input { width: 16px; min-height: 16px; }
.favorite-filter span { color: var(--accent); }
.date-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.date-filters label { display: block; margin-bottom: .4rem; }
.filter-actions { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; margin-top: 1rem; }
.catalog-summary { display: flex; justify-content: space-between; margin: 1.5rem 0 .7rem; color: var(--muted); font-family: var(--font-mono); font-size: .7rem; }
.catalog-list { display: flex; flex-direction: column; gap: 1rem; }
.catalog-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; padding: 1.5rem; }
.catalog-card.is-viewed { border-style: dashed; }
.catalog-card-main { min-width: 0; }
.catalog-summary-preview { margin: .5rem 0 .75rem; color: var(--muted); font-size: .9375rem; line-height: 1.5; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.catalog-card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .45rem; }
.catalog-card-actions form { margin: 0; }
.catalog-card--admin { grid-template-columns: minmax(0, 1fr); }
.catalog-card--admin .catalog-card-actions { justify-content: flex-end; }
.favorite-button { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; font-size: 1.15rem; }
.favorite-button:hover, .favorite-button.is-active { border-color: var(--accent); color: var(--accent); }
.favorite-toggle.is-active { border-color: var(--selected-border); color: var(--accent); }
.catalog-open { display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--border); color: var(--muted); }
.catalog-open:hover { border-color: var(--accent); color: var(--accent); }
.viewed-label { color: var(--success); }
.pagination { display: flex; justify-content: center; gap: .4rem; margin-top: 1.6rem; }
.pagination a { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); }
.pagination a.is-current { border-color: var(--accent); background: var(--action-bg); color: var(--on-accent); }

/* Accessibility and responsive behavior */
:where(a, button, summary, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
    .dashboard-insights.is-visible .kpi-card, .dashboard-insights.is-visible .chart-line, .dashboard-insights.is-visible .chart-area, .dashboard-insights.is-visible .chart-point { animation: none !important; }
}
@media (max-width: 760px) {
    .site-header { display: block; padding: 0 .8rem; }
    .nav-brand { min-height: 54px; }
    .main-nav { margin: 0 -.8rem; padding: 0 .35rem; border-top: 1px solid var(--border); }
    .main-nav .nav-item:last-child { margin-left: 0; }
    .nav-item { min-height: 46px; padding: 0 .7rem; font-size: .86rem; }
    .page { margin-top: 2.25rem; }
    .page-heading { flex-direction: column; align-items: stretch; }
    .page-heading .button { align-self: flex-start; }
    .dashboard-grid, .form-grid, .choice-grid { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-analysis-grid { grid-template-columns: 1fr; }
    .dashboard-side-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: auto; }
    .inline-form, .category-row { grid-template-columns: 1fr; }
    .category-create .inline-form { grid-template-columns: 1fr; }
    .article-row { grid-template-columns: 1fr; }
    .article-actions { flex-wrap: wrap; }
    .watch-toolbar__heading { align-items: flex-start; flex-direction: column; gap: .4rem; }
    .date-filters { grid-template-columns: 1fr; }
    .personal-note-actions { align-items: stretch; flex-direction: column; }
    .url-fetch-row { grid-template-columns: 1fr; }
    .url-fetch-row .button { justify-self: start; }
    .ocr-controls { grid-template-columns: 1fr; }
    .ocr-controls .button { justify-self: start; }
    .ocr-dropzone-hint { align-items: flex-start; flex-direction: column; gap: .25rem; }
    .ocr-actions { align-items: stretch; flex-direction: column; }
    .category-actions { flex-wrap: wrap; }
    .digest-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .user-row { grid-template-columns: auto 1fr auto; }
    .user-row .row-action { grid-column: 2; }
}
@media (max-width: 520px) {
    .auth-page { width: min(calc(100% - 1rem), 520px); padding-top: 1.25rem; }
    .auth-brand { margin-bottom: 1.5rem; }
    .brand-mark { width: 42px; height: 42px; margin-bottom: .9rem; }
    .brand-copy strong { font-size: 1.5rem; }
    .brand-copy small { font-size: .88rem; }
    .auth-card, .form-card { padding: 1.3rem; }
    .subscriber-head { align-items: flex-start; flex-wrap: wrap; }
    .subscriber-actions { width: 100%; margin-left: 50px; }
    .subscription-preview { flex-direction: column; gap: .35rem; }
    .dashboard-section-head, .chart-heading { align-items: flex-start; flex-direction: column; }
    .chart-heading > small { text-align: left; }
    .kpi-grid, .dashboard-side-kpis { grid-template-columns: 1fr; }
    .digest-run-head { flex-direction: column; }
    .digest-manual-send { align-items: stretch; flex-direction: column; }
    .digest-manual-send .button { width: 100%; }
    .digest-stats { grid-template-columns: 1fr; }
}

/* Listes de catégories : ordre vertical et retrait par niveau. */
.choice-grid.category-hierarchy { grid-template-columns: minmax(0, 1fr); }
.filter-category-grid.category-hierarchy { flex-direction: column; flex-wrap: nowrap; }
.category-hierarchy > .category-tree-item { margin-inline-start: calc(min(var(--category-depth, 0), 4) * 1.25rem); min-width: 0; }
.category-hierarchy > .category-tree-item:not([data-category-depth="0"]) { border-inline-start: 3px solid var(--border-strong); }
.category-tree-item strong, .category-tree-item > span { overflow-wrap: anywhere; }
.category-tree-item[data-category-depth="0"] strong { font-weight: 700; }
@media (max-width: 760px) {
    .category-hierarchy > .category-tree-item { margin-inline-start: calc(min(var(--category-depth, 0), 4) * .85rem); }
}

/* Theme choice, available throughout the application and on sign-in pages. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 44px; padding: .6rem .8rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; font-size: .875rem; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.main-nav .theme-toggle { align-self: center; margin: .4rem 0 .4rem auto; }
.main-nav > .nav-account { margin-left: 0; }
.theme-access { position: absolute; top: 1rem; right: 1rem; z-index: 10; }
.auth-body .auth-page { padding-top: 5rem; }
@media (max-width: 760px) { .main-nav .theme-toggle { margin-left: 0; } }

.theme-toggle[hidden] { display: none; }
