/* ============================================================
   STYLES — the in-house template (Analytics/template.html):
   navy sidebar, Inter, Material Icons Round, photo background,
   view cards, badges, modal, toast, dark mode — at the template's own
   sizes (14px base text, 260px sidebar, 60px topbar).
   ============================================================ */
:root {
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: rgba(59,130,246,0.16);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #f1f5f9;
  --sidebar-accent: #3b82f6;
  --sidebar-border: #1e293b;
  --surface: #ffffff;
  --surface-raised: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --border-light: #f1f5f9;
  --text-1: #0f172a;
  --text-2: #475569;
  --text-3: #94a3b8;
  --accent: #3b82f6;
  --accent-btn: #2563eb;
  --accent-btn-hover: #1d4ed8;
  --accent-text: #1d4ed8;
  --accent-subtle: #dbeafe;
  --success: #059669; --success-text: #059669; --success-subtle: #d1fae5; --success-line: #a7f3d0;
  --warning: #d97706; --warning-text: #d97706; --warning-subtle: #fef3c7; --warning-line: #fcd34d;
  --danger: #dc2626;  --danger-text: #dc2626;  --danger-subtle: #fee2e2;  --danger-line: #fca5a5;
  --info: #0284c7;    --info-text: #0284c7;    --info-subtle: #e0f2fe;    --info-line: #7dd3fc;
  --neutral-text: #64748b; --neutral-subtle: #f1f5f9; --neutral-line: #cbd5e1;
  --hover: rgba(59,130,246,0.06);
  --focus: #f59e0b;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-lg: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --transition: 0.2s ease;
  --bg-image: url('https://assets-global.website-files.com/6197be3af1589ce7e5f8a2e9/654e718a5861870bea74570e_4%20med%20staffing.jpg');
  --bg-overlay: linear-gradient(135deg, rgba(241,245,249,0.9) 0%, rgba(226,232,240,0.9) 100%);
  --gb-ok-fill: #2563eb;   --gb-ok-rest: #bfdbfe;
  --gb-warn-fill: #d97706; --gb-warn-rest: #fde68a;
  --gb-bad-fill: #dc2626;  --gb-bad-rest: #fecaca;
  --gb-idle-fill: #94a3b8; --gb-idle-rest: #e2e8f0;
  --gb-done-fill: #059669; --gb-done-rest: #a7f3d0;
  --gantt-baseline: #94a3b8; --gantt-weekend: rgba(148,163,184,0.1); --gantt-hover-solid: #f4f7fe;
  --phase-bg: #f5f3ff; --phase-text: #5b21b6; --phase-line: #c4b5fd;
}
body.dark-mode {
  --bg-overlay: linear-gradient(135deg, rgba(15,23,42,0.93) 0%, rgba(30,41,59,0.93) 100%);
  --surface: #1e293b;
  --surface-raised: #273449;
  --border: #334155;
  --border-strong: #475569;
  --border-light: #2b3a50;
  --text-1: #f1f5f9;
  --text-2: #cbd5e1;
  --text-3: #64748b;
  --accent-text: #93c5fd;
  --accent-subtle: #1e3a5f;
  --success-text: #6ee7b7; --success-subtle: #064e3b; --success-line: #047857;
  --warning-text: #fcd34d; --warning-subtle: #451a03; --warning-line: #92400e;
  --danger-text: #fca5a5;  --danger-subtle: #450a0a;  --danger-line: #b91c1c;
  --info-text: #7dd3fc;    --info-subtle: #0c4a6e;    --info-line: #0369a1;
  --neutral-text: #cbd5e1; --neutral-subtle: #334155; --neutral-line: #475569;
  --hover: rgba(59,130,246,0.1);
  --gb-ok-fill: #3b82f6;   --gb-ok-rest: #1e3a5f;
  --gb-warn-fill: #f59e0b; --gb-warn-rest: #4a3410;
  --gb-bad-fill: #ef4444;  --gb-bad-rest: #4c1d1d;
  --gb-idle-fill: #64748b; --gb-idle-rest: #334155;
  --gb-done-fill: #10b981; --gb-done-rest: #064e3b;
  --gantt-baseline: #64748b; --gantt-weekend: rgba(148,163,184,0.06); --gantt-hover-solid: #22324a;
  --phase-bg: #2e1065; --phase-text: #ddd6fe; --phase-line: #6d28d9;
  color: var(--text-1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
html { font-size: 14px; -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem; line-height: 1.55; color: var(--text-1);
  background: var(--bg-overlay), var(--bg-image);
  background-size: cover; background-position: center; background-attachment: fixed;
  min-height: 100vh; overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: 1rem; color: var(--text-1); }
a { color: var(--accent-text); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.hidden { display: none !important; }
.icon.material-icons-round { font-size: 1.3em; line-height: 1; vertical-align: -0.25em; flex-shrink: 0; width: 1em; overflow: hidden; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 0; font-weight: 700; }
h3 { font-size: 1.1rem; margin: 0; }
p { margin: 0 0 .75rem; }

/* ============================================================
   SIDEBAR (template)
   ============================================================ */
.sidebar { position: fixed; top: 0; left: 0; width: var(--sidebar-w); height: 100vh; background: var(--sidebar-bg); display: flex; flex-direction: column; z-index: 900; transition: transform 0.25s ease; overflow: hidden; }
.sidebar-brand { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--sidebar-border); display: flex; align-items: center; gap: 0.65rem; min-height: 4.25rem; }
.sidebar-brand img { height: 2.6rem; width: auto; object-fit: contain; filter: brightness(0) invert(1); flex-shrink: 0; }
.sidebar-brand-text { font-size: 1.2rem; font-weight: 700; color: #fff; letter-spacing: 0.04em; line-height: 1.1; }
.sidebar-brand-text small { display: block; font-size: .7rem; font-weight: 600; letter-spacing: .08em; color: var(--sidebar-text); margin-top: .2rem; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 0.9rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }
.sidebar-cta { padding: 0 .75rem .5rem; }
.sidebar-cta .btn { width: 100%; }
.nav-section { padding: 1rem 1.5rem 0.4rem; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--sidebar-text); opacity: 0.75; user-select: none; }
.nav-item { display: flex; align-items: center; gap: 0.8rem; width: calc(100% - 1rem); padding: 0.75rem 1.1rem; margin: 2px 0.5rem; border-radius: 6px; color: var(--sidebar-text); font-size: 1rem; font-weight: 500; cursor: pointer; transition: background var(--transition), color var(--transition); text-decoration: none; border: none; border-left: 3px solid transparent; background: none; text-align: left; user-select: none; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-text-active); border-left-color: var(--sidebar-accent); font-weight: 600; }
.nav-item .material-icons-round { font-size: 1.35rem; opacity: 0.85; }
.nav-item.active .material-icons-round { opacity: 1; color: var(--sidebar-accent); }
.nav-item .count { margin-left: auto; }
.nav-divider { height: 1px; background: var(--sidebar-border); margin: 0.6rem 1.25rem; }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--sidebar-border); }
.sidebar-user { display: flex; align-items: center; gap: 0.75rem; }
.user-avatar { width: 2.4rem; height: 2.4rem; border-radius: 8px; background: var(--sidebar-accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .95rem; flex-shrink: 0; }
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-name { color: var(--sidebar-text-active); font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { color: var(--sidebar-text); font-size: .82rem; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 899; }
.sidebar-overlay.active { display: block; }

/* ============================================================
   MAIN & TOPBAR (template)
   ============================================================ */
.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 100; height: var(--topbar-h); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 1.5rem; gap: 1rem; backdrop-filter: blur(8px); background: rgba(255,255,255,0.94); }
.dark-mode .topbar { background: rgba(30,41,59,0.95); }
.topbar-left { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.topbar-title { font-size: 1.2rem; font-weight: 700; color: var(--text-1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.sidebar-toggle { display: none; background: none; border: none; padding: 0.4rem; border-radius: 6px; cursor: pointer; color: var(--text-2); }
.sidebar-toggle:hover { background: var(--surface-raised); }
.topbar-right { display: flex; align-items: center; gap: 0.6rem; }
.topbar-search { display: flex; align-items: center; gap: 0.5rem; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.35rem 0.75rem; transition: border-color var(--transition), box-shadow var(--transition); }
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.topbar-search .material-icons-round { font-size: 1.25rem; color: var(--text-3); }
.topbar-search input[type="text"] { border: none; box-shadow: none; background: transparent; outline: none; font-size: .95rem; color: var(--text-1); width: 12rem; min-height: 0; padding: .2rem 0; }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-actions { display: flex; align-items: center; gap: 0.25rem; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-width: 2.5rem; height: 2.5rem; padding: 0 .55rem; border-radius: var(--radius); cursor: pointer; transition: background var(--transition); color: var(--text-2); background: none; border: none; font-weight: 600; font-size: .95rem; }
.icon-button:hover { background: var(--surface-raised); color: var(--text-1); }
.icon-button.active { background: var(--accent-subtle); color: var(--accent-text); }
.icon-button .material-icons-round { font-size: 1.35rem; }
.save-status { font-weight: 600; font-size: .9rem; display: flex; align-items: center; gap: .35rem; white-space: nowrap; }
.save-status.saving { color: var(--info-text); }
.save-status.saved { color: var(--success-text); }
.save-status.error { color: var(--danger-text); }
#main { padding: 1.5rem 1.5rem 7rem; width: 100%; flex: 1; animation: viewFadeIn 0.2s ease; }
@keyframes viewFadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* ============================================================
   BUTTONS (template)
   ============================================================ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 2.75rem; padding: .5rem 1.2rem; border-radius: var(--radius); font-size: 1rem; font-weight: 600; cursor: pointer; border: 1px solid transparent; transition: all var(--transition); text-decoration: none; line-height: 1.2; white-space: nowrap; }
.btn .material-icons-round { font-size: 1.2em; }
.btn-primary { background: var(--accent-btn); color: #fff; border-color: var(--accent-btn); }
.btn-primary:hover { background: var(--accent-btn-hover); border-color: var(--accent-btn-hover); }
.btn-secondary { background: var(--surface-raised); color: var(--text-1); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-raised); color: var(--text-1); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-outline { background: var(--surface); color: var(--danger-text); border-color: var(--danger-line); }
.btn-danger-outline:hover { background: var(--danger-subtle); }
.btn-sm { min-height: 2.3rem; padding: .3rem .8rem; font-size: .92rem; }
.btn-lg { min-height: 3.2rem; padding: .6rem 1.6rem; font-size: 1.08rem; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.icon-only { padding: 0; width: 2.75rem; }
.btn-sm.icon-only { width: 2.3rem; }

/* ============================================================
   PAGE HEADER & VIEW CARDS (template .view-card)
   ============================================================ */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-sub { font-size: 1.08rem; color: var(--text-2); margin: .35rem 0 0; max-width: 48rem; }
.back-btn { margin-bottom: .75rem; margin-left: -.6rem; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem 1.75rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; padding-bottom: 1rem; border-bottom: 1px solid var(--border-light); }
.card-head h2 { display: flex; align-items: center; gap: .5rem; }
.card-head p { margin: .25rem 0 0; color: var(--text-2); }
.form-section-title { font-size: .85rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-2); margin: 0 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-light); }
.muted { color: var(--text-2); }
.small { font-size: .9rem; }
.empty { padding: 1.5rem; border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); text-align: center; font-size: 1.05rem; font-style: italic; }
.empty.ok { border-color: var(--success-line); color: var(--success-text); background: var(--success-subtle); font-style: normal; }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 1.7rem; height: 1.7rem; padding: 0 .5rem; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--neutral-subtle); color: var(--neutral-text); }
.count.warn { background: var(--warning-subtle); color: var(--warning-text); }
.count.bad { background: var(--danger); color: #fff; }
.nav-item .count { background: rgba(255,255,255,.12); color: #fff; }
.nav-item .count.warn { background: #f59e0b; color: #1f1300; }
.nav-item .count.bad { background: #ef4444; color: #fff; }

/* ============================================================
   BADGES (template chip system, larger) / progress / dots
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .7rem; border-radius: 999px; font-size: .88rem; font-weight: 600; white-space: nowrap; }
.badge .material-icons-round { font-size: 1.05em; }
.badge-ok, .badge-success { background: var(--success-subtle); color: var(--success-text); }
.badge-warn, .badge-warning { background: var(--warning-subtle); color: var(--warning-text); }
.badge-bad, .badge-danger { background: var(--danger-subtle); color: var(--danger-text); }
.badge-info { background: var(--info-subtle); color: var(--info-text); }
.badge-idle, .badge-neutral { background: var(--neutral-subtle); color: var(--neutral-text); }
.badge-accent { background: var(--accent-subtle); color: var(--accent-text); }
.progress { display: flex; align-items: center; gap: .6rem; min-width: 9rem; }
.progress-track { flex: 1; min-width: 4.5rem; height: .7rem; background: var(--border); border-radius: 999px; overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.progress-label { font-weight: 700; min-width: 3.2ch; text-align: right; }
.progress-note { font-size: .85rem; color: var(--text-2); }
.progress.big .progress-track { height: 1rem; }
.progress.big .progress-label { font-size: 1.3rem; }
.dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--success); } .dot-warn { background: var(--warning); } .dot-bad { background: var(--danger); } .dot-idle { background: #94a3b8; }
.due-bad { color: var(--danger-text); font-weight: 700; }
.due-warn { color: var(--warning-text); font-weight: 600; }

/* ============================================================
   CALLOUTS
   ============================================================ */
.callout { display: flex; gap: 1rem; align-items: center; padding: 1.1rem 1.35rem; border-radius: var(--radius-lg); border: 1px solid; border-left-width: 6px; margin-bottom: 1.25rem; flex-wrap: wrap; background: var(--surface); box-shadow: var(--shadow-sm); }
.callout .callout-icon { width: 2.6rem; height: 2.6rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.callout .callout-body { flex: 1; min-width: 14rem; }
.callout .callout-title { font-weight: 700; font-size: 1.12rem; }
.callout-ok { border-color: var(--success-line); border-left-color: var(--success); background: var(--success-subtle); }
.callout-ok .callout-icon { background: var(--success); }
.callout-warn { border-color: var(--warning-line); border-left-color: var(--warning); background: var(--warning-subtle); }
.callout-warn .callout-icon { background: var(--warning); }
.callout-bad { border-color: var(--danger-line); border-left-color: var(--danger); background: var(--danger-subtle); }
.callout-bad .callout-icon { background: var(--danger); }
.callout-info { border-color: var(--info-line); border-left-color: var(--accent); background: var(--accent-subtle); }
.callout-info .callout-icon { background: var(--accent); }
.callout ul { margin: .4rem 0 0 1.2rem; padding: 0; }
.callout-idle { border-color: var(--neutral-line); border-left-color: var(--neutral-text); background: var(--neutral-subtle); }
.callout-idle .callout-icon { background: var(--neutral-text); }

/* Why a project has its health label (project page) + the health guide dialog */
.health-why { align-items: flex-start; }
.health-why ul.why-list { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .6rem; }
.why-reason { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md, 8px); padding: .8rem 1rem; }
.why-title { font-weight: 700; }
.why-detail { color: var(--text-2); margin-top: .15rem; }
.why-fix { display: flex; gap: .45rem; align-items: flex-start; margin: .5rem 0; }
.why-fix .icon { font-size: 1.1rem; margin-top: .1rem; color: var(--text-2); }
.why-also-head { font-weight: 700; margin-top: 1rem; font-size: .95rem; color: var(--text-2); }
.why-items { margin: .3rem 0 0 1.2rem; padding: 0; }
.health-why-ok { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding: .7rem 1rem; margin-bottom: 1.25rem; border-radius: var(--radius-lg); background: var(--success-subtle); color: var(--success-text); }
.health-why-ok > span:not(.icon) { flex: 1; min-width: 14rem; }
.guide-row { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: .9rem 0; border-top: 1px solid var(--border-light); color: var(--text-1); font-size: 1rem; }
.guide-what { font-weight: 600; }
.guide-when { margin-top: .35rem; color: var(--text-2); }
.guide-fix { margin-top: .35rem; }
.hl-flash { animation: hl-flash 3s ease-out; }
@keyframes hl-flash { 0%, 50% { box-shadow: 0 0 0 3px var(--warning); background-color: var(--warning-subtle); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 560px) { .guide-row { grid-template-columns: 1fr; gap: .4rem; } }

/* ============================================================
   TABLES (template .table-panel look)
   ============================================================ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.data-table { width: 100%; border-collapse: collapse; font-size: .97rem; }
.data-table th { background: var(--surface-raised); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2); padding: .75rem .85rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table td { padding: .75rem .85rem; color: var(--text-1); border-bottom: 1px solid var(--border-light); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; }
.data-table tr.clickable-row:hover td, .clickable-row:hover { background: var(--hover); }
.link-text, .id-link { color: var(--accent-text); font-weight: 600; cursor: pointer; }
.clickable-row:hover .link-text, .id-link:hover { text-decoration: underline; }
.id-tag { font-size: .8rem; color: var(--text-3); font-weight: 500; white-space: nowrap; }
.rank { display: inline-flex; align-items: center; justify-content: center; min-width: 2rem; height: 2rem; border-radius: 6px; background: var(--accent-subtle); color: var(--accent-text); font-weight: 700; }
.rank.none { background: var(--neutral-subtle); color: var(--neutral-text); }
.data-table .progress, .dlv-row .progress { min-width: 0; }
.data-table .progress-track { min-width: 3.5rem; }
.data-table .col-project { min-width: 13rem; }
.data-table .btn-row { flex-wrap: nowrap; }

/* ============================================================
   STAT TILES
   ============================================================ */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem 1.25rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; box-shadow: var(--shadow-sm); border-top: 4px solid var(--border-strong); transition: transform var(--transition), box-shadow var(--transition); }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile-num { font-size: 2.2rem; font-weight: 700; line-height: 1.1; color: var(--text-1); }
.tile-label { font-weight: 600; color: var(--text-1); }
.tile-hint { font-size: .85rem; color: var(--text-2); }
.tile.tone-ok { border-top-color: var(--success); } .tile.tone-warn { border-top-color: var(--warning); }
.tile.tone-bad { border-top-color: var(--danger); } .tile.tone-idle { border-top-color: #94a3b8; }
.tile.tone-brand { border-top-color: var(--accent); }

/* ============================================================
   SEGMENTED CONTROLS & TABS
   ============================================================ */
.segmented { display: inline-flex; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: .25rem; gap: .2rem; flex-wrap: wrap; }
.segmented button { border: none; background: transparent; padding: .5rem 1rem; border-radius: 6px; font-weight: 600; cursor: pointer; min-height: 2.5rem; color: var(--text-2); display: inline-flex; align-items: center; gap: .45rem; }
.segmented button:hover { color: var(--text-1); }
.segmented button.active { background: var(--surface); color: var(--accent-text); box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border-strong); margin: 1.5rem 0 1.25rem; flex-wrap: wrap; }
.tabs button { border: none; background: none; padding: .8rem 1.1rem; cursor: pointer; font-size: 1.02rem; font-weight: 600; color: var(--text-2); border-bottom: 3px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: .45rem; }
.tabs button:hover { color: var(--text-1); }
.tabs button.active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* ============================================================
   FORMS (template .form-field look, larger)
   ============================================================ */
input[type="text"], input[type="date"], input[type="number"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; min-height: 2.75rem; padding: .55rem .8rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text-1); transition: border-color var(--transition), box-shadow var(--transition);
}
.dark-mode input[type="text"], .dark-mode input[type="date"], .dark-mode input[type="number"], .dark-mode input[type="search"], .dark-mode select, .dark-mode textarea { background: #0f172a; color-scheme: dark; }
.dark-mode .topbar-search input[type="text"] { background: transparent; }
textarea { min-height: 5.5rem; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.2); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-raised); color: var(--text-2); cursor: not-allowed; }
input[type="checkbox"], input[type="radio"] { width: 1.3rem; height: 1.3rem; accent-color: var(--accent-btn); flex-shrink: 0; }
input[type="range"] { width: 100%; accent-color: var(--accent-btn); height: 2rem; }
::placeholder { color: var(--text-3); }
.field { display: block; margin-bottom: 1rem; }
.field-label { display: block; font-size: .95rem; font-weight: 600; color: var(--text-2); margin-bottom: .35rem; }
.field-label .req, .req { color: var(--danger); margin-left: 2px; }
.field-help { display: block; font-size: .88rem; color: var(--text-2); margin-top: .3rem; }
.field-error { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; font-size: .9rem; font-weight: 600; color: var(--danger-text); margin-top: .35rem; }
.field-static { min-height: 2.75rem; padding: .55rem 0; font-size: 1rem; color: var(--text-1); }
.field-static.empty-value { color: var(--text-3); font-style: italic; }
.saved-tick { display: inline-flex; align-items: center; gap: .25rem; color: var(--success-text); font-weight: 700; font-size: .9rem; margin-top: .3rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.25rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 1.25rem; }
.check-row { display: flex; align-items: center; gap: .6rem; font-weight: 600; cursor: pointer; min-height: 2.75rem; color: var(--text-1); }
.edit-hint { display: flex; align-items: center; gap: .6rem; color: var(--info-text); background: var(--info-subtle); border: 1px solid var(--info-line); border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1.25rem; }

/* ============================================================
   FILTERS & TOOLBARS (template .table-toolbar)
   ============================================================ */
.filter-bar { display: flex; gap: 1rem; flex-wrap: wrap; align-items: flex-end; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-sm); }
.filter-bar .field { margin: 0; min-width: 11rem; }
.filter-bar .field-label { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; }
.toolbar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.toolbar .grow { flex: 1; }
.search-box { position: relative; flex: 1; min-width: 14rem; max-width: 30rem; }
.search-box .material-icons-round { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-box input { padding-left: 2.6rem; }

/* ============================================================
   HOME: attention list, lead groups
   ============================================================ */
.attn-group { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 1rem; overflow: hidden; }
.attn-group-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; background: var(--surface-raised); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.attn-group-title { font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .4rem; }
.attn-list { list-style: none; margin: 0; padding: 0; }
.attn-item { display: flex; gap: .9rem; align-items: center; padding: .9rem 1rem; border-bottom: 1px solid var(--border-light); flex-wrap: wrap; }
.attn-item:last-child { border-bottom: none; }
.attn-icon { width: 2.4rem; height: 2.4rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.attn-icon.tone-bad { background: var(--danger-subtle); color: var(--danger-text); }
.attn-icon.tone-warn { background: var(--warning-subtle); color: var(--warning-text); }
.attn-icon.tone-info { background: var(--info-subtle); color: var(--info-text); }
.attn-text { flex: 1; min-width: 15rem; }
.attn-title { font-weight: 700; }
.attn-detail { color: var(--text-2); }
.attn-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
details.lead-group { border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: .75rem; background: var(--surface); box-shadow: var(--shadow-sm); }
details.lead-group > summary { cursor: pointer; padding: .9rem 1.1rem; font-weight: 700; font-size: 1.05rem; display: flex; align-items: center; gap: .6rem; list-style: none; }
details.lead-group > summary::-webkit-details-marker { display: none; }
details.lead-group > summary .chev { transition: transform .15s; }
details.lead-group[open] > summary .chev { transform: rotate(90deg); }
details.lead-group > .lead-group-body { padding: 0 1.1rem 1.1rem; }

/* ============================================================
   PROJECT CARDS
   ============================================================ */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr)); gap: 1rem; }
.project-card { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.15rem 1.25rem; cursor: pointer; background: var(--surface); display: flex; flex-direction: column; gap: .6rem; box-shadow: var(--shadow-sm); transition: box-shadow var(--transition), border-color var(--transition); }
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); }
.project-card-head { display: flex; justify-content: space-between; gap: .5rem; align-items: flex-start; }
.project-card-name { font-weight: 700; font-size: 1.12rem; line-height: 1.3; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: .25rem .75rem; margin: 0; }
.facts dt { color: var(--text-2); font-weight: 600; }
.facts dd { margin: 0; }
.tag-row { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.role-tag { font-size: .8rem; padding: .12rem .6rem; }
.people-picker { display: flex; flex-direction: column; gap: .5rem; }
.person-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.person-chip { display: inline-flex; align-items: center; gap: .2rem; padding: .2rem .25rem .2rem .7rem; border-radius: 999px; background: var(--accent-subtle); color: var(--accent-text); font-weight: 600; }
.person-chip-x { border: none; background: transparent; color: inherit; cursor: pointer; border-radius: 999px; width: 1.6rem; height: 1.6rem; display: inline-flex; align-items: center; justify-content: center; padding: 0; }
.person-chip-x:hover { background: var(--surface); }
.person-chip-x .material-icons-round { font-size: 1rem; }
.card-foot { margin-top: auto; padding-top: .6rem; border-top: 1px solid var(--border-light); color: var(--accent-text); font-weight: 600; display: flex; align-items: center; gap: .3rem; }

/* ============================================================
   PROJECT PAGE
   ============================================================ */
.detail-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1.1rem 1.5rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--border-light); }
.summary-item .summary-label { font-size: .8rem; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.summary-item .summary-value { font-size: 1.1rem; font-weight: 600; }
.summary-item .summary-sub { font-size: .9rem; color: var(--text-2); }
.tab-intro { color: var(--text-2); margin-bottom: 1rem; }
.phase-card { border: 1px solid var(--border); border-left: 5px solid var(--accent); border-radius: var(--radius-lg); background: var(--surface); margin-bottom: 1.25rem; overflow: hidden; box-shadow: var(--shadow-sm); }
.phase-card.is-finished { border-left-color: var(--success); }
.phase-card.is-overdue { border-left-color: var(--danger); }
.phase-head { display: flex; gap: 1rem; align-items: center; padding: 1rem 1.25rem; flex-wrap: wrap; }
.phase-num { width: 2.5rem; height: 2.5rem; border-radius: 8px; background: var(--accent-subtle); color: var(--accent-text); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 1.1rem; }
.phase-card.is-finished .phase-num { background: var(--success-subtle); color: var(--success-text); }
.phase-card.is-overdue .phase-num { background: var(--danger-subtle); color: var(--danger-text); }
.phase-title { flex: 1; min-width: 14rem; }
.phase-name { font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.phase-dates { color: var(--text-2); }
.phase-desc { color: var(--text-1); margin-top: .25rem; max-width: 60rem; }
.phase-group { border: 1px solid var(--phase-line); border-radius: var(--radius-lg); background: var(--phase-bg); padding: 1rem 1rem .1rem; margin-bottom: 1.5rem; }
.phase-group.is-finished { border-color: var(--success-line); background: var(--success-subtle); }
.phase-group-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.phase-group-title { flex: 1; min-width: 14rem; }
.phase-group-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--phase-text); }
.phase-group.is-finished .phase-group-label { color: var(--success-text); }
.phase-progress { width: 12rem; }
.phase-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.editor { background: var(--surface-raised); border-top: 1px solid var(--border); padding: 1.25rem; }
.editor-title { font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: .5rem; color: var(--accent-text); }
.editor-foot { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 1rem; margin-top: .25rem; }
.dlv-section { border-top: 1px solid var(--border); padding: 1rem 1.25rem 1.25rem; }
.dlv-section-title { font-weight: 700; color: var(--text-2); margin-bottom: .6rem; text-transform: uppercase; font-size: .8rem; letter-spacing: .05em; }
.dlv-row { display: grid; grid-template-columns: minmax(10rem, 2fr) minmax(7rem, 1fr) minmax(9rem, 1.3fr) auto 9rem auto; gap: .75rem; align-items: center; padding: .7rem .5rem; border-bottom: 1px solid var(--border-light); }
.dlv-row:last-of-type { border-bottom: none; }
.dlv-name { font-weight: 600; }
.dlv-cell-label { display: none; }
.dlv-editor { margin: .25rem 0 .75rem; border: 1px solid var(--border); border-radius: var(--radius-lg); }
.update-entry { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.2rem; margin-bottom: .9rem; background: var(--surface); box-shadow: var(--shadow-sm); }
.update-entry-head { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: .5rem; }
.update-entry dl { display: grid; grid-template-columns: 11rem 1fr; gap: .35rem 1rem; margin: 0; }
.update-entry dt { font-weight: 600; color: var(--text-2); }
.update-entry dd { margin: 0; white-space: pre-wrap; }
.history-list { list-style: none; margin: 0; padding: 0; }
.history-list li { padding: .85rem 0; border-bottom: 1px solid var(--border-light); display: grid; grid-template-columns: 9rem 1fr; gap: 1rem; }
.history-list li:last-child { border-bottom: none; }
.history-when { color: var(--text-2); font-weight: 600; }
.history-reason { color: var(--text-2); font-style: italic; margin-top: .2rem; }

/* ============================================================
   FRIDAY UPDATE
   ============================================================ */
.uf-progress { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.uf-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .9rem; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; cursor: pointer; }
.uf-chip.sent { border-color: var(--success-line); background: var(--success-subtle); color: var(--success-text); }
.uf-chip.todo { border-color: var(--warning-line); background: var(--warning-subtle); color: var(--warning-text); }
.uf-card { scroll-margin-top: calc(var(--topbar-h) + 1rem); }
.uf-step { margin-bottom: 1.35rem; }
.uf-step-title { font-weight: 700; font-size: 1.05rem; margin-bottom: .5rem; display: flex; align-items: center; gap: .5rem; }
.uf-step-num { width: 1.8rem; height: 1.8rem; border-radius: 6px; background: var(--accent-subtle); color: var(--accent-text); display: inline-flex; align-items: center; justify-content: center; font-size: .92rem; flex-shrink: 0; }
.choice-group { display: flex; gap: .75rem; flex-wrap: wrap; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: inline-flex; align-items: center; gap: .55rem; padding: .7rem 1.2rem; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); font-weight: 600; cursor: pointer; min-height: 3rem; transition: all var(--transition); }
.choice > span:hover { border-color: var(--text-3); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-subtle); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent); }
.choice.tone-ok input:checked + span { border-color: var(--success); background: var(--success-subtle); color: var(--success-text); box-shadow: inset 0 0 0 1px var(--success); }
.choice.tone-warn input:checked + span { border-color: var(--warning); background: var(--warning-subtle); color: var(--warning-text); box-shadow: inset 0 0 0 1px var(--warning); }
.choice.tone-bad input:checked + span { border-color: var(--danger); background: var(--danger-subtle); color: var(--danger-text); box-shadow: inset 0 0 0 1px var(--danger); }
.last-week { background: var(--surface-raised); border-left: 4px solid var(--accent); border-radius: 6px; padding: .75rem 1rem; margin-bottom: 1rem; }
.check-item { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.1rem; margin-bottom: .75rem; }
.check-item.is-overdue { border-color: var(--danger-line); border-left: 4px solid var(--danger); }
.check-item-head { font-weight: 700; margin-bottom: .6rem; display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.check-controls { display: grid; grid-template-columns: minmax(12rem, 1.5fr) auto; gap: .75rem 1.5rem; align-items: center; }
.pct-live { font-weight: 700; min-width: 3.5ch; display: inline-block; font-size: 1.1rem; }
.range-row { display: flex; align-items: center; gap: .9rem; }
details.more-time { margin-top: .6rem; }
details.more-time > summary { cursor: pointer; color: var(--accent-text); font-weight: 600; padding: .35rem 0; }
details.more-time[open] > summary { margin-bottom: .6rem; }
.sticky-bar { position: sticky; bottom: 0; z-index: 20; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: 0 -4px 16px rgba(15,23,42,.12); padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; }
.sticky-bar .muted { flex: 1; min-width: 14rem; }

/* ============================================================
   GANTT
   ============================================================ */
.legend { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .88rem; color: var(--text-2); margin: 0 0 .8rem; }
.legend span { display: inline-flex; align-items: center; gap: .4rem; }
.legend .legend-sep { width: 1px; height: 1rem; background: var(--border-strong); }
.lg { display: inline-block; flex-shrink: 0; }
.lg-bar { width: 1.8rem; height: .7rem; border-radius: 999px; background: linear-gradient(90deg, var(--bf) 55%, var(--br) 55%); }
.lg-base { width: 1.8rem; height: 3px; border-radius: 2px; background: var(--gantt-baseline); }
.lg-diamond { width: .6rem; height: .6rem; background: var(--gb-ok-fill); transform: rotate(45deg); margin: 0 .2rem; border-radius: 2px; }
.lg-today { width: 2px; height: 1rem; background: var(--danger); }

/* Tones for bars — the darker part is the work done, the light part what is left. */
.t-ok   { --bf: var(--gb-ok-fill);   --br: var(--gb-ok-rest); }
.t-warn { --bf: var(--gb-warn-fill); --br: var(--gb-warn-rest); }
.t-bad  { --bf: var(--gb-bad-fill);  --br: var(--gb-bad-rest); }
.t-idle { --bf: var(--gb-idle-fill); --br: var(--gb-idle-rest); }
.t-done { --bf: var(--gb-done-fill); --br: var(--gb-done-rest); }

.gantt-scroll { --gantt-label-w: 31rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.gantt-grid { position: relative; display: flex; flex-direction: column; min-width: 100%; width: max-content; }
.gantt-row { display: flex; border-bottom: 1px solid var(--border-light); }
.gantt-row:last-child { border-bottom: none; }
.gantt-row:hover .gantt-label { background-color: var(--gantt-hover-solid); }
.gantt-row:hover .gantt-timeline { background-color: var(--hover); }

/* Left pane: a small table — name, lead, due, done. Sticky so it stays put while the chart scrolls. */
.gantt-label { flex: 0 0 var(--gantt-label-w); width: var(--gantt-label-w); position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--border-strong); display: flex; align-items: center; white-space: nowrap; overflow: hidden; height: 2.85rem; font-size: .95rem; }
.gl-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: .45rem; padding: 0 .5rem 0 .75rem; }
.gl-name .gantt-name { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.gl-col { flex: 0 0 auto; padding: 0 .5rem; color: var(--text-2); font-size: .88rem; overflow: hidden; text-overflow: ellipsis; }
.gl-lead { width: 5.2rem; }
.gl-due { width: 4.6rem; }
.gl-pct { width: 4rem; text-align: right; font-variant-numeric: tabular-nums; }
.gl-col.is-late { color: var(--danger-text); font-weight: 600; }
.gantt-label .muted-dash { color: var(--text-3); }

.gantt-header-row { border-bottom: 1px solid var(--border); }
.gantt-header-row .gantt-label { height: 3.4rem; background: var(--surface-raised); font-weight: 700; color: var(--text-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; align-items: flex-end; padding-bottom: .55rem; }
.gantt-header-row .gl-col { font-size: .74rem; color: var(--text-2); }
.gantt-header-row .gantt-timeline { height: 3.4rem; background: var(--surface-raised); }
.gantt-header-row:hover .gantt-label, .gantt-header-row:hover .gantt-timeline { background: var(--surface-raised); }
.gh-tier { position: absolute; left: 0; right: 0; height: 50%; }
.gh-top { top: 0; border-bottom: 1px solid var(--border-light); }
.gh-bottom { bottom: 0; }
.gh-cell { position: absolute; top: 0; bottom: 0; padding: 0 .45rem; display: flex; align-items: center; overflow: clip; white-space: nowrap; border-left: 1px solid var(--border); }
/* Month / quarter names stay pinned beside the left pane while the chart scrolls. */
.gh-top .gh-cell span { position: sticky; left: calc(var(--gantt-label-w) + .45rem); }
.gh-top .gh-cell { font-size: .8rem; font-weight: 700; color: var(--text-1); }
.gh-bottom .gh-cell { font-size: .74rem; color: var(--text-3); border-left-color: var(--border-light); padding: 0 .3rem; }
.gh-bottom .gh-cell.is-weekend { color: var(--text-3); opacity: .7; }

.gantt-timeline { position: relative; height: 2.85rem; flex-shrink: 0; z-index: 1; overflow: clip; }
.gantt-row-phase .gantt-timeline, .gantt-row-phase .gantt-label { height: 2.45rem; }
.gantt-row-deliverable .gantt-timeline, .gantt-row-deliverable .gantt-label { height: 2.2rem; font-size: .9rem; }
.gantt-row-project .gantt-name { font-weight: 700; }
.gantt-row-group .gantt-timeline, .gantt-row-group .gantt-label { height: 2.6rem; }
.gantt-row-group .gantt-label { background: var(--phase-bg); }
.gantt-group-name { font-weight: 700; color: var(--phase-text); }
.gantt-row-phase .gantt-label, .gantt-row-deliverable .gantt-label { background: var(--surface-raised); }

/* Grid lines, weekend shading and the today line — drawn once behind every row. */
.gantt-overlay { position: absolute; top: 0; bottom: 0; left: var(--gantt-label-w); pointer-events: none; z-index: 0; }
.gantt-vline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border-light); }
.gantt-vline.is-major { background: var(--border); }
.gantt-weekend { position: absolute; top: 0; bottom: 0; background: var(--gantt-weekend); }
.today-line { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--danger); opacity: .85; }
.today-flag { position: absolute; bottom: .25rem; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700; padding: .05rem .45rem; border-radius: 999px; z-index: 2; text-transform: none; letter-spacing: 0; white-space: nowrap; box-shadow: 0 0 0 3px var(--surface-raised); }

.bar { position: absolute; top: 50%; height: 1.15rem; margin-top: -.575rem; border-radius: 999px; background: var(--br); overflow: hidden; z-index: 2; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(15,23,42,.06); transition: filter var(--transition); }
.bar:hover { filter: brightness(.95); box-shadow: 0 0 0 2px var(--bf); }
.gantt-row-phase .bar { height: .85rem; margin-top: -.425rem; }
.gantt-row-deliverable .bar { height: .6rem; margin-top: -.3rem; }
.bar-fill { height: 100%; background: var(--bf); border-radius: 999px 0 0 999px; }
.bar-baseline { position: absolute; top: 50%; margin-top: .8rem; height: 3px; border-radius: 2px; background: var(--gantt-baseline); z-index: 1; }
.bar-text { position: absolute; top: 50%; transform: translateY(-50%); margin-left: .55rem; font-size: .82rem; color: var(--text-2); white-space: nowrap; z-index: 2; pointer-events: none; text-shadow: 0 0 3px var(--surface), 0 0 3px var(--surface), 0 0 6px var(--surface); }
.gantt-row-deliverable .bar-text { font-size: .78rem; }
.bar-text b { color: var(--text-1); font-weight: 600; }
.bar-text .late { color: var(--danger-text); font-weight: 700; }
.bar-text .moved { display: inline-block; margin-left: .35rem; padding: 0 .4rem; border-radius: 999px; background: var(--neutral-subtle); color: var(--neutral-text); font-size: .74rem; font-weight: 600; }
.bar-text.no-dates { font-style: italic; color: var(--text-3); }
.diamond { position: absolute; top: 50%; width: .8rem; height: .8rem; margin: -.4rem 0 0 -.4rem; background: var(--bf); transform: rotate(45deg); border-radius: 2px; z-index: 3; cursor: pointer; box-shadow: 0 0 0 2px var(--surface); }
.diamond-small { width: .65rem; height: .65rem; margin: -.325rem 0 0 -.325rem; }

/* Off-screen hints: "◀ ended Sep 11" when a bar is scrolled out of view. */
.edge-chip { position: absolute; top: 50%; transform: translateY(-50%); z-index: 4; display: none; align-items: center; gap: .2rem; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: .76rem; font-weight: 600; padding: .05rem .5rem; border-radius: 999px; cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); }
.edge-chip:hover { border-color: var(--accent); color: var(--accent-text); }
.edge-chip.is-shown { display: inline-flex; }
.edge-chip.is-right { transform: translate(-100%, -50%); }

.expand-btn { border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; width: 1.7rem; height: 1.7rem; border-radius: 6px; padding: 0; color: var(--text-1); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.expand-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.expand-spacer { display: inline-block; width: 1.7rem; flex-shrink: 0; }
.indent { display: inline-block; width: 1.3rem; flex-shrink: 0; }
.indent-2 { width: 2.6rem; }
.gantt-name { cursor: pointer; color: var(--text-1); }
.gantt-name:hover { color: var(--accent-text); text-decoration: underline; }
.gantt-lane-header .gantt-label, .gantt-lane-header .gantt-timeline { background: var(--accent-subtle); }
.gantt-lane-header:hover .gantt-label { background: var(--accent-subtle); }
.gantt-lane-header .gl-name { font-weight: 700; font-size: 1rem; color: var(--accent-text); }

.gantt-tip { position: fixed; z-index: 200; max-width: 20rem; background: #0f172a; color: #e2e8f0; border-radius: var(--radius); padding: .6rem .75rem; font-size: .84rem; line-height: 1.45; box-shadow: 0 8px 24px rgba(15,23,42,.3); pointer-events: none; }
.gantt-tip strong { display: block; color: #fff; font-size: .9rem; margin-bottom: .15rem; }
.gantt-tip .tip-row { color: #cbd5e1; }
.gantt-tip .tip-late { color: #fca5a5; font-weight: 600; }
.gantt-tip .tip-hint { color: #94a3b8; font-size: .76rem; margin-top: .25rem; }

/* ============================================================
   CALENDAR
   ============================================================ */
.calendar-table { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.calendar-table th { text-align: left; color: var(--text-2); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: .65rem .5rem; background: var(--surface-raised); border: 1px solid var(--border); }
.calendar-table td { border: 1px solid var(--border); vertical-align: top; height: 7.5rem; padding: .4rem; }
.calendar-table td.weekend { background: var(--surface-raised); }
.calendar-table td.is-today { background: var(--warning-subtle); box-shadow: inset 0 0 0 3px var(--warning); }
.cal-day-num { font-weight: 700; margin-bottom: .3rem; }
.is-today .cal-day-num::after { content: " · Today"; color: var(--warning-text); }
.cal-item { border-radius: 6px; padding: .2rem .45rem; margin-bottom: .25rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; font-weight: 600; background: var(--info-subtle); color: var(--info-text); }
.cal-item.is-overdue { background: var(--danger-subtle); color: var(--danger-text); }
.cal-item.is-phase { background: var(--phase-bg); color: var(--phase-text); }
.cal-item:hover { text-decoration: underline; }
.cal-empty { background: var(--border-light); }

/* ============================================================
   PRIORITY — Importance x Urgency grid
   ============================================================ */
.prio-chip { font-variant-numeric: tabular-nums; }
.prio-matrix-wrap { overflow-x: auto; }
.prio-matrix { display: grid; gap: .5rem; min-width: 54rem; } /* columns set inline from the priority scale */
.prio-corner { font-size: .78rem; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; align-self: end; padding-bottom: .3rem; }
.prio-axis { font-weight: 700; color: var(--text-2); font-size: .9rem; align-self: end; padding: 0 .25rem .3rem; }
.prio-axis-row { align-self: center; padding: 0; }
.prio-cell { min-height: 6rem; border: 1px solid var(--border); border-radius: var(--radius); padding: 1.6rem .5rem .5rem; background: var(--surface-raised); display: flex; flex-direction: column; gap: .35rem; position: relative; }
.prio-cell.tone-bad { background: var(--danger-subtle); border-color: var(--danger-line); }
.prio-cell.tone-warn { background: var(--warning-subtle); border-color: var(--warning-line); }
.prio-cell-count { position: absolute; top: .35rem; right: .5rem; font-weight: 700; font-size: .8rem; color: var(--text-3); }
.prio-pill { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-1); border-radius: 8px; padding: .35rem .55rem; font-size: .86rem; font-weight: 600; cursor: pointer; width: 100%; text-align: left; display: flex; flex-direction: column; gap: .3rem; }
.prio-pill:hover { border-color: var(--accent); }
.prio-pill:hover .prio-pill-name { color: var(--accent-text); }
.prio-pill-top { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.prio-pill-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress.mini { gap: .4rem; min-width: 0; font-size: .78rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.progress.mini .progress-track { height: .4rem; min-width: 0; }
.size-tag { flex-shrink: 0; font-size: .74rem; font-weight: 700; padding: .05rem .4rem; border-radius: 5px; background: var(--neutral-subtle); color: var(--neutral-text); }
.size-tag.is-unset { background: transparent; color: var(--text-3); border: 1px dashed var(--border-strong); }
.prio-select { min-width: 9rem; }
.prio-sortbar { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.prio-sortbar .muted { font-size: .85rem; }
.data-table th.sortable { padding: 0; }
.th-sort { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .25rem; width: 100%; padding: .75rem .85rem; cursor: pointer; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; }
.th-sort:hover { color: var(--text-1); }
.th-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.th-sort .icon { font-size: 1.1rem; opacity: .35; }
.sortable.is-sorted .th-sort { color: var(--accent-text); }
.sortable.is-sorted .th-sort .icon { opacity: 1; }

/* ============================================================
   TOOLS & WIZARD
   ============================================================ */
.tool-card { cursor: default; }
.tool-card:hover { border-color: var(--border); box-shadow: var(--shadow-sm); }
.tool-card.is-editing { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.15); }
.stepper { display: flex; gap: .5rem; list-style: none; padding: 0; margin: 0 0 1.5rem; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: .6rem; padding: .5rem 1rem .5rem .5rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); font-weight: 600; color: var(--text-2); box-shadow: var(--shadow-sm); }
.stepper .step-num { width: 2rem; height: 2rem; border-radius: 6px; background: var(--surface-raised); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }
.stepper li.active { border-color: var(--accent); color: var(--accent-text); }
.stepper li.active .step-num { background: var(--accent-btn); border-color: var(--accent-btn); color: #fff; }
.stepper li.done { color: var(--success-text); border-color: var(--success-line); }
.stepper li.done .step-num { background: var(--success); border-color: var(--success); color: #fff; }
.wizard-phase-head { display: flex; align-items: center; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.wizard-phase-head input { flex: 1; min-width: 12rem; font-weight: 700; }
.wizard-dlv { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.wizard-group-head { display: flex; align-items: baseline; gap: .6rem; font-weight: 700; font-size: 1.15rem; color: var(--phase-text); margin: 1.75rem 0 .75rem; padding-bottom: .4rem; border-bottom: 2px solid var(--phase-line); }

/* Timeline upload */
.importer { border-top: 4px solid var(--accent); }
.importer-row { display: flex; gap: .75rem; align-items: flex-start; flex-wrap: wrap; }
.importer-sample { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .85rem 1rem; margin-bottom: 1.25rem; border: 1px solid var(--info-line); border-radius: var(--radius); background: var(--info-subtle); }
.importer-sample > .material-icons-round { color: var(--info-text); }
.importer-sample .grow { flex: 1; min-width: 14rem; }
.importer-row .field { flex: 1; min-width: 16rem; }
.importer-row .btn { margin-top: 1.75rem; }
.importer-summary { font-size: 1.05rem; }
.importer-table { max-height: 32rem; overflow: auto; }
.importer-table td { vertical-align: top; }
.importer-table tr.is-error td { background: var(--danger-subtle); }
.importer-dlv { min-width: 12rem; max-width: 20rem; }
.importer-actions { position: static; box-shadow: none; }
input[type="file"] { width: 100%; padding: .55rem; border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-raised); cursor: pointer; }

/* ============================================================
   HELP, MODAL (template), TOAST (template), LOADING (template)
   ============================================================ */
.help-panel { border-left: 5px solid var(--accent); }
.help-panel ul { margin: .25rem 0 0 1.25rem; padding: 0; }
.help-panel li { margin-bottom: .35rem; }
.modal { display: none; position: fixed; z-index: 1000; inset: 0; background: rgba(15,23,42,0.5); backdrop-filter: blur(4px); overflow-y: auto; padding: 2rem 1rem; }
.modal.open { display: flex; align-items: flex-start; justify-content: center; }
.modal-content { background: var(--surface); border-radius: var(--radius-lg); width: 100%; max-width: 38rem; margin: 6vh auto 0; padding: 1.75rem; position: relative; box-shadow: 0 20px 60px -12px rgba(0,0,0,0.3); border: 1px solid var(--border); }
.modal-content h2 { font-size: 1.35rem; font-weight: 700; color: var(--text-1); margin: 0 2.5rem .75rem 0; }
.modal-close { position: absolute; top: 1rem; right: 1rem; width: 2.4rem; height: 2.4rem; display: flex; align-items: center; justify-content: center; border-radius: 6px; cursor: pointer; color: var(--text-2); font-size: 1.6rem; background: none; border: none; line-height: 1; }
.modal-close:hover { background: var(--surface-raised); color: var(--text-1); }
.dialog-message { color: var(--text-2); margin-bottom: 1.25rem; font-size: 1.05rem; }
.dialog-error { color: var(--danger-text); font-weight: 700; background: var(--danger-subtle); border-radius: var(--radius); padding: .6rem .85rem; margin-bottom: 1rem; }
.modal-actions { display: flex; gap: 0.75rem; justify-content: flex-end; margin-top: 1.5rem; padding-top: 1rem; border-top: 1px solid var(--border-light); flex-wrap: wrap; }
#toast-root { position: fixed; left: 50%; bottom: 2.5rem; transform: translateX(-50%); z-index: 99999; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { min-width: 18rem; max-width: 90vw; background: var(--sidebar-bg); color: #fff; border-radius: var(--radius); padding: 0.85rem 1.35rem; font-size: 1.02rem; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; justify-content: center; gap: .6rem; animation: viewFadeIn .25s ease; }
.dark-mode .toast { background: #334155; }
.toast .material-icons-round { color: #6ee7b7; }
.loading { padding: 5rem 1rem; text-align: center; color: var(--text-2); font-size: 1.15rem; }
.loading-spinner { width: 2.75rem; height: 2.75rem; border: 4px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
.spinner { width: 1em; height: 1em; border: 3px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; vertical-align: -0.15em; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   RESPONSIVE (template breakpoints)
   ============================================================ */
@media (max-width: 1240px) {
  .topbar-search input { width: 8rem; }
  .save-status .save-text { display: none; }
}
@media (max-width: 1100px) {
  .dlv-row { grid-template-columns: 1fr 1fr; }
  .dlv-cell-label { display: inline; color: var(--text-2); font-weight: 600; }
  .dlv-row > .dlv-name, .dlv-row > .btn-row { grid-column: 1 / -1; }
  .topbar-btn-label { display: none; }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; }
  .sidebar-toggle { display: flex; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 .75rem; gap: .5rem; }
  .topbar-search { display: none; }
  #main { padding: 1.1rem 1rem 6rem; }
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .check-controls { grid-template-columns: 1fr; }
  .gantt-scroll { --gantt-label-w: 13rem; }
  .gl-col { display: none; }
  .update-entry dl, .history-list li { grid-template-columns: 1fr; gap: .15rem; }
  .phase-progress { width: 100%; }
  h1 { font-size: 1.45rem; }
  .page-head > div { min-width: 0; }
  .segmented { max-width: 100%; }
  .uf-chip { max-width: 100%; white-space: normal; text-align: left; }
  .card { padding: 1.15rem 1.1rem; }
  .modal-content { padding: 1.25rem; }
}
@media (max-width: 480px) {
  .topbar-title { display: none; }
}
/* web port: sign-out button (build.js) */
.pt-signout { margin-left: auto; background: none; border: 1px solid var(--sidebar-border); color: var(--sidebar-text-active); cursor: pointer; padding: 4px 6px; border-radius: 8px; display: flex; align-items: center; }
.pt-signout:hover, .pt-signout:focus-visible { opacity: 1; background: rgba(255,255,255,.12); }
