/* ============================================================================
   The OP CMS — Dark Editorial Theme
   Pico CSS v2 override layer. Loaded after pico.min.css.
   ============================================================================ */

/* ── Instant dark background (prevents white flash during view transitions) */
html { background-color: #09090b; }

/* ── Design Tokens ───────────────────────────────────────────────────────── */
:root {
    /* Surfaces — warmer charcoal base */
    --surface-0: #09090b;
    --surface-1: #111113;
    --surface-2: #18181b;
    --surface-3: #1f1f23;
    --surface-hover: #26262b;
    --surface-active: #2c2c32;

    /* Borders — subtle warm tint */
    --border: #1c1c22;
    --border-hover: #35353d;
    --border-accent: #2e2e38;

    /* Text */
    --text-primary: #ededef;
    --text-secondary: #a1a1aa;
    --text-muted: #63636e;
    --text-inverse: #09090b;

    /* Accent */
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-soft: rgba(59, 130, 246, 0.12);
    --accent-text: #60a5fa;

    /* Semantic */
    --green: #22c55e;
    --green-soft: rgba(34, 197, 94, 0.12);
    --green-text: #4ade80;
    --red: #ef4444;
    --red-soft: rgba(239, 68, 68, 0.12);
    --red-text: #f87171;
    --amber: #f59e0b;
    --amber-soft: rgba(245, 158, 11, 0.12);
    --amber-text: #fbbf24;
    --purple: #8b5cf6;
    --purple-soft: rgba(139, 92, 246, 0.12);
    --purple-text: #a78bfa;
    --grey: #6b7280;
    --grey-soft: rgba(107, 114, 128, 0.12);

    /* Radii */
    --radius-sm: 4px;
    --radius: 6px;
    --radius-lg: 8px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);

    /* Transition — snappier easing */
    --transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Pico CSS v2 Overrides ───────────────────────────────────────────────── */
[data-theme="dark"] {
    --pico-background-color: var(--surface-0);
    --pico-card-background-color: var(--surface-1);
    --pico-card-sectioning-background-color: var(--surface-2);
    --pico-muted-border-color: var(--border);
    --pico-border-color: var(--border);
    --pico-color: var(--text-primary);
    --pico-muted-color: var(--text-muted);
    --pico-secondary: var(--text-secondary);
    --pico-secondary-hover: var(--text-primary);
    --pico-primary: var(--accent);
    --pico-primary-hover: var(--accent-hover);
    --pico-primary-focus: rgba(59, 130, 246, 0.15);
    --pico-primary-background: var(--accent);
    --pico-primary-hover-background: var(--accent-hover);
    --pico-primary-inverse: #fff;
    --pico-form-element-background-color: var(--surface-2);
    --pico-form-element-border-color: var(--border);
    --pico-form-element-focus-color: var(--accent);
    --pico-form-element-active-border-color: var(--accent);
    --pico-form-element-active-background-color: var(--surface-2);
    --pico-form-element-color: var(--text-primary);
    --pico-form-element-placeholder-color: var(--text-muted);
    --pico-switch-background-color: var(--surface-3);
    --pico-switch-checked-background-color: var(--accent);
    --pico-table-border-color: var(--border);
    --pico-table-row-stripped-background-color: var(--surface-2);
    --pico-code-background-color: var(--surface-2);
    --pico-code-color: var(--amber-text);
    --pico-blockquote-border-color: var(--accent);
    --pico-h1-color: var(--text-primary);
    --pico-h2-color: var(--text-primary);
    --pico-h3-color: var(--text-primary);
    --pico-h4-color: var(--text-secondary);
    --pico-mark-background-color: var(--amber-soft);
    --pico-mark-color: var(--amber-text);
    --pico-del-color: var(--red-text);
    --pico-ins-color: var(--green-text);
    --pico-font-size: 15px;
    --pico-spacing: 0.75rem;
    --pico-form-element-spacing-vertical: 0.5rem;
    --pico-typography-spacing-vertical: 0.75rem;
    color-scheme: dark;
}

/* ── Typography ──────────────────────────────────────────────────────────── */
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.011em;
}
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.025em;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
code, kbd, pre, .prompt-textarea, .masked-value {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* ── Layout ──────────────────────────────────────────────────────────────── */
body > main {
    margin-top: 0;
    padding-top: 1.25rem;
}
body > footer {
    margin-top: 1.5rem;
    padding-block: 0.75rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}
hgroup {
    margin-bottom: 0.75rem;
}
hgroup > p {
    margin-bottom: 0;
    color: var(--text-secondary);
}

/* ── Navigation ──────────────────────────────────────────────────────────── */
nav.nav-main {
    background: var(--surface-1);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    padding-block: 0.35rem;
    flex-wrap: wrap;
}
nav.nav-main ul li strong {
    color: var(--text-primary);
    font-weight: 700;
    letter-spacing: -0.03em;
}
.nav-links > li > a,
.nav-links > li > form button {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition);
    font-size: 0.88em;
    font-weight: 500;
    border-radius: var(--radius-sm);
}
.nav-links > li > a:hover,
.nav-links > li > form button:hover {
    color: var(--text-primary);
}
.nav-links > li > a[aria-current="page"],
.nav-dropdown-toggle[aria-current="page"] {
    color: var(--text-primary);
}

.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    margin: 0;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.nav-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Logout button in nav */
nav .nav-links .inline-form button.outline.secondary,
nav .nav-links li form button.outline.secondary {
    padding: 0.2rem 0.65rem;
    margin: 0;
    font-size: 0.8em;
    border-color: var(--border);
    color: var(--text-secondary);
}
nav .nav-links .inline-form button.outline.secondary:hover,
nav .nav-links li form button.outline.secondary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ── Navigation Dropdown ─────────────────────────────────────────────────── */
.nav-dropdown {
    position: relative;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 190px;
    padding: 0.3rem 0;
    z-index: 100;
    list-style: none;
    margin: 0;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-menu li {
    padding: 0;
    margin: 0;
}
.nav-dropdown-menu li a {
    display: block;
    padding: 0.4rem 0.9rem;
    font-size: 0.85em;
    text-decoration: none;
    white-space: nowrap;
    color: var(--text-secondary);
    transition: all var(--transition);
    border-radius: 0;
}
.nav-dropdown-menu li a:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.nav-dropdown-menu hr {
    margin: 0.25rem 0;
    border: 0;
    border-top: 1px solid var(--border);
}

/* ── Cards / Articles ────────────────────────────────────────────────────── */
article {
    background: var(--surface-1);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
article > header {
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
article:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 12px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-1px);
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.2em 0.55em;
    border-radius: 99px;
    font-size: 0.78em;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    letter-spacing: 0.01em;
}
.badge-success {
    background: var(--green-soft);
    color: var(--green-text);
}
.badge-success::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    flex-shrink: 0;
}
.badge-error {
    background: var(--red-soft);
    color: var(--red-text);
}
.badge-error::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--red);
    flex-shrink: 0;
}
.badge-warning {
    background: var(--amber-soft);
    color: var(--amber-text);
}
.badge-warning::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    flex-shrink: 0;
}
.badge-removed {
    background: var(--grey-soft);
    color: var(--text-secondary);
}
.badge-tag {
    background: var(--accent-soft);
    color: var(--accent-text);
    margin: 0.1em;
    display: inline-flex;
}
.badge-available {
    background: var(--green-soft);
    color: var(--green-text);
}
.badge-cooldown {
    background: var(--amber-soft);
    color: var(--amber-text);
}
.badge-needs-refresh {
    background: var(--accent-soft);
    color: var(--accent-text);
}
/* Bug report severity badges */
.badge-severity-critical { background: var(--red-soft); color: var(--red-text); }
.badge-severity-high { background: var(--amber-soft); color: var(--amber-text); }
.badge-severity-medium { background: rgba(234, 179, 8, 0.12); color: #facc15; }
.badge-severity-low { background: var(--grey-soft); color: var(--text-secondary); }

/* Bug report status badges */
.badge-bugstatus-open { background: var(--accent-soft); color: var(--accent-text); }
.badge-bugstatus-in_progress { background: var(--amber-soft); color: var(--amber-text); }
.badge-bugstatus-resolved { background: var(--green-soft); color: var(--green-text); }
.badge-bugstatus-closed { background: var(--grey-soft); color: var(--text-secondary); }

/* Dynamic badge: keeps inline background from DB, provides text/shape */
.badge-dynamic {
    color: #fff;
    padding: 0.2em 0.55em;
    border-radius: var(--radius-sm);
    font-size: 0.78em;
    font-weight: 600;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
/* Shrink form buttons — Pico defaults to width:100%; reduce to auto */
button[type="submit"],
input[type="submit"],
button[type="button"],
form a[role="button"] {
    width: auto;
    padding-inline: 2rem;
}
[role="button"]:not(.outline):not(.secondary):not(.contrast),
button[type="submit"]:not(.outline):not(.secondary):not(.contrast):not(.btn-sm):not(.btn-danger):not(.btn-inline-ok):not(.btn-inline-delete):not(.sidebar-logout-btn):not(.sidebar-bug-btn):not(.sidebar-close):not(.sidebar-toggle):not(.pattern-remove) {
    background: linear-gradient(180deg, var(--accent), var(--accent-hover));
}
[role="button"]:not(.outline):not(.secondary):not(.contrast):hover,
button[type="submit"]:not(.outline):not(.secondary):not(.contrast):not(.btn-sm):not(.btn-danger):not(.btn-inline-ok):not(.btn-inline-delete):not(.sidebar-logout-btn):not(.sidebar-bug-btn):not(.sidebar-close):not(.sidebar-toggle):not(.pattern-remove):hover {
    transform: scale(1.02);
}
[role="button"]:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
.btn-sm {
    height: 1.75rem;
    padding: 0 0.5rem;
    font-size: 0.82rem;
    line-height: 1.75rem;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3em;
    width: auto;
    margin: 0;
    box-sizing: border-box;
}
.btn-danger {
    background: var(--red) !important;
    color: #fff !important;
    border: 1px solid var(--red) !important;
    height: 1.75rem;
    padding: 0 0.5rem !important;
    font-size: 0.82rem;
    line-height: 1.75rem;
    margin: 0;
    box-sizing: border-box;
}
.btn-danger:hover {
    background: #dc2626 !important;
}
.btn-muted {
    background: var(--grey) !important;
    color: #fff !important;
    border: none !important;
}
.btn-muted:hover {
    background: #4b5563 !important;
}
.btn-purple {
    background: var(--purple) !important;
    color: #fff !important;
    border: none !important;
}
.btn-purple:hover {
    background: #7c3aed !important;
}

/* Constrain schedule column so it doesn't overlap actions */
td[id^="sched-cell-"] {
    min-width: 8rem;
    max-width: 11rem;
}
td[id^="sched-cell-"] .inline-form {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* Inline action buttons (stage cell, table rows) */
.btn-inline-ok {
    height: 1.75rem;
    padding: 0 0.5rem !important;
    font-size: 0.82rem;
    line-height: 1.75rem;
    margin: 0 0 0 2px;
    background: var(--accent) !important;
    color: #fff !important;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
}
.btn-inline-ok:hover {
    background: var(--accent-hover);
}
.btn-inline-delete {
    background: none;
    border: none;
    color: var(--red-text);
    cursor: pointer;
    padding: 2px 4px;
    font-size: 0.8em;
    transition: color var(--transition);
}
.btn-inline-delete:hover {
    color: var(--red);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */
table {
    width: 100%;
    table-layout: auto;
    border-collapse: collapse;
}
table td, table th {
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
    padding: 0.4rem 0.6rem;
    font-size: 0.88em;
}
thead th {
    background: var(--surface-2);
    color: var(--text-primary);
    font-size: 0.78em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border-accent);
    position: sticky;
    top: 0;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
a.sort-header {
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}
a.sort-header:hover {
    color: var(--accent-text);
}
tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
tbody tr:nth-child(even) {
    background: rgba(255,255,255,0.015);
}
tbody tr:hover {
    background: var(--surface-hover);
}
table .col-nowrap {
    white-space: nowrap;
}
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.table-responsive table {
    margin-bottom: 0;
}

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
    text-align: center;
    letter-spacing: -0.03em;
}
.stat-success { color: var(--green-text); }
.stat-error { color: var(--red-text); }
.stat-card {
    text-align: center;
    padding: 0.5rem 0.4rem;
    margin: 0;
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.stat-card .stat-number {
    font-size: 1.25rem;
}

/* ── Status Cards (editorial workflow) ───────────────────────────────────── */
.status-card {
    text-decoration: none;
    display: block;
}
.status-card article {
    text-align: center;
    padding: 0.5rem;
    margin: 0;
    cursor: pointer;
    transition: all var(--transition);
}
.status-card:hover article {
    border-color: var(--border-hover);
    background: var(--surface-2);
}

/* ── Forms — Uniform sizing ───────────────────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
    height: 2.5rem;           /* uniform height across all form controls */
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
    line-height: 1.4;
    background-color: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}
textarea {
    height: auto;             /* textareas grow vertically */
    min-height: 5rem;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus {
    box-shadow: 0 0 0 2px var(--accent-soft);
    border-color: var(--accent);
}

/* Labels above inputs — tighter spacing */
label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.65rem;
}
label > small {
    font-weight: 600;
    color: var(--text-secondary);
}
label > input,
label > select,
label > textarea {
    margin-top: 0.2rem;
}

/* Filter bar grids — override Pico grid for equal-width columns */
[data-theme="dark"] form > .grid,
[data-theme="dark"] form.grid,
[data-theme="dark"] #activity-filters.grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)) !important;
    gap: 0.65rem !important;
    align-items: end !important;
}
/* Labels inside filter grids fill their cell */
form > .grid > label,
form.grid > label {
    width: 100%;
    min-width: 0;
}
/* Selects & inputs inside grids take full width of their cell */
form > .grid select,
form > .grid input:not([type="checkbox"]):not([type="radio"]),
form.grid select,
form.grid input:not([type="checkbox"]):not([type="radio"]) {
    width: 100% !important;
    box-sizing: border-box;
}
/* Buttons inside filter grids align with inputs */
form > .grid > button,
form.grid > button,
form > .grid > label > button {
    height: 2.2rem;
    margin-bottom: 0;
}
/* Standardize select/input heights in filter grids */
form > .grid select,
form > .grid input:not([type="checkbox"]):not([type="radio"]),
form.grid select,
form.grid input:not([type="checkbox"]):not([type="radio"]),
#activity-filters.grid select,
#activity-filters.grid input:not([type="checkbox"]):not([type="radio"]) {
    height: 2.2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.82rem;
    margin-bottom: 0;
}
form > .grid > label > small,
form.grid > label > small {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* ── Details / Summary ───────────────────────────────────────────────────── */
details {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    background: var(--surface-1);
}
details > summary {
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background var(--transition);
    border-radius: var(--radius);
}
details > summary::before {
    content: "›";
    font-size: 1.1em;
    font-weight: 700;
    transition: transform var(--transition);
    display: inline-block;
    width: 1em;
    text-align: center;
    color: var(--text-muted);
}
details[open] > summary::before {
    transform: rotate(90deg);
}
details > summary::-webkit-details-marker {
    display: none;
}
details > summary:hover {
    background: var(--surface-hover);
}
details[open] > summary {
    border-bottom: 1px solid var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
}
details > :not(summary) {
    padding: 0 1rem;
}
details > :nth-child(2) {
    padding-top: 0.75rem;
}
.summary-heading {
    display: inline;
}

/* ── Flash Messages ──────────────────────────────────────────────────────── */
.flash-message {
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    border-radius: var(--radius);
    font-size: 0.88em;
    font-weight: 500;
    animation: flash-slide-in 0.3s ease-out;
    background: var(--green-soft);
    color: var(--green-text);
    border: 1px solid rgba(34, 197, 94, 0.2);
}
.flash-warning {
    background: var(--amber-soft);
    color: var(--amber-text);
    border-color: rgba(245, 158, 11, 0.2);
}
.flash-error {
    background: var(--red-soft);
    color: var(--red-text);
    border-color: rgba(239, 68, 68, 0.2);
}
@keyframes flash-fade {
    0%, 75% { opacity: 1; }
    100% { opacity: 0; display: none; }
}
@keyframes flash-slide-in {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── Daemon Status ───────────────────────────────────────────────────────── */
.daemon-status {
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.daemon-controls {
    display: flex;
    gap: 0.5rem;
}
.daemon-controls .btn-sm {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.25em 0.75em;
    font-size: 0.8em;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}
.daemon-controls .btn-sm:hover {
    background: var(--accent-hover);
}

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0;
    color: var(--text-secondary);
}
.pagination a {
    color: var(--accent-text);
    text-decoration: none;
    font-weight: 500;
}
.pagination a:hover {
    color: var(--accent);
}

/* ── Error Detail ────────────────────────────────────────────────────────── */
.error-detail {
    color: var(--red-text);
    word-break: break-word;
}

/* ── Muted Text ──────────────────────────────────────────────────────────── */
.muted {
    color: var(--text-muted);
    opacity: 1;
}

/* ── Bulk Actions ────────────────────────────────────────────────────────── */
.bulk-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Checkbox Column ─────────────────────────────────────────────────────── */
.col-check {
    width: 2.5rem;
    text-align: center;
}
.col-check input[type="checkbox"] {
    margin: 0;
}

/* ── Permission Groups ───────────────────────────────────────────────────── */
.perm-group { margin-bottom: 0.5rem; }
.perm-group summary { display: flex; align-items: center; gap: 0.75rem; cursor: pointer; }
.perm-group-label { font-weight: 600; font-size: 1.05rem; }
.perm-group-count { font-size: 0.85rem; color: var(--pico-muted-color); }
.perm-group-toggle { display: inline-flex; align-items: center; gap: 0.3rem; margin-left: auto; font-size: 0.85rem; font-weight: normal; cursor: pointer; }
.perm-group-toggle input { margin: 0; }
.perm-group table { margin-top: 0.5rem; margin-bottom: 0; }

/* ── Activity Scroll ─────────────────────────────────────────────────────── */
.activity-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.activity-scroll figure {
    margin-bottom: 0;
}
.activity-scroll thead th {
    position: sticky;
    top: 0;
    background: var(--surface-2);
    z-index: 1;
}

/* ── Activity Filters ────────────────────────────────────────────────────── */
#activity-filters {
    margin-bottom: 0.5rem;
}
#activity-filters label small {
    display: block;
    margin-bottom: 0.15rem;
    font-weight: 600;
    color: var(--text-secondary);
}
#activity-filters select,
#activity-filters input[type="text"],
#activity-filters input[type="date"] {
    margin-bottom: 0;
}

/* Date inputs — same height as selects, no width constraint */
input[type="date"],
input[type="date"].inline-date {
    -webkit-appearance: auto;
    appearance: auto;
    cursor: pointer;
    background-image: none !important;
}
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="date"].inline-date::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0;
    /* Stretch indicator to cover full input — click anywhere opens picker */
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
}
input[type="date"] {
    position: relative;
}

/* ── Calendar ────────────────────────────────────────────────────────────── */
.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}
.calendar-center-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}
.tier-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.tier-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.8em;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    transition: background var(--transition), color var(--transition);
}
.tier-btn:last-child { border-right: none; }
.tier-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.tier-btn.tier-active {
    background: var(--accent);
    color: #fff;
}
.calendar-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 900px;
}
.calendar-header {
    background: var(--surface-2);
    padding: 0.5rem 0.4rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.78em;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.calendar-day {
    background: var(--surface-1);
    padding: 0.35rem;
    min-height: 90px;
    font-size: 0.8em;
    vertical-align: top;
    transition: background var(--transition);
}
.calendar-day:hover {
    background: var(--surface-2);
}
.calendar-day.calendar-today {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.calendar-day.calendar-empty {
    background: var(--surface-0);
    min-height: 0;
    pointer-events: none;
}
.calendar-day-num, .calendar-day-number {
    font-weight: 700;
    font-size: 0.85em;
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}
.calendar-today .calendar-day-num,
.calendar-today .calendar-day-number {
    color: var(--accent);
}
.calendar-chip {
    display: block;
    padding: 0.3em 0.45em;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    font-size: 0.82em;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    transition: opacity var(--transition);
    line-height: 1.4;
    letter-spacing: 0.01em;
}
.calendar-chip:hover {
    opacity: 0.8;
    color: #fff;
}
.calendar-chip-free {
    background: #15803d;
}
.calendar-chip-paid {
    background: #7c3aed;
}
.calendar-chip-scheduled {
    opacity: 0.7;
    border-left: 3px dashed var(--amber);
}
.calendar-chip-published {
    opacity: 1;
    border-left: 3px solid rgba(255,255,255,0.5);
}
.chip-tier {
    display: inline-block;
    font-weight: 700;
    font-size: 0.85em;
    margin-right: 0.2em;
    opacity: 0.7;
}
.calendar-need {
    display: block;
    padding: 0.15em 0.3em;
    margin: 2px 0;
    border-radius: var(--radius-sm);
    font-size: 0.65em;
    color: var(--red-text);
    background: var(--red-soft);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

/* View-specific grid heights */
.calendar-view-week .calendar-day {
    min-height: 180px;
}
.calendar-view-2week .calendar-day {
    min-height: 120px;
}
.calendar-day-month {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.15em;
}

/* Production day highlighting */
.calendar-day.calendar-production-gap {
    background: var(--red-soft);
    border-left: 3px solid var(--red);
}
.calendar-day.calendar-production-day {
    border-left: 3px solid var(--green);
}
.calendar-day.calendar-today.calendar-production-gap {
    box-shadow: inset 0 0 0 1px var(--accent);
}

/* Publishing week summary bar */
.pub-week-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.pub-week-label {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
}
.pub-week-label small {
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 0.3em;
}
.pub-week-counts {
    display: flex;
    gap: 1rem;
}
.pub-week-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.3rem 0.6rem;
    border-left: 1px solid var(--border);
}
.pub-week-col:first-child {
    border-left: none;
}
.pub-week-col-label {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}
.pub-count {
    font-size: 0.8em;
    font-weight: 600;
    padding: 0.15em 0.5em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
}
.pub-count-total {
    color: var(--text-primary);
    background: var(--surface-2);
}
.pub-count-free {
    color: var(--green-text);
    background: var(--green-soft);
}
.pub-count-paid {
    color: var(--purple-text);
    background: var(--purple-soft);
}
.pub-count-scheduled {
    color: var(--amber-text);
    background: var(--amber-soft);
}
.pub-count-published {
    color: var(--accent-text);
    background: var(--accent-soft);
}

/* Day view */
.day-view {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.day-view-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    transition: background var(--transition), border-color var(--transition);
}
.day-view-item:hover {
    background: var(--surface-2);
    border-color: var(--accent);
}
.day-view-scheduled {
    opacity: 0.6;
    border-left: 3px dashed var(--amber);
}
.day-view-published {
    border-left: 3px solid var(--green);
}
.day-view-title {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}
.day-view-meta {
    font-size: 0.82em;
    color: var(--text-muted);
}
.day-view-gaps {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* Calendar legend */
.calendar-legend {
    display: flex;
    gap: 1.2rem;
    flex-wrap: wrap;
    font-size: 0.82em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding: 0.6rem 0.8rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.legend-swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.calendar-today-swatch {
    background: rgba(59, 130, 246, 0.08);
    box-shadow: inset 0 0 0 1px var(--accent);
}
.calendar-production-gap-swatch {
    background: var(--red-soft);
    border-left: 3px solid var(--red);
}
.calendar-production-day-swatch {
    background: var(--surface-1);
    border-left: 3px solid var(--green);
}
.legend-swatch-published {
    background: var(--green);
    border-left: 3px solid rgba(255,255,255,0.6);
}
.legend-swatch-scheduled {
    background: var(--surface-2);
    border-left: 3px dashed var(--amber);
    opacity: 0.7;
}

/* ── Pattern Chips ───────────────────────────────────────────────────────── */
.pattern-tag {
    display: inline-block;
    padding: 0.15em 0.45em;
    margin: 0.1em;
    background: var(--surface-3);
    border-radius: var(--radius-sm);
    font-size: 0.8em;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}
.pattern-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.pattern-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3em 0.6em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
}
.pattern-remove {
    background: none;
    border: none;
    color: var(--red-text);
    cursor: pointer;
    font-size: 1.1em;
    padding: 0 0.2em;
    line-height: 1;
    margin: 0;
    transition: color var(--transition);
}
.pattern-remove:hover {
    color: var(--red);
}
.pattern-add-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-end;
    margin-bottom: 1rem;
}
.pattern-add-row label {
    margin-bottom: 0;
}
.pattern-add-row .flex-1 {
    flex: 1;
}

/* ── Editor Cards ──────────────────────────────────────────────────────── */
.editor-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 0.75rem;
}
.editor-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
}
.editor-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.editor-card-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
}
.editor-card-name a {
    text-decoration: none;
    color: var(--text-primary);
}
.editor-card-name a:hover {
    color: var(--accent);
}
.editor-card-initials {
    font-size: 0.8em;
    padding: 0.1em 0.4em;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
}
.editor-card-meta {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}
.editor-card-summary {
    display: flex;
    gap: 1rem;
    margin-top: 0.35rem;
    font-size: 0.82em;
}
.editor-card-details {
    margin-top: 0.5rem;
    border: none;
}
.editor-card-details summary {
    font-size: 0.82em;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    margin-bottom: 0;
}
.editor-card-details summary:hover {
    color: var(--accent);
}
.editor-card-details[open] summary {
    margin-bottom: 0.4rem;
}
.editor-card-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 0.35rem;
}

/* ── Checkbox Grid ──────────────────────────────────────────────────────── */
.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.15rem 1.5rem;
}
.checkbox-grid-item {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    font-size: 0.9em;
    padding: 0.2rem 0;
    margin-bottom: 0;
}
.checkbox-grid-item input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
}
.checkbox-grid-item span {
    line-height: 1.3;
}
@media (max-width: 768px) {
    .checkbox-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 480px) {
    .checkbox-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Prompt / Textarea ───────────────────────────────────────────────────── */
.prompt-textarea {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    font-size: 0.82em;
    line-height: 1.6;
    resize: vertical;
    min-height: 200px;
    background: var(--surface-2);
    border-color: var(--border);
    color: var(--text-primary);
}
.prompt-preview {
    white-space: normal !important;
    max-width: 300px;
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ── Masked Values ───────────────────────────────────────────────────────── */
.masked-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82em;
    color: var(--text-muted);
    letter-spacing: 0.08em;
}

/* ── Google Doc Link ─────────────────────────────────────────────────────── */
.google-doc-link {
    font-weight: 600;
    white-space: nowrap;
    padding: 0.4em 0.8em;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 0.88em;
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    transition: background var(--transition);
}
.google-doc-link:hover {
    background: var(--accent-hover);
    color: #fff;
}

/* ── Top save bar (editorial form) ────────────────────────────────────────── */
.top-save-bar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

/* ── Column width helpers ─────────────────────────────────────────────────── */
.col-nowrap-label { white-space: nowrap; }

/* ── Table Action Cells ──────────────────────────────────────────────────── */
.actions-cell {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
    white-space: nowrap;
}
.actions-cell form {
    margin: 0;
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: nowrap;
}

/* ── Utility Classes ─────────────────────────────────────────────────────── */
.page-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.page-actions a[role="button"],
.page-actions button,
.page-actions .btn-sm,
.page-actions .btn-export {
    height: 2.2rem;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    line-height: 2.2rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin: 0;
}
.page-actions .dropdown-menu {
    position: relative;
    border: none;
    margin: 0;
    background: none;
    padding: 0;
}
.page-actions .dropdown-menu summary {
    cursor: pointer;
    list-style: none;
    height: 2.2rem;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    line-height: 2.2rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.page-actions .dropdown-menu summary::marker,
.page-actions .dropdown-menu summary::-webkit-details-marker { display: none; }
.page-actions .dropdown-menu summary::after { content: " \25BE"; }
.page-actions .dropdown-menu[open] ul {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 60;
    background: var(--card-background-color);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    list-style: none;
    padding: 0.25rem 0;
    margin: 0.25rem 0 0;
    min-width: 10rem;
}
.page-actions .dropdown-menu li a {
    display: block;
    padding: 0.4rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
}
.page-actions .dropdown-menu li a:hover {
    background: var(--surface-2);
}
.bulk-actions button,
.bulk-actions .btn-sm,
.bulk-actions select {
    height: 2.2rem;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    line-height: 2.2rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    margin: 0;
}
.action-divider {
    width: 1px;
    height: 1.4rem;
    background: var(--border);
    flex-shrink: 0;
}
.page-actions select {
    height: 2.2rem;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    line-height: 2.2rem;
    margin: 0;
    width: auto;
}
.inline-form {
    display: inline;
    margin: 0;
}
.inline-form.hidden {
    display: none !important;
}
.form-row {
    display: flex;
    gap: 0.5rem;
    align-items: end;
    flex-wrap: wrap;
}
.inline-select {
    display: inline-block;
    width: auto;
    height: 2.2rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.82rem;
    margin: 0;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
}
.cms-inline-edit.inline-changed {
    border-color: var(--pico-primary);
    box-shadow: 0 0 0 1px var(--pico-primary);
}
/* login-container: see end of file for final definition */
.flex-1 {
    flex: 1;
}
.mb-0 {
    margin-bottom: 0;
}

/* ── Scrollbars ──────────────────────────────────────────────────────────── */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-active) transparent;
}
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--surface-active);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ── Links ────────────────────────────────────────────────────────────────── */
a {
    color: var(--accent-text);
    transition: color var(--transition);
}
a:hover {
    color: var(--accent);
}

/* ── HR ───────────────────────────────────────────────────────────────────── */
hr {
    border-color: var(--border);
}

/* ============================================================================
   Responsive: Navigation
   ============================================================================ */
@media (max-width: 1200px) {
    .nav-links {
        flex-wrap: wrap;
        gap: 0;
    }
    .nav-links > li > a,
    .nav-links > li > form button {
        font-size: 0.83em;
        padding: 0.25rem 0.35rem;
    }
}
@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }
    .nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 0;
        margin: 0;
        list-style: none;
    }
    .nav-links.nav-open {
        display: flex;
        border-top: 1px solid var(--border);
        margin-top: 0.25rem;
        padding-top: 0.25rem;
    }
    .nav-links > li > a,
    .nav-links > li > form button {
        font-size: 0.85em;
        padding: 0.4rem 0.5rem;
    }
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        padding-left: 1rem;
        background: transparent;
    }
}

/* ============================================================================
   Responsive: Calendar
   ============================================================================ */
@media (max-width: 768px) {
    .calendar-controls {
        flex-wrap: wrap;
        justify-content: center;
    }
    .calendar-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        min-width: 500px;
    }
    .calendar-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin-bottom: 1rem;
    }
    .calendar-day {
        min-height: 60px;
        font-size: 0.7em;
        padding: 0.2rem;
    }
    .calendar-header {
        font-size: 0.72em;
        padding: 0.25rem;
    }
}

/* ============================================================================
   Responsive: Filter grids and form grids
   ============================================================================ */
@media (max-width: 768px) {
    #activity-filters.grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .grid {
        grid-template-columns: 1fr !important;
    }
    #activity-filters.grid {
        grid-template-columns: 1fr 1fr;
    }
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
}
@media (max-width: 480px) {
    #activity-filters.grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   Responsive: General layout
   ============================================================================ */
@media (max-width: 768px) {
    .bulk-actions {
        flex-wrap: wrap;
    }
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    hgroup h2 {
        font-size: 1.3rem;
    }
    hgroup p {
        font-size: 0.85em;
    }
    .page-actions {
        flex-direction: column;
        align-items: stretch;
    }
}

/* ============================================================================
   News Digest — Newsroom Command Center
   ============================================================================ */

/* ── Animations ─────────────────────────────────────────────────────────── */
@keyframes nd-fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes nd-count-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}
@keyframes nd-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}
@keyframes nd-scan-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
    50% { box-shadow: 0 0 0 6px rgba(59, 130, 246, 0); }
}
@keyframes nd-ticker-slide {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
}
@keyframes nd-glow {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

/* ── Page Header Accent ─────────────────────────────────────────────────── */
.nd-header {
    position: relative;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}
.nd-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 80px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.nd-header hgroup {
    margin-bottom: 0;
    animation: nd-fade-up 0.4s ease-out;
}
.nd-header h2 {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.nd-header-icon {
    font-size: 0.85em;
    opacity: 0.7;
}
.nd-header-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    flex-wrap: wrap;
}

/* ── Wire / Ticker Bar ──────────────────────────────────────────────────── */
.nd-wire-bar {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 1rem;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    overflow: hidden;
    animation: nd-fade-up 0.4s ease-out 0.05s both;
}
.nd-wire-label {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--red-text);
    white-space: nowrap;
    padding: 0.2em 0.5em;
    background: var(--red-soft);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}
.nd-wire-content {
    font-size: 0.82em;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Stat Cards (News specific) ─────────────────────────────────────────── */
.nd-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.nd-stat-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: border-color var(--transition), transform var(--transition);
    animation: nd-fade-up 0.4s ease-out both;
}
.nd-stat-card:nth-child(1) { animation-delay: 0.05s; }
.nd-stat-card:nth-child(2) { animation-delay: 0.1s; }
.nd-stat-card:nth-child(3) { animation-delay: 0.15s; }
.nd-stat-card:nth-child(4) { animation-delay: 0.2s; }
.nd-stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-1px);
}
.nd-stat-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}
.nd-stat-card--blue::before { background: var(--accent); }
.nd-stat-card--green::before { background: var(--green); }
.nd-stat-card--amber::before { background: var(--amber); }
.nd-stat-card--purple::before { background: var(--purple); }
.nd-stat-card--red::before { background: var(--red); }
.nd-stat-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 0.35rem;
    animation: nd-count-pulse 0.6s ease-out 0.8s both;
}
.nd-stat-value--blue { color: var(--accent-text); }
.nd-stat-value--green { color: var(--green-text); }
.nd-stat-value--amber { color: var(--amber-text); }
.nd-stat-value--purple { color: var(--purple-text); }
.nd-stat-label {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── Section Dividers ───────────────────────────────────────────────────── */
.nd-section {
    margin-bottom: 1.75rem;
    animation: nd-fade-up 0.4s ease-out both;
}
.nd-section:nth-child(2) { animation-delay: 0.1s; }
.nd-section:nth-child(3) { animation-delay: 0.15s; }
.nd-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--border);
}
.nd-section-title::before {
    content: "";
    width: 3px;
    height: 1em;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ── Editor Cards (Generate) ────────────────────────────────────────────── */
.nd-editor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.nd-editor-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: border-color var(--transition), box-shadow var(--transition);
    animation: nd-fade-up 0.35s ease-out both;
}
.nd-editor-card:nth-child(1) { animation-delay: 0.08s; }
.nd-editor-card:nth-child(2) { animation-delay: 0.13s; }
.nd-editor-card:nth-child(3) { animation-delay: 0.18s; }
.nd-editor-card:nth-child(4) { animation-delay: 0.23s; }
.nd-editor-card:hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-soft);
}
.nd-editor-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.nd-editor-name {
    font-weight: 700;
    font-size: 0.95em;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}
.nd-editor-links {
    display: flex;
    gap: 0.75rem;
    font-size: 0.78em;
}
.nd-editor-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.nd-editor-links a:hover {
    color: var(--accent-text);
}
.nd-generate-btn {
    width: 100%;
    font-weight: 600;
    font-size: 0.88em;
    padding: 0.55rem 1rem;
    border-radius: var(--radius);
    border: 1px solid var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.nd-generate-btn:hover {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25);
}
.nd-generate-btn[aria-busy="true"] {
    pointer-events: none;
    animation: nd-scan-pulse 1.5s ease-in-out infinite;
}

/* ── Digest Table ───────────────────────────────────────────────────────── */
.nd-digest-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.nd-digest-table table {
    margin-bottom: 0;
}
.nd-digest-table thead th {
    background: var(--surface-2);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.nd-digest-table tbody td {
    padding: 0.6rem 0.75rem;
    font-size: 0.88em;
}
.nd-digest-table tbody tr {
    transition: background var(--transition);
}
.nd-digest-table tbody tr:hover {
    background: var(--surface-hover);
}
.nd-digest-table .nd-editor-col {
    font-weight: 600;
    color: var(--text-primary);
}
.nd-digest-table .nd-date-col {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    color: var(--text-muted);
}
.nd-digest-table .nd-actions-col {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

/* ── Delivery Status Pills ──────────────────────────────────────────────── */
.nd-delivery {
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
    padding: 0.15em 0.5em;
    border-radius: 99px;
    font-size: 0.75em;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.nd-delivery--sent {
    background: var(--green-soft);
    color: var(--green-text);
}
.nd-delivery--skipped {
    background: var(--grey-soft);
    color: var(--text-muted);
}
.nd-delivery--failed {
    background: var(--red-soft);
    color: var(--red-text);
}
.nd-delivery--pending {
    background: var(--amber-soft);
    color: var(--amber-text);
}
.nd-delivery--no_slack_user {
    background: #e3f2fd;
    color: #1565c0;
}
.nd-delivery-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}
.nd-delivery--sent .nd-delivery-dot { background: var(--green); }
.nd-delivery--skipped .nd-delivery-dot { background: var(--grey); }
.nd-delivery--failed .nd-delivery-dot { background: var(--red); }
.nd-delivery--pending .nd-delivery-dot { background: var(--amber); }
.nd-delivery--no_slack_user .nd-delivery-dot { background: #1976d2; }

/* ── Source Cards ────────────────────────────────────────────────────────── */
.nd-source-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}
.nd-source-row {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: grid;
    grid-template-columns: 2fr 80px 1.5fr 80px auto;
    align-items: center;
    gap: 0.75rem;
    transition: border-color var(--transition);
    animation: nd-fade-up 0.35s ease-out both;
}
.nd-source-row:hover {
    border-color: var(--border-hover);
}
.nd-source-name {
    font-weight: 600;
    font-size: 0.9em;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nd-source-type {
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 0.2em 0.5em;
    border-radius: var(--radius-sm);
    background: var(--accent-soft);
    color: var(--accent-text);
}
.nd-source-type--web {
    background: var(--purple-soft);
    color: var(--purple-text);
}
.nd-source-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78em;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.nd-source-status {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82em;
}
.nd-source-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.nd-source-dot--active {
    background: var(--green);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}
.nd-source-dot--inactive {
    background: var(--grey);
}
.nd-source-dot--error {
    background: var(--red);
    animation: nd-glow 2s ease-in-out infinite;
}
.nd-source-actions {
    display: flex;
    gap: 0.3rem;
    justify-content: flex-end;
}

/* ── Config Panel ───────────────────────────────────────────────────────── */
.nd-config-panel {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    animation: nd-fade-up 0.4s ease-out both;
}
.nd-config-panel h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.nd-delivery-toggles {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.nd-delivery-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.88em;
}
.nd-delivery-toggle:hover {
    border-color: var(--border-hover);
    background: var(--surface-3);
}
.nd-delivery-toggle input[type="checkbox"] {
    margin: 0;
}
.nd-delivery-toggle-icon {
    font-size: 1.1em;
    opacity: 0.6;
}

/* ── Topic / Keyword Chips ──────────────────────────────────────────────── */
.nd-topic-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.nd-topic-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.55rem 0.75rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    transition: background var(--transition);
}
.nd-topic-row:hover {
    background: var(--surface-3);
}
.nd-topic-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9em;
}
.nd-topic-desc {
    color: var(--text-muted);
    font-size: 0.8em;
    margin-left: 0.5em;
}
.nd-topic-subscribed {
    border-left: 2px solid var(--green);
    padding-left: calc(0.75rem - 2px);
}
.nd-keyword-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.5rem;
}
.nd-keyword-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3em 0.65em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: 0.82em;
    color: var(--text-primary);
    transition: all var(--transition);
}
.nd-keyword-chip:hover {
    border-color: var(--red);
    background: var(--red-soft);
}
.nd-keyword-chip button {
    all: unset;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1em;
    line-height: 1;
    transition: color var(--transition);
}
.nd-keyword-chip:hover button {
    color: var(--red-text);
}

/* ── Digest Viewer ──────────────────────────────────────────────────────── */
.nd-digest-viewer {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    animation: nd-fade-up 0.4s ease-out 0.1s both;
}
.nd-digest-viewer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 0.82em;
    font-weight: 600;
    color: var(--text-secondary);
}
.nd-digest-viewer-body {
    padding: 1.5rem;
}
.nd-digest-viewer-body .news-digest h3,
.nd-digest-viewer-body .news-digest h4 {
    color: var(--text-primary);
}
.nd-digest-viewer-body .news-digest h5 a {
    color: var(--accent-text);
}
.nd-digest-viewer-body .news-digest .digest-top-story {
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    margin-bottom: 0.75rem;
}
.nd-digest-viewer-body .news-digest .digest-section {
    margin-bottom: 1.25rem;
}

/* ── Feed Discovery ─────────────────────────────────────────────────────── */
.nd-discover-result {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.15rem;
    margin-bottom: 0.75rem;
    transition: border-color var(--transition);
    animation: nd-fade-up 0.35s ease-out both;
}
.nd-discover-result:hover {
    border-color: var(--accent);
}
.nd-discover-result-title {
    font-weight: 700;
    font-size: 0.95em;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}
.nd-discover-result-desc {
    font-size: 0.85em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.5;
}
.nd-discover-result-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78em;
    color: var(--accent-text);
    word-break: break-all;
    padding: 0.4em 0.65em;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: block;
    margin-bottom: 0.5rem;
}

/* ── Empty State ────────────────────────────────────────────────────────── */
.nd-empty {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.nd-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}
.nd-empty p {
    font-size: 0.88em;
    max-width: 360px;
    margin: 0 auto;
    line-height: 1.6;
}

/* ── Topics Admin ───────────────────────────────────────────────────────── */
.nd-topics-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.nd-topics-table table {
    margin-bottom: 0;
}
.nd-topics-table thead th {
    background: var(--surface-2);
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.65rem 0.75rem;
}
.nd-topics-table tbody td {
    padding: 0.6rem 0.75rem;
    font-size: 0.88em;
}
.nd-topic-keywords-cell {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8em;
    color: var(--text-muted);
}

/* ── Responsive: News Digest ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .nd-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .nd-editor-grid {
        grid-template-columns: 1fr;
    }
    .nd-source-row {
        grid-template-columns: 1fr;
        gap: 0.4rem;
    }
    .nd-source-actions {
        justify-content: flex-start;
    }
    .nd-delivery-toggles {
        flex-direction: column;
    }
}
@media (max-width: 480px) {
    .nd-stats {
        grid-template-columns: 1fr;
    }
}

/* ── Bug Report Dialog ──────────────────────────────────────────────────── */
#bugDialog article {
    max-width: 480px;
}
#bugDialog article header {
    padding: 1rem 1.5rem;
}
#bugDialog article header h3 {
    margin: 0;
}

/* ── Permission Row Layout ─────────────────────────────────────────────── */
.perm-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.4rem 0.75rem;
    border-bottom: 1px solid var(--border);
}
.perm-row:last-child { border-bottom: none; }
.perm-section-name {
    flex: 1;
    font-size: 0.9rem;
}
.perm-cb-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
}
.perm-cb-label input[type="checkbox"] {
    margin: 0;
}

/* ============================================================================
   Sidebar Layout (Welcome Pages)
   ============================================================================ */

/* Sidebar grid — !important overrides Pico CSS element defaults */
.layout-sidebar {
    display: grid !important;
    grid-template-columns: 260px 1fr !important;
    min-height: 100vh;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
    width: 100% !important;
}
.layout-sidebar.no-sidebar {
    grid-template-columns: 1fr !important;
}
.layout-sidebar.no-sidebar > .sidebar-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}
aside.sidebar {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, var(--surface-1) 0%, rgba(15,15,18,1) 100%);
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    display: flex !important;
    flex-direction: column;
    width: 260px !important;
    min-width: 260px !important;
    max-width: 260px !important;
    padding: 0 !important;
    margin: 0 !important;
}
main.sidebar-main {
    max-width: none !important;
    margin: 0 !important;
}
.sidebar-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.sidebar-header strong {
    font-size: 0.95em;
    letter-spacing: -0.02em;
}
.sidebar-brand { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-version { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; text-decoration: none; }
.sidebar-version:hover { color: var(--primary); }
.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}
.sidebar-bug-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.15rem 0.25rem;
    border-radius: var(--radius);
    opacity: 0.6;
    transition: all var(--transition);
}
.sidebar-bug-btn:hover {
    opacity: 1;
    background: var(--surface-hover);
}
.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
}
.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}
.sidebar-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-footer .sidebar-bug-btn {
    flex-shrink: 0;
}
.sidebar-footer .inline-form {
    flex: 1;
    margin: 0;
}
.sidebar-logout-btn {
    width: 100%;
    padding: 0.4rem 0.75rem;
    font-size: 0.82em;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}
.sidebar-logout-btn:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Sidebar nav items */
.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-lg);
    font-size: 0.88em;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all var(--transition);
    margin-bottom: 1px;
}
.sidebar-nav-item:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
    padding-left: calc(0.75rem + 4px);
}
.sidebar-nav-item.active {
    background: var(--group-soft, var(--accent-soft));
    color: var(--group-text, var(--accent-text));
    font-weight: 600;
    border-left: 3px solid var(--group-color, var(--accent));
    padding-left: calc(0.75rem - 3px);
}
.sidebar-nav-icon {
    font-size: 1em;
    width: 1.4em;
    text-align: center;
    flex-shrink: 0;
}
/* Workflow-based sidebar groups */
.sidebar-group {
    margin-bottom: 1rem;
}
.sidebar-group-label {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    padding: 0.4rem 0.75rem 0.2rem;
}
.sidebar-group-label::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--group-color);
    flex-shrink: 0;
}
.sidebar-group-items {
    padding: 0;
}
/* Group color definitions */
.sidebar-group[data-group="monitor"] {
    --group-color: var(--green);
    --group-soft: var(--green-soft);
    --group-text: var(--green-text);
}
.sidebar-group[data-group="create"] {
    --group-color: var(--accent);
    --group-soft: var(--accent-soft);
    --group-text: var(--accent-text);
}
.sidebar-group[data-group="analyze"] {
    --group-color: var(--purple);
    --group-soft: var(--purple-soft);
    --group-text: var(--purple-text);
}
.sidebar-group[data-group="manage"] {
    --group-color: var(--amber);
    --group-soft: var(--amber-soft);
    --group-text: var(--amber-text);
}
.sidebar-group[data-group="configure"] {
    --group-color: var(--grey);
    --group-soft: var(--grey-soft);
    --group-text: var(--text-secondary);
}
/* Breadcrumbs */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}
.breadcrumb a {
    color: var(--text-secondary);
    text-decoration: none;
}
.breadcrumb a:hover {
    color: var(--text-primary);
}
.breadcrumb-sep::before {
    content: '>';
    color: var(--text-muted);
}
.breadcrumb-current {
    color: var(--text-primary);
    font-weight: 600;
}

/* Collapsible dashboard sections */
details.collapsible-section {
    margin: 1rem 0;
}
details.collapsible-section > summary {
    cursor: pointer;
    list-style: none;
    user-select: none;
}
details.collapsible-section > summary::-webkit-details-marker {
    display: none;
}
details.collapsible-section > summary > h3 {
    display: inline;
}
details.collapsible-section > summary > h3::before {
    content: '\25B6';
    font-size: 0.65em;
    margin-right: 0.5rem;
    transition: transform var(--transition);
    display: inline-block;
    vertical-align: middle;
}
details.collapsible-section[open] > summary > h3::before {
    transform: rotate(90deg);
}
.sidebar-badge {
    margin-left: auto;
    font-size: 0.75em;
    font-weight: 700;
    padding: 0.1em 0.45em;
    border-radius: 99px;
    background: var(--accent-soft);
    color: var(--accent-text);
}
.sidebar-badge-red {
    background: var(--red-soft);
    color: var(--red-text);
}
.sidebar-badge-amber {
    background: var(--amber-soft);
    color: var(--amber-text);
}

/* Sidebar main content area */
.sidebar-main {
    padding: 1.5rem 2rem;
    min-width: 0;
    overflow-x: hidden;
}
.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.15rem 0.5rem;
    margin: 0 0 1rem 0;
    line-height: 1;
    border-radius: var(--radius-sm);
}
.sidebar-toggle:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* Welcome page greetings */
.welcome-greeting {
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.welcome-date {
    color: var(--text-muted);
    font-size: 0.88em;
    margin-bottom: 1.5rem;
}

/* Pipeline strip */
.pipeline-strip {
    display: flex;
    gap: 2px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    height: 32px;
    margin-bottom: 1.5rem;
    background: var(--surface-2);
}
.pipeline-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75em;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    min-width: 24px;
    transition: flex-grow 0.3s ease;
}

/* Queue cards */
.queue-section {
    margin-bottom: 1.5rem;
}
details.queue-section {
    border: none;
    padding: 0;
}
details.queue-section > summary {
    list-style: none;
    cursor: pointer;
}
details.queue-section > summary::-webkit-details-marker { display: none; }
details.queue-section > summary::before {
    content: '\25B6';
    font-size: 0.6em;
    transition: transform 0.15s ease;
    display: inline-block;
}
details.queue-section[open] > summary::before {
    transform: rotate(90deg);
}
.queue-section-title {
    font-size: 0.82em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.queue-section-count {
    font-size: 0.85em;
    padding: 0.1em 0.4em;
    border-radius: 99px;
}
.queue-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
    background: var(--surface-1);
    border-top: 1px solid var(--border);
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    margin-bottom: 0.35rem;
    text-decoration: none;
    transition: all var(--transition);
}
.queue-card:hover {
    border-color: var(--accent);
    background: var(--surface-2);
    color: var(--text-primary);
}
.queue-card--overdue { border-left-color: var(--red); }
.queue-card--due-today { border-left-color: var(--amber); }
.queue-card--due-week { border-left-color: var(--accent); }
.queue-card--upcoming { border-left-color: var(--surface-active); }
.queue-card-title {
    flex: 1;
    font-weight: 500;
    font-size: 0.9em;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.queue-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78em;
    color: var(--text-muted);
    flex-shrink: 0;
}
.queue-card-editor {
    color: var(--text-muted);
    font-size: 0.92em;
    font-style: italic;
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gap-create-link {
    color: var(--accent);
    font-size: 0.85em;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}
.gap-create-link:hover {
    text-decoration: underline;
}
.gap-newsletter-link {
    color: var(--text-primary);
    text-decoration: none;
}
.gap-newsletter-link:hover {
    color: var(--accent);
    text-decoration: underline;
}

/* Mini calendar (week view) */
.mini-calendar {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 1.5rem;
}
.mini-cal-header {
    text-align: center;
    font-size: 0.72em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    padding: 0.3rem 0;
}
.mini-cal-day {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.35rem;
    min-height: 60px;
    font-size: 0.8em;
}
.mini-cal-day.is-today {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.06);
}
.mini-cal-day-num {
    font-weight: 700;
    font-size: 0.85em;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
}
.mini-cal-day.is-today .mini-cal-day-num {
    color: var(--accent);
}
.mini-cal-chip {
    display: block;
    padding: 0.15em 0.3em;
    margin: 1px 0;
    border-radius: 3px;
    font-size: 0.72em;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
}

/* Needs Content list (editor dashboard) */
.needs-content-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.needs-content-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface-1);
    border: 1px dashed rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
}
.needs-content-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 0;
}
.needs-content-date {
    font-size: 0.85em;
    color: var(--text-muted);
}

/* ME page: At-risk cards */
.at-risk-card {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-left: 3px solid var(--red);
    margin-bottom: 0.5rem;
    transition: border-color var(--transition);
}
.at-risk-card:hover {
    border-color: var(--border-hover);
}
.at-risk-card--stale {
    border-left-color: var(--amber);
}
.at-risk-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.25rem;
}
.at-risk-title {
    font-weight: 600;
    font-size: 0.9em;
}
.at-risk-title a {
    color: var(--text-primary);
    text-decoration: none;
}
.at-risk-title a:hover {
    color: var(--accent);
}
.at-risk-meta {
    font-size: 0.78em;
    color: var(--text-muted);
}

/* ME page: Workload bars */
.workload-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.workload-row:last-child {
    border-bottom: none;
}
.workload-name {
    width: 120px;
    font-weight: 500;
    font-size: 0.88em;
    flex-shrink: 0;
}
.workload-name a {
    color: var(--text-primary);
    text-decoration: none;
}
.workload-name a:hover {
    color: var(--accent);
}
.workload-bar {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--surface-2);
    overflow: hidden;
}
.workload-fill {
    height: 100%;
    border-radius: 4px;
    background: var(--green);
    transition: width 0.3s ease;
}
.workload-fill--behind {
    background: var(--red);
}
.workload-counts {
    font-size: 0.78em;
    color: var(--text-muted);
    white-space: nowrap;
    width: 80px;
    text-align: right;
    flex-shrink: 0;
}

/* ME page: Activity feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.85em;
    transition: background var(--transition);
}
.activity-item:hover {
    background: var(--surface-hover);
}
.activity-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 0.5em;
    flex-shrink: 0;
}
.activity-content {
    flex: 1;
}
.activity-content strong {
    color: var(--text-primary);
}
.activity-time {
    font-size: 0.82em;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Role switcher (admin) */
.role-switcher {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 1rem;
}
.role-switch-btn {
    padding: 0.35rem 0.8rem;
    font-size: 0.82em;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    background: var(--surface-2);
    border-right: 1px solid var(--border);
    transition: background var(--transition), color var(--transition);
}
.role-switch-btn:last-child { border-right: none; }
.role-switch-btn:hover { background: var(--surface-3); color: var(--text-primary); }
.role-switch-btn.role-active {
    background: var(--accent);
    color: #fff;
}

/* Workspace breadcrumb (in base.html for editor/ME roles) */
.workspace-breadcrumb {
    margin-bottom: 0.75rem;
}
.workspace-breadcrumb a {
    font-size: 0.85em;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition);
}
.workspace-breadcrumb a:hover {
    color: var(--accent);
}

/* Section cards (used in welcome pages) */
.welcome-section {
    margin-bottom: 1.5rem;
}
.welcome-section-title {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Quick actions */
.quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

/* Admin compact assignments widget */
.compact-assignments {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
}
.compact-assignments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}
.compact-assignments-header h4 {
    margin: 0;
    font-size: 0.9rem;
}
.compact-assignments-header a {
    font-size: 0.82em;
}

/* Responsive sidebar */
@media (max-width: 768px) {
    .layout-sidebar {
        grid-template-columns: 1fr !important;
    }
    aside.sidebar {
        position: fixed !important;
        left: -280px;
        width: 260px !important;
        min-width: 260px !important;
        max-width: 260px !important;
        transition: left 0.3s ease;
        z-index: 100;
        box-shadow: none;
    }
    aside.sidebar.sidebar-open {
        left: 0;
        box-shadow: var(--shadow-lg);
    }
    .sidebar-close {
        display: block;
    }
    .sidebar-toggle {
        display: block;
    }
    .sidebar-main {
        padding: 1rem;
    }
}

/* ── Sidebar Logo ───────────────────────────────────────────────────────── */
.sidebar-logo {
    height: 100px;
    width: 100px;
    border-radius: 4px;
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* ── Beta Banner ────────────────────────────────────────────────────────── */
.beta-banner {
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    background: var(--amber-soft);
    color: var(--amber-text);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius);
    font-size: 0.9em;
}

/* ── Beta Badge (sidebar) ───────────────────────────────────────────────── */
.badge-beta {
    font-size: 0.6em;
    opacity: 0.6;
    vertical-align: super;
}

/* ── Compliance Banner ──────────────────────────────────────────────────── */
.compliance-banner {
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9em;
}
.compliance-banner--pass {
    background: var(--green-soft);
    border-color: rgba(34, 197, 94, 0.2);
    color: var(--green-text);
}
.compliance-banner--fail {
    background: var(--red-soft);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--red-text);
}
.compliance-banner--partial {
    background: var(--amber-soft);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--amber-text);
}
.compliance-banner--none {
    background: var(--grey-soft);
    border-color: var(--border);
    color: var(--text-muted);
}
.compliance-checks {
    margin-top: 0.5rem;
    font-size: 0.88em;
}
.compliance-check {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    padding: 0.15rem 0;
}
.compliance-check-icon {
    flex-shrink: 0;
}

/* ============================================================================
   UI/UX Overhaul — Phase 1 & 2 & 3 additions
   ============================================================================ */

/* ── Global fade-up animation ──────────────────────────────────────────── */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade-up {
    animation: fade-up 0.4s ease-out both;
}

/* ── Table row fade-in ──────────────────────────────────────────────────── */
tbody tr {
    animation: fade-up 0.25s ease-out both;
}
tbody tr:nth-child(1)  { animation-delay: 0.02s; }
tbody tr:nth-child(2)  { animation-delay: 0.04s; }
tbody tr:nth-child(3)  { animation-delay: 0.06s; }
tbody tr:nth-child(4)  { animation-delay: 0.08s; }
tbody tr:nth-child(5)  { animation-delay: 0.10s; }
tbody tr:nth-child(6)  { animation-delay: 0.12s; }
tbody tr:nth-child(7)  { animation-delay: 0.14s; }
tbody tr:nth-child(8)  { animation-delay: 0.16s; }
tbody tr:nth-child(9)  { animation-delay: 0.18s; }
tbody tr:nth-child(10) { animation-delay: 0.20s; }

/* ── Responsive column hiding ──────────────────────────────────────────── */
@media (max-width: 1200px) {
    .col-hide-lg { display: none; }
}
@media (max-width: 768px) {
    .col-hide-md { display: none; }
}

/* ── Page Header with accent underline ─────────────────────────────────── */
.page-header {
    position: relative;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.page-header::after {
    content: "";
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 60px;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), transparent);
}
.page-header hgroup {
    margin-bottom: 0;
}
.page-header-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

/* ── Status Chips (editorials list filter bar) ─────────────────────────── */
.status-chips {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}
.status-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    padding: 0.3em 0.75em;
    border-radius: 99px;
    font-size: 0.82em;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: var(--text-secondary);
    transition: all var(--transition);
    cursor: pointer;
}
.status-chip:hover {
    border-color: var(--border-hover);
    background: var(--surface-2);
    color: var(--text-primary);
}
.status-chip.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-text);
}
.status-chip-count {
    font-weight: 700;
}
.status-chip-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Editorial Toolbar (sticky compact action bar) ─────────────────────── */
.editorial-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0.75rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.editorial-toolbar .btn-sm {
    font-size: 0.78em;
}
.editorial-toolbar-spacer {
    flex: 1;
}

/* ── Status Strip (compact dashboard status cards) ─────────────────────── */
.status-strip {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.status-strip .stat-card {
    flex: 1;
    min-width: 100px;
    padding: 0.4rem 0.5rem;
}
.status-strip .stat-card .stat-number {
    font-size: 1.25rem;
}

/* ── Daemon status inline ──────────────────────────────────────────────── */
.daemon-inline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85em;
    margin-left: 0.75rem;
}

/* ── Mailing Analytics Filter Bar ──────────────────────────────────────── */
.ma-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.82rem;
}
.ma-filters label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    margin-bottom: 0;
    font-size: 0.78rem;
    color: var(--text-secondary);
}
.ma-filters select,
.ma-filters input[type="date"] {
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    height: 2.2rem;
    margin-bottom: 0;
}
.ma-filters button[type="submit"] {
    font-size: 0.82rem;
    padding: 0.25rem 1.2rem;
    height: 2.2rem;
    margin-bottom: 0;
    width: auto;
}
.ma-filter-btn {
    visibility: visible;
}
.ma-filter-btn > span,
.ma-filter-btn::first-line {
    font-size: 0.78rem;
}

/* ── KPI Summary Cards (analytics) ─────────────────────────────────────── */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 0.75rem 1rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.kpi-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}
.kpi-card--blue::before { background: var(--accent); }
.kpi-card--green::before { background: var(--green); }
.kpi-card--amber::before { background: var(--amber); }
.kpi-card--purple::before { background: var(--purple); }
.kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 0.25rem;
}
.kpi-value--blue { color: var(--accent-text); }
.kpi-value--green { color: var(--green-text); }
.kpi-value--amber { color: var(--amber-text); }
.kpi-value--purple { color: var(--purple-text); }
.kpi-label {
    font-size: 0.72em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

/* ── Empty State ───────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.4;
}
.empty-state p {
    font-size: 0.88em;
    max-width: 360px;
    margin: 0 auto 0.75rem;
    line-height: 1.6;
}

/* ── Login Page ────────────────────────────────────────────────────────── */
.login-container {
    max-width: 400px;
    margin: 6rem auto 2rem;
    animation: fade-up 0.5s ease-out both;
}
.login-card {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 4px 24px rgba(0,0,0,0.4);
    position: relative;
    overflow: hidden;
}
.login-card::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent), var(--purple), transparent);
}
.login-logo {
    display: block;
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-lg);
}
.login-title {
    text-align: center;
    margin-bottom: 0.25rem;
}
.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
    font-size: 0.88em;
}

/* ── Config section groups ─────────────────────────────────────────────── */
.config-section {
    margin-bottom: 0.5rem;
}
.config-section summary {
    font-weight: 700;
}

/* ── Profile compact ───────────────────────────────────────────────────── */
.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .profile-grid {
        grid-template-columns: 1fr;
    }
}
.profile-card article {
    padding: 0.75rem 1rem;
    margin-bottom: 0;
}

/* ── Utility Classes ───────────────────────────────────────────────────── */
.grid-2col-equal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .grid-2col-equal {
        grid-template-columns: 1fr;
    }
}
.input-xs {
    width: 10ch;
    height: 2rem;
    display: inline-block;
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
}
.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.5rem;
}
.mb-md {
    margin-bottom: 1rem;
}

/* ── Add User form grid ────────────────────────────────────────────────── */
.add-user-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}
@media (max-width: 768px) {
    .add-user-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================================================
   Micro-Details — Selection, Scrollbar, Sidebar Hover
   ============================================================================ */

/* Text selection */
::selection {
    background: rgba(59, 130, 246, 0.35);
    color: #fff;
}

/* Sidebar scrollbar: visible only on hover */
.sidebar-nav {
    scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar {
    width: 0;
}
.sidebar-nav:hover {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-active) transparent;
}
.sidebar-nav:hover::-webkit-scrollbar {
    width: 6px;
}

/* Scrollbar thumb refinement */
::-webkit-scrollbar-thumb {
    background: var(--surface-active);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================================================
   Phase 2 & 3 — Column Toggle, Detail Panel, Drag Calendar, Inline Create
   ============================================================================ */

/* ── Column Toggle Dropdown ─────────────────────────────────────────────── */
.cms-col-toggle {
    position: relative;
    display: inline-block;
}
.cms-col-toggle > summary {
    list-style: none;
    cursor: pointer;
    height: 2.2rem;
    padding: 0 0.75rem;
    font-size: 0.82rem;
    line-height: 2.2rem;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
}
.cms-col-toggle > summary:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}
.cms-col-toggle > summary::-webkit-details-marker { display: none; }
.cms-col-toggle[open] > summary {
    border-color: var(--accent);
    color: var(--accent-text);
}
.cms-col-toggle-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 50;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 0.4rem 0;
    min-width: 170px;
}
.cms-col-toggle-menu label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    font-size: 0.82em;
    cursor: pointer;
    transition: background var(--transition);
    margin: 0;
}
.cms-col-toggle-menu label:hover {
    background: var(--surface-hover);
}
.cms-col-toggle-menu label input[type="checkbox"] {
    margin: 0;
}

/* ── Detail Panel (Slide-Out) ───────────────────────────────────────────── */
#detail-panel {
    position: fixed;
    top: 0;
    right: -500px;
    width: 480px;
    max-width: 90vw;
    height: 100vh;
    background: var(--surface-1);
    border-left: 1px solid var(--border);
    box-shadow: -4px 0 24px rgba(0,0,0,0.5);
    z-index: 200;
    overflow-y: auto;
    transition: right 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}
#detail-panel.open {
    right: 0;
}
#detail-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
    transition: opacity 0.25s ease;
}
#detail-panel-backdrop.open {
    display: block;
}
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.panel-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0.15rem 0.4rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    line-height: 1;
}
.panel-close:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}
.panel-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
}
.panel-body label {
    font-size: 0.88em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}
.panel-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    flex-shrink: 0;
}
/* Panel form — slightly compact */
#detail-panel input:not([type="checkbox"]):not([type="radio"]),
#detail-panel select {
    height: 2.2rem;
    font-size: 0.85rem;
}
#detail-panel label {
    margin-bottom: 0.5rem;
}

/* ── Inline Create Row ──────────────────────────────────────────────────── */
.inline-create-row td {
    background: var(--accent-soft);
    border-bottom: 2px solid var(--accent);
}
.inline-create-row input,
.inline-create-row select {
    height: 2rem;
    font-size: 0.85em;
    padding: 0.25rem 0.4rem;
    margin: 0;
}

/* Compact form elements inside table cells */
td select,
td input:not([type="checkbox"]):not([type="radio"]) {
    height: 2rem;
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
    margin: 0;
}

/* ── Drag-to-Reschedule Calendar ────────────────────────────────────────── */
.calendar-chip[draggable="true"] {
    cursor: grab;
}
.calendar-chip[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.6;
}
.calendar-day.drag-over {
    outline: 2px dashed var(--accent);
    outline-offset: -2px;
    background: var(--accent-soft);
}
.calendar-chip.dragging {
    opacity: 0.4;
}

/* ── CSV Export Button ──────────────────────────────────────────────────── */
.btn-export {
    padding: 0.25em 0.6em;
    font-size: 0.8em;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text-secondary);
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.3em;
}
.btn-export:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
}

/* ── SVG Icon System ──────────────────────────────────────────────────────── */
.icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}
/* Sidebar nav icons: match the old emoji sizing */
.sidebar-nav-icon .icon {
    width: 16px;
    height: 16px;
}
/* Header icons in news digest pages */
.nd-header-icon .icon {
    width: 18px;
    height: 18px;
}
/* Empty state icons: larger decorative */
.empty-state-icon .icon,
.nd-empty-icon .icon {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

/* ── Flash Message Close Button ───────────────────────────────────────────── */
.flash-message {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.flash-close {
    all: unset;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    font-size: 1.1em;
    line-height: 1;
    padding: 0.15rem 0.3rem;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    transition: opacity var(--transition);
}
.flash-close:hover {
    opacity: 1;
}

/* ── Page Transitions (JS-driven, all browsers) ──────────────────────────── */
@keyframes pageEnter {
    from { opacity: 0; }
    to   { opacity: 1; }
}
#page-content {
    animation: pageEnter 150ms ease-out;
    transition: opacity 120ms ease-in;
}
#page-content.page-exiting {
    opacity: 0;
}

/* ── What's New Banner ────────────────────────────────────────────────────── */
.whats-new-banner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0.75rem 1rem; margin-bottom: 1rem;
    background: var(--surface-1); border: 1px solid var(--accent);
    border-radius: var(--radius-lg); gap: 1rem;
}
.whats-new-content { display: flex; flex-direction: column; gap: 0.25rem; }
.whats-new-summary { font-size: 0.85rem; color: var(--text-secondary); }
.whats-new-actions { display: flex; align-items: center; gap: 0.75rem; white-space: nowrap; }
.whats-new-link { font-size: 0.85rem; }
.whats-new-dismiss {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.2rem; cursor: pointer; padding: 0 0.25rem; line-height: 1;
}
.whats-new-dismiss:hover { color: var(--text-primary); }
.dashboard-notify-banner { border-color: var(--green-muted, var(--accent)); align-items: flex-start; }
.dashboard-notify-banner .whats-new-actions { padding-top: 0.15rem; }
.dashboard-promo-banner { border-color: var(--amber-muted, var(--accent)); background: var(--surface-2, var(--surface-1)); }

/* ── Changelog ────────────────────────────────────────────────────────────── */
.changelog h4 {
    text-align: center;
    margin: 1.25rem 0 0.5rem;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    color: var(--text-secondary);
}
.changelog ul {
    padding-left: 2rem;
    margin: 0.25rem 0 1rem;
}
.changelog li {
    margin-bottom: 0.2rem;
}
.changelog details > :nth-child(2) {
    padding-top: 0.5rem;
}

/* ── Reduced Motion ───────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    #page-content.page-exiting { opacity: 1; }
}
