/* ============== DESIGN TOKENS ============== */
:root {
  --bg: #F7F6F2;
  --bg-elev: #FFFFFF;
  --bg-soft: #F1EFE8;
  --ink: #0A2540;
  --ink-2: #364B65;
  --ink-3: #6B7C93;
  --ink-4: #9BA8BA;
  --line: #E5E2D8;
  --line-2: #EFEDE5;

  --who: #009BDB;
  --who-deep: #0073B5;
  --who-soft: #E6F5FC;

  --c-on-track: #10B981;
  --c-on-track-bg: #ECFDF5;
  --c-issues: #F59E0B;
  --c-issues-bg: #FEF3C7;
  --c-risk: #EF4444;
  --c-risk-bg: #FEE2E2;
  --c-completed: #6366F1;
  --c-completed-bg: #EEF2FF;
  --c-not-approved: #94A3B8;
  --c-not-approved-bg: #F1F5F9;
  --c-on-hold: #A855F7;
  --c-on-hold-bg: #F5F3FF;
  --c-cancelled: #6B7280;
  --c-cancelled-bg: #F3F4F6;

  --c-high: #DC2626;
  --c-medium: #D97706;
  --c-low: #059669;

  --shadow-sm: 0 1px 2px rgba(10,37,64,0.04);
  --shadow: 0 4px 12px rgba(10,37,64,0.06), 0 1px 2px rgba(10,37,64,0.04);
  --shadow-lg: 0 12px 32px rgba(10,37,64,0.10), 0 2px 6px rgba(10,37,64,0.05);
  --radius: 12px;
  --radius-lg: 16px;
  --radius-sm: 8px;

  --font-display: "Instrument Serif", Georgia, serif;
  --font-body: "Geist", -apple-system, system-ui, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, monospace;
}

[data-theme="dark"] {
  --bg: #0A1420;
  --bg-elev: #11202F;
  --bg-soft: #0F1A26;
  --ink: #E8EEF5;
  --ink-2: #BCC8D6;
  --ink-3: #8B9AAC;
  --ink-4: #5C6B7D;
  --line: #1E2E40;
  --line-2: #182838;
  --who-soft: rgba(0,155,219,0.12);
  --c-on-track-bg: rgba(16,185,129,0.12);
  --c-issues-bg: rgba(245,158,11,0.12);
  --c-risk-bg: rgba(239,68,68,0.12);
  --c-completed-bg: rgba(99,102,241,0.15);
  --c-not-approved-bg: rgba(148,163,184,0.12);
  --c-on-hold-bg: rgba(168,85,247,0.15);
  --c-cancelled-bg: rgba(107,114,128,0.15);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 4px 12px rgba(0,0,0,0.35);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
}

/* ============== RESET & BASE ============== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* ============== TOP BAR ============== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 20px;
  backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text { line-height: 1.1; }
.brand-text .t1 { font-family: var(--font-display); font-size: 20px; font-style: italic; color: var(--ink); }
.brand-text .t2 { font-size: 11px; color: var(--ink-3); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 2px; }

.project-switcher {
  flex: 1;
  display: flex; align-items: center; gap: 8px;
  max-width: 380px;
  margin-left: 20px;
}
.project-select {
  flex: 1;
  padding: 9px 14px; padding-right: 36px;
  border: 1px solid var(--line);
  background: var(--bg-soft) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7C93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 12px center;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-weight: 500;
  appearance: none;
  cursor: pointer;
}
.icon-btn {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  transition: all 0.15s ease;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn svg { width: 16px; height: 16px; }

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

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-weight: 500; font-size: 13px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink);
  transition: all 0.15s ease;
}
.btn:hover { background: var(--bg-soft); }
.btn svg { width: 14px; height: 14px; }
.btn.primary { background: var(--ink); color: white; border-color: var(--ink); }
.btn.primary:hover { background: var(--ink-2); }
.btn.who { background: var(--who); color: white; border-color: var(--who); }
.btn.who:hover { background: var(--who-deep); }
.btn.danger { color: var(--c-risk); }
.btn.danger:hover { background: var(--c-risk-bg); }

/* ============== TABS ============== */
.tabs {
  display: flex; gap: 4px;
  padding: 0 28px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  padding: 12px 18px;
  font-weight: 500; font-size: 13px;
  color: var(--ink-3);
  border-bottom: 2px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--who); border-bottom-color: var(--who); }
.tab svg { width: 14px; height: 14px; }

/* ============== LAYOUT ============== */
.main { padding: 28px; max-width: 1600px; margin: 0 auto; }
.view { display: none; animation: fadeIn 0.3s ease; }
.view.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.view-head {
  margin-bottom: 24px;
  display: flex; align-items: end; justify-content: space-between; gap: 20px;
  flex-wrap: wrap;
}
.view-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 38px; font-weight: 400; font-style: italic;
  color: var(--ink); letter-spacing: -0.01em; line-height: 1;
}
.view-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 6px; }

/* ============== KPI TILES ============== */
.kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--who);
  border-radius: 0 2px 2px 0;
}
.kpi.green::before { background: var(--c-on-track); }
.kpi.amber::before { background: var(--c-issues); }
.kpi.red::before { background: var(--c-risk); }
.kpi.indigo::before { background: var(--c-completed); }
.kpi.slate::before { background: var(--c-not-approved); }

.kpi .label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 500;
  display: flex; align-items: center; gap: 6px;
}
.kpi .label svg { width: 12px; height: 12px; }
.kpi .value {
  font-family: var(--font-display);
  font-size: 36px; font-weight: 400; line-height: 1.1;
  margin-top: 6px;
  color: var(--ink);
  font-feature-settings: "tnum";
}
.kpi .delta {
  margin-top: 4px;
  font-size: 12px; color: var(--ink-3);
  font-family: var(--font-mono);
}

/* ============== DASHBOARD GRID ============== */
.dash-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 {
  margin: 0 0 14px;
  font-size: 13px; font-weight: 600;
  color: var(--ink-2);
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 8px;
}
.card h3 .badge {
  margin-left: auto;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 6px;
  background: var(--bg-soft); color: var(--ink-3);
  text-transform: none; letter-spacing: 0;
}

/* ============== STATUS PILL ============== */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  font-size: 11px; font-weight: 500;
  border-radius: 999px;
  white-space: nowrap;
}
.pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
}
.pill.s-on-track { background: var(--c-on-track-bg); color: var(--c-on-track); }
.pill.s-issues-exist { background: var(--c-issues-bg); color: var(--c-issues); }
.pill.s-at-risk { background: var(--c-risk-bg); color: var(--c-risk); }
.pill.s-completed { background: var(--c-completed-bg); color: var(--c-completed); }
.pill.s-not-approved { background: var(--c-not-approved-bg); color: var(--c-not-approved); }
.pill.s-on-hold { background: var(--c-on-hold-bg); color: var(--c-on-hold); }
.pill.s-cancelled { background: var(--c-cancelled-bg); color: var(--c-cancelled); }

.priority-tag {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
}
.priority-tag.p-high { color: var(--c-high); background: var(--c-risk-bg); }
.priority-tag.p-medium { color: var(--c-medium); background: var(--c-issues-bg); }
.priority-tag.p-low { color: var(--c-low); background: var(--c-on-track-bg); }

.type-tag {
  font-size: 11px; color: var(--ink-3);
  padding: 2px 7px; border-radius: 4px;
  background: var(--bg-soft);
  font-weight: 500;
}

/* ============== PROGRESS BAR ============== */
.bar {
  height: 6px;
  background: var(--line-2);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.bar > span {
  display: block; height: 100%;
  background: var(--who);
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.bar.done > span { background: var(--c-on-track); }

/* ============== TABLE ============== */
.task-toolbar {
  display: flex; gap: 10px; flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.search-input {
  flex: 1; min-width: 220px; max-width: 320px;
  padding: 9px 14px 9px 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B7C93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><circle cx='11' cy='11' r='8'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
  color: var(--ink);
  outline: none;
}
.search-input:focus { border-color: var(--who); }

.filter-select {
  padding: 9px 30px 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-elev) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7C93' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>") no-repeat right 10px center;
  color: var(--ink);
  appearance: none; cursor: pointer;
  font-size: 13px;
}

/* ============== SEMANTIC SELECT/OPTION COLORS ==============
   Each <option> below shows the same color treatment as the
   matching pill / tag in the task table rows. The closed select
   itself adopts the color of its currently-selected value (a
   small JS helper toggles the matching class on change). */

/* Status — pill colors */
option.s-not-approved { background: var(--c-not-approved-bg); color: var(--c-not-approved); }
option.s-on-track     { background: var(--c-on-track-bg);     color: var(--c-on-track);     }
option.s-issues-exist { background: var(--c-issues-bg);       color: var(--c-issues);       }
option.s-at-risk      { background: var(--c-risk-bg);         color: var(--c-risk);         }
option.s-completed    { background: var(--c-completed-bg);    color: var(--c-completed);    }
option.s-on-hold      { background: var(--c-on-hold-bg);      color: var(--c-on-hold);      }
option.s-cancelled    { background: var(--c-cancelled-bg);    color: var(--c-cancelled);    }

/* Priority — same as .priority-tag.p-* in the table */
option.p-high   { background: var(--c-risk-bg);     color: var(--c-high);   }
option.p-medium { background: var(--c-issues-bg);   color: var(--c-medium); }
option.p-low    { background: var(--c-on-track-bg); color: var(--c-low);    }

/* Type — same as .type-tag.t-* in the table */
option.t-deliverable { background: #DBEAFE; color: #1D4ED8; }
option.t-recurring   { background: #DCFCE7; color: #15803D; }
option.t-milestone   { background: #F3E8FF; color: #7E22CE; }

/* Cost status — matches the inline-styled cost-status tag in the task table */
option.c-no-spending { background: var(--bg-soft);       color: var(--ink-3);       }
option.c-within      { background: var(--c-on-track-bg); color: var(--c-on-track);  }
option.c-over        { background: var(--c-risk-bg);     color: var(--c-risk);      }

/* Closed select picks up the color of its currently-selected value.
   We tint the background lightly and use the semantic foreground for
   the visible text — matching the pill look while keeping the chevron
   readable. Empty filter values (e.g. "All statuses") get no class
   and stay neutral. */
.select-colored {
  font-weight: 500;
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.select-colored.s-not-approved { background-color: var(--c-not-approved-bg); color: var(--c-not-approved); border-color: var(--c-not-approved-bg); }
.select-colored.s-on-track     { background-color: var(--c-on-track-bg);     color: var(--c-on-track);     border-color: var(--c-on-track-bg);     }
.select-colored.s-issues-exist { background-color: var(--c-issues-bg);       color: var(--c-issues);       border-color: var(--c-issues-bg);       }
.select-colored.s-at-risk      { background-color: var(--c-risk-bg);         color: var(--c-risk);         border-color: var(--c-risk-bg);         }
.select-colored.s-completed    { background-color: var(--c-completed-bg);    color: var(--c-completed);    border-color: var(--c-completed-bg);    }
.select-colored.s-on-hold      { background-color: var(--c-on-hold-bg);      color: var(--c-on-hold);      border-color: var(--c-on-hold-bg);      }
.select-colored.s-cancelled    { background-color: var(--c-cancelled-bg);    color: var(--c-cancelled);    border-color: var(--c-cancelled-bg);    }
.select-colored.p-high   { background-color: var(--c-risk-bg);     color: var(--c-high);   border-color: var(--c-risk-bg);     }
.select-colored.p-medium { background-color: var(--c-issues-bg);   color: var(--c-medium); border-color: var(--c-issues-bg);   }
.select-colored.p-low    { background-color: var(--c-on-track-bg); color: var(--c-low);    border-color: var(--c-on-track-bg); }
.select-colored.t-deliverable { background-color: #DBEAFE; color: #1D4ED8; border-color: #DBEAFE; }
.select-colored.t-recurring   { background-color: #DCFCE7; color: #15803D; border-color: #DCFCE7; }
.select-colored.t-milestone   { background-color: #F3E8FF; color: #7E22CE; border-color: #F3E8FF; }
.select-colored.c-no-spending { background-color: var(--bg-soft);       color: var(--ink-3);      border-color: var(--bg-soft);       }
.select-colored.c-within      { background-color: var(--c-on-track-bg); color: var(--c-on-track); border-color: var(--c-on-track-bg); }
.select-colored.c-over        { background-color: var(--c-risk-bg);     color: var(--c-risk);     border-color: var(--c-risk-bg);     }

.task-table-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow-x: scroll;
  overflow-y: visible;
  /* Always-visible, themed scrollbar */
  scrollbar-width: auto;                       /* Firefox: full-width bar, not thin */
  scrollbar-color: var(--ink-3) var(--bg-soft);/* Firefox: thumb track */
}
.task-table-wrap::-webkit-scrollbar {
  height: 14px;                                /* taller = easier to see + grab */
  width: 14px;
  -webkit-appearance: none;
}
.task-table-wrap::-webkit-scrollbar-track {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  border-radius: 0 0 var(--radius) var(--radius);
}
.task-table-wrap::-webkit-scrollbar-thumb {
  background: var(--ink-3);
  border-radius: 8px;
  border: 3px solid var(--bg-soft);            /* creates padding around thumb */
  min-width: 40px;
}
.task-table-wrap::-webkit-scrollbar-thumb:hover {
  background: var(--ink-2);
}
.task-table-wrap::-webkit-scrollbar-thumb:active {
  background: var(--ink);
}
.task-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  font-size: 13px;
}
.task-table th {
  text-align: left;
  padding: 12px 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 600;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  position: sticky; top: 0;
}
.task-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-2);
  vertical-align: middle;
}
.task-table tbody tr { transition: background 0.1s; }
.task-table tbody tr:hover { background: var(--bg-soft); }
.task-table tr.phase-row {
  background: var(--bg-soft);
}
.task-table tr.phase-row td {
  padding: 10px 12px;
  font-family: var(--font-display); font-style: italic;
  font-size: 16px; color: var(--ink);
  letter-spacing: 0.02em;
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.task-table tr.phase-row .phase-title {
  display: flex; align-items: center; gap: 10px;
}
.task-table tr.phase-row .phase-stats {
  font-family: var(--font-mono); font-style: normal;
  font-size: 11px; color: var(--ink-3);
  margin-left: auto;
  font-weight: 400;
}
.task-table .col-actions { width: 80px; text-align: right; }
.row-actions { display: inline-flex; gap: 4px; opacity: 0; transition: opacity 0.15s; }
.task-table tbody tr:hover .row-actions { opacity: 1; }
.row-act-btn {
  width: 26px; height: 26px;
  display: inline-grid; place-items: center;
  border-radius: 6px; color: var(--ink-3);
}
.row-act-btn:hover { background: var(--bg-elev); color: var(--ink); }
.row-act-btn.del:hover { color: var(--c-risk); background: var(--c-risk-bg); }
.row-act-btn svg { width: 14px; height: 14px; }

.task-table .col-id { color: var(--ink-4); font-family: var(--font-mono); font-size: 11px; width: 40px; }
.task-table .task-name { font-weight: 500; color: var(--ink); }
.task-table .task-name-row {
  display: flex; align-items: center; gap: 6px;
}
.task-table .expand-btn {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 5px;
  color: var(--who);
  background: var(--who-soft);
  border: 1px solid transparent;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.18s, color 0.15s, background 0.15s, border-color 0.15s;
}
.task-table .expand-btn:hover { background: var(--who); color: #fff; border-color: var(--who); }
.task-table .expand-btn svg { width: 13px; height: 13px; }
.task-table .expand-btn.open { transform: rotate(180deg); background: var(--who); color: #fff; }
/* dotted underline cue on task names that have an expandable objective */
.task-table .task-name-row.has-obj .task-name {
  border-bottom: 1px dotted var(--ink-4);
  padding-bottom: 1px;
}

.task-table tr.obj-row { display: none; }
.task-table tr.obj-row.show { display: table-row; }
.task-table tr.obj-row td.obj-cell {
  background: var(--bg-soft);
  padding: 10px 16px 12px 38px;
  border-top: 0;
}
.task-table .obj-content .obj-label {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  margin-bottom: 4px;
}
.task-table .obj-content .obj-text {
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink-2);
  white-space: pre-wrap;
}

/* Type tag color variants */
.type-tag.t-recurring   { background: #DCFCE7; color: #15803D; }
.type-tag.t-deliverable { background: #DBEAFE; color: #1D4ED8; }
.type-tag.t-milestone   { background: #F3E8FF; color: #7E22CE; }
.task-table .pct { display: flex; align-items: center; gap: 8px; min-width: 100px; }
.task-table .pct .bar { flex: 1; }
.task-table .pct .num { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); width: 36px; text-align: right; }

/* Milestone variant — wider num to fit "★ X/Y", green bar when fully done */
.task-table .pct.ms .num {
  width: auto; min-width: 44px;
  display: inline-flex; align-items: center; gap: 3px;
  justify-content: flex-end;
  color: var(--ink); font-weight: 500;
}
.task-table .pct.ms .num .ms-star { display: inline-grid; place-items: center; color: var(--c-completed); }
.task-table .pct.ms .num .ms-star svg { width: 11px; height: 11px; }
.task-table .pct.ms.done .bar > span { background: var(--c-on-track); }
.task-table .pct.ms.done .num .ms-star { color: var(--c-on-track); }
.task-table .money { font-family: var(--font-mono); font-size: 12px; }
.task-table .money.over { color: var(--c-risk); font-weight: 600; }
.task-table .date { font-family: var(--font-mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; }

/* ============== KANBAN ============== */
.kanban {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 12px;
}
.kanban-col {
  flex: 0 0 300px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex; flex-direction: column;
  max-height: calc(100vh - 240px);
}
.kanban-col-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.kanban-col-head .name { font-weight: 600; font-size: 13px; }
.kanban-col-head .count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-elev); color: var(--ink-3);
  padding: 2px 7px; border-radius: 999px;
}
.kanban-cards { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.kanban-card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: grab;
  transition: all 0.15s;
  user-select: none;
}
.kanban-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kanban-card.dragging { opacity: 0.4; cursor: grabbing; }
.kanban-card .name { font-weight: 500; font-size: 13px; line-height: 1.3; margin-bottom: 6px; }
.kanban-card .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.kanban-card .phase-tag { font-size: 10px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.kanban-card .footer { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); }
.kanban-col.drag-over { background: var(--who-soft); border-color: var(--who); }

/* ============== GANTT ============== */
.gantt-controls { display: flex; gap: 8px; margin-bottom: 12px; align-items: center; }
.gantt-wrap {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: calc(100vh - 240px);
}
.gantt {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-width: 100%;
}
.gantt-left {
  border-right: 1px solid var(--line);
  position: sticky; left: 0; z-index: 5; background: var(--bg-elev);
}
.gantt-row {
  display: flex; align-items: center;
  padding: 0 14px;
  height: 36px;
  border-bottom: 1px solid var(--line-2);
  font-size: 12px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gantt-row.head {
  background: var(--bg-soft);
  font-weight: 600; height: 50px;
  border-bottom: 1px solid var(--line);
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); position: sticky; top: 0; z-index: 4;
}
.gantt-row.phase {
  background: var(--bg-soft);
  font-family: var(--font-display); font-style: italic;
  font-size: 14px;
  color: var(--ink);
  border-top: 2px solid var(--ink);
  border-bottom: 1px solid var(--line);
}
.gantt-right { position: relative; overflow: hidden; }
.gantt-header {
  display: flex; height: 50px;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 4;
}
.gantt-month {
  flex-shrink: 0;
  border-right: 1px solid var(--line-2);
  padding: 8px 10px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 600;
  display: flex; flex-direction: column; justify-content: center;
}
.gantt-month .yr { color: var(--ink-4); font-size: 9px; }
.gantt-bar-row {
  height: 36px;
  border-bottom: 1px solid var(--line-2);
  position: relative;
  background: repeating-linear-gradient(to right, transparent 0, transparent calc((100% / var(--n-months, 12)) - 1px), var(--line-2) calc((100% / var(--n-months, 12)) - 1px), var(--line-2) calc((100% / var(--n-months, 12))));
}
.gantt-bar-row.phase-bg { background: var(--bg-soft); height: 36px; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--line); }
.gantt-bar-row.head-bg { background: var(--bg-soft); height: 50px; border-bottom: 1px solid var(--line); }
.gantt-bar {
  position: absolute; top: 8px; height: 20px;
  border-radius: 4px;
  font-size: 10px;
  display: flex; align-items: center;
  padding: 0 6px;
  color: white;
  white-space: nowrap; overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: filter 0.15s;
}
.gantt-bar:hover { filter: brightness(1.1); }
.gantt-bar .pct-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: rgba(255,255,255,0.35);
  border-radius: 4px 0 0 4px;
}
.gantt-bar.s-on-track { background: var(--c-on-track); }
.gantt-bar.s-issues-exist { background: var(--c-issues); }
.gantt-bar.s-at-risk { background: var(--c-risk); }
.gantt-bar.s-completed { background: var(--c-completed); }
.gantt-bar.s-not-approved { background: var(--c-not-approved); }
.gantt-bar.s-on-hold { background: var(--c-on-hold); }
.gantt-bar.s-cancelled { background: var(--c-cancelled); }
.gantt-bar.milestone {
  width: 16px !important; height: 16px !important;
  top: 10px !important;
  transform: rotate(45deg);
  border-radius: 2px;
  padding: 0;
}
.gantt-today {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--c-risk);
  z-index: 3;
  box-shadow: 0 0 0 1px rgba(239,68,68,0.2);
}
.gantt-today::before {
  content: 'TODAY';
  position: absolute; top: 4px; left: 4px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--c-risk); background: var(--bg-elev);
  padding: 2px 5px; border-radius: 3px;
  border: 1px solid var(--c-risk);
}

/* ============== MODAL ============== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,37,64,0.45);
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-backdrop.show { display: flex; animation: fadeIn 0.2s ease; }
.modal {
  background: var(--bg-elev);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
}
.modal-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--bg-elev); z-index: 2;
}
.modal-head h2 { margin: 0; font-family: var(--font-display); font-style: italic; font-size: 26px; font-weight: 400; }
.modal-body { padding: 24px; }
.modal-foot {
  padding: 16px 24px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 10px;
  position: sticky; bottom: 0; background: var(--bg-elev);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }
.field label {
  display: block;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); font-weight: 600;
  margin-bottom: 6px;
}
.field input, .field select, .field textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--who); }
.field textarea { min-height: 70px; resize: vertical; font-family: inherit; }
.field .hint { font-size: 11px; color: var(--ink-4); margin-top: 4px; font-family: var(--font-mono); }

/* ============== TOAST ============== */
.toast-stack {
  position: fixed; bottom: 24px; right: 24px; z-index: 200;
  display: flex; flex-direction: column; gap: 10px;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.success { background: var(--c-on-track); }
.toast.error { background: var(--c-risk); }
.toast svg { width: 16px; height: 16px; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ============== CHART CONTAINERS ============== */
.donut-wrap {
  display: flex; gap: 20px; align-items: center;
}
.donut {
  width: 140px; height: 140px;
  flex-shrink: 0;
}
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.donut-legend .item { display: flex; align-items: center; gap: 8px; }
.donut-legend .dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.donut-legend .name { flex: 1; color: var(--ink-2); }
.donut-legend .num { font-family: var(--font-mono); color: var(--ink-3); font-size: 11px; }

.priority-bars { display: flex; flex-direction: column; gap: 8px; }
.priority-bar-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.priority-bar-row .lab { width: 60px; color: var(--ink-2); font-weight: 500; font-size: 12px; }
.priority-bar-row .bar-track {
  flex: 1; height: 22px;
  background: var(--bg-soft);
  border-radius: 5px; overflow: hidden;
  position: relative;
}
.priority-bar-row .bar-fill {
  height: 100%;
  display: flex; align-items: center; padding: 0 8px;
  color: white; font-family: var(--font-mono); font-size: 11px; font-weight: 500;
  border-radius: 5px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.priority-bar-row .num { font-family: var(--font-mono); color: var(--ink-3); width: 32px; text-align: right; }

.phase-progress { display: flex; flex-direction: column; gap: 12px; }
.phase-progress-item .head { display: flex; align-items: center; margin-bottom: 6px; gap: 8px; }
.phase-progress-item .head .nm { font-weight: 500; color: var(--ink); font-family: var(--font-display); font-style: italic; font-size: 16px; }
.phase-progress-item .head .pct { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }
.phase-progress-item .head .ct { font-size: 11px; color: var(--ink-4); font-family: var(--font-mono); }

.budget-rows { display: flex; flex-direction: column; gap: 10px; }
.budget-row {
  display: grid; grid-template-columns: 100px 1fr 110px;
  align-items: center; gap: 10px; font-size: 12px;
}
.budget-row .nm { color: var(--ink-2); font-weight: 500; font-family: var(--font-display); font-style: italic; font-size: 15px; }
.budget-row .track {
  height: 18px;
  background: var(--bg-soft);
  border-radius: 4px; position: relative; overflow: hidden;
}
.budget-row .spent {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--who-deep), var(--who));
  border-radius: 4px;
}
.budget-row .over {
  position: absolute; top: 0; bottom: 0;
  background: var(--c-risk);
}
.budget-row .nums { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: right; }
.budget-row .nums .a { color: var(--ink); font-weight: 500; }

.risk-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.risk-item {
  display: flex; align-items: start; gap: 10px;
  padding: 10px;
  background: var(--bg-soft);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--c-risk);
}
.risk-item.s-issues-exist { border-left-color: var(--c-issues); }
.risk-item.s-on-hold { border-left-color: var(--c-on-hold); }
.risk-item .nm { font-weight: 500; font-size: 12px; color: var(--ink); }
.risk-item .meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }

.deadline-list { display: flex; flex-direction: column; gap: 8px; max-height: 360px; overflow-y: auto; }
.deadline-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.deadline-item:last-child { border-bottom: none; }
.deadline-item .day {
  width: 44px; flex-shrink: 0; text-align: center;
  background: var(--bg-soft); border-radius: 6px; padding: 4px;
}
.deadline-item .day .d { font-family: var(--font-display); font-size: 22px; line-height: 1; color: var(--ink); }
.deadline-item .day .m { font-size: 9px; text-transform: uppercase; color: var(--ink-3); letter-spacing: 0.06em; }
.deadline-item .info { flex: 1; }
.deadline-item .info .nm { font-size: 12px; font-weight: 500; }
.deadline-item .info .meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.deadline-item .days-out { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); }
.deadline-item.urgent .days-out { color: var(--c-risk); font-weight: 600; }

.fte-rows { display: flex; flex-direction: column; gap: 8px; }
.fte-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; font-size: 12px; }
.fte-row .nm { color: var(--ink); font-weight: 500; }
.fte-row .nm .role { color: var(--ink-3); font-size: 11px; margin-left: 6px; }
.fte-row .val {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--who-soft); color: var(--who-deep);
  padding: 2px 8px; border-radius: 4px;
}
.fte-row .val.over { background: var(--c-risk-bg); color: var(--c-risk); }

/* ============== EMPTY STATE ============== */
.empty {
  text-align: center; padding: 60px 20px;
  color: var(--ink-3);
}
.empty .ico {
  width: 56px; height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--bg-soft);
  display: grid; place-items: center;
  color: var(--ink-4);
}
.empty .ico svg { width: 24px; height: 24px; }
.empty h3 { color: var(--ink-2); margin: 0 0 4px; font-family: var(--font-display); font-style: italic; font-size: 22px; font-weight: 400; }

/* ============== PROJECT INFO ============== */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.legend-table {
  width: 100%;
  font-size: 12px;
}
.legend-table th, .legend-table td {
  text-align: left; padding: 8px 10px;
  border-bottom: 1px solid var(--line-2);
}
.legend-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-3); background: var(--bg-soft); font-weight: 600;
}
.legend-table .swatch {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block; vertical-align: middle; margin-right: 8px;
}

/* ============== USER PICKER ============== */
.user-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  cursor: pointer;
  transition: all 0.15s ease;
}
.user-pill:hover { background: var(--bg-soft); }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: white;
  font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.user-pill .name { font-size: 13px; font-weight: 500; }
.user-pill .caret { color: var(--ink-3); }
.user-pill .caret svg { width: 12px; height: 12px; }
.user-popover {
  position: absolute;
  top: 56px; right: 28px;
  width: 280px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: none;
  overflow: hidden;
}
.user-popover.show { display: block; animation: fadeIn 0.15s ease; }
.user-popover .header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.user-popover .header .meta { line-height: 1.2; }
.user-popover .header .meta .nm { font-weight: 600; font-size: 13px; }
.user-popover .header .meta .sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.user-popover .list { max-height: 240px; overflow-y: auto; }
.user-popover .item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 13px;
}
.user-popover .item:hover { background: var(--bg-soft); }
.user-popover .item.active { background: var(--who-soft); color: var(--who-deep); font-weight: 500; }
.user-popover .actions {
  padding: 8px;
  border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px;
}
.user-popover .actions button {
  text-align: left;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ink-2);
}
.user-popover .actions button:hover { background: var(--bg-soft); color: var(--ink); }
.user-popover .actions button svg { width: 14px; height: 14px; }
.user-popover .actions button.danger { color: var(--c-risk); }
.user-popover .actions button.danger:hover { background: var(--c-risk-bg); }

/* Empty hero (no projects) */
.empty-hero {
  text-align: center;
  padding: 80px 20px;
  background: var(--bg-elev);
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  margin-top: 20px;
}
.empty-hero .ico {
  width: 72px; height: 72px;
  background: var(--who-soft); color: var(--who-deep);
  border-radius: 50%;
  display: grid; place-items: center;
  margin: 0 auto 20px;
}
.empty-hero .ico svg { width: 32px; height: 32px; }
.empty-hero h2 {
  font-family: var(--font-display); font-style: italic; font-weight: 400;
  font-size: 36px; margin: 0 0 8px;
  color: var(--ink);
}
.empty-hero p { color: var(--ink-3); margin: 0 auto 24px; max-width: 460px; }
.empty-hero .cta-row { display: inline-flex; gap: 10px; }

.field-group {
  display: contents;
}
.field-group.hidden { display: none; }

.milestone-progress {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  background: var(--c-completed-bg); color: var(--c-completed);
  font-family: var(--font-mono);
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
}
.milestone-progress.done { background: var(--c-on-track-bg); color: var(--c-on-track); }
.milestone-progress svg { width: 11px; height: 11px; }

.muted-pct { color: var(--ink-4); font-size: 12px; font-style: italic; }

/* Milestone occurrence list */
.ms-list { display: flex; flex-direction: column; gap: 6px; }
.ms-row {
  display: grid;
  grid-template-columns: 26px 1fr 1fr auto 30px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.ms-row.done { background: var(--c-on-track-bg); border-color: rgba(16,185,129,0.3); }
.ms-row .ms-num {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-elev); color: var(--ink-3);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px; font-weight: 600;
}
.ms-row .ms-num.done {
  background: var(--c-on-track); color: white; border-color: var(--c-on-track);
}
.ms-row .ms-done-btn {
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.ms-row .ms-done-btn:hover {
  background: var(--c-on-track-bg);
  color: var(--c-on-track);
  border-color: var(--c-on-track);
}
.ms-row .ms-done-btn.is-done {
  background: var(--c-on-track);
  color: white;
  border-color: var(--c-on-track);
}
.ms-row .ms-done-btn.is-done:hover {
  background: var(--bg-elev);
  color: var(--ink-3);
  border-color: var(--line);
}
.ms-row input[type=date] {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg-elev);
  color: var(--ink);
  font-size: 12px;
  font-family: var(--font-mono);
}
.ms-row input[type=date]:focus { outline: none; border-color: var(--who); }
.ms-row .ms-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-4);
  font-weight: 500;
}
.ms-row .ms-del {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--ink-4);
}
.ms-row .ms-del:hover { background: var(--c-risk-bg); color: var(--c-risk); }
.ms-row .ms-del svg { width: 13px; height: 13px; }

.ms-empty {
  padding: 14px;
  text-align: center;
  color: var(--ink-4);
  font-size: 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  font-style: italic;
}

/* ============== HELPER ============== */
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.muted { color: var(--ink-3); font-size: 12px; }
.mono { font-family: var(--font-mono); }
.hidden { display: none !important; }

/* ============== v2.1 ENHANCEMENTS ============== */

/* Global "expand all objectives" toggle in the task toolbar */
.toggle-obj-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--ink-2);
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.toggle-obj-btn:hover { border-color: var(--who); color: var(--who); }
.toggle-obj-btn svg { width: 13px; height: 13px; transition: transform 0.18s; }
.toggle-obj-btn.active { background: var(--who-soft); color: var(--who); border-color: var(--who); }
.toggle-obj-btn.active svg { transform: rotate(180deg); }

/* New Duration column */
.task-table .col-duration {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
  text-align: right;
  white-space: nowrap;
}
.task-table th.col-duration { text-align: right; }

/* Sublines inside Spent / Cost cells */
.task-table .cell-sub {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  font-weight: 400;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.task-table .cell-sub.over   { color: var(--c-risk); }
.task-table .cell-sub.under  { color: var(--c-on-track); }
.task-table .cell-sub.warn   { color: var(--c-issues); }

/* Category (phase) row — edit/delete actions on hover */
.task-table tr.phase-row td { position: relative; }
.task-table tr.phase-row .phase-title { padding-right: 70px; }
.phase-actions {
  position: absolute;
  right: 12px; top: 50%;
  transform: translateY(-50%);
  display: inline-flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
.task-table tr.phase-row:hover .phase-actions { opacity: 1; }
.phase-act-btn {
  width: 24px; height: 24px;
  display: inline-grid; place-items: center;
  border-radius: 5px;
  color: var(--ink-3);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.phase-act-btn:hover { color: var(--who); border-color: var(--who); background: var(--who-soft); }
.phase-act-btn.del:hover { color: var(--c-risk); border-color: var(--c-risk); background: var(--c-risk-bg); }
.phase-act-btn svg { width: 12px; height: 12px; }
.task-table tr.phase-row.empty-cat .phase-stats { font-style: italic; opacity: 0.7; }

/* Computed-value displays inside the task modal form */
.field.computed { background: transparent; }
.field.computed label {
  /* Make the label match other field labels but indicate "auto" */
  display: flex; align-items: center; gap: 6px;
}
.field.computed label::after {
  content: 'auto';
  font-size: 9px; font-weight: 600;
  color: var(--ink-4);
  background: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 3px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.calc-value {
  display: flex; align-items: baseline; gap: 8px;
  padding: 9px 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  min-height: 38px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--ink);
  font-weight: 500;
}
.calc-value.empty { color: var(--ink-4); font-weight: 400; font-style: italic; }
.calc-value .calc-sub {
  font-size: 11px;
  color: var(--ink-3);
  font-weight: 400;
  font-style: normal;
}
.calc-value.over   { color: var(--c-risk); border-color: var(--c-risk); background: var(--c-risk-bg); }
.calc-value.under  { color: var(--c-on-track); border-color: var(--c-on-track); background: var(--c-on-track-bg); }
.calc-value.warn   { color: var(--c-issues); border-color: var(--c-issues); background: var(--c-issues-bg); }

/* A small section header inside the form to group the auto-calculated triplet */
.calc-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.calc-stat {
  padding: 10px 12px;
  background: var(--bg-soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  min-height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s;
}
.calc-stat .calc-stat-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}
.calc-stat .calc-stat-label {
  font-size: 10px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.calc-stat.empty .calc-stat-val { color: var(--ink-4); font-weight: 400; font-style: italic; }
.calc-stat.over   { border-color: var(--c-risk); background: var(--c-risk-bg); }
.calc-stat.over   .calc-stat-val { color: var(--c-risk); }
.calc-stat.under  { border-color: var(--c-on-track); background: var(--c-on-track-bg); }
.calc-stat.under  .calc-stat-val { color: var(--c-on-track); }
.calc-stat.warn   { border-color: var(--c-issues); background: var(--c-issues-bg); }
.calc-stat.warn   .calc-stat-val { color: var(--c-issues); }

@media (max-width: 880px) {
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .project-switcher { order: 3; max-width: 100%; margin-left: 0; flex-basis: 100%; }
  .actions { margin-left: 0; }
  .main { padding: 16px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .calc-trio { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
  .view-head h1 { font-size: 30px; }
}
