/* Gantt Dashboard (web/gantt.js). Everything is scoped under .gt (the page
   and the drawer) or .gt-tip (the tooltip, which lives on <body>). Brand
   tokens only — light and dark both follow theme.css. */

#main:has(> .gt-page) { max-width: none; }
.gt {
  --lab: 330px;
  --row: 56px;
  --prow: 30px;
  --gt-grid: color-mix(in srgb, var(--line) 85%, transparent);
  --gt-wk: color-mix(in srgb, var(--surface-3) 50%, transparent);
  --gt-done: color-mix(in srgb, var(--teal) 55%, var(--surface));
}
.gt-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gt-page > *, .gt-body > * { min-width: 0; }
.gt-muted { color: var(--muted); }
.gt-muted.sm, .gt .sm { font-size: .74rem; }

/* ---------- head ---------- */
.gt-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.gt-titles h1 { margin: 0; font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; position: relative; padding-bottom: 9px; }
.gt-titles h1::after { content: ""; position: absolute; left: 0; bottom: 0; width: 72px; height: 3px; border-radius: 3px; background: var(--gradient); }
.gt-titles p { margin: 8px 0 0; color: var(--muted); font-size: .84rem; max-width: 760px; }
.gt-head-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gt-fresh { font-size: .76rem; color: var(--muted); display: inline-flex; gap: 7px; align-items: center; margin-right: 4px; }
.gt-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.gt-dot.ok { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.gt-dot.old { background: var(--warn); }
#gt-refresh.spin::before { content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 6px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: gt-spin .8s linear infinite; vertical-align: -1px; }
.gt-loading { display: flex; align-items: center; gap: 12px; padding: 48px; justify-content: center; color: var(--muted); }
.gt-loading.sm { padding: 24px; justify-content: flex-start; }
.gt-spinner { width: 18px; height: 18px; border: 2.5px solid var(--line-strong); border-top-color: var(--teal); border-radius: 50%; animation: gt-spin .8s linear infinite; }
@keyframes gt-spin { to { transform: rotate(360deg); } }

/* ---------- KPI tiles ---------- */
.gt-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.gt-kpi {
  position: relative; overflow: hidden; text-align: left; font: inherit; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  padding: 15px 16px 12px; transition: box-shadow .15s, border-color .15s, transform .15s;
}
.gt-kpi::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--gradient); }
.gt-kpi.t-crit::before { background: var(--crit); }
.gt-kpi.t-warn::before { background: var(--warn); }
.gt-kpi.click { cursor: pointer; }
.gt-kpi.click:hover { box-shadow: var(--shadow-hover); border-color: var(--teal); transform: translateY(-1px); }
.gt-kpi .k { font-size: .63rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-kpi .v { font-size: 1.7rem; font-weight: 700; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.gt-kpi.t-crit .v { color: var(--crit); }
.gt-kpi.t-warn .v { color: var(--warn); }
.gt-kpi .s { font-size: .72rem; color: var(--muted); line-height: 1.35; }

/* ---------- tabs ---------- */
.gt-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.gt-tab {
  appearance: none; background: none; border: 0; position: relative; padding: 10px 14px 12px; font: inherit; font-weight: 600;
  font-size: .86rem; color: var(--muted); cursor: pointer; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center;
}
.gt-tab:hover { color: var(--ink); }
.gt-tab[aria-selected="true"] { color: var(--ink); }
.gt-tab[aria-selected="true"]::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--gradient); }
.gt-badge { background: var(--crit-soft); color: var(--crit); border-radius: 999px; padding: 1px 7px; font-size: .68rem; font-weight: 700; }

/* ---------- toolbar ---------- */
/* clip, not hidden: hidden would make the card a scroll container and the
   pinned date header would stick to the card instead of the page */
.gt-card { padding: 0; overflow: clip; border-radius: 12px; }
.gt-toolbar { padding: 14px 16px 10px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.gt-tb-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.gt-tb-sp { flex: 1; }
.gt-search {
  flex: 1 1 260px; min-width: 180px; font: inherit; font-size: .84rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 9px; padding: 8px 12px;
}
.gt-sel { display: inline-flex; align-items: center; gap: 6px; font-size: .72rem; color: var(--muted); font-weight: 600; }
.gt-sel select { font: inherit; font-size: .8rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 8px; max-width: 190px; }
.gt-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; }
.gt-seg button { border: 0; border-left: 1px solid var(--line); background: var(--surface); padding: 6px 11px; font: inherit; font-size: .76rem; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.gt-seg button:first-child { border-left: 0; }
.gt-seg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.gt-check { font-size: .78rem; display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); cursor: pointer; }
.gt-check input { accent-color: var(--teal); }
.gt-hchips .chip { padding: 4px 10px; font-size: .74rem; }
.gt-hchip.t-crit { --chip-color: var(--crit); }
.gt-hchip.t-warn { --chip-color: var(--warn); }
.gt-hchip.t-good { --chip-color: var(--good); }
.gt-hchip.t-neut { --chip-color: var(--muted); }
.gt-hchip.t-done { --chip-color: var(--teal); }

/* ---------- the chart ---------- */
/* The chart scrolls inside itself (so the date header stays put), but a vertical
   scroll that reaches its top or bottom carries on to the PAGE — with
   overscroll-behavior: contain the wheel was swallowed there and, with the
   chart filling most of the screen, the top of the page was hard to get back
   to. Sideways stays contained so a trackpad swipe doesn't trigger browser Back. */
.gt-chart { position: relative; overflow: auto; max-height: calc(100vh - 250px); min-height: 340px; overscroll-behavior-x: contain; overscroll-behavior-y: auto; }
.gt-grid { position: relative; width: calc(var(--lab) + var(--tw)); min-width: 100%; }
.gt-row { display: flex; border-bottom: 1px solid var(--line); }
.gt-lab {
  position: sticky; left: 0; z-index: 3; flex: 0 0 var(--lab); width: var(--lab); background: var(--surface);
  border-right: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 10px 0 6px; min-width: 0;
}
.gt-track {
  position: relative; flex: 0 0 var(--tw); width: var(--tw);
  background-image:
    linear-gradient(to right, var(--gt-grid) 1px, transparent 1px),
    linear-gradient(to right, transparent calc(var(--px) * 5), var(--gt-wk) calc(var(--px) * 5));
  background-size: calc(var(--px) * 7) 100%, calc(var(--px) * 7) 100%;
  background-position: var(--off) 0, var(--off) 0;
}
.z-month .gt-track, .z-quarter .gt-track { background-image: linear-gradient(to right, var(--gt-grid) 1px, transparent 1px); background-size: calc(var(--px) * 7) 100%; }
.z-quarter .gt-track { background-image: none; }

/* the date header lives in .gt-chead, outside the scroll box (gantt.js) */
.gt-chead { position: sticky; top: var(--gt-stick, 0px); z-index: 8; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; background: var(--surface); box-shadow: 0 6px 12px -10px rgba(6, 33, 65, .35); }
.gt-chead::-webkit-scrollbar { display: none; }
.gt-thead { height: 52px; background: var(--surface); border-bottom: 1px solid var(--line-strong); }
.gt-thead .gt-lab { z-index: 7; justify-content: space-between; padding: 0 14px; font-size: .64rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-th-track { background: var(--surface) !important; }
.gt-th-top { position: absolute; left: 0; right: 0; top: 0; height: 26px; }
.gt-th-bot { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; border-top: 1px solid var(--line); }
.gt-th-cell { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: .74rem; font-weight: 700; padding: 5px 8px; white-space: nowrap; overflow: hidden; }
.gt-th-wk { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); font-size: .68rem; color: var(--muted); padding: 5px 5px; white-space: nowrap; overflow: hidden; }
.gt-th-wk.now { color: var(--accent); font-weight: 700; background: var(--accent-soft); }
.gt-th-day { position: absolute; top: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: .66rem; line-height: 1.05; color: var(--ink-2); border-left: 1px solid var(--line); }
.gt-th-day i { font-style: normal; color: var(--muted); font-size: .56rem; }
.gt-th-day.wk { background: var(--gt-wk); }
.gt-th-day.today { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.gt-today-chip {
  position: absolute; bottom: -9px; transform: translateX(-50%); z-index: 2; background: var(--accent-2); color: #fff;
  font-size: .58rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
.gt-todayline { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--accent-2); opacity: .7; z-index: 2; pointer-events: none; }
.gt-empty { padding: 40px; color: var(--muted); display: flex; gap: 12px; align-items: center; justify-content: center; position: sticky; left: 0; width: min(100%, 100vw); }

/* project rows */
.gt-proj { height: var(--row); }
.gt-proj:hover .gt-lab, .gt-proj:hover .gt-track { background-color: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.gt-proj.open { border-bottom-color: transparent; }
.gt-tog { appearance: none; border: 0; background: none; width: 24px; height: 24px; border-radius: 6px; font-size: 1.15rem; line-height: 1; color: var(--muted); cursor: pointer; transition: transform .15s, background .15s; flex: none; }
.gt-tog:hover { background: var(--surface-2); color: var(--ink); }
.gt-tog[aria-expanded="true"] { transform: rotate(90deg); color: var(--ink); }
.gt-pl { appearance: none; border: 0; background: none; text-align: left; padding: 0; font: inherit; color: inherit; cursor: pointer; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.gt-pl-name { font-weight: 700; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-pl:hover .gt-pl-name { color: var(--accent); }
.gt-pl-sub { font-size: .7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-pl-pct { color: var(--ink-2); font-weight: 600; }
.gt-hp { font-size: .64rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; flex: none; }
.gt-hp.t-crit { background: var(--crit-soft); color: var(--crit); }
.gt-hp.t-warn { background: var(--warn-soft); color: var(--warn); }
.gt-hp.t-good { background: var(--good-soft); color: var(--good); }
.gt-hp.t-neut { background: var(--surface-2); color: var(--muted); }
.gt-hp.t-done { background: var(--accent-soft); color: var(--accent); }

.gt-pbar { position: absolute; top: 15px; height: 18px; border-radius: 6px; background: var(--surface-3); overflow: hidden; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line-strong); transition: box-shadow .15s, transform .15s; }
.gt-pbar:hover { transform: translateY(-1px); box-shadow: inset 0 0 0 1px var(--line-strong), 0 6px 16px -8px rgba(6, 33, 65, .45); }
.gt-pbar.h-crit { box-shadow: inset 0 0 0 1.5px var(--crit); }
.gt-pbar.h-warn { box-shadow: inset 0 0 0 1.5px var(--warn); }
.gt-pfill { position: absolute; top: 0; bottom: 0; left: 0; background: linear-gradient(90deg, var(--cyan), var(--teal)); border-radius: 6px 0 0 6px; }
.gt-pbar.h-done .gt-pfill { background: var(--gt-done); }
.gt-base { position: absolute; top: 38px; height: 3px; border-radius: 2px; background: repeating-linear-gradient(90deg, var(--muted) 0 6px, transparent 6px 10px); opacity: .55; }
.gt-base.ph { top: 24px; height: 2px; }
.gt-od-notch { position: absolute; top: 11px; width: 4px; height: 26px; border-radius: 2px; background: var(--crit); z-index: 1; box-shadow: 0 0 0 2px var(--surface); }
.gt-fin { position: absolute; top: 15px; font-size: .72rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; display: flex; align-items: center; gap: 6px; height: 18px; pointer-events: none; }
.gt-fin b { color: var(--crit); font-weight: 700; }
.gt-diamond { width: 8px; height: 8px; transform: rotate(45deg); background: var(--ink); border-radius: 1px; }
.gt-logdots { position: absolute; left: 0; right: 0; bottom: 4px; height: 6px; }
.gt-ld { position: absolute; width: 6px; height: 6px; border-radius: 50%; }
.gt-ld.ok { background: var(--teal); }
.gt-ld.nw { background: var(--warn); }
.gt-ld.blk { background: var(--crit); }
.gt-nosched { position: absolute; top: 18px; font-size: .74rem; color: var(--muted); font-style: italic; white-space: nowrap; }

/* phase rows */
.gt-ph { height: var(--prow); }
.gt-ph .gt-lab { padding-left: 38px; gap: 7px; background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }
.gt-ph.empty .gt-lab { flex-basis: auto; width: auto; font-size: .76rem; }
.gt-ph:last-of-type { border-bottom-color: var(--line-strong); }
.gt-sd { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--line-strong); }
.gt-sd.st-done { background: var(--teal); }
.gt-sd.st-active { background: var(--cyan); box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 25%, transparent); }
.gt-sd.st-overdue { background: var(--crit); }
.gt-sd.st-unscheduled { background: transparent; border: 1.5px dashed var(--line-strong); }
.gt-ph-name { font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; color: var(--ink-2); }
.gt-ph.st-overdue .gt-ph-name { color: var(--crit); font-weight: 600; }
.gt-ph.st-active .gt-ph-name { color: var(--ink); font-weight: 600; }
.gt-ph.st-done .gt-ph-name { color: var(--muted); }
.gt-ms { color: var(--accent-2); }
.gt-bar { position: absolute; top: 8px; height: 14px; border-radius: 4px; cursor: pointer; transition: filter .15s; }
.gt-bar:hover { filter: brightness(1.08) saturate(1.1); }
.gt-bar.st-done { background: var(--gt-done); }
.gt-bar.st-active { background: var(--cyan); box-shadow: 0 0 0 2px color-mix(in srgb, var(--cyan) 22%, transparent); }
.gt-bar.st-overdue { background: var(--crit); }
.gt-bar.st-upcoming { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.gt-bar.ms::after { content: ""; position: absolute; right: -5px; top: 2px; width: 10px; height: 10px; transform: rotate(45deg); background: inherit; border-radius: 1px; }
.gt-bar.moved { outline: 1.5px dashed var(--warn); outline-offset: 1px; }
.gt-tail { position: absolute; top: 10px; height: 10px; border-radius: 0 3px 3px 0; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--crit) 60%, transparent) 0 3px, transparent 3px 6px); }
.gt-eta { position: absolute; top: 8px; height: 14px; border: 1.5px dashed var(--warn); border-left: 0; border-radius: 0 4px 4px 0; background: color-mix(in srgb, var(--warn) 8%, transparent); }
.gt-blab { position: absolute; top: 7px; font-size: .66rem; color: var(--muted); white-space: nowrap; pointer-events: none; }
.gt-blab .c { color: var(--crit); font-weight: 700; }
.gt-pld { position: absolute; bottom: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent-2); }
.gt-flag { font-size: .6rem; font-weight: 700; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--muted); white-space: nowrap; flex: none; }
.gt-flag.warn { background: var(--warn-soft); color: var(--warn); }
.gt-flag.crit { background: var(--crit-soft); color: var(--crit); }

/* avatars */
.gt-avs { display: inline-flex; flex: none; }
.gt-av {
  width: 24px; height: 24px; border-radius: 50%; background: var(--av, var(--muted)); color: #fff; font-size: .58rem; font-weight: 700;
  display: inline-grid; place-items: center; border: 2px solid var(--surface); margin-left: -7px; letter-spacing: .02em; flex: none;
}
.gt-avs .gt-av:first-child { margin-left: 0; }
.gt-av.sm { width: 22px; height: 22px; margin-left: 0; border-width: 0; }
.gt-av.more { background: var(--surface-3); color: var(--ink-2); }

/* legend */
.gt-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; padding: 10px 16px 12px; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
.gt-lg { display: inline-flex; align-items: center; gap: 6px; }
.gt-lg-sw { width: 18px; height: 10px; border-radius: 3px; }
.gt-lg-sw.st-done { background: var(--gt-done); }
.gt-lg-sw.st-active { background: var(--cyan); }
.gt-lg-sw.st-overdue { background: var(--crit); }
.gt-lg-sw.st-upcoming { background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.gt-lg-sw.tail { background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--crit) 60%, transparent) 0 3px, transparent 3px 6px); }
.gt-lg-sw.eta { border: 1.5px dashed var(--warn); }
.gt-lg-sw.base { height: 3px; background: repeating-linear-gradient(90deg, var(--muted) 0 5px, transparent 5px 8px); }
.gt-lg-sw.ld { width: 8px; height: 8px; border-radius: 50%; }
.gt-lg-sw.ld.ok { background: var(--teal); }
.gt-lg-sw.ld.nw { background: var(--warn); }
.gt-lg-sw.ld.blk { background: var(--crit); }
.gt-lg.m { margin-left: auto; }

/* tooltip (on <body>, so not under .gt) */
.gt-tip {
  position: fixed; z-index: 1000; max-width: min(360px, calc(100vw - 24px)); background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: 0 14px 36px -12px rgba(6, 33, 65, .38);
  padding: 10px 12px; font-size: .76rem; line-height: 1.45; pointer-events: none;
}
.gt-tip .tt-h { font-weight: 700; font-size: .86rem; margin-bottom: 2px; }
.gt-tip .tt-g { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 6px 0 2px; }
.gt-tip .tt-g span { color: var(--muted); }
.gt-tip .tt-s { margin-top: 8px; font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-tip .m { color: var(--muted); font-size: .72rem; }
.gt-tip .c, .gt-tip .h-crit, .gt-tip .st-overdue { color: var(--crit); }
.gt-tip .w, .gt-tip .h-warn { color: var(--warn); }
.gt-tip .h-good { color: var(--good); }
.gt-tip .st-active { color: var(--accent); }

/* ---------- needs attention ---------- */
.gt-att { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.gt-body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.gt-acard { border-top: 3px solid var(--line-strong); }
.gt-acard.t-crit { border-top-color: var(--crit); }
.gt-acard.t-warn { border-top-color: var(--warn); }
.gt-acard h2 { display: flex; align-items: center; gap: 8px; }
.gt-count { font-size: .7rem; font-weight: 700; background: var(--surface-2); color: var(--ink-2); padding: 1px 8px; border-radius: 999px; }
.gt-acard.t-crit .gt-count:not(.zero) { background: var(--crit-soft); color: var(--crit); }
.gt-acard.t-warn .gt-count:not(.zero) { background: var(--warn-soft); color: var(--warn); }
.gt-ok { color: var(--good); margin: 4px 0; }
.gt-tblwrap { overflow-x: auto; }
.gt-table { width: 100%; }
.gt-table td { vertical-align: top; }
.gt-table td.num { white-space: nowrap; }
.gt-note { max-width: 520px; font-size: .8rem; }
.gt-note q, .gt-why q, .gt-mini-note { font-style: italic; }
.gt-eta-t { font-size: .72rem; color: var(--warn); font-weight: 600; margin-top: 3px; }
.gt-link { appearance: none; border: 0; background: none; padding: 0; font: inherit; font-weight: 700; color: var(--ink); cursor: pointer; text-align: left; text-decoration: none; }
.gt-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.gt-link.sub { font-weight: 600; color: var(--accent); font-size: .8rem; }
.gt-late { display: inline-block; font-size: .7rem; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--crit-soft); color: var(--crit); white-space: nowrap; }
.gt-late.early { background: var(--good-soft); color: var(--good); }
.gt-late.hi { background: var(--crit); color: #fff; }
.gt-slip { display: inline-block; font-size: .66rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.gt-slip.s-ok { background: var(--good-soft); color: var(--good); }
.gt-slip.s-lo { background: var(--surface-2); color: var(--ink-2); }
.gt-slip.s-mid { background: var(--warn-soft); color: var(--warn); }
.gt-slip.s-hi { background: var(--crit-soft); color: var(--crit); }
.gt-strip { display: inline-flex; gap: 3px; }
.gt-sq { width: 20px; height: 20px; border-radius: 5px; display: inline-grid; place-items: center; font-size: .6rem; font-weight: 700; background: var(--surface-2); color: var(--muted); }
.gt-sq.ok { background: var(--teal); color: #062141; }
.gt-sq.nw { background: var(--warn-soft); color: var(--warn); box-shadow: inset 0 0 0 1.5px var(--warn); }
.gt-why-bars { display: grid; gap: 8px; }
.gt-wb { display: grid; grid-template-columns: 170px minmax(120px, 1fr) 90px minmax(0, 1.4fr); gap: 12px; align-items: center; font-size: .8rem; }
.gt-wb-l { font-weight: 600; }
.gt-wb-t { height: 12px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.gt-wb-f { display: block; height: 100%; background: var(--warn); border-radius: 6px; }
.gt-wb-n { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }
.gt-wb-s { color: var(--muted); font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) { .gt-wb { grid-template-columns: 1fr 70px; } .gt-wb-t { grid-column: 1 / -1; order: 3; } .gt-wb-s { grid-column: 1 / -1; order: 4; } }
.gt-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .84rem; }

/* ---------- lookahead + crew matrices ---------- */
.gt-la, .gt-cw { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .76rem; }
.gt-la th, .gt-cw th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-weight: 600; color: var(--muted); padding: 6px 6px 8px; text-align: left; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.gt-la th b, .gt-cw th b { display: block; color: var(--ink); font-size: .8rem; }
.gt-la td, .gt-cw td { border-bottom: 1px solid var(--line); padding: 6px; vertical-align: top; min-width: 112px; }
.gt-la th.mon, .gt-la td.mon, .gt-cw th.mon, .gt-cw td.mon { border-left: 1px solid var(--line-strong); }
.gt-la .today, .gt-cw .today { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.gt-la th.today b, .gt-cw th.today b { color: var(--accent); }
.gt-la-p, .gt-cw-n { position: sticky; left: 0; background: var(--surface); z-index: 2; min-width: 200px !important; max-width: 240px; }
.gt-la th.gt-la-p, .gt-cw th.gt-cw-n { z-index: 3; }
.gt-la-meta { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.gt-la-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.gt-lchip {
  display: block; width: 100%; text-align: left; margin: 0 0 4px; padding: 3px 6px 3px 7px; border: 0; border-left: 3px solid var(--cyan);
  border-radius: 4px; background: color-mix(in srgb, var(--cyan) 10%, var(--surface)); font: inherit; font-size: .7rem; line-height: 1.25;
  color: var(--ink); cursor: pointer; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.gt-lchip:hover { background: color-mix(in srgb, var(--cyan) 20%, var(--surface)); }
.gt-lchip.st-start { border-left-color: var(--teal); font-weight: 600; }
.gt-lchip.st-overdue { border-left-color: var(--crit); background: var(--crit-soft); color: var(--crit); font-weight: 600; }
.gt-lchip.ms { border-left-color: var(--accent-2); }
.gt-mslist { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: .84rem; }
.gt-ms-date { display: inline-block; min-width: 92px; font-weight: 700; color: var(--accent); }
.gt-cw-n { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.gt-cw td.gt-cw-n { display: table-cell; }
.gt-cw td.gt-cw-n > * { vertical-align: middle; margin-right: 6px; }
.gt-cchip {
  display: block; width: 100%; margin: 0 0 3px; padding: 3px 6px; border: 0; border-left: 3px solid var(--cc); border-radius: 4px;
  background: color-mix(in srgb, var(--cc) 14%, var(--surface)); font: inherit; font-size: .68rem; font-weight: 600; color: var(--ink);
  cursor: pointer; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gt-cchip.nw { opacity: .5; border-left-style: dashed; }
.gt-pchips { display: flex; flex-wrap: wrap; gap: 5px; }
.gt-pchip { border: 0; font: inherit; font-size: .7rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; cursor: pointer; background: var(--surface-2); color: var(--ink-2); }
.gt-pchip.t-crit { background: var(--crit-soft); color: var(--crit); }
.gt-pchip.t-warn { background: var(--warn-soft); color: var(--warn); }
.gt-pchip.t-good { background: var(--good-soft); color: var(--good); }

/* ---------- drawer ---------- */
.gt-drawer-wrap { position: fixed; inset: 0; z-index: 900; }
.gt-drawer-wrap[hidden] { display: none !important; }
.gt-scrim { position: absolute; inset: 0; background: rgba(6, 33, 65, .38); backdrop-filter: blur(2px); animation: gt-fade .18s ease-out; }
.gt-drawer {
  overscroll-behavior: contain;
  position: absolute; top: 0; right: 0; bottom: 0; width: min(780px, 100vw); background: var(--ground); overflow-y: auto;
  box-shadow: -24px 0 60px -24px rgba(0, 0, 0, .45); animation: gt-slide .22s ease-out;
}
.gt-drawer::before { content: ""; position: sticky; top: 0; display: block; height: 4px; background: var(--gradient); z-index: 3; }
@keyframes gt-fade { from { opacity: 0; } }
@keyframes gt-slide { from { transform: translateX(40px); opacity: 0; } }
body.gt-noscroll { overflow: hidden; }
.gt-dr-head { position: sticky; top: 4px; z-index: 2; background: var(--surface); border-bottom: 1px solid var(--line); padding: 16px 22px 12px; }
.gt-dr-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.gt-dr-eyebrow { font-size: .66rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-dr-head h2 { margin: 3px 0 8px; font-size: 1.3rem; letter-spacing: -.01em; }
.gt-dr-pills { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gt-dr-team { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; }
.gt-dr-ppl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: .78rem; }
.gt-dr-ppl .k { font-size: .62rem; font-weight: 700; letter-spacing: .1em; color: var(--muted); }
.gt-dr-person { display: inline-flex; align-items: center; gap: 5px; }
.gt-dr-body { padding: 16px 22px 40px; display: flex; flex-direction: column; gap: 14px; }
.gt-dr-sum { display: flex; gap: 18px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.gt-ring { --p: 0; flex: none; width: 86px; height: 86px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--teal) calc(var(--p) * 1%), var(--surface-3) 0); }
.gt-ring span { width: 66px; height: 66px; border-radius: 50%; background: var(--surface); display: grid; place-items: center; font-weight: 700; font-size: 1.05rem; }
.gt-ds-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; flex: 1; }
.gt-ds .k { font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-ds .v { font-size: .98rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.gt-ds .s { font-size: .7rem; color: var(--muted); }
.gt-ds.t-crit .s, .gt-ds.t-crit .v { color: var(--crit); }
.gt-ds.t-warn .s { color: var(--warn); font-weight: 600; }
.gt-dr-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.gt-dr-sec h3 { margin: 0 0 10px; font-size: .92rem; position: relative; padding-bottom: 6px; }
.gt-dr-sec h3::after { content: ""; position: absolute; left: 0; bottom: 0; width: 36px; height: 2px; border-radius: 2px; background: var(--gradient); }
.gt-why { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: .84rem; }
.gt-why li::marker { color: var(--muted); }
.gt-why li.crit::marker { color: var(--crit); }
.gt-why li.warn::marker { color: var(--warn); }
.gt-why li.good { color: var(--good); }
.gt-why li.m { color: var(--muted); }
.gt-ai p { margin: 0; font-size: .82rem; white-space: pre-line; color: var(--ink-2); }
.gt-mini { --ml: 250px; position: relative; display: flex; flex-direction: column; }
.gt-mini-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent-2); opacity: .6; z-index: 1; pointer-events: none; }
.gt-mini-row { display: grid; grid-template-columns: var(--ml) 1fr; gap: 10px; align-items: center; min-height: 28px; border-bottom: 1px dashed var(--line); padding: 2px 0; border-radius: 6px; }
.gt-mini-row.flash { animation: gt-flash 2.2s ease-out; }
@keyframes gt-flash { 0%, 40% { background: var(--accent-soft); } }
.gt-mini-lab { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: .74rem; }
.gt-mini-lab .n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gt-mini-lab .d { color: var(--muted); font-size: .66rem; white-space: nowrap; }
.gt-mini-row.st-overdue .gt-mini-lab .d, .gt-mini-row.st-overdue .gt-mini-lab .n { color: var(--crit); font-weight: 600; }
.gt-mini-track { position: relative; height: 22px; }
.gt-mini-base { position: absolute; top: 17px; height: 2px; background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 7px); opacity: .6; }
.gt-mini-bar { position: absolute; top: 5px; height: 10px; border-radius: 3px; background: var(--surface-3); box-shadow: inset 0 0 0 1px var(--line-strong); }
.gt-mini-bar.st-done { background: var(--gt-done); box-shadow: none; }
.gt-mini-bar.st-active { background: var(--cyan); box-shadow: none; }
.gt-mini-bar.st-overdue { background: var(--crit); box-shadow: none; }
.gt-mini-tail { position: absolute; top: 6px; height: 8px; background: repeating-linear-gradient(-45deg, color-mix(in srgb, var(--crit) 60%, transparent) 0 3px, transparent 3px 6px); }
.gt-mini-note { grid-column: 1 / -1; font-size: .7rem; color: var(--muted); padding: 0 0 2px 15px; }
.gt-mini-row .gt-mini-note { position: static; }
.gt-logs { display: grid; gap: 10px; }
.gt-log { border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: 8px; padding: 10px 12px; font-size: .8rem; background: var(--surface); }
.gt-log.nw { border-left-color: var(--warn); }
.gt-log.blk { border-left-color: var(--crit); }
.gt-log-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.gt-log-crew { font-size: .74rem; color: var(--muted); margin-bottom: 4px; }
.gt-log-f { display: grid; grid-template-columns: 54px 1fr; gap: 8px; margin-top: 4px; }
.gt-log-f .k { font-size: .6rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
.gt-log-f p { margin: 0; white-space: pre-line; }
.gt-log-f.warn .k, .gt-log-f.warn p { color: var(--warn); }
.gt-log-ph { margin: 6px 0 0; padding-left: 16px; font-size: .76rem; display: grid; gap: 3px; }
.gt-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.gt-photos img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); display: block; }
.gt-hist { display: grid; gap: 6px; }
.gt-hg { border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: .78rem; }
.gt-hg summary { display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none; flex-wrap: wrap; }
.gt-hg summary::-webkit-details-marker { display: none; }
.gt-hg summary::before { content: "›"; color: var(--muted); transition: transform .15s; }
.gt-hg[open] summary::before { transform: rotate(90deg); }
.gt-hg ul { margin: 6px 0 2px; padding-left: 18px; display: grid; gap: 2px; }
.gt-hg .n { font-weight: 600; }
.gt-comments { display: grid; gap: 10px; }
.gt-cmt { font-size: .8rem; }
.gt-cmt-h { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.gt-cmt p { margin: 0 0 0 28px; white-space: pre-line; color: var(--ink-2); }
.gt-dr-x { font-size: .9rem !important; }

/* ---------- original vs current timeline ---------- */
.gt { --plan: color-mix(in srgb, var(--ink) 16%, var(--surface)); --plan-edge: color-mix(in srgb, var(--ink) 55%, var(--surface)); }
.gt-plan-l .gt-seg button { padding: 6px 12px; }
.gt-planseg button[aria-pressed="true"] { background: var(--ink); color: var(--surface); }
.gt-planbanner {
  display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; padding: 10px 16px; font-size: .8rem; color: var(--ink-2);
  background: color-mix(in srgb, var(--plan) 45%, var(--surface)); border-bottom: 1px solid var(--line);
}
.gt-planbanner b { color: var(--ink); }
.gt-planbanner > span { flex: 1 1 420px; }
.gt-planbanner button { margin-left: auto; flex: none; }
.gt-pbar.plan { background: repeating-linear-gradient(135deg, var(--plan) 0 6px, color-mix(in srgb, var(--plan) 60%, var(--surface)) 6px 12px); box-shadow: inset 0 0 0 1.5px var(--plan-edge); }
.gt-diamond.plan { background: var(--plan-edge); }
.gt-bar.plan { background: var(--plan); box-shadow: inset 0 0 0 1px var(--plan-edge); }
.gt-bar.plan.done { background: color-mix(in srgb, var(--plan) 50%, var(--gt-done)); }
.gt-bar.plan.fixed { box-shadow: inset 0 0 0 1.5px var(--warn); }
.gt-lg-sw.plan { background: var(--plan); box-shadow: inset 0 0 0 1px var(--plan-edge); }
.gt-mini-bar.plan { background: var(--plan); box-shadow: inset 0 0 0 1px var(--plan-edge); }

/* drawer: schedule section */
.gt-sched-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.gt-sched-head h3 { margin: 0 auto 0 0 !important; }
.gt-prov { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.gt-prov p { margin: 6px 0 0; }
.gt-prov-fin { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; }
.gt-prov-fin > span:not(.gt-slip):not(.gt-prov-arrow) { display: inline-flex; flex-direction: column; }
.gt-prov-fin .k { font-size: .6rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-prov-fin b { font-size: .95rem; }
.gt-prov-arrow { color: var(--muted); font-size: 1.1rem; }
.gt-mini-lab .gt-flag, .gt-ed .gt-flag { margin-left: 4px; background: var(--warn-soft); color: var(--warn); }
.gt-mini-lab .gt-late { padding: 0 6px; }
.gt-bedits { margin-top: 10px; }
.gt-bedit { border-top: 1px dashed var(--line); padding: 8px 0 4px; font-size: .78rem; }
.gt-bedit q { display: block; margin: 3px 0; font-style: italic; color: var(--ink-2); }

/* drawer: original-timeline editor (admins) */
.gt-ed-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; font-size: .78rem; }
.gt-ed-tools .k { font-size: .62rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.gt-ed-shift { display: inline-flex; align-items: center; gap: 8px; }
.gt-ed-sep { width: 1px; height: 20px; background: var(--line-strong); margin: 0 4px; }
.gt-ed-num { width: 64px; font: inherit; font-size: .8rem; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.gt-ed-msg { margin: 8px 0 0; font-size: .78rem; color: var(--accent); font-weight: 600; }
.gt-ed-wrap { max-height: 52vh; overflow: auto; margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; }
.gt-ed { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .76rem; }
.gt-ed th { position: sticky; top: 0; z-index: 1; background: var(--surface); text-align: left; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line-strong); }
.gt-ed td { padding: 4px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.gt-ed td.n { white-space: normal; min-width: 180px; max-width: 260px; }
.gt-ed tr.changed td { background: color-mix(in srgb, var(--accent-soft) 70%, var(--surface)); }
.gt-ed tr.changed td.n { box-shadow: inset 3px 0 0 var(--cyan); font-weight: 600; }
.gt-ed input[type="date"] { font: inherit; font-size: .78rem; padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); }
.gt-ed input.wk { border-color: var(--warn); background: var(--warn-soft); }
.gt-ed input.bad { border-color: var(--crit); background: var(--crit-soft); }
.gt-ed-foot { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.gt-ed-note { width: 100%; font: inherit; font-size: .82rem; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); color: var(--ink); resize: vertical; }
.gt-ed-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (max-width: 640px) {
  .gt-plan-l > span { display: none; }
  .gt-ed-tools { flex-direction: column; align-items: flex-start; }
  .gt-ed-sep { display: none; }
  .gt-ed input[type="date"], .gt-ed-note, .gt-ed-num { font-size: 16px; }
}

/* touch: bigger targets for the small controls */
@media (pointer: coarse) {
  .gt-tog { height: 36px; min-width: 32px; }
  .gt-seg button { min-height: 36px; }
  .gt-check { min-height: 36px; }
  .gt-lchip, .gt-cchip { padding-top: 6px; padding-bottom: 6px; }
  .gt-ed input[type="date"] { min-height: 36px; }
}

/* ---------- present mode ---------- */
body.gt-present .topbar, body.gt-present .sidebar, body.gt-present #pipebar, body.gt-present #sourcebar { display: none !important; }
body.gt-present .shell { grid-template-columns: minmax(0, 1fr); }
body.gt-present .gt-chart { max-height: calc(100vh - 220px); }

/* ---------- phones ---------- */
@media (max-width: 640px) {
  .gt { --lab: 150px; --row: 58px; }
  .gt-tog { width: 28px; margin-left: -4px; }
  .gt-proj .gt-lab { gap: 4px; padding-right: 6px; }
  .gt-la-p, .gt-cw-n { min-width: 124px !important; max-width: 150px; }
  .gt-la td, .gt-cw td { min-width: 96px; }
  .gt-drawer { width: 100vw; }
  /* phones: no box-inside-the-page for vertical scrolling — a finger on the
     chart scrolls the page; the chart itself only pans sideways */
  .gt-chart, .gt-la-wrap { max-height: none; min-height: 0; }
  .gt-titles h1 { font-size: 1.3rem; }
  .gt-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .gt-kpi { padding: 12px 12px 10px; }
  .gt-kpi .v { font-size: 1.35rem; }
  .gt-proj .gt-avs, .gt-ph .gt-avs, .gt-flag { display: none; }
  .gt-proj .gt-lab { flex-wrap: wrap; align-content: center; row-gap: 2px; }
  .gt-proj .gt-hp { order: 3; margin-left: 28px; }
  .gt-proj .gt-pl { flex-basis: calc(100% - 32px); }
  .gt-ph .gt-lab { padding-left: 14px; }
  .gt-search, .gt-sel select { font-size: 16px; }
  .gt-legend .gt-lg.m { margin-left: 0; }
  .gt-dr-body, .gt-dr-head { padding-left: 14px; padding-right: 14px; }
  .gt-dr-sum { flex-direction: column; align-items: stretch; }
  .gt-ring { align-self: center; }
  .gt-ds-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gt-mini { --ml: 130px; }
  .gt-log-f { grid-template-columns: 1fr; gap: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .gt-drawer, .gt-scrim, .gt-mini-row.flash { animation: none; }
  .gt-kpi, .gt-pbar, .gt-tog { transition: none; }
}
