:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f9fafb;
  --border: #e6e8ec;
  --text: #1b1f27;
  --muted: #6b7280;
  --accent: #5b5bd6;
  --accent-soft: #ededfc;
  --side: #ffffff;
  --side-text: #4b5563;
  --danger: #dc3e42;
  --danger-soft: #feebec;
  --warn: #d97706;
  --warn-soft: #fff4e0;
  --good: #1f9d55;
  --good-soft: #e6f6ec;
  --info: #3e63dd;
  --low: #8b8d98;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  --radius: 10px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent); }
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }
h3 { font-size: 15px; margin: 0; font-weight: 600; }
code { font-size: 12px; background: var(--panel-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); }

/* ---------- shell ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--side);
  color: var(--side-text);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; white-space: nowrap; color: var(--text); font-weight: 700; font-size: 16px; padding: 4px 10px 20px; }
.brand:hover { color: var(--text); }
.brand { flex-direction: column; align-items: flex-start; gap: 4px; }
.brand-logo { width: 168px; height: auto; display: block; }
.brand-product { font-size: 11px; font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; color: #f59e0b; padding-left: 2px; }
nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-weight: 500; color: var(--side-text); }
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; border-radius: 10px; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding: 10px; font-size: 12px; display: flex; flex-direction: column; gap: 10px; }
.syncinfo { display: flex; align-items: center; gap: 8px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #c4c7cf; flex-shrink: 0; }
.live-dot.on { background: #3dd68c; box-shadow: 0 0 0 3px rgba(61, 214, 140, 0.2); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(61, 214, 140, 0.05); } }
.demo-pill { align-self: flex-start; background: var(--warn-soft); color: var(--warn); padding: 2px 8px; border-radius: 6px; font-weight: 600; }

.shell { flex: 1; min-width: 0; }
main { padding: 24px 28px 60px; max-width: 1500px; }
.banner { padding: 10px 28px; font-size: 13px; }
.banner-error { background: var(--danger-soft); color: var(--danger); }
.banner-live { background: var(--good-soft); color: var(--text); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.banner-live a { font-weight: 600; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.sub { color: var(--muted); margin: 4px 0 0; }
.crumbs { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.crumbs a:hover { text-decoration: underline; }
.head-actions { display: flex; gap: 8px; }
.person-title { display: flex; gap: 14px; align-items: center; }
.person-title > .av { width: 48px; height: 48px; font-size: 17px; }

/* ---------- utility ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { margin-left: auto; text-align: right; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.t-danger { color: var(--danger); }
.t-warn { color: var(--warn); }
.t-good { color: var(--good); }
.pad { padding: 0 16px; }
.mt { margin-top: 18px; }
.empty { color: var(--muted); padding: 18px; text-align: center; list-style: none; }
.link { font-size: 12px; color: var(--accent); font-weight: 500; }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { color: #fff; filter: brightness(1.08); }

/* ---------- cards & grids ---------- */
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.section-title { margin: 26px 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.section-title:first-of-type { margin-top: 4px; }

.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
a.kpi:hover { border-color: var(--accent); color: inherit; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-value small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 2px; }
.kpi-value.kpi-text { font-size: 16px; padding: 6px 0; }
.kpi-foot { font-size: 12px; color: var(--muted); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -16px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table tbody tr:hover { background: var(--panel-2); }
.table.compact td { padding-top: 7px; padding-bottom: 7px; }
.is-done .task-name { text-decoration: line-through; color: var(--muted); }
.task-cell { min-width: 260px; }
.task-name { font-weight: 500; }
.task-meta { display: flex; flex-wrap: wrap; gap: 6px; font-size: 11px; color: var(--muted); margin-top: 2px; }
.progress-cell { min-width: 120px; }
.progress { height: 6px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin-bottom: 2px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

/* ---------- badges ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.status::before { content: ''; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.prio { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.p-urgent { background: var(--danger-soft); color: var(--danger); }
.p-high { background: var(--warn-soft); color: var(--warn); }
.p-normal { background: var(--accent-soft); color: var(--accent); }
.p-low { background: var(--panel-2); color: var(--low); }
.tag { background: var(--panel-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.tag-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.due { white-space: nowrap; font-size: 12px; }
.due.overdue { color: var(--danger); font-weight: 600; }
.due.soon { color: var(--warn); font-weight: 600; }

.health { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.h-on-track { background: var(--good-soft); color: var(--good); }
.h-at-risk { background: var(--warn-soft); color: var(--warn); }
.h-off-track { background: var(--danger-soft); color: var(--danger); }
.h-done { background: var(--accent-soft); color: var(--accent); }
.h-idle { background: var(--panel-2); color: var(--muted); }
.health-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.health-dot.h-on-track { background: var(--good); }
.health-dot.h-at-risk { background: var(--warn); }
.health-dot.h-off-track { background: var(--danger); }
.health-dot.h-idle, .health-dot.h-done { background: var(--muted); }

.flag { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.f-overloaded { background: var(--danger-soft); color: var(--danger); }
.f-idle { background: var(--warn-soft); color: var(--warn); }
.f-ok { background: var(--good-soft); color: var(--good); }
.f-quiet { background: var(--panel-2); color: var(--muted); }

.av { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--c, #888); color: #fff; font-size: 10px; font-weight: 700; flex-shrink: 0; object-fit: cover; border: 2px solid var(--panel); }
.avs { display: inline-flex; align-items: center; }
.avs .av + .av { margin-left: -8px; }

.rec { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); animation: blink 1.6s infinite; flex-shrink: 0; }
@keyframes blink { 50% { opacity: 0.35; } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip { padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); background: var(--panel); font-size: 12px; font-weight: 500; }
.chip b { margin-left: 4px; color: var(--muted); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip.active b { color: rgba(255, 255, 255, 0.8); }
.chip-clear { color: var(--muted); }
.page-head .chips { margin-bottom: 0; }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
select { font: inherit; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); max-width: 260px; }
.check { display: flex; align-items: center; gap: 6px; font-size: 13px; }

/* ---------- actions ---------- */
.actions { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.action { display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 10px 0; background: var(--panel); overflow: hidden; }
.sev-bar { width: 4px; flex-shrink: 0; border-radius: 0 3px 3px 0; margin: -10px 0; }
.sev-critical .sev-bar { background: var(--danger); }
.sev-high .sev-bar { background: var(--warn); }
.sev-medium .sev-bar { background: var(--info); }
.sev-low .sev-bar { background: var(--low); }
.action-body { flex: 1; min-width: 0; }
.action-top { display: flex; gap: 6px; align-items: center; font-size: 11px; }
.sev-label { text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; font-size: 10px; }
.sev-critical .sev-label { color: var(--danger); }
.sev-high .sev-label { color: var(--warn); }
.sev-medium .sev-label { color: var(--info); }
.sev-low .sev-label { color: var(--low); }
.cat { font-weight: 600; color: var(--muted); }
.action-title { font-weight: 600; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-detail { font-size: 12px; color: var(--muted); }
.action-do { font-size: 12px; color: var(--accent); font-weight: 500; margin-top: 3px; }
.action-people { flex-shrink: 0; align-self: center; }
.actions-lg .action { padding-top: 12px; padding-bottom: 12px; }

.sev-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.sev-tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-left-width: 4px; box-shadow: var(--shadow); }
.sev-tile b { font-size: 22px; }
.sev-tile.sev-critical { border-left-color: var(--danger); }
.sev-tile.sev-high { border-left-color: var(--warn); }
.sev-tile.sev-medium { border-left-color: var(--info); }
.sev-tile.sev-low { border-left-color: var(--low); }
.sev-tile.active { outline: 2px solid var(--accent); }
.rules { margin-top: 16px; }
.rules summary { cursor: pointer; font-weight: 600; }
.rules li { margin: 6px 0; color: var(--muted); }

/* ---------- who's working ---------- */
.who { list-style: none; margin: 0; padding: 0; }
.who li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); }
.who li:last-child { border-bottom: 0; }
.who .av { width: 32px; height: 32px; font-size: 11px; }
.who-body { flex: 1; min-width: 0; }
.who-name { font-weight: 600; display: flex; gap: 8px; align-items: center; }
.who-task { font-size: 12px; display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.who-task a { overflow: hidden; text-overflow: ellipsis; }
.who-stats { display: flex; gap: 6px; }
.who-stats span, .who-legend span { width: 52px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; }
.who-legend { display: flex; justify-content: flex-end; gap: 6px; }
.who-legend span { font-weight: 400; font-size: 10px; }

/* ---------- charts ---------- */
.chart-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.chart-legend strong { color: var(--text); }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.sw-created, .bar-created { background: #c4c6f5; }
.sw-done, .bar-done { background: var(--accent); }
.bars { display: flex; align-items: stretch; gap: 4px; height: 150px; }
.bar-col { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.bar-col.weekend { opacity: 0.55; }
.bar-pair { flex: 1; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--border); }
.bar { flex: 1; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar-label { text-align: center; font-size: 10px; color: var(--muted); }

.stacked { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--panel-2); gap: 1px; }
.stacked span { background: var(--c); }
.stacked-lg { height: 16px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c); margin-right: 6px; vertical-align: -1px; }
.legend b { color: var(--muted); margin-left: 2px; }

.spark { display: inline-flex; align-items: flex-end; gap: 2px; height: 22px; }
.spark i { width: 5px; background: var(--accent); opacity: 0.75; border-radius: 1px; min-height: 2px; }

/* ---------- project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.project-card { display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--border); color: inherit; }
.project-card:hover { color: inherit; border-color: var(--accent); }
.hb-on-track { border-top-color: var(--good); }
.hb-at-risk { border-top-color: var(--warn); }
.hb-off-track { border-top-color: var(--danger); }
.pc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.pc-stats { display: grid; grid-template-columns: repeat(5, 1fr); text-align: center; gap: 4px; }
.pc-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.pc-stats span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.pc-row { display: flex; justify-content: space-between; font-size: 12px; }
.pc-reasons { font-size: 12px; color: var(--warn); }
.pc-foot { display: flex; justify-content: space-between; align-items: flex-end; margin-top: auto; }

/* ---------- people ---------- */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.person-card { display: flex; flex-direction: column; gap: 12px; }
.person-card.pf-overloaded { border-color: var(--danger); }
.person-head { display: flex; align-items: center; gap: 10px; }
.person-head .av { width: 38px; height: 38px; font-size: 13px; }
.person-head .flag { margin-left: auto; }
.now { background: var(--panel-2); border-radius: 8px; padding: 10px 12px; min-height: 64px; }
.now-label { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.now-task { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wip { display: flex; align-items: center; gap: 8px; }
.load-bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.load-bar span { display: block; height: 100%; background: var(--accent); }
.load-bar.over span { background: var(--danger); }
.person-foot { display: flex; align-items: flex-end; gap: 12px; }
.daily { display: flex; gap: 4px; height: 44px; align-items: stretch; }
.daily div { width: 14px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.daily i { width: 100%; background: var(--accent); border-radius: 2px; min-height: 2px; opacity: 0.8; }
.daily span { font-size: 9px; color: var(--muted); }
.proj-list { border-top: 1px solid var(--border); padding-top: 8px; }

.load { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.load li { display: flex; align-items: center; gap: 10px; }
.load-name { width: 130px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.simple { list-style: none; margin: 0; padding: 0; }
.simple li { padding: 7px 0; border-bottom: 1px solid var(--border); display: flex; gap: 8px; align-items: center; }
.simple li:last-child { border-bottom: 0; }

.status-group { margin-bottom: 8px; }
.status-group summary { cursor: pointer; padding: 6px 0; list-style: none; display: flex; gap: 8px; align-items: center; }
.status-group summary::-webkit-details-marker { display: none; }
.status-group summary::before { content: '▸'; color: var(--muted); font-size: 11px; transition: transform 0.15s; }
.status-group[open] summary::before { transform: rotate(90deg); }

.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 12px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

/* ---------- activity feed ---------- */
.feed-wrap { max-height: 460px; overflow-y: auto; }
.feed-full { max-height: none; }
.feed-day { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 600; padding: 10px 0 4px; position: sticky; top: 0; background: var(--panel); z-index: 1; }
.feed { list-style: none; margin: 0; padding: 0; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; position: relative; }
.feed-time { font-size: 11px; color: var(--muted); width: 38px; flex-shrink: 0; padding-top: 2px; font-variant-numeric: tabular-nums; }
.feed-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); margin-top: 4px; flex-shrink: 0; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--border); }
.k-completed .feed-dot { background: var(--good); }
.k-created .feed-dot { background: var(--accent); }
.k-status .feed-dot { background: var(--info); }
.k-due .feed-dot, .k-priority .feed-dot { background: var(--warn); }
.k-deleted .feed-dot, .k-reopened .feed-dot { background: var(--danger); }
.k-comment .feed-dot { background: #a855f7; }
.feed-body { flex: 1; min-width: 0; }
.feed-body a { font-weight: 500; }
.feed-detail { font-size: 12px; color: var(--muted); }
.feed-people .av { width: 22px; height: 22px; font-size: 9px; }

/* ---------- gantt ---------- */
.gantt { --label: 300px; font-size: 12px; overflow-x: auto; }
.gantt-axis, .gantt-row { display: flex; min-width: 900px; }
.gantt-label { width: var(--label); flex-shrink: 0; padding: 5px 10px 5px 0; display: flex; align-items: center; gap: 6px; min-width: 0; }
.gantt-label > a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.gantt-who .av { width: 20px; height: 20px; font-size: 8px; }
.gantt-track { flex: 1; position: relative; min-height: 28px; }
.gantt-axis .gantt-track { height: 22px; border-bottom: 1px solid var(--border); }
.tick { position: absolute; top: 3px; font-size: 10px; color: var(--muted); transform: translateX(-50%); white-space: nowrap; }
.grid-line { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); opacity: 0.6; }
.today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); opacity: 0.7; z-index: 2; }
.gantt-row { border-bottom: 1px solid var(--border); }
.gantt-row:hover { background: var(--panel-2); }
.gantt-project { cursor: pointer; list-style: none; font-weight: 600; background: var(--panel-2); }
.gantt-project::-webkit-details-marker { display: none; }
.gbar { position: absolute; top: 8px; height: 12px; border-radius: 4px; z-index: 1; }
.gbar.summary { background: var(--accent); opacity: 0.35; height: 8px; top: 10px; }
.gbar.active, .gl.active { background: var(--accent); }
.gbar.todo, .gl.todo { background: #a4a8b8; }
.gbar.blocked, .gl.blocked { background: var(--warn); }
.gbar.overdue, .gl.overdue { background: var(--danger); }
.gbar.done, .gl.done { background: var(--good); opacity: 0.6; }
.gpoint, .gl-point { position: absolute; top: 8px; width: 11px; height: 11px; transform: translateX(-50%) rotate(45deg); background: #a4a8b8; z-index: 1; border-radius: 2px; }
.gpoint.active { background: var(--accent); }
.gpoint.overdue { background: var(--danger); }
.gpoint.blocked { background: var(--warn); }
.gpoint.done { background: var(--good); }
.gantt-legend { display: flex; flex-wrap: wrap; gap: 16px; padding-top: 12px; color: var(--muted); }
.gl { display: inline-block; width: 18px; height: 8px; border-radius: 3px; margin-right: 6px; }
.gl-point { position: static; display: inline-block; width: 9px; height: 9px; transform: rotate(45deg); margin-right: 6px; }

/* ---------- misc ---------- */
.toast { position: fixed; bottom: 18px; right: 18px; background: #1b1f27; color: #fff; padding: 8px 14px; border-radius: 8px; font-size: 12px; opacity: 0; transform: translateY(8px); transition: all 0.2s; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }
.loading { text-align: center; padding: 120px 20px; }
.loading h1 { justify-content: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); margin: 0 auto 18px; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1200px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  body { flex-direction: column; }
  .sidebar { width: auto; height: auto; position: static; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; overflow-x: auto; }
  .brand { padding: 0; }
  nav { flex-direction: row; }
  .nav-item span:not(.nav-badge) { display: none; }
  .sidebar-foot { margin: 0 0 0 auto; flex-direction: row; padding: 0; white-space: nowrap; }
  main { padding: 16px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sev-tiles { grid-template-columns: repeat(2, 1fr); }
  .gantt { --label: 180px; }
}

/* ---------- team view ---------- */
.center { text-align: center; }
.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 2px; box-shadow: var(--shadow); }
.seg a { padding: 5px 12px; border-radius: 6px; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg a:hover { color: var(--text); }
.seg a.active { background: var(--accent-soft); color: var(--accent); }
.tm-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
#team-search { font: inherit; padding: 7px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); width: 240px; }
#team-search:focus, select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

/* compact list: one slim line per person, click to expand their tasks */
.tl { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.tl-grid { display: grid; grid-template-columns: 28px minmax(170px, 1.3fr) 170px 64px 88px 72px 64px minmax(180px, 2fr); align-items: center; gap: 12px; padding: 0 16px; }
.tl-head { padding-top: 9px; padding-bottom: 9px; background: var(--panel-2); border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); position: sticky; top: 0; z-index: 3; }
.tl-toggle-all { display: flex; gap: 2px; }
.tl-btn { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; }
.tl-btn:hover { color: var(--accent); }

.tl-row { border-bottom: 1px solid var(--border); }
.tl-row:last-of-type { border-bottom: 0; }
.tl-row[hidden] { display: none; }
.tl-line { list-style: none; cursor: pointer; min-height: 52px; }
.tl-line::-webkit-details-marker { display: none; }
.tl-line:hover { background: var(--panel-2); }
.tl-row[open] > .tl-line { background: var(--accent-soft); }
.tl-chev { color: var(--muted); font-size: 11px; transition: transform 0.15s; justify-self: center; }
.tl-row[open] .tl-chev { transform: rotate(90deg); color: var(--accent); }
.tl-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tl-person .av { width: 30px; height: 30px; font-size: 11px; }
.tl-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-unassigned .tl-name { color: var(--muted); }
.av-none { background: var(--panel); color: var(--muted); border: 1px dashed var(--muted); }
.tl-load { display: flex; align-items: center; gap: 8px; }
.tl-load .tm-bar { flex: 1; }
.tl-pct { font-size: 12px; width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.tl-line .num { font-variant-numeric: tabular-nums; font-weight: 500; }
.tl-now { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 13px; }
.tl-now-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.tm-bar { display: block; height: 6px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--border); overflow: hidden; }
.tm-bar span { display: block; height: 100%; border-radius: 4px; }
.tm-bar-ok span { background: var(--good); }
.tm-bar-high span { background: var(--warn); }
.tm-bar-over span { background: var(--danger); }
.tm-pct-ok { color: var(--muted); }
.tm-pct-high { color: var(--warn); font-weight: 600; }
.tm-pct-over { color: var(--danger); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dot-prog { background: var(--accent); }
.dot-todo { background: #b5b9c4; }
.dot-done { background: var(--good); }
.tm-sq { display: inline-block; width: 9px; height: 9px; border-radius: 2px; background: var(--c); flex-shrink: 0; }
.tm-n { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 0 7px; font-size: 11px; color: var(--text); font-weight: 500; }

.tl-body { padding: 4px 16px 14px 56px; background: var(--panel); }
.tl-meta { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 10px 0 6px; }
.tl-tasks { margin: 0; }
.tl-tasks td { padding-left: 8px !important; padding-right: 8px !important; }
.tl-group td { background: none; border-bottom: 1px solid var(--border); padding-top: 14px !important; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.tl-group td > * { vertical-align: middle; }
.tl-group .dot { margin-right: 6px; }
.tl-tasks tr.tl-group:hover { background: none; }
.tl-task { display: flex; align-items: center; gap: 8px; min-width: 280px; }
.tl-task a { font-weight: 500; }
.tl-where { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-none { color: var(--muted); font-size: 12px; }
.tm-task[hidden] { display: none; }
.tm-task.is-done a { text-decoration: line-through; color: var(--muted); }

@media (max-width: 1100px) {
  .tl-grid { grid-template-columns: 24px minmax(150px, 1fr) 130px 52px 76px 64px 52px; }
  .tl-grid > :last-child { display: none; }
}
@media (max-width: 900px) {
  #team-search { width: 100%; }
  .tl-grid { grid-template-columns: 20px minmax(0, 1fr) 90px 44px; gap: 8px; padding: 0 10px; }
  .tl-grid > :nth-child(5), .tl-grid > :nth-child(6), .tl-grid > :nth-child(7) { display: none; }
  .tl-body { padding: 4px 10px 12px; }
  .tl-where { display: none; }
  .tl-task { min-width: 0; }
}
.tl-task .tag { font-size: 11px; padding: 0 5px; }
@media (max-width: 900px) { .brand { gap: 1px; } .brand-logo { width: 104px; } .brand-product { font-size: 9px; } }
tr.row-link { cursor: pointer; }
.sync-btn { margin-left: auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel); color: var(--muted); cursor: pointer; padding: 0; flex-shrink: 0; }
.sync-btn:hover { color: var(--accent); border-color: var(--accent); }
.sync-btn:disabled { cursor: progress; }
.sync-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.sync-btn.spinning { color: var(--accent); }
.sync-btn.spinning svg { animation: spin 0.8s linear infinite; }
