/* RNA Project Tracker — shared stylesheet
   Clean, card-based aesthetic in the style of the other RNA tools.
   Swap the color variables below to match exact brand colors later. */

:root {
    --color-bg: #f5f5f7;
    --color-surface: #ffffff;
    --color-border: #e2e2e6;
    --color-text: #1d1d1f;
    --color-text-muted: #6e6e73;
    --color-accent: #0071e3;
    --color-accent-hover: #0058b0;
    --color-success: #1a8a4a;
    --color-warning: #b7791f;
    --color-danger: #c0342c;
    --stage1: #0071e3;
    --stage2: #7c5cff;
    --stage3: #e0891e;
    --stage4: #1a8a4a;
    --admin-color: #5b6472;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.06);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .06), 0 8px 24px rgba(0, 0, 0, .10);
    /* Same typeface as the Cross-Reference tool and Badge Scanner (Inter, loaded from Google
       Fonts in header.php) — falls back to the system font if it's ever slow/unavailable. */
    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Tinted pill/alert backgrounds — kept as variables (rather than hardcoded hex on each
       .status-* rule) so dark mode can flip every pill, badge, and alert in one place below. */
    --tint-blue: #eef4ff;
    --tint-amber: #fff6e6;
    --tint-green: #eaf7ee;
    --tint-red: #fdecea;
    --tint-gray: #f2f2f4;

    --input-bg: #fbfbfd;
    --progress-track-bg: #eceef1;
    --gantt-grid: #ececef;
    --row-hover-bg: #fafafa;
    --focus-ring: rgba(0, 113, 227, 0.15);
    --star-empty: #d7d7db;
    --star-filled: #f0a93a;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: var(--font);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

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

/* Top nav — wraps onto extra lines instead of overflowing sideways once it no longer fits
   on one row (a narrow phone, or a tablet with a long project category selected). */
.navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 20px;
    padding: 14px 28px;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
}
.navbar .brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 17px;
    color: var(--color-text);
    text-decoration: none;
}
.brand-logo { height: 22px; width: auto; display: block; }
.navbar-right { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 10px 20px; }
.navbar nav { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; }
.navbar nav a { color: var(--color-text-muted); font-size: 14px; font-weight: 500; }
.navbar nav a:hover { color: var(--color-text); text-decoration: none; }
.navbar .user-chip {
    font-size: 13px;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 10px;
}
.role-badge {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--tint-blue);
    color: var(--color-accent);
}
/* Admin gets its own color (matching the Cross-Reference tool and Badge Scanner's admin/
   employee badge convention) so it stands out from the other four roles at a glance. */
.role-badge-admin { background: var(--tint-red); color: var(--color-danger); }

/* Light/dark theme toggle button, always shown at the right of the nav — even when signed out. */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: background .15s ease, color .15s ease;
}
.theme-toggle:hover { background: var(--tint-gray); color: var(--color-text); text-decoration: none; }
.theme-toggle svg { width: 16px; height: 16px; }

/* Per-page accent: retints links, buttons, and focus states to match a stage's color */
.accent-stage1 { --color-accent: var(--stage1); --color-accent-hover: #0058b0; }
.accent-stage2 { --color-accent: var(--stage2); --color-accent-hover: #6142e0; }
.accent-stage3 { --color-accent: var(--stage3); --color-accent-hover: #b96b15; }
.accent-stage4 { --color-accent: var(--stage4); --color-accent-hover: #146b39; }
.accent-admin  { --color-accent: var(--admin-color); --color-accent-hover: #454c57; }

/* Nav icons: always shown in their own stage color, regardless of the current page's accent */
.navbar nav a { display: inline-flex; align-items: center; gap: 6px; }
.nav-icon { display: inline-flex; }
.nav-icon svg { width: 15px; height: 15px; }

/* Stage badge: colored icon shown beside a page's H1 */
.page-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.page-title-row h1 { margin: 0; }
.stage-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    color: #fff;
    flex-shrink: 0;
}
.stage-badge svg { width: 20px; height: 20px; }

/* Layout */
.page {
    flex: 1 0 auto;
    width: 100%;
    max-width: 960px;
    margin: 0 auto;
    padding: 36px 24px 64px;
}
.page-narrow { max-width: 440px; }

/* Site footer — pinned to the bottom of the viewport on short pages via the body's flex
   column above, but simply follows the content on taller pages rather than overlapping it. */
.site-footer {
    flex-shrink: 0;
    padding: 20px 24px;
    text-align: center;
    border-top: 1px solid var(--color-border);
}
.site-footer p {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}
.site-footer a { color: var(--color-text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--color-text); }

.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 28px 32px;
    margin-bottom: 20px;
}

h1 { font-size: 24px; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 18px; font-weight: 600; margin: 0 0 14px; }
p.subtitle { color: var(--color-text-muted); margin: 0 0 24px; font-size: 14px; }

/* Forms */
label { display: block; font-size: 13px; font-weight: 500; margin: 16px 0 6px; color: var(--color-text); }
label:first-of-type { margin-top: 0; }
input[type="text"], input[type="email"], input[type="password"], select, textarea {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--font);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--input-bg);
    color: var(--color-text);
}
textarea { resize: vertical; }
input:disabled, select:disabled, textarea:disabled {
    background: var(--tint-gray);
    color: var(--color-text-muted);
    cursor: not-allowed;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.btn {
    display: inline-block;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--color-accent);
    color: #fff;
    text-align: center;
}
.btn:hover { background: var(--color-accent-hover); text-decoration: none; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }
.btn-secondary:hover { background: var(--tint-gray); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: #9c2a23; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-stage4 { background: var(--stage4); }
.btn-stage4:hover { background: #146b39; }

/* "Ready to advance" callout — shown on a Stage 3 project once every task is done, so the
   next step (moving to Stage 4) reads as the obvious, clickable action rather than a quiet
   secondary link. */
.ready-callout {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    background: var(--tint-green);
    border: 1px solid var(--stage4);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.ready-callout-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--stage4);
    color: #fff;
    flex-shrink: 0;
}
.ready-callout-icon svg { width: 19px; height: 19px; }
.ready-callout-text { flex: 1; min-width: 180px; }
.ready-callout-text strong { display: block; font-size: 14px; color: var(--color-text); }
.ready-callout-text span { font-size: 13px; color: var(--color-text-muted); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; margin-bottom: 18px; }
.alert-error { background: var(--tint-red); color: var(--color-danger); }
.alert-success { background: var(--tint-green); color: var(--color-success); }

/* Tables */
/* Wrap a wide table (more columns than the card comfortably fits) in this so it scrolls
   horizontally inside its own card instead of pushing the whole page layout sideways. */
.table-scroll { overflow-x: auto; }
/* Only needed once a table is actually too wide to fit its card — i.e. on a narrow screen —
   so this stays hidden on desktop and only appears there. */
.table-scroll-hint { display: none; }
@media (max-width: 640px) {
    .table-scroll-hint { display: block; font-size: 12px; color: var(--color-text-muted); margin: 8px 0 0; }
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--color-border); }
th { color: var(--color-text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }

/* A <select> with no explicit width shrinks to an unreadably narrow box inside a table cell
   (the browser's auto table-layout sizes the column from the select's own tiny intrinsic
   width before the 100%-width rule above has anything to fill) — this floors it to a width
   that comfortably fits the longest role label ("Marketing Head"). */
.role-select { min-width: 170px; }

.status-pill {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.status-active { background: var(--tint-green); color: var(--color-success); }
.status-inactive { background: var(--tint-gray); color: var(--color-text-muted); }

.form-inline { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.text-muted { color: var(--color-text-muted); font-size: 13px; }
.text-danger { color: var(--color-danger); }
.mt-24 { margin-top: 24px; }

.status-overdue { background: var(--tint-red); color: var(--color-danger); }

/* Idea board */
.idea-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.idea-card { display: block; color: inherit; }
.idea-card:hover { text-decoration: none; }
.idea-card .card { margin-bottom: 0; height: 100%; cursor: pointer; transition: box-shadow .15s ease; border-left: 4px solid var(--color-accent); }
.idea-card:hover .card { box-shadow: var(--shadow-hover); }
.idea-card h2 { font-size: 16px; margin-bottom: 8px; }
.idea-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 14px; }

.status-submitted { background: var(--tint-blue); color: var(--color-accent); }
.status-under_review { background: var(--tint-amber); color: var(--color-warning); }
.status-approved { background: var(--tint-green); color: var(--color-success); }
.status-rejected { background: var(--tint-red); color: var(--color-danger); }
.status-on_hold { background: var(--tint-gray); color: var(--color-text-muted); }

/* Star rating */
.stars { display: inline-flex; gap: 2px; }
.stars .star { font-size: 18px; color: var(--star-empty); }
.stars .star.filled { color: var(--star-filled); }
.rate-form { display: inline-flex; gap: 2px; }
.rate-form button {
    background: none; border: none; padding: 0; cursor: pointer;
    font-size: 22px; color: var(--star-empty); line-height: 1;
}
.rate-form button.filled { color: var(--star-filled); }
.rate-form button:hover { color: #d98c1f; }

/* Notes thread */
.note { padding: 14px 0; border-bottom: 1px solid var(--color-border); }
.note:last-child { border-bottom: none; }
.note-meta { font-size: 12px; color: var(--color-text-muted); margin-bottom: 4px; }
.note-body { font-size: 14px; white-space: pre-wrap; }

.detail-field { margin-bottom: 18px; }
.detail-field .label { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--color-text-muted); margin-bottom: 4px; }
.detail-field .value { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; }
.link-list { list-style: none; padding: 0; margin: 0; }
.link-list li { margin-bottom: 4px; font-size: 14px; }
.link-list li a { overflow-wrap: anywhere; word-break: break-word; }

/* Health flag pills (Stage 3) */
.status-on_track { background: var(--tint-green); color: var(--color-success); }
.status-at_risk { background: var(--tint-amber); color: var(--color-warning); }
.status-delayed { background: var(--tint-red); color: var(--color-danger); }

/* Task status pills (Stage 3) */
.status-not_started { background: var(--tint-gray); color: var(--color-text-muted); }
.status-in_progress { background: var(--tint-blue); color: var(--stage1); }
.status-blocked { background: var(--tint-red); color: var(--color-danger); }
.status-done { background: var(--tint-green); color: var(--color-success); }

/* Progress bar */
.progress-track { background: var(--progress-track-bg); border-radius: 999px; height: 8px; overflow: hidden; width: 100%; }
.progress-fill { background: var(--color-accent); height: 100%; border-radius: 999px; transition: width .2s ease; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .progress-track { flex: 1; }

.milestone-flag { color: var(--stage3); display: inline-flex; vertical-align: -2px; margin-right: 4px; }
.milestone-flag svg { width: 14px; height: 14px; }

/* Activity feed */
.activity-item { font-size: 13px; color: var(--color-text-muted); padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.activity-item:last-child { border-bottom: none; }
.activity-item strong { color: var(--color-text); font-weight: 500; }

/* Gantt view: a scrollable table with the task/owner/status columns frozen on the left
   (via position: sticky) and a colored timeline bar per row scrolling on the right. */
.gantt-export-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.gantt-scroll { overflow-x: auto; border: 1px solid var(--color-border); border-radius: var(--radius); }
.gantt-table { width: max-content; border-collapse: collapse; font-size: 13px; }
.gantt-table th, .gantt-table td { white-space: nowrap; padding: 8px 12px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.gantt-table th { color: var(--color-text-muted); font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; text-align: left; }
.gantt-sticky { position: sticky; background: var(--color-surface); z-index: 2; }
.gantt-table tbody tr:hover .gantt-sticky { background: var(--row-hover-bg); }
.gantt-ruler-cell { padding: 0 !important; border-bottom: 1px solid var(--color-border); }
.gantt-ruler { position: relative; height: 30px; min-width: 100%; }
.gantt-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--color-border); font-size: 11px; color: var(--color-text-muted); padding: 6px 0 0 5px; }
.gantt-tick.gantt-today { border-left-color: var(--color-danger); color: var(--color-danger); font-weight: 600; }
.gantt-track { position: relative; height: 36px; background-image: repeating-linear-gradient(to right, var(--gantt-grid) 0, var(--gantt-grid) 1px, transparent 1px var(--tick-px, 60px)); }
.gantt-bar { position: absolute; top: 8px; height: 18px; border-radius: 4px; min-width: 6px; }
.gantt-bar.gantt-overdue { box-shadow: 0 0 0 2px var(--color-danger); }
.gantt-today-line { position: absolute; top: 0; bottom: 0; border-left: 2px dashed var(--color-danger); }
.gantt-empty-track { color: var(--color-text-muted); font-size: 12px; padding-left: 4px; }

/* Cross-stage active-projects list: a colorful, full-row-clickable card per project, used on
   the dashboard and the full active-projects page. Color always reflects the project's current
   stage, so the same project visually "moves" through blue -> violet -> amber -> green as it
   advances, matching the stage colors used everywhere else in the app. */
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--row-accent, var(--color-accent));
    border-radius: 10px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease;
}
.project-row:hover { box-shadow: var(--shadow); text-decoration: none; }
.project-row-icon { flex: 0 0 auto; display: inline-flex; margin-top: 2px; }
.project-row-icon svg { width: 16px; height: 16px; }
.project-row-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.project-row-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.project-row-title { font-weight: 600; color: var(--color-text); }
.project-row-meta { font-size: 12px; }

/* Dashboard hero: the "Active projects" list is the main attraction on the dashboard, so it
   gets a bigger heading (h1, via page-title-row + stage_badge like an inner page's own title),
   more breathing room, and a permanently "raised" shadow — everything below it (the per-stage
   tiles) is deliberately smaller and flatter to read as secondary. */
.active-projects-hero { padding: 32px 36px; box-shadow: var(--shadow-hover); }
.active-projects-hero .page-title-row { align-items: center; }

/* Small muted caption introducing the secondary tile grid below the hero, signaling it's a
   lower-priority set of shortcuts rather than a second "main" section. */
.section-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    margin: 0 0 10px;
}

/* Compact per-stage shortcut tiles — deliberately smaller and quieter than .card / .project-row
   (less padding, smaller type, no buttons) so they read as secondary next to the active-projects
   hero above. */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
.stat-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--color-border);
    border-left: 3px solid var(--tile-accent, var(--color-border));
    border-radius: 10px;
    background: var(--color-surface);
    color: inherit;
    text-decoration: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}
.stat-tile:hover { box-shadow: var(--shadow); text-decoration: none; }
.stat-tile-icon { flex: 0 0 auto; display: inline-flex; }
.stat-tile-icon svg { width: 18px; height: 18px; }
.stat-tile-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat-tile-title { font-size: 13px; font-weight: 600; color: var(--color-text); }
.stat-tile-meta { font-size: 12px; }

/* Navbar pill showing the currently-selected project category (Digital Tools / Trade Shows &
   Events / General Marketing Projects) — a link back to select_group.php so switching is
   always one click away from anywhere in the app. */
.group-switcher {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    white-space: nowrap;
    gap: 6px;
    padding: 5px 12px 5px 9px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--group-color, var(--color-accent));
    font-size: 13px;
    font-weight: 600;
    transition: background .15s ease;
}
.group-switcher:hover { background: var(--tint-gray); text-decoration: none; }
.group-switcher svg { width: 14px; height: 14px; flex-shrink: 0; }

/* Category chooser screen (select_group.php) — three big, clickable cards shown right after
   login (and reachable anytime via the navbar pill above) so the user's choice of Digital
   Tools / Trade Shows & Events / General Marketing Projects is the obvious first decision,
   not a buried setting. */
.group-chooser { max-width: 880px; margin: 0 auto; padding: 24px 0 8px; text-align: center; }
.group-chooser h1 { margin-bottom: 4px; }
.group-chooser .subtitle { margin: 0 auto; max-width: 520px; }
.group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 20px;
    margin-top: 36px;
    text-align: left;
}
.group-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s ease, transform .15s ease;
}
.group-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.group-card-current { border-color: var(--group-color); }
.group-card-icon {
    width: 52px;
    height: 52px;
    flex-shrink: 0;
    border-radius: 14px;
    background: var(--group-color);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.group-card-icon svg { width: 26px; height: 26px; }
.group-card h2 { margin: 4px 0 0; font-size: 18px; }
.group-card p { margin: 0; color: var(--color-text-muted); font-size: 14px; flex: 1 1 auto; }
.group-card .btn { align-self: flex-start; margin-top: 4px; }

/* Two-factor authentication: QR box, manual-entry key, code input, and the backup-codes grid
   shown once at enrollment (mfa_setup.php) and again whenever codes are regenerated
   (account.php). The QR itself is always rendered black-on-white by the vendored
   qrcode-generator library regardless of the app's theme — it has to stay high-contrast to
   scan reliably — so this box pins a white card around it even in dark mode. */
.qr-box {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 193px;
    height: 193px;
    margin: 14px auto 0;
    padding: 10px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
}
.qr-box svg { display: block; width: 100%; height: 100%; }
.mfa-steps { margin: 20px 0 0; padding-left: 20px; }
.mfa-steps li { margin-bottom: 8px; }
.mfa-steps li + li { margin-top: 24px; }
.manual-key {
    display: inline-block;
    margin-top: 4px;
    padding: 6px 10px;
    background: var(--input-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 13px;
    letter-spacing: 0.03em;
    word-break: break-all;
}
.mfa-code-input {
    width: 100%;
    font-size: 22px;
    letter-spacing: 0.3em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 16px;
}
.backup-codes-grid code {
    display: block;
    padding: 10px;
    text-align: center;
    background: var(--input-bg);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    font-size: 14px;
    letter-spacing: 0.02em;
}

/* Dark mode — set by clicking the sun/moon button in the top nav (includes/theme.php flips a
   cookie and reloads the current page; the server renders the right theme immediately, so
   there's no flash of the wrong theme and no client-side JS involved).
   Every color above is a variable, so this block is the whole theme: it re-points the same
   variables to darker values rather than duplicating every rule. Stage/status colors are
   brightened a little so they still read clearly against a dark background, and the tint
   backgrounds behind pills/alerts become soft translucent versions of their own color instead
   of pale pastels. */
body.theme-dark {
    color-scheme: dark;

    --color-bg: #161618;
    --color-surface: #232326;
    --color-border: #3a3a3e;
    --color-text: #f2f2f4;
    --color-text-muted: #9a9aa1;
    --color-accent: #3d9bff;
    --color-accent-hover: #63aeff;
    --color-success: #34c274;
    --color-warning: #e0a94a;
    --color-danger: #ec6459;
    --stage1: #3d9bff;
    --stage2: #a48bff;
    --stage3: #f0a445;
    --stage4: #34c274;
    --admin-color: #9aa2ad;

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, .35), 0 8px 24px rgba(0, 0, 0, .5);

    --tint-blue: rgba(61, 155, 255, 0.16);
    --tint-amber: rgba(240, 164, 69, 0.16);
    --tint-green: rgba(52, 194, 116, 0.16);
    --tint-red: rgba(236, 100, 89, 0.18);
    --tint-gray: rgba(255, 255, 255, 0.08);

    --input-bg: #1b1b1d;
    --progress-track-bg: #3a3a3e;
    --gantt-grid: rgba(255, 255, 255, 0.08);
    --row-hover-bg: rgba(255, 255, 255, 0.04);
    --focus-ring: rgba(61, 155, 255, 0.35);
    --star-empty: #48484c;
    --star-filled: #f0c15a;
}
body.theme-dark .accent-stage1 { --color-accent-hover: #63aeff; }
body.theme-dark .accent-stage2 { --color-accent-hover: #b6a1ff; }
body.theme-dark .accent-stage3 { --color-accent-hover: #f5bd75; }
body.theme-dark .accent-stage4 { --color-accent-hover: #4fd68d; }
body.theme-dark .accent-admin  { --color-accent-hover: #b0b7c0; }
body.theme-dark .stage-badge { color: #12141a; }
/* Dark near-black button text reads better than white against these brightened accent
   colors (checked against WCAG contrast: ~6:1 and ~5.9:1 vs. ~2.9:1 and ~3.2:1 for white). */
body.theme-dark .btn { color: #12141a; }
body.theme-dark .btn-secondary { color: var(--color-text); }
body.theme-dark .btn-stage4:hover { background: #4fd68d; }
body.theme-dark .ready-callout-icon { color: #12141a; }
