/* ---------------------------------------------------------------------------
   Aligned with Microsoft Fluent, so the app reads as a tool that belongs next to
   the Azure portal rather than a chat toy.

   Three rules hold it together:
     1. Colour carries meaning. The accent is for actions and the current
        selection only, never decoration.
     2. Monospace is for machine text -- endpoints, JSON, tool names, keys.
        Prose is set in the UI font.
     3. One spacing scale (4/8/12/16/24/32) and five type sizes. No others.
   --------------------------------------------------------------------------- */

:root {
    --bg: #faf9f8;
    --surface: #ffffff;
    --surface-alt: #f5f4f2;
    --border: #e1dfdd;
    --border-strong: #c8c6c4;

    --text: #242424;
    --text-secondary: #5d5a58;
    --text-tertiary: #8a8886;

    --accent: #0f6cbd;
    --accent-hover: #115ea3;
    --accent-subtle: #eff6fc;
    --accent-border: #b4d6fa;

    --success: #0e700e;
    --warning-text: #8a5300;
    --warning-bg: #fff8e6;
    --warning-border: #f2d18c;
    --danger: #b10e1c;
    --danger-bg: #fdf3f4;

    --radius: 4px;
    --radius-lg: 6px;
    --shadow: 0 1px 2px rgba(0, 0, 0, .07), 0 2px 8px rgba(0, 0, 0, .04);

    --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #1b1a19;
        --surface: #252423;
        --surface-alt: #2d2c2b;
        --border: #3b3a39;
        --border-strong: #545251;

        --text: #f3f2f1;
        --text-secondary: #c8c6c4;
        --text-tertiary: #a19f9d;

        --accent: #479ef5;
        --accent-hover: #62abf5;
        --accent-subtle: #0c1c2e;
        --accent-border: #1b4a7a;

        --success: #6ccb5f;
        --warning-text: #f2c661;
        --warning-bg: #2b2413;
        --warning-border: #5c4a1c;
        --danger: #f1707b;
        --danger-bg: #2b1618;

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

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--ui);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

code {
    font-family: var(--mono);
    font-size: 0.9em;
}

/* ---------- shell ---------- */

.shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px;
    height: 48px;
    flex: 0 0 48px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.brand {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.brand-sub {
    color: var(--text-secondary);
    font-size: 13px;
}

/* A hairline rule reads as cleaner separation than a middot. */
.brand-divider {
    width: 1px;
    height: 16px;
    background: var(--border-strong);
    flex: 0 0 auto;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Status reads as a quiet badge, not a traffic light. */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-alt);
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-tertiary);
}

.status-ready .dot {
    background: var(--success);
}

.status-warn {
    color: var(--warning-text);
    background: var(--warning-bg);
    border-color: var(--warning-border);
}

.status-warn .dot {
    background: var(--warning-text);
}

.nav-link {
    color: var(--text-secondary);
    font-size: 13px;
    padding: 5px 10px;
    border-radius: var(--radius);
}

.nav-link:hover {
    background: var(--surface-alt);
    color: var(--text);
    text-decoration: none;
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-subtle);
}

main {
    flex: 1 1 auto;
    min-height: 0;
    /* The chat workbench filled the viewport and scrolled its own transcript pane,
       so this was 'hidden'. The digest is a document: it must scroll here. */
    overflow-y: auto;
}

/* ---------- workbench ---------- */

.workbench {
    display: flex;
    height: 100%;
    min-height: 0;
}

.sidebar {
    flex: 0 0 264px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow-y: auto;
}

.sidebar-heading {
    margin: 4px 8px 8px;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    font-weight: 600;
}

/* Fluent nav pattern: a selected row is marked by an accent bar, not a filled block. */
.mode {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    text-align: left;
    padding: 8px 10px 8px 12px;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font: inherit;
}

.mode:hover:not(:disabled) {
    background: var(--surface-alt);
}

.mode.selected {
    background: var(--accent-subtle);
}

.mode.selected::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 2px;
    background: var(--accent);
}

.mode:disabled {
    opacity: .5;
    cursor: default;
}

.mode-number {
    flex: 0 0 18px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text-tertiary);
    padding-top: 2px;
}

.mode.selected .mode-number {
    color: var(--accent);
}

.mode-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.mode-title {
    font-size: 13px;
    font-weight: 500;
}

.mode.selected .mode-title {
    font-weight: 600;
    color: var(--accent);
}

.mode-shape {
    font-size: 12px;
    color: var(--text-tertiary);
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    margin: 12px 8px 0;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.sidebar-footnote {
    margin: auto 8px 4px;
    padding-top: 16px;
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ---------- buttons ---------- */

button {
    font: inherit;
}

.ghost {
    flex: 1;
    padding: 5px 12px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 13px;
}

.ghost:hover:not(:disabled) {
    background: var(--surface-alt);
}

.ghost:disabled {
    opacity: .4;
    cursor: default;
}

.ghost.on {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-subtle);
}

.ghost.small {
    flex: 0 0 auto;
}

.primary,
.button,
.send {
    padding: 6px 16px;
    background: var(--accent);
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    display: inline-block;
}

.primary:hover:not(:disabled),
.send:hover:not(:disabled),
.button:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.primary:disabled,
.send:disabled {
    opacity: .4;
    cursor: default;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ---------- panel ---------- */

.panel {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.panel-header {
    flex: 0 0 auto;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta {
    display: flex;
    gap: 12px;
    font-size: 13px;
    min-width: 0;
}

.meta-label {
    flex: 0 0 80px;
    color: var(--text-tertiary);
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-weight: 600;
    padding-top: 2px;
}

.meta-value {
    color: var(--text-secondary);
    min-width: 0;
}

/* Machine text stays monospace; the instruction prose does not. */
.meta-value.machine {
    font-family: var(--mono);
    font-size: 12px;
}

.empty {
    margin: auto;
    max-width: 440px;
    padding: 32px;
    text-align: center;
    color: var(--text-secondary);
}

.empty h1 {
    color: var(--text);
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
}

.warn-inline {
    color: var(--warning-text);
}

.blocked {
    margin: 24px;
    padding: 16px;
    border: 1px solid var(--warning-border);
    border-left: 3px solid var(--warning-text);
    border-radius: var(--radius);
    background: var(--warning-bg);
}

.blocked strong {
    display: block;
    margin-bottom: 4px;
}

.blocked p {
    color: var(--text-secondary);
    margin: 0 0 16px;
}

/* ---------- transcript ---------- */

.transcript {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.line {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    max-width: 820px;
}

/* A quiet label, not a chat nameplate. */
.speaker {
    flex: 0 0 68px;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-tertiary);
    padding-top: 3px;
}

.line.user .speaker {
    color: var(--text-secondary);
}

.line.assistant .speaker {
    color: var(--accent);
}

.bubble {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 0;
    flex: 1;
}

.line.user .bubble {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 8px 12px;
}

.notice,
.error {
    font-size: 12.5px;
    padding-left: 84px;
    color: var(--text-tertiary);
    max-width: 820px;
}

.error {
    color: var(--danger);
    background: var(--danger-bg);
    border-left: 3px solid var(--danger);
    border-radius: var(--radius);
    padding: 8px 12px;
    margin-left: 84px;
}

/* Three dots while the model thinks, instead of a blinking block. */
.typing {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    height: 20px;
}

.typing i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--text-tertiary);
    animation: pulse 1.2s infinite ease-in-out;
}

.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }

@keyframes pulse {
    0%, 60%, 100% { opacity: .25; }
    30%           { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
    .typing i { animation: none; opacity: .5; }
}

/* ---------- tool calls ---------- */

.tool {
    margin-left: 84px;
    max-width: 736px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: 13px;
    overflow: hidden;
}

.tool summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-secondary);
    list-style: none;
}

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

/* Disclosure chevron, rotating on open. */
.tool summary::before {
    content: "";
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--text-tertiary);
    border-bottom: 1.5px solid var(--text-tertiary);
    transform: rotate(-45deg);
    transition: transform .15s ease;
    margin-right: 2px;
}

.tool[open] summary::before {
    transform: rotate(45deg);
}

.tool-badge {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .06em;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 3px;
    background: var(--accent-subtle);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.tool summary code {
    color: var(--text);
    font-weight: 600;
}

.tool-args,
.tool-preview {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-tertiary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.tool-running {
    color: var(--warning-text);
    margin-left: auto;
    flex: 0 0 auto;
    font-size: 12px;
}

.tool-result {
    margin: 0;
    padding: 12px;
    border-top: 1px solid var(--border);
    background: var(--surface-alt);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text-secondary);
    max-height: 320px;
    overflow-y: auto;
}

/* ---------- history ---------- */

.history {
    flex: 0 0 auto;
    max-height: 38%;
    overflow-y: auto;
    margin: 16px 24px 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    font-size: 12px;
}

.history-head {
    color: var(--text-tertiary);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    font-weight: 600;
}

.history-row {
    display: flex;
    gap: 12px;
    padding: 3px 0;
    min-width: 0;
}

.role {
    flex: 0 0 72px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 600;
    color: var(--text-tertiary);
}

.role-system    { color: var(--warning-text); }
.role-user      { color: var(--text-secondary); }
.role-assistant { color: var(--accent); }

.history-text {
    color: var(--text-secondary);
    font-family: var(--mono);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- composer ---------- */

.composer {
    flex: 0 0 auto;
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.composer textarea {
    flex: 1 1 auto;
    resize: none;
    padding: 9px 12px;
    background: var(--bg);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    line-height: 1.5;
}

.composer textarea::placeholder {
    color: var(--text-tertiary);
}

.composer textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.composer textarea:disabled {
    background: var(--surface-alt);
    opacity: .7;
}

.send {
    flex: 0 0 auto;
    padding: 9px 20px;
}

.send.stop {
    background: var(--surface);
    border-color: var(--danger);
    color: var(--danger);
}

.send.stop:hover {
    background: var(--danger-bg);
}

/* ---------- settings ---------- */

.settings {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    height: 100%;
    overflow-y: auto;
}

.settings h1 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 8px;
}

.settings h2 {
    font-size: 15px;
    font-weight: 600;
    margin: 32px 0 8px;
}

.lede {
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.origin {
    margin: 0 0 24px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 12.5px;
    color: var(--text-secondary);
    overflow-wrap: anywhere;
}

.origin strong {
    color: var(--text);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 20px;
}

.field label {
    font-size: 13px;
    font-weight: 600;
}

.optional {
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 12px;
}

.field input {
    padding: 7px 10px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    width: 100%;
}

.field input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.secret {
    display: flex;
    gap: 8px;
}

.hint {
    font-size: 12px;
    color: var(--text-tertiary);
    font-family: var(--mono);
}

.problems {
    margin: 0 0 20px;
    padding: 12px 12px 12px 32px;
    border: 1px solid var(--warning-border);
    border-left: 3px solid var(--warning-text);
    border-radius: var(--radius);
    background: var(--warning-bg);
    color: var(--warning-text);
    font-size: 13px;
}

.actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 12px;
}

.actions .ghost {
    flex: 0 0 auto;
}

.saved {
    color: var(--success);
    font-size: 13px;
}

.load-error {
    color: var(--warning-text);
    font-size: 13px;
}

/* Read-only view of the configuration, used when hosted. */
.readonly-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
}

.readonly-grid dt,
.readonly-grid dd {
    background: var(--surface);
    margin: 0;
    padding: 10px 12px;
    font-size: 13px;
}

.readonly-grid dt {
    color: var(--text-secondary);
    font-weight: 600;
}

.readonly-grid dd {
    font-family: var(--mono);
    font-size: 12.5px;
    overflow-wrap: anywhere;
}

.value-missing {
    color: var(--warning-text);
}

.danger-zone {
    margin-top: 32px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.danger-zone h2 {
    margin: 0 0 8px;
}

.danger-zone p {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 12px;
    overflow-wrap: anywhere;
}

.danger-zone .ghost {
    border-color: var(--danger);
    color: var(--danger);
    margin-right: 8px;
}

.danger-zone .ghost:hover {
    background: var(--danger-bg);
}

/* ---------------------------------------------------------------------------
   Morning AI Digest — the published page.

   A publication, not a tool, but no longer a single narrow column: five short
   sections in one column left most of a widescreen empty and pushed the last
   section below three scrolls of nothing. The article now flows into two
   newspaper columns once there is room, each still at a readable measure, with
   every item in its own card so the eye has edges to work with.

   None of the machinery that produced the digest appears here.
   --------------------------------------------------------------------------- */

[hidden] { display: none !important; }

.paper {
    max-width: 720px;
    margin: 0 auto;
    padding: 48px 24px 72px;
}

/* Masthead ---------------------------------------------------------------- */

.masthead {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--text);
}

.masthead h1 {
    margin: 0 0 10px;
    font-size: 38px;
    font-weight: 700;
    letter-spacing: -.025em;
    line-height: 1.05;
}

.dateline {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.dateline .sep { margin: 0 8px; color: var(--text-tertiary); }

.editions {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
}

.edition-step { color: var(--accent); text-decoration: none; }
.edition-step:hover { text-decoration: underline; }
.edition-step.disabled { color: var(--text-tertiary); opacity: .5; }
.edition-today { color: var(--text-secondary); text-decoration: none; }
.edition-today:hover { color: var(--accent); }

/* Toolbar: section jumps, filter, density ---------------------------------- */

.toolbar {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 28px;
    padding: 10px 0;
    /* The sticky bar sits over scrolling cards, so it needs its own ground. */
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.jump {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.jump-link {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 12px;
    text-decoration: none;
    white-space: nowrap;
}

.jump-link:hover { border-color: var(--accent-border); color: var(--accent); }

.jump-link.active {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 600;
}

.toolbar-right { display: flex; align-items: center; gap: 8px; }

.filter-input {
    width: 150px;
    padding: 5px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--ui);
    font-size: 13px;
}

.filter-input:focus { border-color: var(--accent); outline: none; }

.density-toggle {
    padding: 5px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--ui);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.density-toggle:hover { border-color: var(--accent-border); color: var(--accent); }

.filter-empty {
    margin: 24px 0;
    color: var(--text-tertiary);
    font-size: 14px;
    font-style: italic;
}

/* The article -------------------------------------------------------------- */

.digest-body { font-size: 15px; }

.section { margin-bottom: 36px; }

/* Anchored jumps must clear the sticky toolbar or the heading lands under it. */
.section { scroll-margin-top: 64px; }

.digest-body h2 {
    margin: 0 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}

.section-emoji { margin-right: 8px; }

.digest-body ul {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.item {
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}

.item:hover {
    border-color: var(--accent-border);
    box-shadow: var(--shadow);
}

.item-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: -.01em;
}

/* Titles are the only thing on the page you can click, so they are the only
   thing that carries the accent. */
.item-title a {
    color: var(--accent);
    text-decoration: none;
}

.item-title a:hover { text-decoration: underline; }

.ext {
    display: inline-block;
    margin-left: 5px;
    font-size: 11px;
    opacity: .55;
    transform: translateY(-1px);
}

.item-title a:hover .ext { opacity: 1; }

/* Badges: provenance and engagement, as pills rather than a grey line ------- */

.item-meta {
    margin: 9px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.badge {
    padding: 2px 8px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-secondary);
    font-size: 11px;
    line-height: 1.6;
    white-space: nowrap;
}

.badge.source {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
    color: var(--accent);
    font-weight: 600;
}

.item-note {
    margin: 10px 0 0;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Compact view: titles and badges only ------------------------------------- */

.density-toggle .when-compact { display: none; }
body.is-compact .density-toggle .when-expanded { display: none; }
body.is-compact .density-toggle .when-compact { display: inline; }

body.is-compact .item-note { display: none; }
body.is-compact .item { padding: 10px 14px; }
body.is-compact .digest-body ul { gap: 6px; }
body.is-compact .item-title { font-size: 15px; }

/* Colophon ----------------------------------------------------------------- */

.colophon-note {
    margin: 0 0 24px;
    padding: 8px 12px;
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    border-radius: var(--radius);
    color: var(--warning-text);
    font-size: 12.5px;
}

.colophon {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    color: var(--text-tertiary);
    font-size: 12px;
    line-height: 1.6;
}

.colophon p { margin: 0; }

.archive {
    margin-top: 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
}

.archive-label {
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: 11px;
}

.archive a {
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
}

.archive a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* Two columns once there is room ------------------------------------------- */

@media (min-width: 1100px) {
    .paper { max-width: 1180px; }

    /* CSS columns rather than grid: sections are wildly different heights, and
       columns pack them without leaving a grid row sized to the tallest. Each
       section is kept whole so a heading never separates from its items. */
    .digest-body {
        column-count: 2;
        column-gap: 36px;
    }

    .section {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}

@media (max-width: 640px) {
    .paper { padding: 32px 16px 56px; }
    .masthead h1 { font-size: 29px; }
    .toolbar { gap: 10px; }
    .toolbar-right { width: 100%; }
    .filter-input { flex: 1 1 auto; width: auto; }
}

/* Enhancements for UX */
.edition-picker {
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--ui);
    font-size: 13px;
    cursor: pointer;
}
.edition-picker:focus {
    outline: none;
    border-color: var(--accent);
}
.rss-button {
    padding: 5px 10px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-family: var(--ui);
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.rss-button:hover {
    border-color: var(--accent-border);
    color: var(--accent);
}
.deep-link {
    opacity: 0;
    margin-left: 8px;
    font-size: 14px;
    color: var(--text-tertiary) !important;
    text-decoration: none !important;
    transition: opacity 0.1s ease;
}
.item:hover .deep-link {
    opacity: 1;
}
.deep-link:hover {
    color: var(--accent) !important;
}
