/* TGED content desk - design system.
   Tokens first (both themes), mapped onto Bootstrap 5.3 variables. Reference page: GET /ui. */

/* ---------- Fonts (self-hosted, latin subset) ---------- */
@font-face {
    font-family: "Archivo";
    src: url("../vendor/fonts/archivo-latin-wdth-normal.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Public Sans";
    src: url("../vendor/fonts/public-sans-latin-400-normal.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Public Sans";
    src: url("../vendor/fonts/public-sans-latin-500-normal.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Public Sans";
    src: url("../vendor/fonts/public-sans-latin-600-normal.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Public Sans";
    src: url("../vendor/fonts/public-sans-latin-400-italic.woff2") format("woff2");
    font-weight: 400;
    font-style: italic;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root,
[data-bs-theme="dark"] {
    --tged-bg: #141C27;
    --tged-surface: #1B2533;
    --tged-raised: #233042;
    --tged-lift: #27364A;
    --tged-border: #2E3B4F;
    --tged-text: #E6EAF0;
    --tged-muted: #93A0B4;
    --tged-muted-strong: #A9B5C7;
    --tged-accent: #7DB4FF;
    --tged-accent-from: #93C2FF;
    --tged-accent-to: #5E9BF2;
    --tged-on-accent: #0B1B33;
    --tged-accent-text: #7DB4FF;
    --tged-accent-hover: #A5CBFF;
    --tged-focus: #7DB4FF;
    --tged-thumb-on: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%230B1B33'/%3e%3c/svg%3e");
    --tged-danger: #B42318;
    --tged-danger-hover: #C73A2E;
    --tged-danger-text: #FF9A90;
    --tged-danger-tint: rgba(255, 123, 109, 0.14);
    --tged-ok-tint: rgba(95, 208, 138, 0.16);
    --tged-on-danger: #FFFFFF;

    --tged-edge: rgba(255, 255, 255, 0.06);
    --tged-line: rgba(255, 255, 255, 0.07);
    --tged-hl: rgba(255, 255, 255, 0.035);
    --tged-tint: rgba(255, 255, 255, 0.06);
    --tged-tint-hover: rgba(255, 255, 255, 0.1);
    --tged-glass: rgba(27, 37, 51, 0.62);
    --tged-track: rgba(255, 255, 255, 0.09);
    --tged-glow-accent: rgba(125, 180, 255, 0.08);
    --tged-glow-indigo: rgba(76, 70, 214, 0.1);
    --tged-noise-opacity: 0.05;
    --tged-shadow-float: 0 22px 56px -14px rgba(0, 0, 0, 0.6), 0 6px 18px rgba(0, 0, 0, 0.28);
    --tged-accent-glow: rgba(125, 180, 255, 0.3);
    --tged-card-hl: inset 0 1px 0 rgba(255, 255, 255, 0.055);
    --tged-shadow-card: 0 1px 2px rgba(0, 0, 0, 0.16), 0 10px 24px -16px rgba(0, 0, 0, 0.5);
    --tged-shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.2), 0 18px 36px -18px rgba(0, 0, 0, 0.62);
    --tged-glass-modal: rgba(35, 48, 66, 0.86);

    --tged-net-facebook: #1877F2;
    --tged-net-instagram: #D62976;
    --tged-net-x: var(--tged-text);
    --tged-net-facebook-icon: #5C9DFF;
    --tged-net-instagram-icon: #F062A0;
    --tged-net-x-icon: #E6EAF0;
    --tged-net-facebook-tint: #1B304E;
    --tged-net-instagram-tint: #35263C;
    --tged-net-instagram-tintb: #3E3431;
    --tged-net-x-tint: #37414D;

    --pill-draft: #93A0B4;
    --pill-pending: #D8B43A;
    --pill-approved: #A5B4FC;
    --pill-scheduled: #38D0D0;
    --pill-publishing: #B79BFF;
    --pill-published: #5FD08A;
    --pill-failed: #FF8F85;
    --pill-attention: #FFA94D;
    --pill-rejected: #FF8F85;
    --pill-deleted: #93A0B4;

    --tged-thumb-off: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%2393A0B4'/%3e%3c/svg%3e");

    --bs-body-bg: #141C27;
    --bs-body-bg-rgb: 20, 28, 39;
    --bs-body-color: #E6EAF0;
    --bs-body-color-rgb: 230, 234, 240;
    --bs-emphasis-color: #E6EAF0;
    --bs-secondary-color: #93A0B4;
    --bs-secondary-bg: #233042;
    --bs-tertiary-bg: #233042;
    --bs-border-color: #2E3B4F;
    --bs-link-color: #7DB4FF;
    --bs-link-hover-color: #A5CBFF;
    --bs-link-color-rgb: 201, 162, 39;
    --bs-link-hover-color-rgb: 216, 180, 58;
    --bs-heading-color: #E6EAF0;
    color-scheme: dark;
}

[data-bs-theme="light"] {
    --tged-bg: #F3F5F8;
    --tged-surface: #FFFFFF;
    --tged-raised: #F8FAFC;
    --tged-lift: #FFFFFF;
    --tged-border: #D9DFE7;
    --tged-text: #17202B;
    --tged-muted: #5B6778;
    --tged-muted-strong: #4C5868;
    --tged-accent: #2563EB;
    --tged-accent-from: #2B6BEE;
    --tged-accent-to: #1D4ED8;
    --tged-on-accent: #FFFFFF;
    --tged-accent-text: #1D4ED8;
    --tged-accent-hover: #1D4ED8;
    --tged-focus: #1D4ED8;
    --tged-thumb-on: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%23FFFFFF'/%3e%3c/svg%3e");
    --tged-danger: #B42318;
    --tged-danger-hover: #9B1C13;
    --tged-danger-text: #B42318;
    --tged-danger-tint: rgba(180, 35, 24, 0.09);
    --tged-ok-tint: rgba(22, 128, 61, 0.12);
    --tged-on-danger: #FFFFFF;

    --tged-edge: rgba(23, 32, 43, 0.1);
    --tged-line: rgba(23, 32, 43, 0.08);
    --tged-hl: rgba(255, 255, 255, 0);
    --tged-tint: rgba(23, 32, 43, 0.05);
    --tged-tint-hover: rgba(23, 32, 43, 0.09);
    --tged-glass: rgba(255, 255, 255, 0.7);
    --tged-track: rgba(23, 32, 43, 0.09);
    --tged-glow-accent: rgba(37, 99, 235, 0.07);
    --tged-glow-indigo: rgba(76, 70, 214, 0.06);
    --tged-noise-opacity: 0.035;
    --tged-shadow-float: 0 22px 56px -14px rgba(23, 32, 43, 0.28), 0 6px 18px rgba(23, 32, 43, 0.12);
    --tged-accent-glow: rgba(37, 99, 235, 0.3);
    --tged-card-hl: inset 0 1px 0 rgba(255, 255, 255, 0.9);
    --tged-shadow-card: 0 1px 2px rgba(23, 32, 43, 0.05), 0 10px 24px -18px rgba(23, 32, 43, 0.2);
    --tged-shadow-lift: 0 2px 4px rgba(23, 32, 43, 0.07), 0 18px 36px -20px rgba(23, 32, 43, 0.3);
    --tged-glass-modal: rgba(255, 255, 255, 0.88);

    --tged-net-facebook: #1877F2;
    --tged-net-instagram: #D62976;
    --tged-net-x: var(--tged-text);
    --tged-net-facebook-icon: #1877F2;
    --tged-net-instagram-icon: #D62976;
    --tged-net-x-icon: #17202B;
    --tged-net-facebook-tint: #DFECFD;
    --tged-net-instagram-tint: #F9E1EC;
    --tged-net-instagram-tintb: #FDEBDD;
    --tged-net-x-tint: #DFE0E1;

    --pill-draft: #4C5868;
    --pill-pending: #8A5700;
    --pill-approved: #4338CA;
    --pill-scheduled: #0B6479;
    --pill-publishing: #6D28D9;
    --pill-published: #166534;
    --pill-failed: #B42318;
    --pill-attention: #9A3F05;
    --pill-rejected: #B42318;
    --pill-deleted: #5B6778;

    --tged-thumb-off: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%235B6778'/%3e%3c/svg%3e");

    --bs-body-bg: #F3F5F8;
    --bs-body-bg-rgb: 243, 245, 248;
    --bs-body-color: #17202B;
    --bs-body-color-rgb: 23, 32, 43;
    --bs-emphasis-color: #17202B;
    --bs-secondary-color: #5B6778;
    --bs-secondary-bg: #F8FAFC;
    --bs-tertiary-bg: #F8FAFC;
    --bs-border-color: #D9DFE7;
    --bs-link-color: #1D4ED8;
    --bs-link-hover-color: #1E40AF;
    --bs-link-color-rgb: 122, 94, 8;
    --bs-link-hover-color-rgb: 92, 69, 6;
    --bs-heading-color: #17202B;
    --bs-code-color: #B4266C;
    color-scheme: light;
}

/* Shared tokens (task-078): THEME.md documents each group; values live only here. Names with a number carry the px size at a 16 px root. */
:root {
    --tged-fs-9: 0.5625rem;
    --tged-fs-10: 0.625rem;
    --tged-fs-11: 0.6875rem;
    --tged-fs-12: 0.75rem;
    --tged-fs-13: 0.8125rem;
    --tged-fs-14: 0.875rem;
    --tged-fs-15: 0.9375rem;
    --tged-fs-16: 1rem;
    --tged-fs-17: 1.0625rem;
    --tged-fs-18: 1.125rem;
    --tged-fs-20: 1.25rem;
    --tged-fs-22: 1.375rem;
    --tged-fs-24: 1.5rem;
    --tged-fs-30: 1.875rem;
    --tged-fs-32: 2rem;
    --tged-fs-36: 2.25rem;
    --tged-fw-regular: 400;
    --tged-fw-medium: 500;
    --tged-fw-semibold: 600;
    --tged-fw-display: 650;
    --tged-fw-bold: 700;
    --tged-lh-1: 1;
    --tged-lh-110: 1.1;
    --tged-lh-115: 1.15;
    --tged-lh-120: 1.2;
    --tged-lh-125: 1.25;
    --tged-lh-130: 1.3;
    --tged-lh-135: 1.35;
    --tged-lh-145: 1.45;
    --tged-lh-body: 1.5;
    --tged-lh-155: 1.55;
    --tged-lh-18px: 1.125rem;
    --tged-lh-20px: 1.25rem;
    --tged-lh-22px: 1.375rem;
    --tged-lh-24px: 1.5rem;
    --tged-ls-tight: -0.03em;
    --tged-ls-title: -0.025em;
    --tged-ls-heading: -0.02em;
    --tged-ls-art: 0.02em;
    --tged-ls-caps: 0.08em;
    --tged-ls-brand: 0.14em;
    --tged-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --tged-space-1: 0.0625rem;
    --tged-space-2: 0.125rem;
    --tged-space-3: 0.1875rem;
    --tged-space-4: 0.25rem;
    --tged-space-5: 0.3125rem;
    --tged-space-6: 0.375rem;
    --tged-space-7: 0.4375rem;
    --tged-space-8: 0.5rem;
    --tged-space-10: 0.625rem;
    --tged-space-12: 0.75rem;
    --tged-space-14: 0.875rem;
    --tged-space-16: 1rem;
    --tged-space-18: 1.125rem;
    --tged-space-20: 1.25rem;
    --tged-space-22: 1.375rem;
    --tged-space-24: 1.5rem;
    --tged-space-28: 1.75rem;
    --tged-space-32: 2rem;
    --tged-space-40: 2.5rem;
    --tged-space-48: 3rem;
    --tged-space-64: 4rem;

    --tged-radius-3: 3px;
    --tged-radius-4: 4px;
    --tged-radius-6: 6px;
    --tged-radius-8: 8px;
    --tged-radius-inner: 9px;
    --tged-radius-12: 12px;
    --tged-radius-card: 14px;
    --tged-radius-pill: 999px;
    --tged-radius-round: 50%;
    --tged-radius-panel: 16px;
    --tged-radius-control: 10px;

    --tged-dur-fast: 0.12s;
    --tged-dur-quick: 0.15s;
    --tged-dur-base: 0.18s;
    --tged-dur-fade: 0.2s;
    --tged-dur-slide: 0.22s;
    --tged-dur-page: 0.24s;
    --tged-dur-toast: 0.28s;
    --tged-dur-bar: 0.4s;
    --tged-ease: ease;
    --tged-ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
    --tged-ease-spring: cubic-bezier(0.3, 1.5, 0.5, 1);

    --tged-z-raised: 2;
    --tged-z-over: 3;
    --tged-z-sticky: 20;
    --tged-z-popover: 30;
    --tged-z-bar: 100;
    --tged-z-menu: 1040;
    --tged-z-toast: 1090;
    --tged-z-overlay: 2000;
    --tged-z-palette: 2100;

    --tged-blur-glass: blur(16px) saturate(140%);
    --tged-blur-3: blur(3px);
    --tged-blur-4: blur(4px);
    --tged-blur-6: blur(6px);
    --tged-rule-edge: 1px solid var(--tged-edge);
    --tged-rule-line: 1px solid var(--tged-line);
    --tged-rule-border: 1px solid var(--tged-border);
    --tged-outline: 2px solid var(--tged-focus);
    --tged-outline-accent: 2px solid var(--tged-accent-text);
    --tged-inset-edge: inset 0 0 0 1px var(--tged-edge);
    --tged-inset-accent: inset 0 0 0 1px var(--tged-accent);
    --tged-inset-focus: inset 0 0 0 2px var(--tged-focus);
    --tged-ring: 0 0 0 4px color-mix(in srgb, var(--tged-accent) 22%, transparent);
    --tged-ring-soft: 0 0 0 3px color-mix(in srgb, var(--tged-accent) 22%, transparent);
    --tged-ring-glow: 0 0 0 4px var(--tged-accent-glow), 0 0 18px var(--tged-accent-glow);
    --tged-glow-btn: 0 6px 22px -6px var(--tged-accent-glow);
    --tged-attention-tint: color-mix(in srgb, var(--pill-attention) 12%, transparent);
    --tged-accent-soft: color-mix(in srgb, var(--tged-accent) 16%, transparent);
    --tged-accent-soft-20: color-mix(in srgb, var(--tged-accent) 20%, transparent);
    --tged-accent-mid: color-mix(in srgb, var(--tged-accent) 45%, transparent);

    /* Same in both themes: text and scrims over images, the lightbox, Discord buttons */
    --tged-on-dark: #FFFFFF;
    --tged-danger-from: #FF8F85;
    --tged-scrim-55: rgba(8, 12, 18, 0.55);
    --tged-scrim-62: rgba(8, 12, 18, 0.62);
    --tged-scrim-70: rgba(8, 12, 18, 0.7);
    --tged-scrim-88: rgba(8, 12, 18, 0.88);
    --tged-fade-from: rgba(0, 0, 0, 0.78);
    --tged-fade-to: rgba(0, 0, 0, 0);
    --tged-pvnav-fg: #0B1B33;
    --tged-pvnav-bg: rgba(255, 255, 255, 0.88);
    --tged-lb-text: #F3F6FA;
    --tged-lb-muted: #D3DBE6;
    --tged-lb-link: #C7DBFF;
    --tged-lb-img: rgba(255, 255, 255, 0.04);
    --tged-lb-btn: rgba(255, 255, 255, 0.12);
    --tged-lb-btn-edge: rgba(255, 255, 255, 0.28);
    --tged-dc-green: #1F7A3E;
    --tged-dc-red: #B42318;
    /* Artwork samples: the house post previews copy the look of the published image, not of the dashboard */
    --tged-art-link: #1d9bf0;
    --tged-art-black: #000000;
    --tged-art-black-text: #e7e9ea;
    --tged-art-black-muted: #71767b;
    --tged-art-white: #ffffff;
    --tged-art-white-text: #0f1419;
    --tged-art-white-muted: #536471;
    --tged-art-blue: #406b9a;
    --tged-art-blue-muted: #d6e2f0;
    --tged-art-hl: #7ECDF9;
    --tged-art-avatar: rgba(127, 127, 127, 0.35);

    /* Spacing tokens (task-045): label to value, items of one meta row, and buttons of one group never sit closer than these */
    --tged-gap-stack: var(--tged-space-16);
    --tged-gap-label: var(--tged-space-8);
    --tged-gap-meta: var(--tged-space-12);
    --tged-gap-btns: var(--tged-space-8);
    --tged-gap-icon: var(--tged-space-8);
    --tged-tap: 2.5rem;
    --tged-btn-h: 2.25rem;
    --tged-btn-h-sm: 1.875rem;
    --tged-sidebar-w: 248px;
    --tged-noise: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    --tged-font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --tged-font-display: "Archivo", "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

    --bs-body-font-family: var(--tged-font-body);
    --bs-body-font-size: var(--tged-fs-15);
    --bs-body-line-height: var(--tged-lh-body);
    --bs-border-radius: var(--tged-radius-control);
    --bs-border-radius-sm: var(--tged-radius-8);
    --bs-border-radius-lg: var(--tged-radius-panel);
    --bs-border-radius-pill: 50rem;
}

/* ---------- Base ---------- */
body {
    background: var(--tged-bg);
    color: var(--tged-text);
    font-family: var(--tged-font-body);
    font-size: var(--tged-fs-15);
    line-height: var(--tged-lh-body);
}

/* Ambient background: two soft glows and a faint noise, fixed behind everything. Static. */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}
body::before {
    background:
        radial-gradient(54rem 40rem at -6% -10%, var(--tged-glow-accent), transparent 70%),
        radial-gradient(58rem 46rem at 108% 108%, var(--tged-glow-indigo), transparent 70%);
}
body::after {
    background-image: var(--tged-noise);
    opacity: var(--tged-noise-opacity);
}

h1, h2, h3, h4,
.page-title, .section-title, .wordmark-name, .lane-name, .modal-title, .offcanvas-title, .lane-countdown, .stat-value {
    font-family: var(--tged-font-display);
    font-weight: var(--tged-fw-display);
    font-stretch: 90%;
    letter-spacing: var(--tged-ls-heading);
    color: var(--tged-text);
}

a { color: var(--tged-accent-text); }
a:hover { color: var(--bs-link-hover-color); }

.tnum { font-variant-numeric: tabular-nums; }
.is-empty { color: var(--tged-muted); }

:focus-visible {
    outline: var(--tged-outline);
    outline-offset: 2px;
}

.skip-link {
    position: absolute;
    left: var(--tged-space-12);
    top: -4rem;
    z-index: var(--tged-z-overlay);
    padding: var(--tged-space-8) var(--tged-space-14);
    background: var(--tged-accent);
    color: var(--tged-on-accent);
    border-radius: var(--tged-radius-control);
    font-weight: var(--tged-fw-semibold);
    text-decoration: none;
}
.skip-link:focus { top: var(--tged-space-12); }

main:focus { outline: none; }

html:not(.js) .js-only { display: none !important; }

/* ---------- Shell ---------- */
.shell-main { min-height: 100vh; }

.topbar {
    position: sticky;
    top: 0;
    z-index: var(--tged-z-bar);
    display: flex;
    align-items: center;
    gap: var(--tged-space-12);
    min-height: 4.25rem;
    padding: var(--tged-space-8) var(--tged-space-16);
    background: var(--tged-surface);
    border-bottom: var(--tged-rule-edge);
}
.page-title {
    margin: 0;
    min-width: 0;
    font-size: var(--tged-fs-24);
    line-height: var(--tged-lh-120);
    letter-spacing: var(--tged-ls-title);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
@media (min-width: 768px) {
    .page-title { font-size: var(--tged-fs-30); }
}
.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: var(--tged-space-8);
}

.content {
    max-width: 1440px;
    margin-inline: auto;
    padding: var(--tged-space-24) var(--tged-space-16) var(--tged-space-48);
}

.section-title {
    font-size: var(--tged-fs-18);
    font-weight: var(--tged-fw-semibold);
    margin: 0 0 var(--tged-space-12);
}

@media (min-width: 992px) {
    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: var(--tged-sidebar-w);
        background: var(--tged-surface);
        border-right: var(--tged-rule-edge);
        overflow-y: auto;
    }
    .shell-main { margin-left: var(--tged-sidebar-w); }
    .topbar { padding: var(--tged-space-8) var(--tged-space-32); }
    .content { padding: var(--tged-space-32) var(--tged-space-32) var(--tged-space-64); }
}

/* Glass chrome. The solid surfaces above are the fallback and what the contrast tests measure. */
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .topbar {
        background: var(--tged-glass);
        -webkit-backdrop-filter: var(--tged-blur-glass);
        backdrop-filter: var(--tged-blur-glass);
    }
    @media (min-width: 992px) {
        .sidebar {
            background: var(--tged-glass);
            -webkit-backdrop-filter: var(--tged-blur-glass);
            backdrop-filter: var(--tged-blur-glass);
        }
    }
    @media (max-width: 991.98px) {
        .sidebar .offcanvas-lg {
            --bs-offcanvas-bg: var(--tged-glass);
            -webkit-backdrop-filter: var(--tged-blur-glass);
            backdrop-filter: var(--tged-blur-glass);
        }
    }
}

/* ---------- Sidebar ---------- */
.sidebar .offcanvas-lg {
    --bs-offcanvas-bg: var(--tged-surface);
    --bs-offcanvas-color: var(--tged-text);
    --bs-offcanvas-border-color: var(--tged-edge);
    --bs-offcanvas-width: 280px;
}
.sidebar .offcanvas-body {
    display: block;
    padding: var(--tged-space-20) var(--tged-space-12) var(--tged-space-24);
}
@media (min-width: 992px) {
    .sidebar .offcanvas-lg { background: transparent; }
    .sidebar .offcanvas-body { display: block; padding: var(--tged-space-20) var(--tged-space-12) var(--tged-space-24); }
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--tged-space-12);
    padding: var(--tged-space-4) var(--tged-space-8) var(--tged-space-20);
    text-decoration: none;
    color: var(--tged-text);
}
.brand:hover { color: var(--tged-text); }
.brand-logo {
    flex: none;
    display: block;
    width: var(--tged-space-40);
    height: var(--tged-space-40);
    object-fit: contain;
}
.brand-text { display: grid; line-height: var(--tged-lh-115); }
/* The one all-caps exception (owner ruling): the wordmark is literal capitals. */
.wordmark-name {
    display: block;
    font-size: var(--tged-fs-17);
    font-weight: var(--tged-fw-bold);
    font-stretch: 100%;
    line-height: var(--tged-lh-115);
    letter-spacing: var(--tged-ls-caps);
}
.wordmark-sub {
    display: block;
    margin-top: var(--tged-space-2);
    font-size: var(--tged-fs-11);
    letter-spacing: var(--tged-ls-brand);
    color: var(--tged-muted);
}

.side-group {
    margin: var(--tged-space-20) 0 var(--tged-space-6);
    padding: 0 var(--tged-space-10);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-semibold);
    color: var(--tged-muted);
}
.side-list { list-style: none; margin: 0; padding: 0; }
.side-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--tged-space-10);
    padding: var(--tged-space-5) var(--tged-space-8);
    border-radius: var(--tged-radius-control);
    color: var(--tged-text);
    text-decoration: none;
    transition: background-color var(--tged-dur-base) var(--tged-ease);
}
.side-icon {
    display: grid;
    place-items: center;
    flex: none;
    width: 1.875rem;
    height: 1.875rem;
    border-radius: var(--tged-radius-inner);
    color: var(--tged-muted);
    transition: background-color var(--tged-dur-base) var(--tged-ease), color var(--tged-dur-base) var(--tged-ease);
}
.side-icon .bi { font-size: var(--tged-fs-17); }
a.side-item:hover { background: var(--tged-tint); color: var(--tged-text); }
.side-item.active { background: var(--tged-tint); font-weight: var(--tged-fw-medium); }
.side-item.active .side-icon {
    background: var(--tged-accent-soft-20);
    color: var(--tged-accent-text);
}
.side-item.active::before {
    content: "";
    position: absolute;
    left: calc(var(--tged-space-12) * -1);
    top: var(--tged-space-4);
    bottom: var(--tged-space-4);
    width: 3px;
    border-radius: 0 var(--tged-radius-3) var(--tged-radius-3) 0;
    background: var(--tged-accent);
}
.side-item.is-soon { color: var(--tged-muted); cursor: default; }
.soon-tag {
    margin-left: auto;
    padding: 0 var(--tged-space-8);
    font-size: var(--tged-fs-12);
    line-height: var(--tged-lh-20px);
    border: var(--tged-rule-border);
    border-radius: var(--tged-radius-pill);
    color: var(--tged-muted);
}
.count-badge {
    display: inline-grid;
    place-items: center;
    min-width: var(--tged-space-22);
    height: var(--tged-space-22);
    margin-left: auto;
    padding: 0 var(--tged-space-7);
    font-size: var(--tged-fs-12);
    font-weight: var(--tged-fw-semibold);
    line-height: var(--tged-lh-1);
    border-radius: var(--tged-radius-pill);
}
.count-accent {
    color: var(--tged-on-accent);
    background: linear-gradient(180deg, var(--tged-accent-from), var(--tged-accent-to));
}
.count-red {
    color: var(--tged-on-danger);
    background: var(--tged-danger);
}

/* ---------- Segmented control ---------- */
.segmented {
    display: inline-flex;
    gap: var(--tged-space-2);
    padding: var(--tged-space-3);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-12);
}
.segmented-item {
    display: inline-flex;
    align-items: center;
    gap: var(--tged-space-6);
    padding: var(--tged-space-5) var(--tged-space-10);
    border: 0;
    border-radius: var(--tged-radius-inner);
    background: transparent;
    color: var(--tged-muted);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-medium);
    line-height: var(--tged-lh-20px);
    text-decoration: none;
    transition: background-color var(--tged-dur-base) var(--tged-ease), color var(--tged-dur-base) var(--tged-ease), transform var(--tged-dur-fast) var(--tged-ease);
}
.segmented-item:hover { color: var(--tged-text); }
.segmented-item:active { transform: scale(0.96); }
.segmented-item.active {
    background: var(--tged-raised);
    color: var(--tged-accent-text);
    box-shadow: var(--tged-inset-edge);
}
@media (max-width: 575.98px) {
    .topbar .seg-label { display: none; }
    .topbar .segmented-item { padding: var(--tged-space-5) var(--tged-space-8); }
}

/* ---------- Buttons ---------- */
/* One system (task-045, documented on /ui): variants btn-primary, btn-secondary, btn-danger (outline) and btn-danger-solid (confirm dialogs only);
   sizes standard and btn-sm (compact); btn-icon makes either square; links are for going somewhere, buttons for doing something. */
.btn {
    --bs-btn-border-radius: var(--tged-radius-control);
    --bs-btn-font-weight: var(--tged-fw-medium);
    --bs-btn-focus-box-shadow: none;
    --bs-btn-padding-x: var(--tged-space-14);
    --bs-btn-padding-y: 0;
    --bs-btn-font-size: var(--tged-fs-15);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--tged-gap-icon);
    min-height: var(--tged-btn-h);
    line-height: var(--tged-lh-120);
    white-space: nowrap;
    transition: transform var(--tged-dur-fast) var(--tged-ease), box-shadow var(--tged-dur-base) var(--tged-ease), background-color var(--tged-dur-base) var(--tged-ease), filter var(--tged-dur-base) var(--tged-ease), border-color var(--tged-dur-base) var(--tged-ease);
}
.btn.btn-sm {
    --bs-btn-padding-x: var(--tged-space-10);
    --bs-btn-font-size: var(--tged-fs-13);
    min-height: var(--tged-btn-h-sm);
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible, a:focus-visible, summary:focus-visible, .menu-pop-item:focus-visible { outline: var(--tged-outline-accent); outline-offset: 2px; }
.btn:disabled, .btn.disabled, fieldset:disabled .btn {
    cursor: not-allowed;
    pointer-events: auto;
    opacity: 0.55;
    filter: saturate(0.6);
    transform: none;
    box-shadow: none;
}
.btn:disabled:hover, .btn.disabled:hover { filter: saturate(0.6); box-shadow: none; }
.btn-primary {
    --bs-btn-color: var(--tged-on-accent);
    --bs-btn-bg: var(--tged-accent-to);
    --bs-btn-border-color: transparent;
    --bs-btn-hover-color: var(--tged-on-accent);
    --bs-btn-hover-bg: var(--tged-accent-to);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-active-color: var(--tged-on-accent);
    --bs-btn-active-bg: var(--tged-accent-to);
    --bs-btn-active-border-color: transparent;
    --bs-btn-disabled-color: var(--tged-on-accent);
    --bs-btn-disabled-bg: var(--tged-accent-to);
    --bs-btn-disabled-border-color: transparent;
    background-image: linear-gradient(180deg, var(--tged-accent-from), var(--tged-accent-to));
    font-weight: var(--tged-fw-semibold);
}
.btn-primary:hover { filter: brightness(1.06); box-shadow: var(--tged-glow-btn); }
.btn-primary:focus-visible { box-shadow: var(--tged-ring-glow); }
.btn-secondary {
    --bs-btn-color: var(--tged-text);
    --bs-btn-bg: var(--tged-tint);
    --bs-btn-border-color: var(--tged-edge);
    --bs-btn-hover-color: var(--tged-text);
    --bs-btn-hover-bg: var(--tged-tint-hover);
    --bs-btn-hover-border-color: var(--tged-border);
    --bs-btn-active-color: var(--tged-text);
    --bs-btn-active-bg: var(--tged-tint-hover);
    --bs-btn-active-border-color: var(--tged-border);
    --bs-btn-disabled-color: var(--tged-muted);
    --bs-btn-disabled-bg: var(--tged-tint);
    --bs-btn-disabled-border-color: var(--tged-edge);
}
.btn-secondary { border-color: var(--tged-border); }
.btn-danger {
    --bs-btn-color: var(--tged-danger-text);
    --bs-btn-bg: transparent;
    --bs-btn-border-color: var(--tged-danger);
    --bs-btn-hover-color: var(--tged-danger-text);
    --bs-btn-hover-bg: var(--tged-danger-tint);
    --bs-btn-hover-border-color: var(--tged-danger-hover);
    --bs-btn-active-color: var(--tged-danger-text);
    --bs-btn-active-bg: var(--tged-danger-tint);
    --bs-btn-active-border-color: var(--tged-danger-hover);
    --bs-btn-disabled-color: var(--tged-danger-text);
    --bs-btn-disabled-bg: transparent;
    --bs-btn-disabled-border-color: var(--tged-danger);
}
.btn-danger-solid {
    --bs-btn-color: var(--tged-on-danger);
    --bs-btn-bg: var(--tged-danger);
    --bs-btn-border-color: var(--tged-danger);
    --bs-btn-hover-color: var(--tged-on-danger);
    --bs-btn-hover-bg: var(--tged-danger-hover);
    --bs-btn-hover-border-color: var(--tged-danger-hover);
    --bs-btn-active-color: var(--tged-on-danger);
    --bs-btn-active-bg: var(--tged-danger-hover);
    --bs-btn-active-border-color: var(--tged-danger-hover);
    --bs-btn-disabled-color: var(--tged-on-danger);
    --bs-btn-disabled-bg: var(--tged-danger);
    --bs-btn-disabled-border-color: var(--tged-danger);
}
.btn.btn-icon {
    width: var(--tged-btn-h);
    height: var(--tged-btn-h);
    padding: 0;
    font-size: var(--tged-fs-18);
}
.btn.btn-icon.btn-sm {
    width: var(--tged-btn-h-sm);
    height: var(--tged-btn-h-sm);
    min-height: var(--tged-btn-h-sm);
    font-size: var(--tged-fs-16);
}
/* A navigation link: underlined text, only for going somewhere (never for an action). */
.link-nav { display: inline-flex; align-items: center; gap: var(--tged-gap-icon); color: var(--tged-accent-text); text-decoration: underline; text-underline-offset: 0.2em; font-weight: var(--tged-fw-medium); }
.link-nav:hover { text-decoration-thickness: 2px; }
/* Spacing helpers on the tokens */
.btn-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-gap-btns); }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-gap-label) var(--tged-gap-meta); }
.label-value { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tged-gap-label); }

/* ---------- Panels, key-value, tables ---------- */
.panel {
    background:
        linear-gradient(180deg, var(--tged-hl), transparent 45%),
        var(--tged-surface);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
}
.panel-body { padding: var(--tged-space-18) var(--tged-space-22); }
.panel-header {
    padding: var(--tged-space-14) var(--tged-space-22);
    font-size: var(--tged-fs-15);
    font-weight: var(--tged-fw-semibold);
    border-bottom: var(--tged-rule-line);
}
.panel-title {
    margin: 0 0 var(--tged-space-14);
    font-family: var(--tged-font-body);
    font-size: var(--tged-fs-15);
    font-weight: var(--tged-fw-semibold);
    letter-spacing: 0;
    color: var(--tged-text);
}

.kv { margin: 0; }
.kv-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--tged-space-4) var(--tged-space-24);
    padding: var(--tged-space-10) var(--tged-space-22);
    border-bottom: var(--tged-rule-line);
}
.kv-row:last-child { border-bottom: 0; }
.kv dt { font-weight: var(--tged-fw-regular); color: var(--tged-muted); }
.kv dd { margin: 0; font-weight: var(--tged-fw-medium); text-align: right; }

.table-dense {
    --bs-table-bg: transparent;
    --bs-table-color: var(--tged-text);
    --bs-table-border-color: var(--tged-line);
    --bs-table-hover-bg: var(--tged-tint);
    margin: 0;
}
.table-dense > :not(caption) > * > * {
    padding: var(--tged-space-8) var(--tged-space-16);
    vertical-align: middle;
}
.table-dense thead th {
    font-weight: var(--tged-fw-medium);
    color: var(--tged-muted);
    background: var(--tged-raised);
    border-bottom: var(--tged-rule-line);
}
.table-dense tbody th { font-weight: var(--tged-fw-semibold); }
.table-dense tbody tr:last-child > * { border-bottom: 0; }
/* Publishing activity feed (task-031): day groups of rows; time left, post and chips in the middle, Details right. */
.feed-day { margin-top: var(--tged-space-16); }
.feed-day-title { margin: 0 0 var(--tged-space-8); font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); color: var(--tged-muted); }
.feed-list { list-style: none; margin: 0; padding: 0; }
.feed-row {
    display: grid;
    grid-template-columns: 3.75rem minmax(0, 1fr);
    gap: var(--tged-space-6) var(--tged-space-14);
    align-items: start;
    padding: var(--tged-space-12) var(--tged-space-16);
    border-bottom: var(--tged-rule-line);
}
.feed-row:last-child { border-bottom: 0; }
.feed-time { display: grid; gap: var(--tged-space-1); white-space: nowrap; }
.feed-clock { font-weight: var(--tged-fw-semibold); }
.feed-ago { font-size: var(--tged-fs-13); }
.feed-main { min-width: 0; display: grid; gap: var(--tged-space-6); }
.feed-line { display: flex; align-items: center; gap: var(--tged-space-8); min-width: 0; }
.feed-post { display: flex; align-items: center; gap: var(--tged-space-8); min-width: 0; flex: 0 1 auto; color: var(--tged-text); text-decoration: none; }
a.feed-post:hover .feed-excerpt { text-decoration: underline; }
.feed-thumb { flex: 0 0 auto; width: var(--tged-space-32); height: var(--tged-space-32); object-fit: cover; border-radius: var(--tged-radius-6); background: var(--tged-tint); }
.feed-excerpt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-id { flex: 0 0 auto; font-size: var(--tged-fs-12); }
.feed-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-8); }
.feed-view { white-space: nowrap; font-size: var(--tged-fs-14); }
.feed-note, .feed-error, .feed-cost { white-space: nowrap; font-size: var(--tged-fs-13); }
.feed-actions { grid-column: 2; justify-self: start; }
.feed-actions:empty { display: none; }
@media (min-width: 576px) {
    .feed-row { grid-template-columns: 4.5rem minmax(0, 1fr) auto; align-items: center; }
    .feed-actions { grid-column: 3; justify-self: end; }
}
/* Bootstrap's .table-responsive sets only overflow-x: auto, which makes overflow-y compute to auto too: a table whose box is a few px
   taller than its content (the table's bottom margin, borders) then shows a tiny vertical scrollbar. Shared fix (task-051): never. */
/* Positioned, so a visually hidden header cell stays inside the scroller instead of widening the page (task-078). */
.table-responsive { position: relative; overflow-y: hidden; }
.table-responsive.panel .table-dense thead th:first-child { border-top-left-radius: var(--tged-radius-panel); }
.table-responsive.panel .table-dense thead th:last-child { border-top-right-radius: var(--tged-radius-panel); }

/* ---------- Status pills ---------- */
.pill {
    --pill-fg: var(--pill-draft);
    display: inline-flex;
    align-items: center;
    padding: var(--tged-space-1) var(--tged-space-10);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-medium);
    line-height: var(--tged-lh-22px);
    white-space: nowrap;
    color: var(--pill-fg);
    background: color-mix(in srgb, var(--pill-fg) 14%, transparent);
    border: 1px solid color-mix(in srgb, var(--pill-fg) 30%, transparent);
    border-radius: var(--tged-radius-pill);
}
.pill-draft { --pill-fg: var(--pill-draft); }
.pill-pending-review { --pill-fg: var(--pill-pending); }
.pill-approved { --pill-fg: var(--pill-approved); }
.pill-scheduled { --pill-fg: var(--pill-scheduled); }
.pill-publishing { --pill-fg: var(--pill-publishing); }
.pill-published { --pill-fg: var(--pill-published); }
.pill-failed { --pill-fg: var(--pill-failed); }
.pill-needs-attention { --pill-fg: var(--pill-attention); }
.pill-rejected {
    --pill-fg: var(--pill-rejected);
    background: transparent;
    border-color: var(--pill-fg);
}
.pill-deleted {
    --pill-fg: var(--pill-deleted);
    text-decoration: line-through;
}
/* A published post that was deleted from the network: muted, replaces the green Published pill. */
.pill + .pill, .chip-btn + .pill { margin-left: var(--tged-space-4); }
.pill-remote-deleted { --pill-fg: var(--pill-deleted); }

/* ---------- Network identity ---------- */
.net-facebook { --net-color: var(--tged-net-facebook); --net-icon: var(--tged-net-facebook-icon); --net-tint: var(--tged-net-facebook-tint); --net-tint-b: var(--tged-net-facebook-tint); }
.net-instagram { --net-color: var(--tged-net-instagram); --net-icon: var(--tged-net-instagram-icon); --net-tint: var(--tged-net-instagram-tint); --net-tint-b: var(--tged-net-instagram-tintb); }
.net-x { --net-color: var(--tged-net-x); --net-icon: var(--tged-net-x-icon); --net-tint: var(--tged-net-x-tint); --net-tint-b: var(--tged-net-x-tint); }

.net-icon {
    display: inline-grid;
    place-items: center;
    flex: none;
    width: var(--tged-space-40);
    height: var(--tged-space-40);
    font-size: var(--tged-fs-18);
    color: var(--net-icon);
    background: linear-gradient(135deg, var(--net-tint), var(--net-tint-b));
    border-radius: var(--tged-radius-round);
}
.net-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--tged-space-7);
    padding: var(--tged-space-1) var(--tged-space-12) var(--tged-space-1) var(--tged-space-5);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-medium);
    line-height: var(--tged-lh-22px);
    color: var(--tged-text);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-pill);
}
.net-chip .bi {
    display: inline-grid;
    place-items: center;
    width: var(--tged-space-22);
    height: var(--tged-space-22);
    font-size: var(--tged-fs-12);
    color: var(--net-icon);
    background: linear-gradient(135deg, var(--net-tint), var(--net-tint-b));
    border-radius: var(--tged-radius-round);
}

/* ---------- Overview ---------- */
.lane {
    --net-color: var(--tged-net-x);
    position: relative;
    height: 100%;
    padding: var(--tged-space-20) var(--tged-space-22) var(--tged-space-12);
    background:
        radial-gradient(20rem 10rem at 0% 0%, color-mix(in srgb, var(--net-color) 13%, transparent), transparent 70%),
        linear-gradient(180deg, var(--tged-hl), transparent 40%),
        var(--tged-surface);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
}
.lane-head {
    display: flex;
    align-items: center;
    gap: var(--tged-space-12);
    margin-bottom: var(--tged-space-16);
}
.lane-name {
    margin: 0;
    font-size: var(--tged-fs-20);
    line-height: var(--tged-lh-115);
}
.lane-status { margin-left: auto; }
.lane-head { flex-wrap: wrap; }
.lane-quota { font-size: var(--tged-fs-13); line-height: var(--tged-lh-125); color: var(--tged-muted); cursor: help; }
.lane-quota.is-warn { color: var(--tged-muted); font-weight: var(--tged-fw-semibold); }
@media (max-width: 575.98px) {
    .lane-quota { order: 3; flex: 1 1 100%; }
}
.lane-note {
    margin: 0 0 var(--tged-space-12);
    color: var(--tged-muted);
}
.lane-label {
    margin: 0;
    font-size: var(--tged-fs-13);
    color: var(--tged-muted);
}
.lane-when { margin: calc(var(--tged-space-14) * -1) 0 var(--tged-space-18); font-size: var(--tged-fs-13); color: var(--tged-muted); }
.lane-countdown {
    margin: 0 0 var(--tged-space-18);
    font-size: var(--tged-fs-36);
    line-height: var(--tged-lh-110);
    letter-spacing: var(--tged-ls-tight);
}
.lane-countdown.is-none {
    font-size: var(--tged-fs-24);
    font-weight: var(--tged-fw-medium);
    color: var(--tged-muted);
}
.lane-rail { margin-bottom: var(--tged-space-4); }
.lane-rows { margin: 0; }
.lane-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--tged-space-16);
    padding: var(--tged-space-10) 0;
    border-top: var(--tged-rule-line);
}
.lane-row dt { font-weight: var(--tged-fw-regular); color: var(--tged-muted); white-space: nowrap; }
.lane-row dd { margin: 0; font-weight: var(--tged-fw-medium); text-align: right; }
.lane-row dd.is-empty { font-weight: var(--tged-fw-regular); }

/* Timeline rail */
.rail { list-style: none; margin: 0 0 var(--tged-space-18); padding: 0; }
.rail-none { margin: 0 0 var(--tged-space-18); color: var(--tged-muted); }
.rail-item {
    position: relative;
    display: flex;
    gap: var(--tged-space-12);
    padding-bottom: var(--tged-space-12);
}
.rail-item:last-child { padding-bottom: 0; }
.rail-item:not(:last-child)::before {
    content: "";
    position: absolute;
    left: calc(0.4375rem - 1px);
    top: 1.15rem;
    bottom: -0.2rem;
    width: 2px;
    background: var(--tged-line);
}
.rail-dot {
    flex: none;
    box-sizing: border-box;
    width: var(--tged-space-14);
    height: var(--tged-space-14);
    margin-top: var(--tged-space-4);
    border: 2px solid var(--tged-muted);
    border-radius: var(--tged-radius-round);
}
.rail-item.is-filled .rail-dot {
    border-color: transparent;
    background: linear-gradient(135deg, var(--tged-accent-from), var(--tged-accent-to));
    box-shadow: var(--tged-ring-soft);
}
.rail-main { display: grid; min-width: 0; flex: 1; line-height: var(--tged-lh-135); }
.rail-time { font-weight: var(--tged-fw-semibold); }
.rail-rel { margin-left: var(--tged-space-6); font-weight: var(--tged-fw-regular); color: var(--tged-muted); }
.rail-title {
    display: block;
    overflow: hidden;
    color: var(--tged-text);
    text-overflow: ellipsis;
    white-space: nowrap;
    text-decoration: none;
}
a.rail-title:hover { text-decoration: underline; }
.rail-title.is-none { color: var(--tged-muted); }

/* Coverage bar */
.coverage { display: grid; gap: var(--tged-space-6); margin-bottom: var(--tged-space-16); }
.coverage-text { font-size: var(--tged-fs-13); color: var(--tged-muted); }
progress.coverage-bar {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: var(--tged-space-8);
    border: 0;
    border-radius: var(--tged-radius-pill);
    background: var(--tged-track);
    overflow: hidden;
}
.coverage-bar::-webkit-progress-bar { background: var(--tged-track); border-radius: var(--tged-radius-pill); }
.coverage-bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--tged-accent-from), var(--tged-accent-to));
    border-radius: var(--tged-radius-pill);
    transition: width var(--tged-dur-bar) var(--tged-ease);
}
.coverage-bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--tged-accent-from), var(--tged-accent-to));
    border-radius: var(--tged-radius-pill);
}
.coverage.is-low .coverage-bar::-webkit-progress-value { background: linear-gradient(90deg, var(--tged-danger-from), var(--tged-danger)); }
.coverage.is-low .coverage-bar::-moz-progress-bar { background: linear-gradient(90deg, var(--tged-danger-from), var(--tged-danger)); }

/* Needs you, health strip, details */
.needs-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
    gap: var(--tged-space-12);
}
.all-clear {
    display: flex;
    align-items: center;
    gap: var(--tged-space-8);
    margin: 0;
    color: var(--tged-muted);
}
.all-clear .bi { color: var(--pill-published); font-size: var(--tged-fs-18); }

.health-strip { display: flex; flex-wrap: wrap; gap: var(--tged-space-12) var(--tged-space-28); }
.health { display: inline-flex; align-items: center; gap: var(--tged-space-8); }
.health-dot {
    --dot: var(--tged-muted);
    flex: none;
    width: var(--tged-space-10);
    height: var(--tged-space-10);
    background: var(--dot);
    border-radius: var(--tged-radius-round);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot) 22%, transparent);
}
.health-ok { --dot: var(--pill-published); }
.health-warn { --dot: var(--pill-attention); }
.health-bad { --dot: var(--pill-failed); }
.health-off { --dot: var(--tged-muted); }

.details-panel > summary {
    display: inline-flex;
    align-items: center;
    gap: var(--tged-space-10);
    padding: var(--tged-space-6) var(--tged-space-4);
    color: var(--tged-text);
    font-weight: var(--tged-fw-medium);
    cursor: pointer;
    list-style: none;
}
.details-panel > summary::-webkit-details-marker { display: none; }
.details-panel > summary::before {
    content: "";
    width: var(--tged-space-7);
    height: var(--tged-space-7);
    border: solid var(--tged-muted);
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg);
    transition: transform var(--tged-dur-base) var(--tged-ease);
}
.details-panel[open] > summary::before { transform: rotate(45deg); }
.details-panel > .panel { margin-top: var(--tged-space-8); }

/* Advanced disclosure (task-081): closed by default, one line says what is inside, a dot says something differs from its default. */
.advanced:not(.panel) { border-top: var(--tged-rule-line); }
.advanced-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-2) var(--tged-space-10);
    min-height: 2.5rem;
    padding: var(--tged-space-6) 0;
    cursor: pointer;
    list-style: none;
}
.advanced-head::-webkit-details-marker { display: none; }
.advanced-head::before {
    content: "";
    flex: none;
    width: var(--tged-space-7);
    height: var(--tged-space-7);
    border: solid var(--tged-muted);
    border-width: 0 2px 2px 0;
    transform: rotate(-45deg);
    transition: transform var(--tged-dur-base) var(--tged-ease);
}
.advanced[open] > .advanced-head::before { transform: rotate(45deg); }
.advanced-title { font-weight: var(--tged-fw-medium); }
.advanced-summary { flex: 1 1 12rem; min-width: 0; font-size: var(--tged-fs-13); color: var(--tged-muted); }
.advanced-changed { display: inline-flex; align-items: center; gap: var(--tged-space-4); font-size: var(--tged-fs-13); color: var(--tged-accent-text); }
.advanced-changed[hidden] { display: none; }
.advanced-dot { width: var(--tged-space-7); height: var(--tged-space-7); background: var(--tged-accent-text); border-radius: 50%; }
.advanced-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-14); padding: var(--tged-space-6) 0 var(--tged-space-12); }
.advanced-body.row { display: flex; }
.advanced-body > .chip-bar { margin-bottom: 0; }
.advanced-body > .mb-3 { margin-bottom: 0 !important; }
.advanced-body > .feed-day { margin-top: 0; }
.field-highlight { border-radius: var(--tged-radius-control); outline: 2px solid var(--tged-accent-text); outline-offset: var(--tged-space-4); }

/* Stat tile */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--tged-space-12); }
.stat-tile {
    display: grid;
    gap: var(--tged-space-2);
    padding: var(--tged-space-16) var(--tged-space-20);
    background: linear-gradient(180deg, var(--tged-hl), transparent 45%), var(--tged-surface);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
}
.stat-label { display: inline-flex; align-items: center; gap: var(--tged-space-6); font-size: var(--tged-fs-13); color: var(--tged-muted); }
.stat-value { font-size: var(--tged-fs-30); line-height: var(--tged-lh-115); letter-spacing: var(--tged-ls-tight); }
.stat-hint { font-size: var(--tged-fs-13); color: var(--tged-muted); }

/* ---------- Forms ---------- */
.form-label {
    margin-bottom: var(--tged-space-6);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-medium);
    color: var(--tged-muted);
}
.form-control,
.form-select {
    background-color: var(--tged-bg);
    color: var(--tged-text);
    border-color: var(--tged-border);
    border-radius: var(--tged-radius-control);
    transition: border-color var(--tged-dur-base) var(--tged-ease), box-shadow var(--tged-dur-base) var(--tged-ease);
}
.form-control::placeholder { color: var(--tged-muted); }
.form-control:focus,
.form-select:focus {
    background-color: var(--tged-bg);
    color: var(--tged-text);
    border-color: var(--tged-focus);
    box-shadow: var(--tged-ring);
}
.form-text { color: var(--tged-muted); }
.form-check-input { background-color: var(--tged-bg); border-color: var(--tged-muted); }
.form-check-input:checked {
    background-color: var(--tged-accent);
    border-color: var(--tged-accent);
}
.form-check-input:focus { box-shadow: var(--tged-ring); border-color: var(--tged-focus); }

/* Switch */
.form-switch {
    display: flex;
    align-items: center;
    gap: var(--tged-space-12);
    min-height: var(--tged-space-24);
    padding-left: 0;
    margin-bottom: 0;
}
.form-switch .form-check-input {
    float: none;
    flex: none;
    width: 2.75rem;
    height: var(--tged-space-24);
    margin: 0;
    background-color: var(--tged-tint);
    background-image: var(--tged-thumb-off);
    background-position: left var(--tged-space-3) center;
    background-repeat: no-repeat;
    background-size: var(--tged-space-16);
    border: 1px solid var(--tged-muted);
    border-radius: var(--tged-radius-pill);
    transition: background-color var(--tged-dur-fade) var(--tged-ease), border-color var(--tged-dur-fade) var(--tged-ease), background-position var(--tged-dur-slide) var(--tged-ease-spring);
}
.form-switch .form-check-input:checked {
    background-color: var(--tged-accent-to);
    background-image: var(--tged-thumb-on), linear-gradient(180deg, var(--tged-accent-from), var(--tged-accent-to));
    background-position: right var(--tged-space-3) center, 0 0;
    background-size: var(--tged-space-16), 100% 100%;
    border-color: transparent;
}
.form-switch .form-check-label { font-size: var(--tged-fs-15); color: var(--tged-text); }
.switch-field .form-text { margin-top: var(--tged-space-4); margin-left: 3.5rem; }

/* ---------- Settings ---------- */
.settings-layout { display: grid; gap: var(--tged-space-20); grid-template-columns: minmax(0, 1fr); }
.settings-main { min-width: 0; }
.subnav-picker { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.subnav-list {
    display: flex;
    flex-direction: column;
    gap: var(--tged-space-2);
    margin: 0;
    padding: var(--tged-space-3);
    list-style: none;
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-12);
}
.js [data-settings-nav]:not(.is-open) .subnav-list { display: none; }
.js [data-settings-nav].is-open .subnav-list { margin-top: var(--tged-space-8); }
.subnav-item {
    display: flex;
    align-items: center;
    gap: var(--tged-space-8);
    padding: var(--tged-space-7) var(--tged-space-12);
    border-radius: var(--tged-radius-inner);
    color: var(--tged-muted);
    font-weight: var(--tged-fw-medium);
    text-decoration: none;
    transition: background-color var(--tged-dur-base) var(--tged-ease), color var(--tged-dur-base) var(--tged-ease);
}
.subnav-item:hover { color: var(--tged-text); }
.subnav-item.active {
    background: var(--tged-raised);
    color: var(--tged-accent-text);
    box-shadow: var(--tged-inset-edge);
}
.subnav-label { flex: 1 1 auto; min-width: 0; }
.subnav-item .net-icon, .subnav-item > .bi { flex: none; }
.subnav-item .net-icon { width: 1em; height: 1em; font-size: inherit; line-height: 1; background: none; }
.subnav-item .net-icon .bi { display: block; line-height: 1; }
.subnav-item .net-icon .bi::before { display: block; vertical-align: top; }
.subnav-item .health-dot { flex: none; margin: 0; }
.subnav-group { padding: var(--tged-space-12) var(--tged-space-12) var(--tged-space-4); color: var(--tged-muted); font-size: var(--tged-fs-13); }
@media (min-width: 768px) {
    .settings-layout { grid-template-columns: 14rem minmax(0, 1fr); gap: var(--tged-space-32); }
    .subnav { position: sticky; top: 6rem; align-self: start; max-height: calc(100vh - 7rem); overflow-y: auto; scrollbar-width: thin; }
    .subnav-picker { display: none; }
    .subnav-list, .js [data-settings-nav]:not(.is-open) .subnav-list { display: flex; padding: 0; background: transparent; border: 0; }
    .js [data-settings-nav].is-open .subnav-list { margin-top: 0; }
    .subnav-item { padding: var(--tged-space-6) var(--tged-space-12); }
}

/* The settings header, its fold and the page body (task-083). */
.settings-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--tged-space-12) var(--tged-space-24); margin-bottom: var(--tged-space-12); }
.settings-head-main { flex: 1 1 20rem; min-width: 0; }
.settings-head-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); }
.settings-head-title { min-width: 0; }
.settings-head-title .page-title { max-width: none; overflow: visible; white-space: normal; }
.settings-head-line { margin: var(--tged-space-4) 0 0; color: var(--tged-muted); }
.settings-head-side { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-16); }
.settings-head-actions { display: flex; flex-wrap: wrap; gap: var(--tged-gap-btns); }
.settings-how { margin-bottom: var(--tged-space-16); }
.settings-how-text { margin: 0; color: var(--tged-muted); }
.settings-body { display: grid; gap: var(--tged-space-24); grid-template-columns: minmax(0, 1fr); }
.settings-content, .settings-form { display: grid; gap: var(--tged-space-16); min-width: 0; align-content: start; grid-template-columns: minmax(0, 1fr); }
.settings-group, .settings-content > .panel { scroll-margin-top: 6rem; }
.settings-split { display: grid; gap: var(--tged-space-16); grid-template-columns: minmax(0, 1fr); align-items: start; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tged-space-4) var(--tged-space-12); margin-bottom: var(--tged-space-8); }
.panel-head .panel-title { margin-bottom: 0; }
.panel-head-note { color: var(--tged-muted); font-size: var(--tged-fs-13); }
.panel-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); }

/* Setting rows: the label and its help on the left, the control on the right, one line per panel (task-083). */
.setting-row { display: grid; gap: var(--tged-space-6) var(--tged-space-24); grid-template-columns: minmax(0, 1fr); padding: var(--tged-space-12) 0; border-top: var(--tged-rule-line); }
.setting-rows > .setting-row:first-child { border-top: 0; padding-top: var(--tged-space-4); }
.setting-rows > .setting-row:last-child { padding-bottom: var(--tged-space-4); }
.setting-rows + .setting-rows > .setting-row:first-child { border-top: var(--tged-rule-line); margin-top: var(--tged-space-12); padding-top: var(--tged-space-12); }
.setting-row[hidden] { display: none; }
.setting-row-label { min-width: 0; }
.setting-row-label .form-label { margin-bottom: 0; font-weight: var(--tged-fw-medium); }
.setting-row-label .form-text { margin-top: var(--tged-space-2); }
.setting-row-control { min-width: 0; }
.setting-rows-foot { margin-top: var(--tged-space-12); padding-top: var(--tged-space-12); border-top: var(--tged-rule-line); }
.settings-group .advanced { margin-top: var(--tged-space-8); }
.provider-models { color: var(--tged-muted); }
@media (min-width: 768px) {
    .setting-row { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); align-items: start; }
    .setting-row-stack { grid-template-columns: minmax(0, 1fr); }
    .setting-row:not(.setting-row-stack) .setting-row-control > .form-control,
    .setting-row:not(.setting-row-stack) .setting-row-control > .form-select,
    .setting-row:not(.setting-row-stack) .setting-row-control > .input-group { max-width: 28rem; }
}

/* On this page (task-083): only where there is room for it. */
.section-index { display: none; }
@media (min-width: 1280px) {
    .settings-body.has-index { grid-template-columns: minmax(0, 1fr) 11rem; }
    .section-index { display: block; position: sticky; top: 6rem; align-self: start; max-height: calc(100vh - 7rem); overflow-y: auto; scrollbar-width: thin; }
    .settings-split { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
    .settings-split .house-preview-grid { grid-template-columns: minmax(0, 1fr); }
}
.section-index-title { margin: 0 0 var(--tged-space-6); color: var(--tged-muted); font-size: var(--tged-fs-13); }
.section-index-list { list-style: none; margin: 0; padding: 0; border-left: var(--tged-rule-line); }
.section-index-link { display: block; padding: var(--tged-space-4) var(--tged-space-12); color: var(--tged-muted); font-size: var(--tged-fs-13); text-decoration: none; transition: color var(--tged-dur-base) var(--tged-ease); }
.section-index-link:hover { color: var(--tged-text); }
.section-index-link[aria-current] { color: var(--tged-accent-text); font-weight: var(--tged-fw-medium); box-shadow: -2px 0 0 var(--tged-accent-text); }

/* Danger zone (task-083): reset and remove actions, each behind a confirm. */
.danger-zone { background: linear-gradient(var(--tged-danger-tint), var(--tged-danger-tint)), var(--tged-raised); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--tged-danger) 45%, transparent), var(--tged-shadow-card); }
.settings-main > .danger-zone { margin-top: var(--tged-space-16); }
.danger-zone .panel-title { color: var(--tged-danger-text); }
.danger-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tged-space-8) var(--tged-space-16); padding: var(--tged-space-12) 0; border-top: var(--tged-rule-line); }
.danger-row:first-of-type { border-top: 0; padding-top: var(--tged-space-4); }
.danger-row:last-of-type { padding-bottom: 0; }
.danger-row-text { flex: 1 1 16rem; min-width: 0; }
.danger-row-title { margin: 0; font-weight: var(--tged-fw-medium); }
.danger-row-text .form-text { margin: var(--tged-space-2) 0 0; }

/* Schedule: the week at a glance (task-083). */
.week-grid { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.week-grid th, .week-grid td { padding: var(--tged-space-6) var(--tged-space-4); border-top: var(--tged-rule-line); text-align: center; font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); }
.week-grid thead th { border-top: 0; color: var(--tged-muted); }
.week-grid thead th:not(:first-child) { width: 10%; }
.week-grid th[scope="row"], .week-grid thead th:first-child { text-align: left; padding-left: 0; }
.week-grid td { color: var(--tged-muted); }
.week-grid td.has-slots { color: var(--tged-accent-text); background: var(--tged-accent-soft); box-shadow: inset 0 0 0 1px var(--tged-surface); }
.week-grid tr.is-off td, .week-grid tr.is-off .week-grid-net { color: var(--tged-muted); }
.week-grid tr.is-off td.has-slots { background: var(--tged-tint); color: var(--tged-muted); }
.week-grid-net { display: inline-flex; align-items: center; gap: var(--tged-space-8); }
.week-grid-name { display: flex; flex-direction: column; }
.week-grid-hours { color: var(--tged-muted); font-weight: var(--tged-fw-regular); white-space: nowrap; }

/* Prompts as rows (task-083). */
.prompts-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); margin-bottom: var(--tged-space-16); }
.prompts-search { flex: 0 1 18rem; min-width: 12rem; }
.prompts-chips { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); }
.prompts-count { margin-left: auto; }
.settings-content > [data-prompt-group][hidden] { display: none; }
.prompt-row-name { font-weight: var(--tged-fw-medium); }
.prompt-row-side { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-12); }
.prompt-row-used { flex: 1 1 10rem; min-width: 0; color: var(--tged-muted); font-size: var(--tged-fs-13); }
.prompt-row-state { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-6); }
.prompt-row-state:empty { display: none; }
.prompt-row-open { flex: none; }

/* The Settings home (task-083): the safety strip, then the area cards. */
.settings-home-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tged-space-12) var(--tged-space-24); margin-bottom: var(--tged-space-20); }
.settings-home-title { min-width: 0; }
.settings-home-sub { margin: var(--tged-space-4) 0 0; color: var(--tged-muted); }
.settings-search { flex: 0 1 22rem; min-width: 0; width: 100%; }
.settings-search-row { display: flex; gap: var(--tged-gap-btns); }
.settings-search-field { position: relative; flex: 1 1 auto; min-width: 0; }
.settings-search-field > .bi { position: absolute; left: var(--tged-space-12); top: 50%; transform: translateY(-50%); color: var(--tged-muted); pointer-events: none; }
.settings-search-field > .form-control { padding-left: 2.25rem; padding-right: 4rem; }
.settings-search-field > .palette-kbd { position: absolute; right: var(--tged-space-8); top: 50%; transform: translateY(-50%); pointer-events: none; }
.settings-overview[hidden] { display: none; }
.settings-overview { display: grid; gap: var(--tged-space-24); grid-template-columns: minmax(0, 1fr); }

.safety-strip { display: grid; gap: var(--tged-space-12); grid-template-columns: minmax(0, 1fr); }
.safety-tile { display: flex; flex-direction: column; gap: var(--tged-space-8); min-width: 0; padding: var(--tged-space-16); background: var(--tged-raised); border-radius: var(--tged-radius-card); box-shadow: var(--tged-inset-edge), var(--tged-shadow-card); }
.safety-tile:has(.is-live) { background: linear-gradient(var(--tged-attention-tint), var(--tged-attention-tint)), var(--tged-raised); }
.safety-tile:has(.is-problem) { background: linear-gradient(var(--tged-danger-tint), var(--tged-danger-tint)), var(--tged-raised); }
.safety-tile-head { display: flex; align-items: center; gap: var(--tged-space-8); }
.safety-tile-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--tged-space-32); height: var(--tged-space-32); border-radius: var(--tged-radius-inner); background: var(--tged-tint); color: var(--tged-muted-strong); }
.safety-tile-title { margin: 0; font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); }
.safety-tile-title a { color: inherit; text-decoration: none; }
.safety-tile-title a:hover { text-decoration: underline; }
.safety-tile-word { display: flex; align-items: center; gap: var(--tged-space-6); margin: 0; font-size: var(--tged-fs-18); font-weight: var(--tged-fw-semibold); }
.is-safe .safety-tile-word { color: var(--pill-published); }
.is-live .safety-tile-word { color: var(--pill-attention); }
.is-problem .safety-tile-word { color: var(--tged-danger-text); }
.safety-tile-line { margin: var(--tged-space-2) 0 0; color: var(--tged-muted); font-size: var(--tged-fs-13); }
.safety-switch .net-icon, .area-card-head .net-icon { width: var(--tged-space-28); height: var(--tged-space-28); font-size: var(--tged-fs-13); }
.safety-bars { display: grid; gap: var(--tged-space-12) var(--tged-space-16); grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-top: var(--tged-space-8); }
.safety-bar { display: grid; grid-template-columns: auto 1fr; gap: var(--tged-space-2) var(--tged-space-8); align-items: baseline; font-size: var(--tged-fs-13); }
.safety-bar-label { font-weight: var(--tged-fw-medium); }
.safety-bar-value { color: var(--tged-muted); text-align: right; }
.safety-bar .coverage-bar { grid-column: 1 / -1; width: 100%; }
.safety-bar.is-warn .coverage-bar::-webkit-progress-value { background: var(--pill-attention); }
.safety-bar.is-warn .coverage-bar::-moz-progress-bar { background: var(--pill-attention); }
.safety-bar.is-bad .coverage-bar::-webkit-progress-value { background: var(--tged-danger); }
.safety-bar.is-bad .coverage-bar::-moz-progress-bar { background: var(--tged-danger); }
.safety-tile-switches { display: grid; gap: var(--tged-space-12) var(--tged-space-16); grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin-top: auto; }
.safety-switch { display: flex; flex-wrap: wrap; align-items: center; align-content: flex-start; gap: var(--tged-space-4) var(--tged-space-8); }
.safety-switch-line { flex: 1 1 100%; color: var(--tged-muted); font-size: var(--tged-fs-13); }

.area-group .section-title { margin-bottom: var(--tged-space-12); }
.area-grid { display: grid; gap: var(--tged-space-12); grid-template-columns: minmax(0, 1fr); }
.area-card { position: relative; display: flex; flex-direction: column; gap: var(--tged-space-8); min-width: 0; padding: var(--tged-space-16); background: var(--tged-raised); border-radius: var(--tged-radius-card); box-shadow: var(--tged-inset-edge), var(--tged-shadow-card); transition: transform var(--tged-dur-base) var(--tged-ease); }
.area-card:hover { transform: translateY(-2px); }
.area-card:has(.area-tone-warn) { background: linear-gradient(var(--tged-attention-tint), var(--tged-attention-tint)), var(--tged-raised); }
.area-card:has(.area-tone-bad) { background: linear-gradient(var(--tged-danger-tint), var(--tged-danger-tint)), var(--tged-raised); }
.area-card:has(.area-card-link:focus-visible) { outline: var(--tged-outline); outline-offset: 2px; }
.area-card-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-8); }
.area-card-icon { display: inline-flex; align-items: center; justify-content: center; flex: none; width: var(--tged-space-24); height: var(--tged-space-24); color: var(--tged-muted-strong); }
.area-card-title { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); }
.area-card-link { color: inherit; text-decoration: none; }
.area-card-link:focus-visible { outline: 0; }
.area-card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.area-card-status { flex: none; }
.area-status { display: inline-flex; align-items: center; gap: var(--tged-space-6); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); color: var(--tged-muted); }
.area-status .health-dot { margin: 0; }
.area-card > .area-card-body { display: block; flex: 1 1 auto; }
.area-card-reason { margin: 0 0 var(--tged-space-6); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); }
/* Each value stands next to its label, on narrow and wide cards alike: the labels of a card share one column, a wide card has two pairs of columns. */
.area-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--tged-space-2) var(--tged-space-12); margin: 0; }
.area-fact { display: grid; grid-column: 1 / -1; grid-template-columns: subgrid; font-size: var(--tged-fs-13); }
.area-fact dt { color: var(--tged-muted); font-weight: var(--tged-fw-regular); }
.area-fact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.area-tests { position: relative; z-index: 1; display: grid; gap: var(--tged-space-6); }
.area-test { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-8); }
.area-test-result { color: var(--tged-muted); font-size: var(--tged-fs-13); }
.area-test-result .bi { margin-right: var(--tged-space-4); }
.area-test-ok { color: var(--pill-published); font-weight: var(--tged-fw-medium); }
.area-test-bad { color: var(--tged-danger-text); font-weight: var(--tged-fw-medium); }
.area-card-foot { margin: 0; color: var(--tged-muted); font-size: var(--tged-fs-13); }
/* The home stands beside the settings sidebar (task-085): one column until the main column holds two (1200 px), three once the content reaches its 1440 px cap. */
@media (min-width: 1200px) {
    .safety-strip, .area-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .safety-tile-wide, .safety-tile-tablet-2, .area-tablet-2 { grid-column: span 2; }
    .area-tablet-2 .area-facts { grid-template-columns: repeat(2, max-content minmax(0, 1fr)); }
    .area-tablet-2 .area-fact { grid-column: span 2; }
}
@media (min-width: 1688px) {
    .safety-strip, .area-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .area-tablet-2, .safety-tile-tablet-2 { grid-column: auto; }
    .area-card.area-span-2 { grid-column: span 2; }
    .area-card.area-span-3 { grid-column: span 3; }
    .safety-tile-wide { grid-column: span 2; }
    .area-tablet-2 .area-facts { grid-template-columns: max-content minmax(0, 1fr); }
    .area-tablet-2 .area-fact { grid-column: 1 / -1; }
    .area-span-2 .area-facts, .area-span-3 .area-facts { grid-template-columns: repeat(2, max-content minmax(0, 1fr)); }
    .area-span-2 .area-fact, .area-span-3 .area-fact { grid-column: span 2; }
}
.safety-glance { display: grid; gap: var(--tged-space-8); grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: var(--tged-space-12); }
.safety-glance-tile { display: flex; flex-direction: column; gap: var(--tged-space-4); min-width: 0; min-height: 44px; padding: var(--tged-space-8) var(--tged-space-12); background: var(--tged-raised); border-radius: var(--tged-radius-card); box-shadow: var(--tged-inset-edge), var(--tged-shadow-card); color: var(--tged-text); text-decoration: none; }
.safety-glance-tile:last-child { grid-column: 1 / -1; }
.safety-glance-tile:hover { color: var(--tged-text); }
.safety-glance-tile:has(.is-live) { background: linear-gradient(var(--tged-attention-tint), var(--tged-attention-tint)), var(--tged-raised); }
.safety-glance-tile:has(.is-problem) { background: linear-gradient(var(--tged-danger-tint), var(--tged-danger-tint)), var(--tged-raised); }
.safety-glance-title { display: flex; align-items: center; gap: var(--tged-space-6); color: var(--tged-muted); font-size: var(--tged-fs-13); }
.safety-glance-tile .safety-tile-word { font-size: var(--tged-fs-14); }
@media (min-width: 768px) {
    .safety-glance { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .safety-glance-tile:last-child { grid-column: auto; }
}
.show-more { display: flex; align-items: center; justify-content: space-between; gap: var(--tged-space-12); margin: 0; padding: var(--tged-space-8) var(--tged-space-12); }
.settings-results-wrap[hidden] { display: none; }
.settings-results { list-style: none; margin: 0; padding: 0; }
.settings-result-link { display: block; padding: var(--tged-space-8) var(--tged-space-12); border-bottom: var(--tged-rule-line); color: var(--tged-text); text-decoration: none; }
.settings-result-link:hover { background: var(--tged-tint); }
.settings-result-name { font-weight: var(--tged-fw-medium); }
.settings-result-section { margin-left: var(--tged-space-8); color: var(--tged-muted); font-size: var(--tged-fs-13); }
.settings-result-help { display: block; color: var(--tged-muted); font-size: var(--tged-fs-13); }
.settings-main > .callout, .settings-main > div[data-autosave-refresh] > .callout { margin-bottom: var(--tged-space-12); }

.secret-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); }
.js .secret-field:not(.is-open) .secret-input { display: none; }
.js .secret-field:not(.is-open):not(:has(.secret-clear input:checked)) .secret-save { display: none; }
.secret-input { margin-top: var(--tged-space-8); }
.secret-clear { margin-top: var(--tged-space-10); }

.weekday-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--tged-space-8);
}
.weekday-cell .form-control { text-align: center; padding-left: var(--tged-space-4); padding-right: var(--tged-space-4); }

.action-row .action-row-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-12); }
.action-row .action-row-controls .form-label { margin: 0; }
.action-row .form-select { width: auto; min-width: 12rem; }

/* Sticky action bar */
.action-bar {
    position: sticky;
    bottom: var(--tged-space-16);
    z-index: var(--tged-z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--tged-space-12) var(--tged-space-16);
    margin-top: var(--tged-space-16);
    padding: var(--tged-space-10) var(--tged-space-12) var(--tged-space-10) var(--tged-space-18);
    background: var(--tged-raised);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-card);
    box-shadow: var(--tged-shadow-float);
    transition: opacity var(--tged-dur-fade) var(--tged-ease), transform var(--tged-dur-slide) var(--tged-ease-out), visibility 0s;
}
.action-bar-msg {
    display: inline-flex;
    align-items: center;
    gap: var(--tged-space-8);
    margin-right: auto;
    font-weight: var(--tged-fw-medium);
}
.action-bar-msg .bi { color: var(--tged-accent-text); }
.action-bar-buttons { display: flex; gap: var(--tged-space-8); }
.js .action-bar:not(.is-visible) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity var(--tged-dur-fade) var(--tged-ease), transform var(--tged-dur-slide) var(--tged-ease), visibility 0s var(--tged-dur-slide);
}
.action-bar-demo .action-bar { position: static; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .action-bar {
        background: var(--tged-glass);
        -webkit-backdrop-filter: var(--tged-blur-glass);
        backdrop-filter: var(--tged-blur-glass);
    }
}

/* ---------- Callouts, alerts, toasts ---------- */
.callout,
.alert {
    --c: var(--pill-approved);
    display: flex;
    align-items: flex-start;
    gap: var(--tged-space-12);
    padding: var(--tged-space-12) var(--tged-space-16);
    color: var(--tged-text);
    background: color-mix(in srgb, var(--c) 9%, var(--tged-surface));
    border: 1px solid color-mix(in srgb, var(--c) 32%, transparent);
    border-radius: var(--tged-radius-card);
}
.callout-info { --c: var(--pill-approved); }
.callout-success, .alert-success { --c: var(--pill-published); }
.callout-warning, .alert-warning { --c: var(--pill-attention); }
.callout-error, .alert-danger { --c: var(--pill-failed); }
.alert-info { --c: var(--pill-approved); }
.alert { display: block; margin-bottom: var(--tged-space-16); }
/* The icon sits in a box as tall as one text line (1.5rem): centered on a single line, level with the first line on several. */
.callout-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; height: var(--tged-space-24); margin: 0; font-size: var(--tged-fs-18); line-height: var(--tged-lh-1); color: var(--c); }
.callout-body { flex: 1; min-width: 0; }
.callout-title { margin: 0; font-weight: var(--tged-fw-semibold); line-height: var(--tged-lh-24px); }
.callout-text { margin: 0; line-height: var(--tged-lh-body); color: var(--tged-muted); }
.callout-action {
    align-self: center;
    flex: none;
    padding: var(--tged-space-3) var(--tged-space-10);
    color: var(--tged-text);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-semibold);
    text-decoration: none;
    background: var(--tged-tint);
    border-radius: var(--tged-radius-pill);
    transition: background-color var(--tged-dur-base) var(--tged-ease);
}
.callout-action:hover { color: var(--tged-text); background: var(--tged-tint-hover); }

.toast-region {
    position: fixed;
    top: 4.75rem;
    right: var(--tged-space-16);
    z-index: var(--tged-z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--tged-space-8);
    width: min(24rem, calc(100vw - var(--tged-space-32)));
    pointer-events: none;
}
.toast-item {
    --c: var(--pill-published);
    display: flex;
    align-items: flex-start;
    gap: var(--tged-space-10);
    padding: var(--tged-space-12) var(--tged-space-12) var(--tged-space-12) var(--tged-space-16);
    color: var(--tged-text);
    background: var(--tged-raised);
    border: 1px solid color-mix(in srgb, var(--c) 40%, var(--tged-edge));
    border-radius: var(--tged-radius-card);
}
.toast-error { --c: var(--pill-failed); }
.toast-item > .bi { flex: none; color: var(--c); }
.toast-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.toast-region .toast-item {
    pointer-events: auto;
    box-shadow: var(--tged-shadow-float);
    animation: tged-toast-in var(--tged-dur-toast) var(--tged-ease-out) both;
}
.toast-region .toast-item.is-leaving {
    opacity: 0;
    transform: translateX(14px);
    transition: opacity var(--tged-dur-fade) var(--tged-ease), transform var(--tged-dur-fade) var(--tged-ease);
}
.toast-close {
    flex: none;
    display: grid;
    place-items: center;
    width: var(--tged-space-24);
    height: var(--tged-space-24);
    padding: 0;
    color: var(--tged-muted);
    background: transparent;
    border: 0;
    border-radius: var(--tged-radius-8);
    transition: background-color var(--tged-dur-base) var(--tged-ease), color var(--tged-dur-base) var(--tged-ease);
}
.toast-close:hover { color: var(--tged-text); background: var(--tged-tint); }
main > .toast-item { margin-bottom: var(--tged-space-16); }
@keyframes tged-toast-in {
    from { opacity: 0; transform: translateY(-10px) scale(0.98); }
    to { opacity: 1; transform: none; }
}

/* ---------- Empty state ---------- */
.empty-state {
    padding: var(--tged-space-40) var(--tged-space-24);
    text-align: center;
    color: var(--tged-muted);
}
.empty-state .bi { font-size: var(--tged-fs-32); }
.empty-title { margin: var(--tged-space-8) 0 var(--tged-space-2); font-weight: var(--tged-fw-semibold); color: var(--tged-text); }
.empty-text { margin: 0; }

/* ---------- Floating layers (the only place large shadows appear) ---------- */
.dropdown-menu {
    --bs-dropdown-bg: var(--tged-raised);
    --bs-dropdown-color: var(--tged-text);
    --bs-dropdown-border-color: var(--tged-edge);
    --bs-dropdown-border-radius: var(--tged-radius-card);
    --bs-dropdown-link-color: var(--tged-text);
    --bs-dropdown-link-hover-color: var(--tged-text);
    --bs-dropdown-link-hover-bg: var(--tged-tint-hover);
    --bs-dropdown-link-active-color: var(--tged-text);
    --bs-dropdown-link-active-bg: var(--tged-tint-hover);
    --bs-dropdown-box-shadow: var(--tged-shadow-float);
    box-shadow: var(--bs-dropdown-box-shadow);
    min-width: 13rem;
}
.dropdown-item { display: flex; align-items: center; gap: var(--tged-space-10); border-radius: var(--tged-radius-8); }
.dropdown-item .bi { color: var(--tged-muted); }

.modal {
    --bs-modal-bg: var(--tged-raised);
    --bs-modal-color: var(--tged-text);
    --bs-modal-border-color: var(--tged-edge);
    --bs-modal-border-radius: var(--tged-radius-panel);
    --bs-modal-inner-border-radius: calc(var(--tged-radius-panel) - 1px);
    --bs-modal-header-border-color: var(--tged-line);
    --bs-modal-footer-border-color: var(--tged-line);
    --bs-modal-box-shadow: var(--tged-shadow-float);
}
.modal-title { font-size: var(--tged-fs-18); font-weight: var(--tged-fw-semibold); }
.offcanvas { box-shadow: var(--tged-shadow-float); }
@media (min-width: 992px) {
    .offcanvas-lg { box-shadow: none; }
}
/* Every drawer: the page background behind a header that can carry an icon chip, and the body holds a `.post-preview` panel,
   the very surface the editor's preview panel uses (same class, same card inside). */
.drawer {
    --bs-offcanvas-bg: var(--tged-bg);
    --bs-offcanvas-color: var(--tged-text);
    --bs-offcanvas-border-color: var(--tged-edge);
    --bs-offcanvas-width: min(28rem, 100vw);
    --bs-offcanvas-padding-x: var(--tged-space-16);
    --bs-offcanvas-padding-y: var(--tged-space-16);
    background: var(--tged-bg);
}
.drawer .offcanvas-header {
    gap: var(--tged-space-12);
    padding: var(--tged-space-20) var(--tged-space-16) var(--tged-space-16);
    border-bottom: var(--tged-rule-line);
}
.drawer .offcanvas-header .offcanvas-title { flex: 1 1 auto; min-width: 0; margin: 0; }
.drawer .offcanvas-header .btn-close { margin: 0; }
.drawer .offcanvas-body { padding: var(--tged-space-16); }
.drawer .post-preview { position: static; }
.offcanvas-title { font-size: var(--tged-fs-18); font-weight: var(--tged-fw-semibold); }
[data-bs-theme="dark"] .btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ---------- Login ---------- */
.login-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: var(--tged-space-24) var(--tged-space-16);
}
.login-panel {
    width: 100%;
    max-width: 23rem;
    padding: var(--tged-space-28);
    background: linear-gradient(180deg, var(--tged-hl), transparent 45%), var(--tged-raised);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
    box-shadow: var(--tged-shadow-float);
}
.login-brand {
    display: grid;
    justify-items: center;
    gap: var(--tged-space-14);
    padding: 0 0 var(--tged-space-24);
    text-align: center;
}
.login-logo { display: block; width: 6rem; height: 6rem; object-fit: contain; }
.login-brand .wordmark-name { font-size: var(--tged-fs-22); }
.login-brand .wordmark-sub { font-size: var(--tged-fs-12); }

/* ---------- Gallery ---------- */
.gallery-intro { color: var(--tged-muted); max-width: 40rem; }
.gallery-block { margin-top: var(--tged-space-32); }

/* ---------- Discord card preview (/ui/discord): an approximation of a Discord embed ---------- */
.dc-gallery { display: grid; gap: var(--tged-space-32); grid-template-columns: repeat(auto-fit, minmax(min(100%, 30rem), 1fr)); align-items: start; }
.dc-block { min-width: 0; }
.dc-meta { color: var(--tged-muted); font-size: var(--tged-fs-13); margin: calc(var(--tged-space-4) * -1) 0 var(--tged-space-12); }
.dc-message { background: var(--tged-surface); border: var(--tged-rule-border); border-radius: var(--tged-radius-12); padding: var(--tged-space-14); display: grid; gap: var(--tged-space-8); font-size: var(--tged-fs-14); line-height: var(--tged-lh-145); }
.dc-embed { --dc-bar: var(--tged-muted); display: flex; gap: var(--tged-space-12); justify-content: space-between; background: var(--tged-raised); border-left: 4px solid var(--dc-bar); border-radius: var(--tged-radius-6); padding: var(--tged-space-10) var(--tged-space-14) var(--tged-space-12); max-width: 34rem; overflow-wrap: anywhere; }
.dc-embed-main { min-width: 0; display: grid; gap: var(--tged-space-6); flex: 1 1 auto; }
.dc-c-1877F2 { --dc-bar: #1877F2; }
.dc-c-8899A6 { --dc-bar: #8899A6; }
.dc-c-D62976 { --dc-bar: #D62976; }
.dc-c-22C55E { --dc-bar: #22C55E; }
.dc-c-EF4444 { --dc-bar: #EF4444; }
.dc-c-F59E0B { --dc-bar: #F59E0B; }
.dc-c-7DB4FF { --dc-bar: #7DB4FF; }
.dc-c-64748B { --dc-bar: #64748B; }
.dc-author { font-size: var(--tged-fs-13); font-weight: var(--tged-fw-semibold); }
.dc-title { font-weight: var(--tged-fw-display); font-size: var(--tged-fs-15); }
.dc-link { color: var(--tged-accent-text); }
.dc-description { white-space: normal; }
.dc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--tged-space-8) var(--tged-space-12); }
.dc-field { grid-column: 1 / -1; min-width: 0; }
.dc-field-inline { grid-column: auto; }
.dc-field-name { font-size: var(--tged-fs-12); font-weight: var(--tged-fw-display); color: var(--tged-muted); }
.dc-field-value { font-size: var(--tged-fs-13); }
.dc-image { width: 100%; max-width: 22rem; height: auto; border-radius: var(--tged-radius-6); margin-top: var(--tged-space-4); background: var(--tged-bg); object-fit: contain; }
.dc-thumb { width: var(--tged-space-64); height: var(--tged-space-64); border-radius: var(--tged-radius-6); object-fit: contain; background: var(--tged-bg); flex: 0 0 auto; }
.dc-footer { font-size: var(--tged-fs-11); color: var(--tged-muted); margin-top: var(--tged-space-2); }
.dc-description, .dc-field-value, .dc-content { white-space: pre-line; }
.dc-seg-bold { font-weight: var(--tged-fw-bold); }
.dc-seg-mention { background: var(--tged-tint); color: var(--tged-accent-text); border-radius: var(--tged-radius-4); padding: 0 var(--tged-space-4); }
.dc-seg-time { background: var(--tged-tint); border-radius: var(--tged-radius-4); padding: 0 var(--tged-space-4); }
.dc-buttons { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }
.dc-button { border-radius: var(--tged-radius-6); padding: var(--tged-space-5) var(--tged-space-14); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-semibold); background: var(--tged-tint); color: var(--tged-text); }
.dc-button-success { background: var(--tged-dc-green); color: var(--tged-on-dark); }
.dc-button-danger { background: var(--tged-dc-red); color: var(--tged-on-dark); }
.dc-button-link { background: var(--tged-tint-hover); }
@media (max-width: 575.98px) {
    .dc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Posts ---------- */
.post-list { list-style: none; margin: 0; padding: 0; }
.post-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-8) var(--tged-space-16);
    padding: var(--tged-space-12) var(--tged-space-20);
    border-bottom: var(--tged-rule-line);
}
.post-item:last-child { border-bottom: 0; }
.post-excerpt { flex: 1 1 14rem; min-width: 0; margin: 0; overflow-wrap: anywhere; }
.post-excerpt a { color: inherit; text-decoration: none; }
.post-excerpt a:hover { text-decoration: underline; }
.post-meta { color: var(--tged-muted); font-size: var(--tged-fs-14); }
.remote-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-12); margin: 0 0 var(--tged-space-16); overflow-wrap: anywhere; }
.remote-label { color: var(--tged-text); font-weight: var(--tged-fw-semibold); }
.remote-state { color: var(--tged-muted); }
.queue-card .draft-actions { flex-wrap: wrap; }
.post-actions { display: flex; gap: var(--tged-gap-btns); flex-wrap: wrap; align-items: center; }
.gallery-stack { display: grid; gap: var(--tged-space-20); }
.generate-actions { margin-top: var(--tged-space-16); gap: var(--tged-gap-meta); }
.idea-generate .post-meta + .table-responsive, .idea-generate .callout + .table-responsive { margin-top: var(--tged-gap-meta); }
.idea-generate .table-responsive + p { margin-top: var(--tged-space-16); }
.idea-generate td .post-meta { margin-left: 0; }
.post-actions form { margin: 0; }
.post-counter { color: var(--tged-muted); font-size: var(--tged-fs-14); margin-top: var(--tged-space-4); }
.post-counter.is-over { font-weight: var(--tged-fw-semibold); }
.set-group { margin-bottom: var(--tged-space-24); }
.slot-list { list-style: none; margin: 0; padding: var(--tged-space-12) var(--tged-space-20); color: var(--tged-muted); font-size: var(--tged-fs-14); }


.post-images { list-style: none; margin: 0 0 var(--tged-space-12); padding: 0; }
.post-image { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-16); padding: var(--tged-space-8) 0; border-bottom: var(--tged-rule-line); }
.post-image:last-child { border-bottom: 0; }
.post-image-thumb { width: 6rem; height: 4.5rem; object-fit: cover; border-radius: var(--tged-radius-8); background: var(--tged-bg); }
.post-image-body { flex: 1 1 14rem; min-width: 0; }
.post-image-body > summary { min-height: 2.5rem; padding-block: var(--tged-space-8); cursor: pointer; }
.post-image-more { display: grid; gap: var(--tged-space-8); padding-top: var(--tged-space-8); }
.image-tag { color: var(--tged-muted); font-size: var(--tged-fs-14); }
.library-pick { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: var(--tged-space-12); }
.library-pick-item { display: flex; flex-direction: column; gap: var(--tged-space-4); cursor: pointer; }
.library-pick-thumb { width: 100%; height: 5.5rem; object-fit: cover; border-radius: var(--tged-radius-8); background: var(--tged-bg); }
.media-users { margin: 0; font-size: var(--tged-fs-14); color: var(--tged-muted); }

/* ---------- v2 pages: Queues, Drafts, Review (task-017) ---------- */

/* Lane extras */
.lane-off { margin-bottom: var(--tged-space-4); }
.lane-off-link {
    display: inline-block;
    margin-bottom: var(--tged-space-10);
    font-weight: var(--tged-fw-medium);
}
.lane-sub {
    margin: var(--tged-space-12) 0 var(--tged-space-6);
    font-family: var(--tged-font-body);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-semibold);
    letter-spacing: 0;
    color: var(--tged-muted);
}
.lane-foot { margin: calc(var(--tged-space-8) * -1) 0 var(--tged-space-12); font-size: var(--tged-fs-13); color: var(--tged-muted); }

/* Image thumbnails */
.thumbs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4); margin: var(--tged-space-6) 0 0; padding: 0; list-style: none; }
.thumb {
    display: block;
    width: 2.25rem;
    height: 2.25rem;
    object-fit: cover;
    background: var(--tged-bg);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-8);
}
.thumb-more {
    display: grid;
    place-items: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 var(--tged-space-6);
    font-size: var(--tged-fs-13);
    color: var(--tged-muted);
    background: var(--tged-tint);
    border-radius: var(--tged-radius-8);
}
.thumbs-md .thumb { width: 4.5rem; height: 4.5rem; border-radius: var(--tged-radius-control); }
.thumbs-md .thumb-more { min-width: 4.5rem; height: 4.5rem; }

/* Queue rail rows */
.rail-queue .rail-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    color: var(--tged-text);
    text-decoration: none;
    overflow-wrap: anywhere;
}
.rail-queue a.rail-excerpt:hover { text-decoration: underline; }
.rail-actions { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); margin-top: var(--tged-space-6); }
.rail-actions form { margin: 0; }
.rail-queue .rail-item { padding-bottom: var(--tged-space-16); }

.waiting-list { list-style: none; margin: 0 0 var(--tged-space-16); padding: 0; }
.waiting-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-4) var(--tged-space-12);
    padding: var(--tged-space-8) 0;
    border-top: var(--tged-rule-line);
}
.waiting-excerpt {
    flex: 1 1 10rem;
    min-width: 0;
    overflow: hidden;
    color: var(--tged-text);
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}
a.waiting-excerpt:hover { text-decoration: underline; }
.waiting-item .post-actions { gap: var(--tged-space-6); }

/* Needs you groups on Queues */
.needs-strip-wide { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); align-items: start; }
.problem-group .callout-body { min-width: 0; }
.problem-list { list-style: none; margin: var(--tged-space-10) 0 0; padding: 0; }
.problem-item { padding: var(--tged-space-10) 0; border-top: 1px solid color-mix(in srgb, var(--c) 22%, transparent); }
.problem-excerpt { margin: 0; overflow-wrap: anywhere; }
.problem-excerpt a { color: var(--tged-text); }
.problem-error { margin: var(--tged-space-2) 0 0; font-size: var(--tged-fs-14); color: var(--tged-muted); }
.problem-item .post-actions { margin-top: var(--tged-space-8); align-items: flex-start; }
.problem-publish { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); align-items: center; }
.problem-publish .form-control { width: 12rem; }

/* Filter chips and toolbars */
.chips { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); }
.nav-pills { gap: var(--tged-space-8); }
.chip,
.nav-pills .nav-link {
    display: inline-flex;
    align-items: center;
    padding: var(--tged-space-4) var(--tged-space-12);
    font-size: var(--tged-fs-13);
    font-weight: var(--tged-fw-medium);
    line-height: var(--tged-lh-20px);
    color: var(--tged-muted);
    text-decoration: none;
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-pill);
    transition: background-color var(--tged-dur-base) var(--tged-ease), color var(--tged-dur-base) var(--tged-ease);
}
.chip:hover,
.nav-pills .nav-link:hover { color: var(--tged-text); background: var(--tged-tint-hover); }
.chip.active,
.nav-pills .nav-link.active {
    color: var(--tged-accent-text);
    background: var(--tged-accent-soft);
    border-color: var(--tged-accent-mid);
}
.chip-bar { display: flex; flex-wrap: wrap; gap: var(--tged-space-8) var(--tged-space-24); margin-bottom: var(--tged-space-12); }
.toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-12) var(--tged-space-16);
    margin-bottom: var(--tged-space-16);
}
.toolbar-search { display: flex; gap: var(--tged-space-8); flex: 1 1 14rem; max-width: 24rem; }
.toolbar-search .form-control { min-width: 0; min-height: var(--tged-btn-h); padding-block: 0; }
.toolbar-new { margin-left: auto; }

/* Drafts */
.draft-groups { display: grid; gap: var(--tged-gap-stack); }
.draft-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--tged-space-4) var(--tged-space-12);
    padding: var(--tged-space-12) var(--tged-space-20) var(--tged-space-4);
}
.draft-card-title { margin: 0; font-size: var(--tged-fs-15); }
.draft-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    gap: var(--tged-space-8) var(--tged-space-14);
    align-items: start;
    padding: var(--tged-space-14) var(--tged-space-20);
    border-bottom: var(--tged-rule-line);
}
.draft-row:last-child { border-bottom: 0; }
.draft-check { align-self: center; }
html:not(.js) .draft-row { grid-template-columns: auto minmax(0, 1fr); }
.draft-body { min-width: 0; }
.draft-excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    color: var(--tged-text);
    text-decoration: none;
    overflow-wrap: anywhere;
}
a.draft-excerpt:hover { text-decoration: underline; }
.draft-meta { grid-column: 3; display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-12); }
.draft-actions { grid-column: 3; }
html:not(.js) .draft-meta, html:not(.js) .draft-actions { grid-column: 2; }
@media (min-width: 992px) {
    .draft-row { grid-template-columns: auto auto minmax(0, 1fr) 10.5rem 13rem; align-items: center; }
    html:not(.js) .draft-row { grid-template-columns: auto minmax(0, 1fr) 10.5rem 13rem; }
    .draft-meta, .draft-actions, html:not(.js) .draft-meta, html:not(.js) .draft-actions { grid-column: auto; }
    .draft-meta { flex-direction: column; align-items: flex-end; gap: var(--tged-space-4); }
    .draft-actions { justify-content: flex-end; }
}

/* Queues: network switcher, summary strip, draggable list (task-018) */
.seg-count {
    min-width: var(--tged-space-20);
    padding: 0 var(--tged-space-6);
    font-size: var(--tged-fs-12);
    line-height: var(--tged-lh-20px);
    text-align: center;
    color: var(--tged-muted-strong);
    background: var(--tged-tint);
    border-radius: var(--tged-radius-pill);
}
.segmented-item.active .seg-count { color: var(--tged-text); }
.queue-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-12) var(--tged-space-32);
    margin-bottom: var(--tged-gap-stack);
    padding: var(--tged-space-14) var(--tged-space-20);
}
.queue-summary .lane-head { margin: 0; }
.queue-summary-next { display: grid; gap: var(--tged-space-2); }
.queue-summary-value { font-family: var(--tged-font-display); font-size: var(--tged-fs-18); font-weight: var(--tged-fw-display); }
.queue-summary-coverage { flex: 1 1 14rem; min-width: 0; }
.queue-summary-coverage .coverage { margin-bottom: 0; }
.queue-summary-off { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tged-space-4) var(--tged-space-12); }
.queue-summary-off .lane-note, .queue-summary-off .lane-off-link { margin: 0; }
.queue-card { margin-bottom: var(--tged-gap-stack); }
.gallery-scroll { max-height: 7rem; overflow: auto; padding: var(--tged-space-8) var(--tged-space-12); border: var(--tged-rule-edge); border-radius: var(--tged-radius-control); }
.gallery-scroll-text { resize: none; }
.queue-pos {
    align-self: center;
    min-width: var(--tged-space-24);
    font-weight: var(--tged-fw-semibold);
    text-align: center;
    color: var(--tged-muted);
}
.drag-handle {
    align-self: center;
    display: grid;
    place-items: center;
    width: var(--tged-space-32);
    height: 2.75rem;
    color: var(--tged-muted);
    border-radius: var(--tged-radius-8);
    cursor: grab;
    touch-action: none;
    user-select: none;
}
.drag-handle:hover { color: var(--tged-text); background: var(--tged-tint); }
.drag-handle:active { cursor: grabbing; }
.slot-chip {
    display: inline-block;
    padding: var(--tged-space-2) var(--tged-space-10);
    font-size: var(--tged-fs-13);
    color: var(--tged-text);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-pill);
}
.slot-chip.is-waiting { color: var(--tged-muted); }
.queue-unpaired { margin: var(--tged-space-8) 0 0; }
.queue-row.is-ghost { opacity: 0.45; background: var(--tged-tint); }
.queue-row.is-chosen { background: var(--tged-tint); }
.queue-row.is-dragging { box-shadow: var(--tged-shadow-float); }
[data-queue-panel].is-busy { opacity: 0.6; pointer-events: none; }
html:not(.js) .queue-row { grid-template-columns: auto minmax(0, 1fr); }
@media (min-width: 992px) {
    .queue-row { grid-template-columns: auto auto minmax(0, 1fr) 14rem 16rem; }
    html:not(.js) .queue-row { grid-template-columns: auto minmax(0, 1fr) 14rem 16rem; }
    .queue-row .draft-meta { align-items: flex-end; }
}

/* Sticky bulk bar */
.bulk-bar {
    position: sticky;
    bottom: var(--tged-space-16);
    z-index: var(--tged-z-sticky);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--tged-space-12) var(--tged-space-16);
    margin-top: var(--tged-space-16);
    padding: var(--tged-space-10) var(--tged-space-12) var(--tged-space-10) var(--tged-space-18);
    background: var(--tged-raised);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-card);
    box-shadow: var(--tged-shadow-float);
    transition: opacity var(--tged-dur-fade) var(--tged-ease), transform var(--tged-dur-slide) var(--tged-ease-out), visibility 0s;
}
.bulk-count { font-weight: var(--tged-fw-medium); }
.js .bulk-bar:not(.is-visible) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(14px);
    pointer-events: none;
    transition: opacity var(--tged-dur-fade) var(--tged-ease), transform var(--tged-dur-slide) var(--tged-ease), visibility 0s var(--tged-dur-slide);
}
.bulk-demo .bulk-bar { position: static; opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .bulk-bar {
        background: var(--tged-glass);
        -webkit-backdrop-filter: var(--tged-blur-glass);
        backdrop-filter: var(--tged-blur-glass);
    }
}

/* Review */
.queue-summary-next .post-meta { margin-top: var(--tged-space-2); }
.review-row { align-items: start; }
.review-row .draft-check { align-self: start; padding-top: var(--tged-space-8); min-width: var(--tged-space-18); }
.review-row .draft-meta, .review-row .draft-actions { align-self: start; }
.row-text, .row-text-plain { margin: 0; overflow-wrap: anywhere; }
.row-text-plain, .row-text-body { white-space: pre-wrap; }
.row-text summary { display: block; list-style: none; cursor: pointer; }
.row-text summary::-webkit-details-marker { display: none; }
.row-text-body {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.row-text[open] .row-text-body { display: block; overflow: visible; }
.row-text-toggle { display: inline-block; margin-top: var(--tged-space-2); color: var(--tged-accent-text); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); }
.row-text summary:hover .row-text-toggle { text-decoration: underline; }
.row-text summary:focus-visible { outline: var(--tged-outline); outline-offset: 2px; border-radius: var(--tged-radius-4); }
.row-text .when-open, .row-text[open] .when-closed { display: none; }
.row-text[open] .when-open { display: inline; }
.warn-chip { margin-top: var(--tged-space-6); }
.warn-chip summary { display: inline-block; list-style: none; cursor: pointer; }
.warn-chip summary::before { content: ""; display: inline-block; width: var(--tged-space-8); height: var(--tged-space-8); margin-right: var(--tged-space-6); border-radius: var(--tged-radius-round); background: var(--pill-attention); }
.warn-chip.is-problem summary::before { background: var(--pill-failed, var(--pill-attention)); }
.warn-chip summary::-webkit-details-marker { display: none; }
.warn-chip summary:focus-visible { outline: var(--tged-outline); outline-offset: 2px; }
.warn-chip[open] summary { background: var(--tged-tint); }
.review-notes { display: grid; gap: var(--tged-space-8); margin-top: var(--tged-space-8); }
.review-notes .callout-title { font-weight: var(--tged-fw-medium); }
a.set-chip { text-decoration: none; }
a.set-chip:hover { background: var(--tged-raised); text-decoration: underline; }
.set-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-8) var(--tged-space-12);
    margin-bottom: var(--tged-space-12);
    padding: var(--tged-space-8) var(--tged-space-12) var(--tged-space-8) var(--tged-space-16);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-12);
}
.set-banner-text { flex: 1 1 12rem; font-weight: var(--tged-fw-medium); overflow-wrap: anywhere; }
.set-banner form { margin: 0; }
.review-row .draft-actions { flex-wrap: wrap; }

/* Drawer with preformatted text */
.drawer-pre {
    margin: 0;
    font-size: var(--tged-fs-13);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    color: var(--tged-text);
}

/* ---------- Media library v2 (task-020) ---------- */
.chip-count { margin-left: var(--tged-space-4); }
.chip-group { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-6) var(--tged-space-8); }
.chip-label { font-size: var(--tged-fs-13); color: var(--tged-muted); }

.media-file { max-width: 22rem; }
.media-drop {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-12) var(--tged-space-20);
    padding: var(--tged-space-20) var(--tged-space-24);
    border-style: dashed;
    border-color: color-mix(in srgb, var(--tged-text) 22%, transparent);
}
.media-drop-icon { font-size: var(--tged-fs-32); line-height: var(--tged-lh-1); color: var(--tged-accent-text); }
.media-drop-body { flex: 1 1 16rem; min-width: 0; }
.media-drop-title { margin: 0 0 var(--tged-space-4); font-weight: var(--tged-fw-semibold); }
.media-drop-actions { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }
html.js .media-drop .media-upload-submit { display: none; }
.media-progress { margin-top: var(--tged-space-16); padding: var(--tged-space-16) var(--tged-space-20); }
.media-progress[hidden] { display: none; }
.media-progress-title { margin: 0 0 var(--tged-space-8); font-weight: var(--tged-fw-semibold); }
.media-progress-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--tged-space-8); }
.media-progress-item { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-4) var(--tged-space-12); align-items: center; }
@media (min-width: 768px) {
    .media-progress-item { grid-template-columns: minmax(0, 1.2fr) 10rem minmax(0, 1.6fr); }
}
.media-progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-progress-bar { width: 100%; height: var(--tged-space-8); accent-color: var(--tged-accent); }
.media-progress-status { font-size: var(--tged-fs-14); color: var(--tged-muted); overflow-wrap: anywhere; }
.media-progress-item.is-failed .media-progress-bar { opacity: 0.4; }
.media-progress-link { grid-column: 1 / -1; font-size: var(--tged-fs-14); }
.media-drawer-icon { --net-icon: var(--tged-accent-text); --net-tint: var(--tged-tint-hover); --net-tint-b: var(--tged-tint); }
.media-progress-item.is-ok .media-progress-status { color: var(--tged-text); }
.media-progress-item.is-failed .media-progress-status { color: var(--tged-text); font-weight: var(--tged-fw-semibold); }
.media-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--tged-z-overlay);
    display: grid;
    place-items: center;
    padding: var(--tged-space-24);
    pointer-events: none;
    background: color-mix(in srgb, var(--tged-bg) 80%, transparent);
    backdrop-filter: var(--tged-blur-4);
}
.media-overlay[hidden] { display: none; }
.media-overlay-card {
    display: flex;
    align-items: center;
    gap: var(--tged-space-14);
    padding: var(--tged-space-40) var(--tged-space-48);
    font-size: var(--tged-fs-20);
    font-weight: var(--tged-fw-semibold);
    background: var(--tged-raised);
    border: 2px dashed var(--tged-accent);
    border-radius: var(--tged-radius-panel);
}
.media-overlay-card .bi { font-size: var(--tged-fs-32); color: var(--tged-accent-text); }

.media-toolbar { display: flex; flex-wrap: wrap; gap: var(--tged-space-10) var(--tged-space-24); margin: var(--tged-space-20) 0 var(--tged-space-12); }
.media-grid {
    list-style: none;
    margin: var(--tged-space-12) 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--tged-space-12);
}
@media (min-width: 576px) { .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 992px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--tged-space-16); } }
@media (min-width: 1400px) { .media-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.media-tile {
    position: relative;
    overflow: hidden;
    background: linear-gradient(180deg, var(--tged-hl), transparent 45%), var(--tged-surface);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
}
.media-open { display: block; color: inherit; text-decoration: none; }
.media-open:focus-visible { outline: var(--tged-outline); outline-offset: -2px; }
.media-frame { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--tged-bg); }
.media-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
/* In place of an image whose file is gone; the image's own class gives it its size. */
.thumb-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: var(--tged-space-32);
    min-height: var(--tged-space-32);
    color: var(--tged-muted);
    background: var(--tged-tint);
    border-radius: var(--tged-radius-8);
}
.media-hover {
    position: absolute;
    inset: auto 0 0 0;
    padding: var(--tged-space-20) var(--tged-space-12) var(--tged-space-8);
    font-size: var(--tged-fs-13);
    color: var(--tged-on-dark);
    background: linear-gradient(0deg, var(--tged-fade-from), var(--tged-fade-to));
    opacity: 0;
    transition: opacity var(--tged-dur-quick) var(--tged-ease);
}
.media-open:hover .media-hover, .media-open:focus-visible .media-hover { opacity: 1; }
.media-pick {
    position: absolute;
    top: var(--tged-space-8);
    left: var(--tged-space-8);
    z-index: var(--tged-z-raised);
    display: grid;
    place-items: center;
    width: var(--tged-space-28);
    height: var(--tged-space-28);
    margin: 0;
    background: color-mix(in srgb, var(--tged-surface) 86%, transparent);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-8);
    cursor: pointer;
}
.media-pick .form-check-input { margin: 0; }
.media-badges { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); padding: var(--tged-space-10) var(--tged-space-12); }
.media-detail { display: grid; gap: 0; }
.media-detail-page { max-width: 44rem; padding: var(--tged-space-24); }
.media-detail-preview {
    display: grid;
    place-items: center;
    padding: var(--tged-space-8);
    background: var(--tged-bg);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-12);
}
.media-detail-preview img { display: block; max-width: 100%; max-height: 52vh; width: auto; height: auto; object-fit: contain; border-radius: var(--tged-radius-8); }
.media-detail-badges { display: flex; flex-wrap: wrap; gap: var(--tged-space-6); margin-top: var(--tged-space-14); }
.media-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tged-space-12) var(--tged-space-16); margin: var(--tged-space-16) 0 0; }
.media-facts dt { font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); color: var(--tged-muted); }
.media-facts dd { margin: 0; }
.media-block { display: block; margin-top: var(--tged-space-20); }
.media-block-title { margin: 0 0 var(--tged-space-8); font-family: var(--tged-font-body); font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); }
.media-copy { display: flex; gap: var(--tged-space-8); }
.media-copy .form-control { min-width: 0; }
.site-links { display: grid; }
.site-links > .form-text { margin-top: var(--tged-space-8); }
.site-link-row .form-label { margin-bottom: var(--tged-space-6); }
.media-used { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--tged-space-4); }
.media-danger { padding-top: var(--tged-space-16); border-top: var(--tged-rule-line); }
.media-error { margin: 0 0 var(--tged-space-16); padding: var(--tged-space-10) var(--tged-space-14); font-weight: var(--tged-fw-medium); border: 1px solid var(--tged-danger); border-radius: var(--tged-radius-control); }

/* ---------- Command palette (task-020) ---------- */
.palette-trigger { display: inline-flex; align-items: center; gap: var(--tged-space-8); }
.palette-kbd {
    padding: var(--tged-space-1) var(--tged-space-6);
    font: inherit;
    font-size: var(--tged-fs-12);
    color: var(--tged-muted-strong);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-6);
}
@media (max-width: 575.98px) {
    .palette-kbd { display: none; }
    .palette-trigger-text {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}
body.palette-open { overflow: hidden; }
.palette {
    position: fixed;
    inset: 0;
    z-index: var(--tged-z-palette);
    display: grid;
    justify-items: center;
    align-items: start;
    padding: 12vh var(--tged-space-16) var(--tged-space-16);
}
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: var(--tged-scrim-55); backdrop-filter: var(--tged-blur-3); }
.palette-dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 36rem;
    max-height: min(32rem, 76vh);
    overflow: hidden;
    background: linear-gradient(180deg, var(--tged-hl), transparent 45%), var(--tged-raised);
    border: 1px solid color-mix(in srgb, var(--tged-text) 16%, transparent);
    border-radius: var(--tged-radius-panel);
    box-shadow: var(--tged-shadow-float);
}
.palette-input-row { display: flex; align-items: center; gap: var(--tged-space-12); padding: var(--tged-space-10) var(--tged-space-16); border-bottom: var(--tged-rule-line); }
.palette-input-row:focus-within { box-shadow: var(--tged-inset-focus); }
.palette-input-row > .bi { color: var(--tged-muted); }
.palette-input { flex: 1 1 auto; min-width: 0; padding: var(--tged-space-6) 0; font-size: var(--tged-fs-16); color: var(--tged-text); background: transparent; border: 0; outline: none; }
.palette-input::placeholder { color: var(--tged-muted); }
.palette-list { flex: 1 1 auto; margin: 0; padding: var(--tged-space-6); overflow: auto; list-style: none; }
.palette-group { padding: var(--tged-space-8) var(--tged-space-10) var(--tged-space-4); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-semibold); color: var(--tged-muted); }
.palette-option { display: flex; align-items: center; gap: var(--tged-space-12); padding: var(--tged-space-8) var(--tged-space-10); cursor: pointer; border-radius: var(--tged-radius-control); }
.palette-option .bi { flex: none; color: var(--tged-accent-text); }
.palette-option.is-active { background: var(--tged-accent-soft); }
.palette-text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.palette-label { font-weight: var(--tged-fw-medium); }
.palette-detail { overflow: hidden; font-size: var(--tged-fs-13); color: var(--tged-muted); text-overflow: ellipsis; white-space: nowrap; }
.palette-status { flex: none; font-size: var(--tged-fs-13); color: var(--tged-muted); }
.palette-empty, .palette-foot { margin: 0; padding: var(--tged-space-12) var(--tged-space-16); font-size: var(--tged-fs-13); color: var(--tged-muted); }
.palette-foot { border-top: var(--tged-rule-line); }

/* ---------- Queues All view (task-020) ---------- */
.queue-sections { display: grid; gap: var(--tged-space-24); }
.lane-name-link { color: inherit; text-decoration: none; }
.lane-name-link:hover { color: var(--tged-accent-text); text-decoration: underline; }

/* ---------- Motion ---------- */
/* Cross-document view transitions: only the main content fades and rises 8px; the sidebar and top bar stay still. */
@media (prefers-reduced-motion: no-preference) {
    @view-transition { navigation: auto; }
    .content { view-transition-name: tged-main; }
    .topbar { view-transition-name: tged-topbar; }
    @media (min-width: 992px) {
        .sidebar { view-transition-name: tged-sidebar; }
    }
    ::view-transition-group(root),
    ::view-transition-old(root),
    ::view-transition-new(root),
    ::view-transition-group(tged-topbar),
    ::view-transition-old(tged-topbar),
    ::view-transition-new(tged-topbar),
    ::view-transition-group(tged-sidebar),
    ::view-transition-old(tged-sidebar),
    ::view-transition-new(tged-sidebar) {
        animation: none;
        mix-blend-mode: normal;
    }
    ::view-transition-old(tged-main) { animation: tged-main-out var(--tged-dur-fast) var(--tged-ease) both; }
    ::view-transition-new(tged-main) { animation: tged-main-in var(--tged-dur-page) var(--tged-ease-out) both; }
}
@keyframes tged-main-out {
    to { opacity: 0; }
}
@keyframes tged-main-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Post editor, New post and previews (task-019) ---------- */
.post-layout { display: grid; gap: var(--tged-space-20); align-items: start; }
@media (min-width: 1200px) {
    .post-layout { grid-template-columns: minmax(0, 1fr) 25rem; }
    .post-preview { position: sticky; top: 5rem; }
}
.post-main { min-width: 0; }
.post-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--tged-space-8) var(--tged-space-12);
    padding: var(--tged-space-14) var(--tged-space-22);
    border-bottom: var(--tged-rule-line);
}
.post-card-sets { margin-left: auto; }
.post-notes { display: grid; gap: var(--tged-space-8); margin-top: var(--tged-space-10); }
.post-notes .callout-title, .post-image-notes .callout-title { font-weight: var(--tged-fw-medium); }
.post-image { position: relative; }
.post-image-notes { flex: 1 1 100%; display: grid; gap: var(--tged-space-8); }
.ratio-badge { margin-left: var(--tged-space-8); font-size: var(--tged-fs-12); line-height: var(--tged-lh-18px); vertical-align: middle; }
.post-counters { display: flex; flex-wrap: wrap; gap: var(--tged-space-4) var(--tged-space-16); margin-top: var(--tged-space-4); }
.post-counters .post-counter { margin-top: 0; }
.autosave-status { display: inline-flex; align-items: center; gap: var(--tged-space-4); margin-right: auto; font-size: var(--tged-fs-14); color: inherit; }
.autosave-status[data-state="saving"] { opacity: 0.8; }
.autosave-status[data-state="error"], .autosave-status[data-state="conflict"], .autosave-status[data-state="invalid"] { color: var(--bs-danger-text-emphasis, var(--tged-danger-text)); }
/* The engine's field status, its note under a field, and the one status of the page (task-080). */
.autosave-field-status { margin-left: var(--tged-space-8); font-size: var(--tged-fs-12); font-weight: var(--tged-fw-regular); color: var(--tged-muted); }
.autosave-field-status[data-state="invalid"], .autosave-field-status[data-state="error"], .autosave-field-status[data-state="conflict"] { color: var(--tged-danger-text); }
.autosave-field-note { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8); margin-top: var(--tged-space-4); font-size: var(--tged-fs-14); color: var(--tged-danger-text); }
.autosave-field-note[data-state="confirm"] { color: var(--tged-text); }
.autosave-page-status { font-size: var(--tged-fs-12); white-space: nowrap; color: var(--tged-muted); }
.autosave-page-status[data-state="failed"] { color: var(--tged-danger-text); font-weight: var(--tged-fw-medium); }
html.autosave-on form[data-autosave-form] [data-autosave-hide], html.autosave-on form[data-autosave] [data-autosave-hide], html.autosave-on form[data-autosave-form] [data-action-bar] { display: none !important; }
div[data-autosave-refresh] { display: contents; }
.toast-action { flex: none; padding: 0 var(--tged-space-4); border: 0; background: none; color: inherit; font-weight: var(--tged-fw-medium); text-decoration: underline; }
.action-bar-persist .action-bar-msg { display: none; }
.action-bar-persist.is-visible .action-bar-msg { display: inline-flex; }
.js .action-bar.action-bar-persist:not(.is-visible) {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}

/* Network toggle chips on New post: a visually hidden checkbox followed by its label. */
.net-toggles { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }
.net-toggle-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.net-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--tged-space-8);
    margin: 0;
    padding: var(--tged-space-7) var(--tged-space-14);
    font-weight: var(--tged-fw-medium);
    color: var(--tged-text);
    background: var(--tged-tint);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-pill);
    cursor: pointer;
    transition: background-color var(--tged-dur-quick) var(--tged-ease), border-color var(--tged-dur-quick) var(--tged-ease);
}
.net-toggle .bi { color: var(--net-icon); }
.net-toggle:hover { background: var(--tged-tint-hover); }
.net-toggle-input:checked + .net-toggle { background: var(--tged-accent-soft); border-color: var(--tged-accent); }
.net-toggle-input:focus-visible + .net-toggle { outline: var(--tged-outline); outline-offset: 2px; }

/* Preview panel */
.post-preview {
    padding: var(--tged-space-16);
    background: var(--tged-surface);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-panel);
}
.post-preview-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--tged-space-12); margin-bottom: var(--tged-space-12); }
.post-preview-bar .panel-title { margin: 0; }
.post-preview-toggle { display: none; }
@media (max-width: 1199.98px) {
    .js .post-preview-toggle { display: inline-flex; }
    .js .post-preview[data-preview-panel]:not(.is-open) .post-preview-body { display: none; }
    .js .post-preview[data-preview-panel]:not(.is-open) .post-preview-bar { margin-bottom: 0; }
}
.pv-tabs { display: flex; flex-wrap: wrap; gap: var(--tged-space-4); margin-bottom: var(--tged-space-12); }
.pv-tab {
    padding: var(--tged-space-4) var(--tged-space-12);
    font-size: var(--tged-fs-14);
    color: var(--tged-muted);
    background: transparent;
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-pill);
}
.pv-tab:hover { color: var(--tged-text); background: var(--tged-tint); }
.pv-tab.is-active { color: var(--tged-text); background: var(--tged-tint-hover); border-color: var(--tged-border); }
.drawer-preview { --bs-offcanvas-width: min(26rem, 100vw); }
.pv-note { margin: var(--tged-space-10) 0 0; font-size: var(--tged-fs-13); color: var(--tged-muted); }
.pv-empty { color: var(--tged-muted); margin: 0; }

.pv-card {
    padding: var(--tged-space-14);
    color: var(--tged-text);
    background: var(--tged-raised);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-card);
    overflow-wrap: anywhere;
}
.pv-head { display: flex; align-items: center; gap: var(--tged-space-10); margin-bottom: var(--tged-space-10); }
.pv-avatar { flex: none; width: var(--tged-space-40); height: var(--tged-space-40); object-fit: cover; border-radius: var(--tged-radius-round); background: var(--tged-bg); }
.pv-who { display: flex; flex-direction: column; min-width: 0; line-height: var(--tged-lh-130); }
.pv-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--tged-space-8); }
.pv-name { font-weight: var(--tged-fw-semibold); }
.pv-sub { font-size: var(--tged-fs-13); color: var(--tged-muted); }
.pv-text { margin: 0 0 var(--tged-space-10); white-space: pre-wrap; line-height: var(--tged-lh-145); }
.pv-caption { margin: var(--tged-space-8) 0 0; }
.pv-user { font-weight: var(--tged-fw-semibold); }
.pv-url, .pv-tag, .pv-mention { color: var(--tged-accent-text); }
.pv-more {
    padding: 0;
    color: var(--tged-muted);
    font: inherit;
    background: none;
    border: 0;
}
.pv-more:hover { color: var(--tged-text); text-decoration: underline; }
.pv-actions { display: flex; flex-wrap: wrap; gap: var(--tged-space-4) var(--tged-space-20); margin-top: var(--tged-space-10); color: var(--tged-muted); font-size: var(--tged-fs-14); }
.pv-action { display: inline-flex; align-items: center; gap: var(--tged-space-6); }
.pv-instagram .pv-actions { margin-top: var(--tged-space-8); font-size: var(--tged-fs-18); }
.pv-x .pv-text { margin-bottom: var(--tged-space-8); }

/* Image layouts: one grid per layout name from preview.js. */
.pv-grid { display: grid; gap: var(--tged-space-2); overflow: hidden; border-radius: var(--tged-radius-control); background: var(--tged-bg); }
.pv-x .pv-grid { border-radius: var(--tged-radius-panel); }
.pv-cell { position: relative; min-width: 0; min-height: 0; overflow: hidden; }
.pv-img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.pv-img.thumb-missing { display: flex; border-radius: 0; }
.pv-overlay {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: var(--tged-fs-24);
    font-weight: var(--tged-fw-semibold);
    color: var(--tged-on-dark);
    background: var(--tged-scrim-62);
}
.pv-l-full .pv-cell, .pv-l-single .pv-cell { height: 100%; }
.pv-whole .pv-img { object-fit: contain; }
.pv-fullimg { display: block; margin: var(--tged-space-4) 0 0; padding: 0; border: 0; background: none; font: inherit; font-size: var(--tged-fs-13); color: inherit; text-decoration: underline; cursor: pointer; }
.pv-l-two { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.pv-l-one-two { grid-template-columns: 1fr 1fr; grid-template-rows: 3fr 2fr; aspect-ratio: 1 / 1; }
.pv-l-one-two .pv-cell:first-child { grid-column: 1 / 3; }
.pv-l-grid { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 1 / 1; }
.pv-l-two-three { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr 1fr; aspect-ratio: 6 / 5; }
.pv-l-two-three .pv-cell:nth-child(-n + 2) { grid-column: span 3; }
.pv-l-two-three .pv-cell:nth-child(n + 3) { grid-column: span 2; }
.pv-l-tall-left { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16 / 9; }
.pv-l-tall-left .pv-cell:first-child { grid-row: 1 / 3; }

/* Instagram carousel */
.pv-carousel { margin: 0 calc(var(--tged-space-14) * -1); }
.pv-carousel:focus-visible { outline: var(--tged-outline); outline-offset: -2px; }
.pv-ig-frame { position: relative; overflow: hidden; background: var(--tged-bg); }
.pv-slide { position: absolute; inset: 0; }
.pv-slide[hidden] { display: none; }
.pv-ig-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--tged-space-8); color: var(--tged-muted); }
.pv-ig-empty .bi { font-size: var(--tged-fs-32); }
.pv-ig-count {
    position: absolute;
    top: var(--tged-space-8);
    right: var(--tged-space-8);
    z-index: var(--tged-z-raised);
    padding: 0 var(--tged-space-8);
    font-size: var(--tged-fs-12);
    line-height: var(--tged-lh-22px);
    color: var(--tged-on-dark);
    background: var(--tged-scrim-70);
    border-radius: var(--tged-radius-pill);
}
.pv-nav {
    position: absolute;
    top: 50%;
    z-index: var(--tged-z-raised);
    display: grid;
    place-items: center;
    width: var(--tged-space-32);
    height: var(--tged-space-32);
    margin-top: calc(var(--tged-space-16) * -1);
    padding: 0;
    color: var(--tged-pvnav-fg);
    background: var(--tged-pvnav-bg);
    border: 0;
    border-radius: var(--tged-radius-round);
}
.pv-nav:disabled { display: none; }
.pv-nav:focus-visible, .pv-dot:focus-visible, .pv-more:focus-visible, .pv-tab:focus-visible { outline: var(--tged-outline); outline-offset: 2px; }
.pv-prev { left: var(--tged-space-8); }
.pv-next { right: var(--tged-space-8); }
.pv-dots { display: flex; justify-content: center; gap: var(--tged-space-6); padding-top: var(--tged-space-8); }
.pv-dot {
    width: var(--tged-space-7);
    height: var(--tged-space-7);
    padding: 0;
    background: var(--tged-track);
    border: 0;
    border-radius: var(--tged-radius-round);
}
.pv-dot[aria-current="true"] { background: var(--tged-accent); }

/* ---------- Scrollbars (task-018): thin, transparent track, muted thumb, accent on hover or drag ---------- */
/* Engines that know ::-webkit-scrollbar (Chromium, Safari) use the rules below, which can show the accent on hover;
   the standard properties serve the rest (Firefox). */
@supports not selector(::-webkit-scrollbar) {
    * {
        scrollbar-width: thin;
        scrollbar-color: var(--tged-muted) transparent;
    }
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track, ::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-thumb {
    background-color: var(--tged-muted);
    background-clip: content-box;
    border: 2px solid transparent;
    border-radius: var(--tged-radius-pill);
}
::-webkit-scrollbar-thumb:hover, ::-webkit-scrollbar-thumb:active { background-color: var(--tged-accent); }

/* Live updates: the top-bar indicator and the "Updated. Reload section" button shown where a person is working */
.live-status { font-size: var(--tged-fs-13); color: var(--tged-muted); white-space: nowrap; }
.live-stale-btn { margin-bottom: var(--tged-space-12); }
[data-live-notice]:not(:empty) { margin-bottom: var(--tged-space-16); }

/* Outbox page (task-033) */
.pill-link { text-decoration: none; }
a.health-label { color: inherit; text-decoration: underline; text-decoration-color: var(--tged-edge); text-underline-offset: 0.2em; }
a.health-label:hover { text-decoration-color: currentColor; }
.net-discord { --net-icon: var(--tged-text); --net-tint: var(--tged-tint); --net-tint-b: var(--tged-tint-hover); }
.outbox-row, html:not(.js) .outbox-row { grid-template-columns: auto minmax(0, 1fr); }
.outbox-row .draft-meta, .outbox-row .draft-actions, html:not(.js) .outbox-row .draft-meta, html:not(.js) .outbox-row .draft-actions { grid-column: 2; }
@media (min-width: 992px) {
    .outbox-row, html:not(.js) .outbox-row { grid-template-columns: auto minmax(0, 1fr) 10.5rem 13rem; }
    .outbox-row .draft-meta, .outbox-row .draft-actions, html:not(.js) .outbox-row .draft-meta, html:not(.js) .outbox-row .draft-actions { grid-column: auto; }
}
.outbox-title { margin: 0; font-weight: var(--tged-fw-semibold); }
.outbox-facts { display: flex; flex-wrap: wrap; gap: var(--tged-space-2) var(--tged-space-14); margin-top: var(--tged-space-2); }
.outbox-error { margin: var(--tged-space-4) 0 0; overflow-wrap: anywhere; }
.outbox-code { font-size: var(--tged-fs-12); color: var(--tged-text); overflow-wrap: anywhere; }
.outbox-log { margin: 0; padding-left: var(--tged-space-20); font-size: var(--tged-fs-13); display: grid; gap: var(--tged-space-4); }
.drawer-actions { margin-top: var(--tged-space-16); }
.drawer-outbox { --bs-offcanvas-width: min(32rem, 100vw); }
.drawer-heading { margin: var(--tged-space-16) 0 var(--tged-space-8); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-semibold); color: var(--tged-muted); }
.drawer-heading:first-child { margin-top: 0; }

/* Stats and Audit pages (task-035) */
.cost-chart { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); align-items: start; }
.cost-chart-axis { display: block; }
.chart-label { fill: var(--tged-muted); font-size: var(--tged-fs-11); }
.cost-chart-plot { position: relative; min-width: 0; padding-top: var(--tged-space-6); }
.cost-chart-grid { position: absolute; top: var(--tged-space-6); left: 0; width: 100%; height: 160px; overflow: visible; }
.chart-grid-line { stroke: var(--tged-line); stroke-width: 1; }
.chart-axis { stroke: var(--tged-border); stroke-width: 1; }
.cost-chart-cols, .cost-chart-days { display: flex; list-style: none; margin: 0; padding: 0; }
.cost-chart-cols { position: relative; height: 160px; }
.cost-chart-col { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; border-radius: var(--tged-radius-4); }
.cost-chart-col:hover, .cost-chart-col:focus-visible { background: var(--tged-hl); }
.chart-bar { display: block; width: 100%; max-width: 2.25rem; }
.chart-bar rect { fill: var(--tged-accent); }
.chart-value { margin-bottom: var(--tged-space-2); font-size: var(--tged-fs-11); line-height: var(--tged-lh-120); color: var(--tged-muted); white-space: nowrap; }
.cost-chart.is-dense .chart-value { display: none; }
.cost-chart.is-dense .cost-chart-col:hover .chart-value, .cost-chart.is-dense .cost-chart-col:focus-visible .chart-value,
.cost-chart.is-many .cost-chart-col:hover .chart-value, .cost-chart.is-many .cost-chart-col:focus-visible .chart-value {
    display: block; position: absolute; top: 0; left: 50%; transform: translateX(-50%); z-index: var(--tged-z-raised);
    padding: var(--tged-space-2) var(--tged-space-6); border: var(--tged-rule-border); border-radius: var(--tged-radius-6); background: var(--tged-raised); color: var(--tged-text);
}
.cost-chart-days li { flex: 1 1 0; min-width: 0; padding-top: var(--tged-space-4); overflow: hidden; text-align: center; font-size: var(--tged-fs-10); color: var(--tged-muted); white-space: nowrap; }
.day-short, .day-month { display: none; }
.day-month { font-size: var(--tged-fs-9); line-height: var(--tged-lh-1); }
/* Short labels (the day number, with the month under the first day and every 1st) where the columns are narrow. */
.cost-chart.is-dense .day-full { display: none; }
.cost-chart.is-dense .day-short, .cost-chart.is-dense .day-month { display: block; }
@media (max-width: 575.98px) {
    .day-full { display: none; }
    .day-short, .day-month { display: block; }
    .cost-chart.is-many .chart-value { display: none; }
    /* Thirty narrow columns: every label turned on its side ("8 Sep") so none overlaps and none is left out. */
    .cost-chart.is-dense .cost-chart-days li { height: 2.75rem; padding: 0 0 var(--tged-space-4); writing-mode: vertical-rl; transform: rotate(180deg); text-align: end; }
    .cost-chart.is-dense .day-full { display: inline; }
    .cost-chart.is-dense .day-short, .cost-chart.is-dense .day-month { display: none; }
}
.stats-status { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-20); }
.stats-pair { display: inline-flex; align-items: center; gap: var(--tged-space-8); white-space: nowrap; }
.split-grid { display: grid; gap: var(--tged-gap-stack); grid-template-columns: 1fr; }
@media (min-width: 768px) {
    .split-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.audit-filters { margin-bottom: var(--tged-space-16); }
.audit-filter-actions { display: flex; gap: var(--tged-space-8); }
.audit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--tged-space-6) var(--tged-space-14);
    align-items: start;
    padding: var(--tged-space-12) var(--tged-space-16);
    border-bottom: var(--tged-rule-line);
}
.audit-row:last-child { border-bottom: 0; }
.audit-time { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 var(--tged-space-12); font-size: var(--tged-fs-13); color: var(--tged-muted); }
.audit-main { min-width: 0; }
.audit-label { margin: 0; font-weight: var(--tged-fw-semibold); overflow-wrap: anywhere; }
.audit-actions { align-self: center; }
@media (min-width: 768px) {
    .audit-row { grid-template-columns: 13rem minmax(0, 1fr) auto; align-items: center; }
    .audit-time { grid-column: auto; display: grid; gap: var(--tged-space-1); }
}

/* Ideas, Formats, templates and the step editor (task-036) */
html.js .no-js-only { display: none !important; }
.confirm-inline > summary { list-style: none; cursor: pointer; }
.confirm-inline > summary::-webkit-details-marker { display: none; }
.confirm-inline[open] > .confirm-inline-body { margin-top: var(--tged-space-8); padding: var(--tged-space-12); border: var(--tged-rule-edge); border-radius: var(--tged-radius-12); background: var(--tged-raised); }
.menu-pop { position: relative; }
.menu-pop > summary { list-style: none; cursor: pointer; }
.menu-pop > summary::-webkit-details-marker { display: none; }
.menu-pop-body {
    position: absolute;
    z-index: var(--tged-z-popover);
    top: calc(100% + var(--tged-space-6));
    right: 0;
    min-width: 16rem;
    max-width: min(24rem, 86vw);
    padding: var(--tged-space-6);
    background: var(--tged-raised);
    border: var(--tged-rule-edge);
    border-radius: var(--tged-radius-card);
    box-shadow: var(--tged-shadow-float);
}
.menu-pop-item {
    display: flex;
    align-items: center;
    gap: var(--tged-space-10);
    width: 100%;
    padding: var(--tged-space-8) var(--tged-space-10);
    color: var(--tged-text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: var(--tged-radius-8);
}
.menu-pop-item:hover, .menu-pop-item:focus-visible { background: var(--tged-tint-hover); }
a.menu-pop-item { text-decoration: none; }
.menu-pop-item .bi { color: var(--tged-muted); }
.menu-pop-item-rich { align-items: flex-start; }
.menu-pop-name { display: block; font-weight: var(--tged-fw-semibold); }
.menu-pop-help { display: block; font-size: var(--tged-fs-12); color: var(--tged-muted); }
.menu-pop-label { margin: var(--tged-space-8) var(--tged-space-10) var(--tged-space-2); font-size: var(--tged-fs-12); font-weight: var(--tged-fw-semibold); color: var(--tged-muted); }
.menu-pop-empty { margin: 0 var(--tged-space-10) var(--tged-space-6); font-size: var(--tged-fs-13); color: var(--tged-muted); }
/* The overflow menu (task-045): a square secondary button that opens a short list of secondary and danger actions */
.overflow-menu-body { min-width: 11rem; width: max-content; max-width: min(18rem, 86vw); display: grid; gap: var(--tged-space-2); }
.overflow-menu-body form { margin: 0; display: block; }
.overflow-menu-body .menu-pop-item { font-size: var(--tged-fs-14); cursor: pointer; }
.menu-pop-item.is-danger, .menu-pop-item.is-danger .bi { color: var(--tged-danger-text); }
.menu-pop-item:disabled { opacity: 0.55; cursor: not-allowed; }
.menu-pop[open] > summary.btn { background: var(--tged-tint-hover); }
.menu-pop-sep { margin: var(--tged-space-4) 0; border: 0; border-top: var(--tged-rule-edge); }
.overflow-menu-body .template-rename { display: grid; gap: var(--tged-gap-label); padding: var(--tged-space-8) var(--tged-space-10); min-width: 14rem; }
.overflow-menu-body .template-rename .form-label { margin: 0; font-size: var(--tged-fs-13); color: var(--tged-muted); }
.template-name { font-weight: var(--tged-fw-semibold); min-width: 0; overflow-wrap: anywhere; }
/* Queue rows: arrows, Publish now, Edit and the more menu stay on one line from tablet width up */
@media (min-width: 768px) { .queue-card .queue-row .draft-actions { flex-wrap: nowrap; justify-content: flex-end; } }
/* Review rows: four compact buttons in two aligned columns, Approve and Reject above Preview and Edit */
.review-row .draft-actions { display: grid; grid-template-columns: repeat(2, max-content); justify-content: end; align-content: start; }
.review-row .draft-actions .btn:not(.btn-icon) { width: 100%; }
/* Same bubble as the select checkbox (.media-pick), so it shows on light and dark images in both themes. */
.media-zoom, .media-zoom.btn { position: absolute; top: var(--tged-space-8); right: var(--tged-space-8); z-index: var(--tged-z-raised); display: grid; place-items: center; width: var(--tged-space-28); height: var(--tged-space-28); padding: 0; margin: 0; background: color-mix(in srgb, var(--tged-surface) 86%, transparent); border: var(--tged-rule-edge); border-radius: var(--tged-radius-8); color: var(--tged-text, inherit); backdrop-filter: var(--tged-blur-6); }
.media-zoom:hover, .media-zoom:focus-visible { background: var(--tged-surface); }

/* The image lightbox (task-045; js/lightbox.js). A link around an image keeps the image's own look. */
.lb-link { display: inline-block; line-height: 0; border-radius: var(--tged-radius-control); cursor: zoom-in; }
.lb-link:focus-visible { outline: var(--tged-outline-accent); outline-offset: 2px; }
[data-lightbox]:not(a) { cursor: zoom-in; }
html.lb-open { overflow: hidden; scrollbar-gutter: stable; }
.lb {
    position: fixed;
    inset: 0;
    z-index: var(--tged-z-overlay);
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
    align-items: center;
    gap: 0 var(--tged-gap-btns);
    padding: var(--tged-space-12);
    background: var(--tged-scrim-88);
    color: var(--tged-lb-text);
}
.lb-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-end; gap: var(--tged-gap-meta); min-height: var(--tged-btn-h); }
.lb-count { margin-right: auto; color: var(--tged-lb-muted); font-size: var(--tged-fs-14); }
.lb-orig { color: var(--tged-lb-link); }
.lb-fig { grid-column: 2; grid-row: 2; margin: 0; min-width: 0; min-height: 0; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--tged-gap-label); }
.lb-img { display: block; max-width: 100%; max-height: calc(100% - var(--tged-space-48)); min-height: 0; object-fit: contain; border-radius: var(--tged-radius-8); background: var(--tged-lb-img); }
.lb-cap { max-width: 60rem; text-align: center; font-size: var(--tged-fs-14); color: var(--tged-lb-muted); overflow-wrap: anywhere; }
.lb .btn-secondary { --bs-btn-color: var(--tged-lb-text); --bs-btn-hover-color: var(--tged-on-dark); background-color: var(--tged-lb-btn); border-color: var(--tged-lb-btn-edge); }
.lb-nav { grid-row: 2; }
.lb-prev { grid-column: 1; }
.lb-next { grid-column: 3; }
@media (max-width: 575.98px) {
    .lb { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; padding: var(--tged-space-8); }
    .lb-fig { grid-column: 1; grid-row: 2; }
    .lb-nav { grid-row: 3; }
    .lb-prev { grid-column: 1; justify-self: start; }
    .lb-next { grid-column: 1; justify-self: end; }
}

.plan-heading { margin: var(--tged-space-16) 0 var(--tged-space-8); font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); }
.plan .table-responsive { overflow-y: hidden; }
/* Generate now and Voices (task-043): the same fix, a table inside a panel must not grow a vertical scrollbar. */
.idea-generate .table-responsive, .voices-table-wrap { overflow-y: hidden; }
.voices-head { display: flex; align-items: center; justify-content: space-between; gap: var(--tged-space-12); flex-wrap: wrap; margin-bottom: var(--tged-space-4); }
.voices-table th[scope="row"] { min-width: 10rem; }
.voices-table .post-meta { font-weight: var(--tged-fw-regular); }
.voices-table .post-actions { flex-wrap: nowrap; }
.voice-form textarea { font-family: var(--bs-font-monospace); font-size: var(--tged-fs-13); }
/* The run page's Final result (task-044, F6): the preview card has its own border, so the wrapper box is dropped (it drew a second
   rounded corner at the top left of the box) and it never sticks under the header like the editor's preview panel does. */
.gen-final .post-preview { position: static; padding: 0; background: none; border: 0; border-radius: 0; }
.xa-search { display: flex; gap: var(--tged-space-8); align-items: center; flex-wrap: nowrap; max-width: 100%; }
.xa-search .form-control { flex: 1 1 13rem; min-width: 0; }
.xa-search .btn { flex: none; }
.xa-links a { display: inline-block; margin-right: var(--tged-space-12); white-space: nowrap; }
/* The X posts tab (task-049, L2): initials stand in for the author's picture (the CSP allows images from this site only). */
/* Task-052 (C3): one grid for every entry, avatar | details | screenshot on the right; stacked at 576px and below. The earlier
   flex-wrap row with a 14rem minimum let the screenshots drop below the details whenever the details' natural width did not fit. */
.xposts-row { display: grid; grid-template-columns: var(--tged-space-40) minmax(0, 1fr) auto; column-gap: var(--tged-space-16); row-gap: var(--tged-space-12); align-items: start; }
.xposts-body { min-width: 0; overflow-wrap: anywhere; }
.xposts-shots { justify-content: flex-end; }
@media (max-width: 576px) {
    .xposts-row { grid-template-columns: var(--tged-space-40) minmax(0, 1fr); }
    .xposts-row > .xposts-shots, .xposts-row > p { grid-column: 1 / -1; justify-content: flex-start; }
}
.xposts-avatar { display: inline-flex; align-items: center; justify-content: center; width: var(--tged-space-40); height: var(--tged-space-40); flex: none; border-radius: var(--tged-radius-round); background: var(--tged-line); font-weight: var(--tged-fw-semibold); font-size: var(--tged-fs-14); }
.xposts-avatar { overflow: hidden; }
.xposts-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xposts-shot { max-width: 10rem; height: auto; border: var(--tged-rule-line); border-radius: var(--tged-radius-control); }
/* House posts tab and House identity page (task-052). The preview is a rough CSS approximation of the renderer's three styles. */
.houseposts-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--tged-space-16); row-gap: var(--tged-space-12); align-items: start; }
.houseposts-body { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 576px) {
    .houseposts-row { grid-template-columns: minmax(0, 1fr); }
}
.house-logo-preview { border-radius: var(--tged-radius-round); object-fit: cover; border: var(--tged-rule-line); }
.house-preview-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: var(--tged-space-16); }
.house-preview { margin: 0; padding: var(--tged-space-14); border-radius: var(--tged-radius-control); border: var(--tged-rule-line); }
.house-preview-head { display: flex; align-items: center; gap: var(--tged-space-10); margin-bottom: var(--tged-space-10); }
.house-preview-avatar { display: inline-flex; align-items: center; justify-content: center; width: var(--tged-space-40); height: var(--tged-space-40); flex: none; border-radius: var(--tged-radius-round); overflow: hidden; background: var(--tged-art-avatar); font-weight: var(--tged-fw-semibold); font-size: var(--tged-fs-14); }
.house-preview-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.house-preview-id { display: flex; flex-direction: column; line-height: var(--tged-lh-120); min-width: 0; overflow-wrap: anywhere; }
.house-preview-namerow { display: inline-flex; align-items: center; gap: var(--tged-space-4); min-width: 0; }
.house-preview-text { margin: 0 0 var(--tged-space-6); }
.house-preview-cap { font-size: var(--tged-fs-12); opacity: .75; }
.house-preview-badge { color: var(--tged-art-link); }
.house-preview-black { background: var(--tged-art-black); color: var(--tged-art-black-text); }
.house-preview-black .house-preview-handle, .house-preview-black .house-preview-cap { color: var(--tged-art-black-muted); opacity: 1; }
.house-preview-black .house-preview-link { color: var(--tged-art-link); }
.house-preview-white { background: var(--tged-art-white); color: var(--tged-art-white-text); }
.house-preview-white .house-preview-handle, .house-preview-white .house-preview-cap { color: var(--tged-art-white-muted); opacity: 1; }
.house-preview-white .house-preview-link { color: var(--tged-art-link); }
.house-preview-blue { background: var(--tged-art-blue); color: var(--tged-art-white); }
.house-preview-blue .house-preview-handle, .house-preview-blue .house-preview-cap { color: var(--tged-art-blue-muted); opacity: 1; }
.house-preview-blue .house-preview-link { color: var(--tged-art-white); text-decoration: underline; }
.gen-bestpost { margin: var(--tged-space-8) 0; padding: var(--tged-space-10) var(--tged-space-12); border: var(--tged-rule-line); border-radius: var(--tged-radius-control); }
.gen-bestpost p { margin-bottom: var(--tged-space-4); }
.gen-info-statement { margin: var(--tged-space-8) 0; padding: var(--tged-space-10) var(--tged-space-12); background: var(--tged-art-black); color: var(--tged-art-white); border-radius: var(--tged-radius-control); font-weight: var(--tged-fw-bold); letter-spacing: var(--tged-ls-art); }
.gen-info-hl { color: var(--gen-hl, var(--tged-art-hl)); }
/* The artwork's highlight colour is chosen for dark photos; on a light panel it marks the words instead of colouring them. */
[data-bs-theme="light"] .gen-info-hl { color: inherit; text-decoration: underline 2px var(--gen-hl, var(--tged-art-hl)); text-underline-offset: 2px; }
.gen-carousel-slides { display: grid; gap: var(--tged-space-10); margin: var(--tged-space-8) 0; padding: 0; list-style: none; }
.gen-carousel-row { display: flex; gap: var(--tged-space-12); align-items: flex-start; }
.gen-carousel-thumb { display: block; width: 56px; height: 70px; object-fit: cover; border-radius: var(--tged-radius-6); border: var(--tged-rule-line); background: var(--tged-tint); }
.gen-carousel-body { display: grid; gap: var(--tged-space-2); min-width: 0; }
.gen-carousel-label { font-size: var(--tged-fs-13); font-weight: var(--tged-fw-semibold); color: var(--tged-muted, inherit); }
.gen-carousel-text { line-height: var(--tged-lh-body); }
.carousel-tile { overflow: visible; }
.carousel-cover { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; border-radius: var(--tged-radius-panel) var(--tged-radius-panel) 0 0; overflow: hidden; }
.carousel-frame { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; background: var(--tged-bg); }
.carousel-meta { padding: var(--tged-space-10) var(--tged-space-12) var(--tged-space-12); }
.carousel-menu { position: absolute; top: var(--tged-space-8); right: var(--tged-space-8); z-index: var(--tged-z-over); }
/* Over a picture the button has a solid face, so it stays visible on light and dark images in both themes */
.carousel-menu summary.btn:not(:hover) { background: var(--tged-surface); }
.night-run-wrap { display: inline-block; }
.review-gen-flags i { color: var(--pill-attention); }
.plan-table { margin-bottom: 0; }
.idea-nets .net-icon { width: var(--tged-space-28); height: var(--tged-space-28); font-size: var(--tged-fs-13); }
.plan-off { display: block; margin-top: var(--tged-space-2); font-size: var(--tged-fs-12); }
.th-short, .plan-net-icon { display: none; }
@media (max-width: 575.98px) {
    .plan-net-full { display: none; }
    .plan-net-icon { display: inline-flex; }
    .plan-table th, .plan-table td { padding-left: var(--tged-space-6); padding-right: var(--tged-space-6); font-size: var(--tged-fs-13); }
    .th-long { display: none; }
    .th-short { display: inline; }
}
.plan .callout { margin: var(--tged-space-12) 0; }
.plan-picks { display: grid; gap: var(--tged-space-12); margin: 0 0 var(--tged-space-8); padding: 0; list-style: none; }
.plan-pick { display: flex; gap: var(--tged-space-12); }
.plan-num { flex: none; display: grid; place-items: center; width: var(--tged-space-28); height: var(--tged-space-28); font-size: var(--tged-fs-13); color: var(--tged-muted); background: var(--tged-tint); border-radius: var(--tged-radius-round); }
.plan-pick-body { display: flex; flex-direction: column; gap: var(--tged-space-4); min-width: 0; }
.plan-pick-title { font-weight: var(--tged-fw-semibold); color: var(--tged-text); text-decoration: none; overflow-wrap: anywhere; }
a.plan-pick-title:hover { text-decoration: underline; }
.plan-nets { display: flex; flex-wrap: wrap; gap: var(--tged-space-4) var(--tged-space-14); margin: 0; padding: 0; list-style: none; }
.plan-skipped { margin: var(--tged-space-8) 0 0; padding-left: var(--tged-space-20); font-size: var(--tged-fs-14); }

.idea-row, .format-row { grid-template-columns: minmax(0, 1fr); }
.idea-row .draft-actions, .format-row .draft-actions, .idea-row .idea-facts { grid-column: auto; flex-wrap: wrap; justify-content: flex-start; }
.idea-title { -webkit-line-clamp: 1; line-clamp: 1; font-weight: var(--tged-fw-semibold); }
.idea-excerpt { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; margin: var(--tged-space-2) 0 var(--tged-space-6); font-size: var(--tged-fs-13); color: var(--tged-muted); overflow-wrap: anywhere; }
.idea-facts { min-width: 0; }
.idea-chips { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-6); }
.idea-line { margin: var(--tged-space-3) 0 0; }
.idea-nets { display: inline-flex; gap: var(--tged-space-4); }
.format-toggle { display: flex; align-items: center; gap: var(--tged-space-8); }
.format-toggle .switch-field { margin: 0; }
@media (min-width: 992px) {
    .idea-row { grid-template-columns: minmax(0, 1fr) 13rem auto; align-items: center; }
    .format-row { grid-template-columns: minmax(0, 1fr) 11rem 8rem auto; align-items: center; }
    .idea-row .draft-actions, .format-row .draft-actions { justify-content: flex-end; max-width: 20rem; }
    .idea-row .draft-actions { max-width: 25rem; }
}
.template-list { margin: var(--tged-space-12) 0 0; padding: 0; list-style: none; }
.template-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-16); padding: var(--tged-space-12) var(--tged-space-20); border-bottom: var(--tged-rule-line); }
.template-row:last-child { border-bottom: 0; }
.template-rename { display: flex; gap: var(--tged-space-8); flex: 1 1 16rem; max-width: 28rem; }
.template-facts { margin: 0; }
.template-row .post-actions { margin-left: auto; align-items: flex-start; }
.template-save { display: grid; gap: var(--tged-space-8); max-width: 28rem; }

/* Formats page (task-039): one section per network, formats in rows */
.fmt-net { margin-top: var(--tged-space-16); padding: 0; overflow: hidden; }
.fmt-net-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); padding: var(--tged-space-12) var(--tged-space-20); }
.fmt-net-name { margin: 0; font-size: var(--tged-fs-17); font-weight: var(--tged-fw-display); }
.fmt-net-count { margin-right: auto; }
.fmt-net-new { margin: 0; }
.fmt-list { margin: 0; padding: 0; list-style: none; border-top: var(--tged-rule-line); }
.fmt-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-10) var(--tged-space-16); padding: var(--tged-space-14) var(--tged-space-20); border-bottom: var(--tged-rule-line); }
.fmt-row:last-child { border-bottom: 0; }
.fmt-main, .fmt-facts { min-width: 0; }
.fmt-name { display: block; overflow-wrap: anywhere; color: var(--tged-text); text-decoration: none; }
a.fmt-name:hover { text-decoration: underline; }
.fmt-desc { margin-bottom: var(--tged-space-4); }
.fmt-steps { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-6); color: var(--tged-muted); }
.fmt-steps .is-off { opacity: 0.4; }
.fmt-line { margin: var(--tged-space-3) 0 0; }
.fmt-why { max-width: 16rem; }
.fmt-actions { align-items: flex-start; }
.fmt-templates { margin-top: var(--tged-space-24); }
.field-narrow { max-width: 10rem; }
.step-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tged-space-12); }
@media (min-width: 768px) {
    .step-field-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .step-ai-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Task 074: one row per AI text call (Provider, Model, Voice). */
.step-ai-row { border: 1px solid var(--bs-border-color); border-radius: var(--tged-radius-6); padding: var(--tged-space-8) var(--tged-space-12) var(--tged-space-4); margin-bottom: var(--tged-space-12); }
.step-ai-row[hidden] { display: none; }
.step-ai-label { float: none; width: auto; font-size: var(--tged-fs-14); font-weight: var(--tged-fw-semibold); margin: 0 0 var(--tged-space-2); padding: 0; }
.step-ai-help { margin: 0 0 var(--tged-space-8); }
.gen-text-calls { list-style: none; padding-left: 0; margin: var(--tged-space-4) 0; }
@media (min-width: 992px) {
    .fmt-row { grid-template-columns: minmax(0, 1fr) 13rem 10rem auto; align-items: center; }
    .fmt-row .fmt-actions { justify-content: flex-end; max-width: 20rem; }
}

.idea-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tged-space-8) var(--tged-space-16); margin-bottom: var(--tged-space-12); }
.idea-head-pills { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8); }
.idea-section, .wf-editor { margin-top: var(--tged-space-16); }
/* The hidden Unsaved changes bar takes no room between the form and the sections after it. */
.js .idea-form .action-bar:not(.is-visible), .js .settings-form .action-bar:not(.is-visible) { height: 0; margin: 0; padding: 0; border: 0; overflow: hidden; }
.idea-guidance { min-height: 14rem; }
/* A warning under the network chips: shown only while its network is ticked (works without JavaScript). */
.idea-net-warn { display: none; flex: 1 0 100%; align-items: flex-start; gap: var(--tged-space-8); margin: 0; color: var(--pill-attention); font-size: var(--tged-fs-14); }
#net-facebook:checked ~ .idea-net-warn-facebook, #net-x:checked ~ .idea-net-warn-x, #net-instagram:checked ~ .idea-net-warn-instagram { display: flex; }
.idea-net-warn a { color: inherit; text-decoration: underline; }
.js [data-nojs-note] { display: none; }
.provider-tests { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }
.mode-switch { display: inline-flex; border: var(--tged-rule-edge); border-radius: var(--tged-radius-pill); overflow: hidden; background: var(--tged-tint); }
.mode-input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.mode-label { margin: 0; padding: var(--tged-space-7) var(--tged-space-18); font-weight: var(--tged-fw-medium); color: var(--tged-muted-strong); cursor: pointer; }
.mode-input:checked + .mode-label { color: var(--tged-accent-hover); background: var(--tged-accent-soft); }
.mode-input:focus-visible + .mode-label { outline: var(--tged-outline); outline-offset: -2px; }
.idea-actions { flex-wrap: wrap; gap: var(--tged-space-8); margin-bottom: var(--tged-space-8); }

.wf-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-12); }
.wf-editor.is-busy { opacity: 0.6; pointer-events: none; }
.wf-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--tged-space-8) var(--tged-space-16); }
.wf-head .panel-title { margin-bottom: var(--tged-space-4); }
.wf-add .menu-pop-body { min-width: 18rem; }
.wf-empty { margin: 0; }
.wf-steps { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-10); margin: 0; padding: 0; list-style: none; }
.step-card { background: var(--tged-raised); border: var(--tged-rule-edge); border-radius: var(--tged-radius-card); scroll-margin-top: 5rem; }
.step-card.is-off .step-head { opacity: 0.62; }
.step-card.has-error { border-color: var(--tged-danger); }
.step-card.is-ghost { opacity: 0.45; background: var(--tged-tint); }
.step-card.is-chosen { background: var(--tged-tint); }
.step-card.is-dragging { box-shadow: var(--tged-shadow-float); }
.step-head { display: flex; align-items: center; gap: var(--tged-space-10); padding: var(--tged-space-10) var(--tged-space-12); }
.step-head .drag-handle { height: 2.25rem; }
.step-icon { flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem; color: var(--tged-accent-text); background: var(--tged-tint); border-radius: var(--tged-radius-control); }
.step-title { flex: 1 1 auto; display: flex; flex-direction: column; min-width: 0; }
.step-label { font-weight: var(--tged-fw-semibold); }
.step-summary { display: block; font-size: var(--tged-fs-13); color: var(--tged-muted); text-wrap: pretty; }
.format-layout { display: block; }
.format-main { min-width: 0; }
.wf-summary { display: none; }
@media (min-width: 1280px) {
    .format-layout { display: grid; grid-template-columns: minmax(0, 1fr) 17.5rem; gap: var(--tged-space-16); align-items: start; }
    .wf-summary {
        display: block;
        position: sticky;
        top: var(--tged-space-16);
        margin-top: var(--tged-space-16);
        padding: var(--tged-space-16);
        background: var(--tged-raised);
        border: 1px solid var(--tged-rule-edge);
        border-radius: var(--tged-radius-card);
    }
}
.wf-summary-facts { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-2); margin: 0; font-size: var(--tged-fs-13); }
.wf-summary-facts dt { margin-top: var(--tged-space-8); font-weight: var(--tged-fw-medium); color: var(--tged-muted); }
.wf-summary-facts dd { margin: 0; }
.wf-summary-note { display: block; color: var(--tged-muted); }
.wf-summary-head { margin: var(--tged-space-16) 0 var(--tged-space-8); font-size: var(--tged-fs-13); font-weight: var(--tged-fw-medium); }
.wf-summary-issues { display: grid; gap: var(--tged-space-8); margin: 0; padding: 0; font-size: var(--tged-fs-13); list-style: none; }
.step-switch .switch-field { margin: 0; }
.step-form > .callout { margin: 0 var(--tged-space-12) var(--tged-space-8); }
.step-more > summary { padding: var(--tged-space-2) var(--tged-space-12) var(--tged-space-8) 3.75rem; font-size: var(--tged-fs-13); color: var(--tged-accent-text); cursor: pointer; }
.step-fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--tged-space-14); padding: var(--tged-space-4) var(--tged-space-12) var(--tged-space-14) 3.75rem; }
.step-help { margin: 0; }
.step-fields .btn { justify-self: start; }
.step-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--tged-gap-btns); padding: var(--tged-space-6) var(--tged-space-8); border-top: var(--tged-rule-line); }
.chip-insert { display: flex; flex-wrap: wrap; gap: var(--tged-space-4); margin-top: var(--tged-space-6); }
.chip-btn { font-family: var(--tged-font-mono); font-size: var(--tged-fs-12); color: var(--tged-muted-strong); cursor: pointer; }
.wf-template { justify-self: start; }
@media (max-width: 575.98px) {
    .step-more > summary, .step-fields { padding-left: var(--tged-space-12); }
    .step-head { flex-wrap: wrap; }
    .step-title { flex-basis: calc(100% - 7rem); }
}

/* Test run trace (task-040) */
.gen-head { display: grid; gap: var(--tged-space-8); margin-bottom: var(--tged-space-16); }
.gen-head-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-gap-label) var(--tged-gap-meta); }
.gen-cancel { margin: 0; }
.gen-steps { display: grid; gap: var(--tged-gap-stack); margin: 0 0 var(--tged-space-16); padding: 0; list-style: none; }
.gen-step { display: grid; gap: var(--tged-space-8); padding: var(--tged-space-12); }
.gen-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-gap-label) var(--tged-gap-meta); }
/* Quiet by colour, not opacity: text inside stays AA in both themes (task-078). */
.gen-step-pending, .gen-step-skipped { color: var(--tged-muted); background: transparent; }
.gen-fold > summary { font-size: var(--tged-fs-13); color: var(--tged-accent-text); cursor: pointer; }
.gen-pre { max-height: 24rem; margin: var(--tged-space-6) 0 0; padding: var(--tged-space-10) var(--tged-space-12); overflow: auto; font-family: inherit; font-size: var(--tged-fs-14); white-space: pre-wrap; overflow-wrap: anywhere; background: var(--tged-tint); border-radius: var(--tged-radius-control); }
.gen-muted { color: var(--tged-muted); }
.gen-posts { display: grid; gap: var(--tged-space-8); margin: 0; padding-left: var(--tged-space-20); }
.gen-post-text { display: block; overflow-wrap: anywhere; }
.gen-error { margin: 0; color: var(--tged-danger-text, var(--bs-danger)); overflow-wrap: anywhere; }
.gen-sub { margin: var(--tged-space-16) 0 var(--tged-space-8); font-size: var(--tged-fs-15); font-weight: var(--tged-fw-semibold); }
.gen-over { font-weight: var(--tged-fw-semibold); }
.gen-table td { vertical-align: middle; }
.gen-table thead th, .table-sm thead th { font-weight: var(--tged-fw-medium); color: var(--tged-muted); }
/* On a phone a table of many columns reads as a stacked list: one line per cell, its column name on the left. */
@media (max-width: 575.98px) {
    .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .table-stack, .table-stack tbody, .table-stack tr { display: block; width: 100%; }
    .table-stack tr { padding: var(--tged-space-8) var(--tged-space-12); border-bottom: 1px solid var(--tged-border); }
    .table-stack tr:last-child { border-bottom: 0; }
    .table-stack td { display: flex; justify-content: space-between; align-items: center; gap: var(--tged-space-12); min-height: 2.5rem; padding: var(--tged-space-4) 0; text-align: right; border: 0; }
    .table-stack td::before { content: attr(data-label); flex: none; color: var(--tged-muted); font-size: var(--tged-fs-13); }
    .table-stack td > a { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 2.75rem; min-height: 2.75rem; }
    .table-stack tbody th { display: block; padding: 0; border: 0; }
    .table-stack td.stack-text { display: block; min-height: 0; text-align: left; }
    .table-stack td.stack-text::before { content: none; }
}
.test-plan { display: grid; gap: var(--tged-space-4); margin: 0 0 var(--tged-space-16); padding-left: var(--tged-space-20); font-size: var(--tged-fs-14); }
.gen-sources > summary { color: var(--tged-accent-text); }
.gen-source-list { margin: var(--tged-space-6) 0 0; padding-left: var(--tged-space-28); font-size: var(--tged-fs-13); line-height: var(--tged-lh-body); columns: 2 18rem; column-gap: var(--tged-space-32); overflow-wrap: anywhere; }
.gen-source-list li { break-inside: avoid; }
.gen-source-list.gen-grok-trace { columns: 1; }
.gen-trace-query { font-family: var(--tged-font-mono); overflow-wrap: anywhere; word-break: break-word; white-space: normal; }
.gen-images { display: flex; flex-wrap: wrap; gap: var(--tged-space-12); margin: 0; padding: 0; list-style: none; }
.gen-image { display: grid; gap: var(--tged-space-4); max-width: 10rem; }
.gen-image img { display: block; width: auto; max-width: 100%; height: auto; max-height: 14rem; object-fit: contain; border-radius: var(--tged-radius-control); border: var(--tged-rule-line); background: var(--tged-tint); }
.media-prompt { white-space: pre-wrap; overflow-wrap: anywhere; }

/* Icon and text inside one button always keep a gap, and a menu summary styled as a button lines up with its neighbours (task-041) */
.btn > .bi { flex: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Nightly engine and preview widths (task-042) ---------- */

/* The mock card is as wide as the real feed column and never wider; narrower screens use the whole width. */
.pv-facebook, .pv-instagram { max-width: 500px; }
.pv-x { max-width: 600px; }
/* Text first, then the images, in normal flow: the grid keeps its images inside its own box. */
.pv-grid { position: relative; isolation: isolate; }
.pv-textwrap { margin: 0 0 var(--tged-space-10); }
.pv-textwrap .pv-text { margin: 0; }
/* Facebook collapses a post to five lines; "See more" appears only when the browser hides lines. */
.pv-clamp { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; line-clamp: 5; overflow: hidden; }
.pv-more[hidden] { display: none; }
.pv-more-below { display: block; margin-top: var(--tged-space-4); font-weight: var(--tged-fw-semibold); }

/* Tonight's plan: the night's state line. */
.night-state { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-8) var(--tged-space-12); margin: var(--tged-space-12) 0; }
.night-line { min-width: 0; }
.night-run { margin-left: auto; }
.night-plan-list { margin: 0 0 var(--tged-space-16); padding-left: var(--tged-space-20); }
.night-plan-list li { margin-bottom: var(--tged-space-4); }
.night-title { margin: 0; }
.night-ideas { margin-top: var(--tged-space-16); }
.night-idea { padding: var(--tged-space-14) var(--tged-space-16); }
.night-runs { display: flex; flex-direction: column; gap: var(--tged-space-8); margin: 0; padding: 0; list-style: none; }
.night-runs li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-gap-label) var(--tged-gap-meta); min-width: 0; }
.night-runs a, .gen-head-row a:not(.btn), .gen-step-head a:not(.step-label), .review-gen a, .lane-off-link { text-decoration: underline; text-underline-offset: 0.2em; }
.night-run-error { overflow-wrap: anywhere; }

/* Review: generated posts show where they came from and the reply that was prepared. */
.review-gen { margin: var(--tged-space-4) 0 0; }
.review-gen-trace { margin-left: var(--tged-space-12); white-space: nowrap; }
.review-comment { margin-top: var(--tged-space-6); }
html.js .review-comment.is-tucked:not([open]):not(:focus-within) { display: none; }
.review-comment-form { display: grid; gap: var(--tged-space-6); margin-top: var(--tged-space-6); max-width: 40rem; }
.review-comment-form .post-actions { display: flex; gap: var(--tged-space-8); }
/* Follow-up comment status (task-047): chip, link and the Retry / Skip buttons on one line */
.comment-status { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-8); }
.comment-status form { margin: 0; }
.feed-comment { margin-top: var(--tged-space-6); }
.scope-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--tged-space-4); }
.scope-item .bi-check-circle { color: var(--pill-published); }
.scope-item .bi-x-circle { color: var(--pill-failed); }
.pv-reply { margin: var(--tged-space-10) 0 0 var(--tged-space-20); padding: var(--tged-space-8) var(--tged-space-12); border-left: 2px solid var(--tged-edge); }
.pv-reply-head { display: flex; flex-wrap: wrap; gap: var(--tged-space-4) var(--tged-space-8); font-size: var(--tged-fs-13); }
.pv-reply-text { margin: var(--tged-space-2) 0 0; }
/* The more menu is fixed to the viewport while open (js/overflow-menu.js places it), above cards, below dialogs */
.overflow-menu-body { z-index: var(--tged-z-menu); }
/* An open list sits on <body> and scrolls on its own (task-049b): wheel and touch never reach the page behind it */
[data-overflow-portal] { overscroll-behavior: contain; z-index: var(--tged-z-menu); }
/* Until the script has placed it, an open list stays invisible (task-051): no flash at the top left or in its old spot */
details[data-overflow-menu][open] > [data-overflow-body] { visibility: hidden; }
.review-comment-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }

/* The top bar keeps room for the page title on a phone: the live status shows its dot only, and a title that does not fit beside the
   actions keeps the menu button's row and sends the actions to a second one. A callout's action moves under a text it would squeeze. */
@media (max-width: 575.98px) {
    .topbar { flex-wrap: wrap; gap: var(--tged-space-4) var(--tged-space-8); padding-inline: var(--tged-space-12); }
    .page-title { flex: 1 1 auto; min-width: 4.5rem; max-width: calc(100% - var(--tged-tap) - var(--tged-space-8)); }
    .topbar-actions { gap: var(--tged-space-4); }
    .callout { flex-wrap: wrap; }
    .callout-body { flex: 1 1 10rem; }
    .callout-action { margin-inline-start: calc(var(--tged-fs-18) + var(--tged-space-12)); }
    .live-status .health-label {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* Prompts (task-050): the side-by-side comparison with the default; a changed line is tinted and edged, not colour only (the text differs). */
.prompt-diff td { width: 50%; vertical-align: top; }
.prompt-diff .gen-pre { max-height: none; background: transparent; padding: 0; }
.prompt-diff-changed td, .prompt-diff-added td:last-child, .prompt-diff-removed td:first-child { background: var(--tged-tint); }
.prompt-diff-added td:last-child, .prompt-diff-changed td:last-child { border-left: 3px solid var(--tged-accent); }
.prompt-diff-removed td:first-child { border-left: 3px solid var(--tged-danger); }

/* Regenerate from step N and post versions (task-068). The plan of the checked format choice shows; without :has() both show, titled. */
.regen-step-list, .regen-steps, .version-list { list-style: none; margin: 0; padding: 0; }
.regen-step-list li { display: flex; align-items: center; gap: var(--tged-gap-btns); padding: var(--tged-space-6) 0; border-top: var(--tged-rule-line); }
.regen-step-list li:first-child { border-top: 0; }
.regen-step-name { flex: 1 1 auto; min-width: 0; }
.regen-steps { margin-bottom: var(--tged-space-8); }
.regen-steps li { display: flex; justify-content: space-between; gap: var(--tged-space-12); padding: var(--tged-space-4) var(--tged-space-8); border-left: 3px solid transparent; }
.regen-steps li.is-rerun { background: var(--tged-tint); border-left-color: var(--tged-accent); }
.regen-plan-title { font-weight: var(--tged-fw-semibold); font-size: var(--tged-fs-14); margin: var(--tged-space-12) 0 var(--tged-space-4); }
.regen-form:has(input[name="mode"][value="current"]:checked) .regen-plan-snapshot { display: none; }
.regen-form:has(input[name="mode"][value="snapshot"]:checked) .regen-plan-current { display: none; }
.regen-form:has(input[name="mode"]) .regen-plan-title:first-child { display: none; }
.version-row { display: flex; align-items: flex-start; gap: var(--tged-gap-btns); padding: var(--tged-space-6) 0; border-top: var(--tged-rule-line); }
.version-row:first-child { border-top: 0; }
.version-row.is-active { border-left: 3px solid var(--tged-accent); padding-left: var(--tged-space-10); }
.version-row.is-discarded .version-line { color: var(--tged-muted); }
.version-name { font-weight: var(--tged-fw-semibold); }
.btn-row .btn[aria-current="page"] { border-color: var(--tged-accent); box-shadow: var(--tged-inset-accent); }
.version-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.version-images { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }

/* Task-069: the new-version callout, the compact history (a line per version that opens read-only), runs, and the compare page. */
.version-ready .btn-row { margin-top: var(--tged-space-8); }
.version-details { flex: 1 1 auto; min-width: 0; }
.version-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-8); cursor: pointer; padding: var(--tged-space-4) 0; }
.version-body { padding: var(--tged-space-8) 0 var(--tged-space-4); }
.version-tail { display: flex; align-items: center; gap: var(--tged-gap-btns); flex: 0 0 auto; }
.version-note, .gen-owner-note { font-style: italic; overflow-wrap: anywhere; }
.regen-live { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tged-space-4) var(--tged-space-8); margin: 0 0 var(--tged-space-8); color: var(--tged-muted); }
.version-row.is-failed { align-items: center; border-left: 3px solid var(--tged-danger); padding-left: var(--tged-space-10); }
.version-failed { flex: 1 1 auto; min-width: 0; margin: 0; padding: var(--tged-space-4) 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--tged-space-4) var(--tged-space-8); overflow-wrap: anywhere; }
/* Task-070: the compare page is plain by default; "Highlight changes" tints the changed sentences (no word fragments, no underline). */
.compare-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--tged-space-8) var(--tged-space-16); margin-bottom: var(--tged-space-12); }
.compare-summary { font-weight: var(--tged-fw-semibold); margin: 0; }
.version-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tged-space-16); }
.compare-text { font-size: var(--tged-fs-16); line-height: var(--tged-lh-155); }
.compare-label { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--tged-space-2) var(--tged-space-8); }
.compare-count { font-weight: var(--tged-fw-regular); letter-spacing: 0; color: var(--tged-muted); }
.compare-note { display: flex; align-items: baseline; gap: var(--tged-space-8); margin: 0 0 var(--tged-space-12); padding: var(--tged-space-8) var(--tged-space-12); border-radius: var(--tged-radius-6); background: var(--tged-tint); border-left: 3px solid var(--tged-accent); overflow-wrap: anywhere; }
.diff-sent { border-radius: var(--tged-radius-3); }
.compare-old .diff-sent, .compare-new .diff-sent { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.compare-page.is-highlighted .compare-old .diff-sent.is-changed { background: var(--tged-danger-tint); }
.compare-page.is-highlighted .compare-new .diff-sent.is-changed { background: var(--tged-ok-tint); }
.compare-page:has(#compare-highlight:checked) .compare-old .diff-sent.is-changed { background: var(--tged-danger-tint); }
.compare-page:has(#compare-highlight:checked) .compare-new .diff-sent.is-changed { background: var(--tged-ok-tint); }
.compare-images { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr)); gap: var(--tged-space-12); }
.compare-images li { display: flex; flex-direction: column; gap: var(--tged-space-4); }
.compare-image, .compare-image img { width: 100%; height: auto; border-radius: var(--tged-radius-6); }
.compare-image-state { font-size: var(--tged-fs-13); color: var(--tged-muted); }
.compare-image-state.is-changed { color: var(--tged-text); font-weight: var(--tged-fw-semibold); }
.compare-strip { display: flex; flex-wrap: wrap; gap: var(--tged-space-8); }
.part-regen-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tged-space-4) var(--tged-space-12); margin-bottom: var(--tged-space-12); }
.gen-reused > summary { color: var(--tged-muted); }
.image-text-form textarea { font-family: inherit; }
.image-text-slide { padding-left: var(--tged-space-12); border-left: 2px solid var(--tged-border); }
@media (max-width: 767.98px) {
    .version-compare { grid-template-columns: minmax(0, 1fr); }
}

/* Headings and short labels wrap in balanced lines, so none ends on one lonely word (task-078). */
h2, h3, h4, th, .form-label, .stat-label, .panel-title, .section-title, .step-title, .empty-title, legend { text-wrap-style: balance; }
.panel.row { margin-left: 0; margin-right: 0; }

/* ---------- Touch widths (task-078): every control at least --tged-tap; desktop density untouched ---------- */
@media (max-width: 768px) {
    :root {
        --tged-btn-h: var(--tged-tap);
        --tged-btn-h-sm: var(--tged-tap);
    }
    .btn,
    .segmented-item,
    .chip,
    .slot-chip,
    .mode-label,
    .subnav-item,
    .side-item,
    .link-nav,
    .callout-action,
    .lane-off-link,
    .lane-name-link,
    .health-label,
    .menu-pop-item,
    .toast-close,
    .outbox-facts a,
    a.post-meta,
    a.pill,
    .skip-link,
    .nav-pills .nav-link,
    .net-toggle,
    .lb-link,
    .feed-post,
    .feed-view,
    .draft-excerpt,
    .idea-title,
    .plan-pick-title,
    .remote-link,
    .post-meta a,
    .version-line a,
    .xa-links a,
    th a {
        display: inline-flex;
        align-items: center;
        min-height: var(--tged-tap);
        min-width: var(--tged-tap);
    }
    .side-item, .subnav-item, .menu-pop-item { display: flex; }
    .week-grid th, .week-grid td { padding-inline: var(--tged-space-2); }
    .week-grid-net { gap: var(--tged-space-4); }
    .area-card-link, .safety-tile-title a, .prompt-row-name, .setting-row:has(.form-switch) .setting-row-label .form-label {
        display: inline-flex;
        align-items: center;
        min-height: var(--tged-tap);
        min-width: var(--tged-tap);
    }
    .pv-nav { width: var(--tged-tap); height: var(--tged-tap); }
    .thumb { width: var(--tged-tap); height: var(--tged-tap); }
    .weekday-grid { gap: var(--tged-space-4); }
    .media-pick { width: var(--tged-tap); height: var(--tged-tap); }
    .media-pick .form-check-input { width: var(--tged-space-16); height: var(--tged-space-16); margin: 0; border: var(--tged-rule-edge); }
    .media-pick .form-check-input:not([id]) { box-shadow: none; }
    .form-check-input:not([id]):focus, .draft-check .form-check-input:focus { outline: var(--tged-outline); outline-offset: -2px; }
    summary { min-height: var(--tged-tap); }
    .form-control,
    .form-control-sm,
    .form-select,
    .form-select-sm { min-height: var(--tged-tap); }
    /* A labelled check counts as its label; one without a label grows its hit area with a clear border around the same small box. */
    .form-check { display: flex; align-items: center; min-height: var(--tged-tap); }
    .form-check .form-check-input { flex: none; margin-top: 0; }
    .form-check-label { display: inline-flex; align-items: center; min-height: var(--tged-tap); min-width: var(--tged-tap); padding-left: var(--tged-space-8); }
    .form-check-input:not([id]),
    .draft-check .form-check-input {
        width: var(--tged-tap);
        height: var(--tged-tap);
        margin: calc((var(--tged-space-16) - var(--tged-tap)) / 2);
        border: calc((var(--tged-tap) - var(--tged-space-16)) / 2) solid transparent;
        background-clip: padding-box;
        background-origin: padding-box;
        box-shadow: inset 0 0 0 1px var(--tged-muted);
    }
}

/* ---------- Theme next (task 079) ---------- */

/* Depth. Cards keep their edge and gain a top highlight with one very soft shadow. */
.panel, .queue-card, .lane, .stat-tile, .media-tile { box-shadow: var(--tged-card-hl), var(--tged-shadow-card); }
.segmented-item.active { box-shadow: var(--tged-inset-edge), var(--tged-card-hl), var(--tged-shadow-card); }
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .modal-content {
        --bs-modal-bg: var(--tged-glass-modal);
        -webkit-backdrop-filter: var(--tged-blur-glass);
        backdrop-filter: var(--tged-blur-glass);
    }
}

/* Figures. Every number is tabular; titles and key figures use the condensed cut. */
body { font-variant-numeric: tabular-nums; }
.page-title, .stat-value, .lane-countdown { font-stretch: 84%; }

/* Nothing moves on load: an icon holds its square before its font arrives, and fonts are preloaded in the layout. */
.bi::before { width: 1em; height: 1em; }
.step-icon .bi, .step-icon .bi::before { display: block; }

/* The Live label keeps the room of its longest word, and lazy images hold their box, so a page does not shift while it settles. */
.live-status { min-width: 7rem; }
@media (max-width: 575.98px) { .live-status { min-width: 0; } }
.gen-image img, .xposts-shot { width: 10rem; height: 10rem; max-width: 100%; object-fit: contain; background: var(--tged-tint); }

/* Larger media in the library. */
@media (min-width: 576px) { .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 992px) { .media-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .media-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* The Overview's figures and their one-series lines. A figure with a line gets the wider tile. */
.overview-pulse { margin-bottom: var(--tged-space-24); }
.overview-pulse .stat-tile { align-content: start; }
@media (min-width: 1200px) {
    .overview-pulse { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .overview-pulse > :nth-child(1), .overview-pulse > :nth-child(2) { grid-column: span 4; }
    .overview-pulse > :nth-child(3), .overview-pulse > :nth-child(4) { grid-column: span 2; }
}
.stat-tile .sparkline { display: block; width: 100%; height: var(--tged-space-32); margin-top: var(--tged-space-8); overflow: visible; }
.sparkline-fill { fill: var(--tged-accent); opacity: 0.12; }
.sparkline-line, .sparkline-end { fill: none; stroke: var(--tged-accent); stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.sparkline-line { stroke-width: 2; }
.sparkline-end { stroke-width: 6; }
.sparkline-hit { fill: transparent; pointer-events: all; }

/* Calmer rows. One main action stays; the ⋯ menu holds the rest and waits for the row's hover or focus, keeping its space so nothing moves. Touch always shows it. */
@media (min-width: 769px) and (hover: hover) and (pointer: fine) {
    .queue-row .overflow-menu { opacity: 0; }
    .queue-row:hover .overflow-menu,
    .queue-row:focus-within .overflow-menu,
    .queue-row .overflow-menu[open] { opacity: 1; }
}

/* One Filter control: the closed panel, with a chip per active filter beside it. */
.filter-control { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--tged-space-8); margin: var(--tged-space-16) 0 var(--tged-space-12); }
.filter-control + .feed-day, .filter-control + .empty-state { margin-top: var(--tged-space-14); }
.filter-control-box[open] { flex: 1 0 100%; }
.filter-control-box > summary { list-style: none; display: inline-flex; align-items: center; gap: var(--tged-gap-label); }
.filter-control-box > summary::-webkit-details-marker { display: none; }
.filter-control-body { margin-top: var(--tged-space-10); }
.filter-control-body .media-toolbar { margin: 0; }
.filter-control-body .audit-filters { margin-bottom: 0; }
.filter-chip { display: inline-flex; align-items: center; gap: var(--tged-gap-label); }

/* Selects draw in the theme where the browser allows; elsewhere the styled closed control stays and the list is the system's. */
@supports (appearance: base-select) {
    select.form-select:not([multiple]):not([size]),
    select.form-select:not([multiple]):not([size])::picker(select) { appearance: base-select; }
    select.form-select::picker-icon { display: none; }
    select.form-select::picker(select) {
        margin-block: var(--tged-space-4);
        padding: var(--tged-space-4);
        background: var(--tged-raised);
        color: var(--tged-text);
        border: var(--tged-rule-edge);
        border-radius: var(--tged-radius-control);
        box-shadow: var(--tged-shadow-float);
    }
    select.form-select option { padding: var(--tged-space-6) var(--tged-space-10); border-radius: var(--tged-radius-6); }
    select.form-select option::checkmark { display: none; }
    select.form-select option:hover, select.form-select option:focus-visible { background: var(--tged-tint-hover); }
    select.form-select option:checked { color: var(--tged-accent-text); font-weight: var(--tged-fw-semibold); }
}

/* A long page's section title stays under the top bar and gains a backing once it is stuck. */
@supports (container-type: scroll-state) {
    @media (min-width: 992px) {
        .content .section-title:not(.panel .section-title):not(.modal .section-title) {
            position: sticky;
            top: 4.25rem;
            z-index: var(--tged-z-raised);
            container-type: scroll-state;
        }
        .content .section-title:not(.panel .section-title):not(.modal .section-title)::before {
            content: "";
            position: absolute;
            inset: calc(var(--tged-space-4) * -1) 0;
            z-index: -1;
            background: color-mix(in srgb, var(--tged-bg) 94%, transparent);
            opacity: 0;
        }
        @container scroll-state(stuck: top) {
            .content .section-title:not(.panel .section-title):not(.modal .section-title)::before { opacity: 1; }
        }
    }
}

/* Library: hover shows the whole picture instead of the crop. */
@media (hover: hover) and (pointer: fine) {
    .media-open:hover .media-thumb { object-fit: contain; }
}

@media (prefers-reduced-motion: no-preference) {
    .queue-row .overflow-menu { transition: opacity var(--tged-dur-quick) var(--tged-ease); }
    .btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); }

    /* Disclosures open and close by height, and stop clipping once open so a menu inside can overhang. */
    .details-panel, .gen-fold, .step-more, .version-details, .advanced, details.mt-3 { interpolate-size: allow-keywords; }
    .details-panel::details-content, .gen-fold::details-content, .step-more::details-content, .version-details::details-content, .advanced::details-content, details.mt-3::details-content {
        block-size: 0;
        overflow: clip;
        overflow-clip-margin: var(--tged-space-6);
        transition: block-size var(--tged-dur-slide) var(--tged-ease-out), content-visibility var(--tged-dur-slide) allow-discrete, overflow 0s allow-discrete;
    }
    .details-panel[open]::details-content, .gen-fold[open]::details-content, .step-more[open]::details-content, .version-details[open]::details-content, .advanced[open]::details-content, details.mt-3[open]::details-content {
        block-size: auto;
        overflow: visible;
        transition: block-size var(--tged-dur-slide) var(--tged-ease-out), content-visibility var(--tged-dur-slide) allow-discrete, overflow 0s var(--tged-dur-slide) allow-discrete;
    }

    /* The Live dot's ring: one of the two looping motions, with the refresh sweep below. */
    [data-live-status][data-state="live"] .live-dot { position: relative; }
    [data-live-status][data-state="live"] .live-dot::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: var(--tged-radius-round);
        background: inherit;
        animation: tged-live-ring 2.4s var(--tged-ease-out) infinite;
    }
    @keyframes tged-live-ring {
        from { transform: scale(1); opacity: 0.5; }
        70%, to { transform: scale(2.8); opacity: 0; }
    }

    /* A slow live refresh: a soft sweep over the region, drawn on top so nothing moves. */
    .content .is-refreshing { position: relative; }
    .content .is-refreshing::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: var(--tged-radius-panel);
        background: linear-gradient(100deg, transparent 30%, var(--tged-tint-hover) 50%, transparent 70%) 0 0 / 220% 100%;
        pointer-events: none;
        animation: tged-sweep 1.2s linear infinite;
    }
    @keyframes tged-sweep {
        from { background-position: 120% 0; }
        to { background-position: -120% 0; }
    }

    .count-bump { animation: tged-count-bump 0.36s var(--tged-ease-spring); }
    @keyframes tged-count-bump {
        40% { transform: scale(1.14); }
    }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
    .lane, .stat-tile, .media-tile { transition: transform var(--tged-dur-base) var(--tged-ease-out), box-shadow var(--tged-dur-base) var(--tged-ease-out); }
    .lane:hover, .stat-tile:hover, .media-tile:hover { transform: translateY(-2px); box-shadow: var(--tged-card-hl), var(--tged-shadow-lift); }
}
