:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #6f6d68;
  --grid: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #256abf;
  --accent-soft: #e3eefb;
  --accent-text: #ffffff;
  --series-1: #2a78d6; /* tasks / on track */
  --series-2: #eb6834; /* next actions */
  --series-3: #1baf7a; /* revision deadlines */
  --critical: #d03b3b;
  --critical-soft: #fbeaea;
  --critical-text: #a72a2a;
  --good: #0ca30c;
  --good-text: #006300;
  --soon-soft: #fdf1d8;
  --soon-text: #7a5200;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 1px 1px rgba(11, 11, 11, 0.02);
  --radius: 12px;
  --brand-bg: #0f2747;
  --brand-fg: #f2f6fc;
  --brand-muted: #a8bbd6;
  --brand-line: rgba(242, 246, 252, 0.18);
  --brand-accent: #7fb2f5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #9c9a93;
    --grid: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-soft: #1b2a3d;
    --accent-text: #0b0b0b;
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --critical-soft: #3a1d1c;
    --critical-text: #ff9b9b;
    --good-text: #0ca30c;
    --soon-soft: #3a2f14;
    --soon-text: #f5cf7a;
    --shadow: none;
    --brand-bg: #10213a;
    --brand-accent: #8ab9f7;
  }
}
:root[data-theme="dark"] {
  --brand-bg: #10213a;
  --brand-accent: #8ab9f7;
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #9c9a93;
  --grid: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.1);
  --accent: #3987e5;
  --accent-soft: #1b2a3d;
  --accent-text: #0b0b0b;
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --critical-soft: #3a1d1c;
  --critical-text: #ff9b9b;
  --good-text: #0ca30c;
  --soon-soft: #3a2f14;
  --soon-text: #f5cf7a;
  --shadow: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; font-weight: 650; letter-spacing: -0.01em; margin: 0; line-height: 1.2; }
h2 { font-size: 0.95rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
svg { display: block; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.meta { color: var(--text-2); font-size: 0.82rem; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  position: sticky; top: env(safe-area-inset-top, 0px); height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 16px;
  background: var(--surface); border-right: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 1rem; padding: 4px 8px; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-text); }
.brand-mark svg { width: 18px; height: 18px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; color: var(--text-2); font-weight: 500;
}
.nav a svg { width: 18px; height: 18px; fill: currentColor; opacity: 0.75; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a.active svg { opacity: 1; }

.new-btn { width: 100%; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; font-size: 0.82rem; }

.content { min-width: 0; }
main { max-width: 1280px; margin: 0 auto; padding: 28px 32px 48px; }
.warning { max-width: 1280px; margin: 16px auto 0; padding: 10px 16px; background: var(--soon-soft); color: var(--soon-text); border-radius: 8px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.eyebrow { margin: 0 0 4px; color: var(--text-2); font-size: 0.85rem; }

/* ---------- Panels & tiles ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; min-width: 0;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 14px; }
.panel-head + .panel-sub { margin-top: -10px; }
.panel-sub { color: var(--text-2); font-size: 0.82rem; margin: 0 0 14px; }
.panel-link { font-size: 0.85rem; }
.subhead { font-size: 0.8rem; font-weight: 600; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.04em; margin: 18px 0 4px; }

.count {
  font-size: 0.72rem; font-weight: 600; color: var(--text-2);
  background: var(--surface-2); border-radius: 999px; padding: 1px 8px;
}

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 20px;
}
.tile-label { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 0.85rem; font-weight: 500; }
.tile-label svg { width: 15px; height: 15px; }
.tile-value { font-size: 2rem; font-weight: 650; line-height: 1.15; margin: 6px 0 2px; letter-spacing: -0.02em; }
.tile-sub { color: var(--text-2); font-size: 0.8rem; }
.tile-critical { border-color: color-mix(in srgb, var(--critical) 45%, transparent); }
.tile-critical .tile-label { color: var(--critical-text); }
.tile-critical .tile-label svg { color: var(--critical); }
.tile-good .tile-label svg { color: var(--good); }

.dash-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.dash-grid > .panel { margin-bottom: 0; }
.span-2 { grid-column: span 2; }

.empty { text-align: center; max-width: 560px; margin: 80px auto; }
.empty p { color: var(--text-2); margin: 12px 0 24px; }

/* ---------- Controls ---------- */
.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 14px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--critical-text); }
.btn.danger-solid { background: var(--critical); border-color: var(--critical); color: #ffffff; }
.btn.small { padding: 4px 10px; font-size: 0.85rem; }
.link-btn { font: inherit; background: none; border: none; padding: 0; color: var(--accent); cursor: pointer; }
.icon-btn {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 1.2rem; line-height: 1; padding: 2px 6px; border-radius: 6px;
}
.icon-btn:hover { color: var(--critical-text); background: var(--critical-soft); }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.segmented button {
  font: inherit; font-size: 0.85rem; font-weight: 500; border: none; background: none; color: var(--text-2);
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.segmented button:disabled { opacity: 0.5; cursor: not-allowed; }

input, textarea, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%;
}
select { width: auto; padding: 5px 8px; cursor: pointer; }
.field select { width: 100%; padding: 7px 10px; font-size: 0.95rem; }
select.needs-value { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type="checkbox"] { width: auto; }
textarea { resize: vertical; }

.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.82rem; color: var(--text-2); margin-bottom: 12px; }
.field input, .field textarea { font-size: 0.95rem; }
.field-inline { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--text-2); }
.field-inline input { width: auto; padding: 5px 10px; }

.title-input { font-size: 1.5rem; font-weight: 650; flex: 1; min-width: 0; background: transparent; border-color: transparent; padding-left: 6px; }
.title-input:hover { border-color: var(--border); }

/* ---------- Lists ---------- */
.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--grid); }
.item:first-child { border-top: none; }
.item-body { flex: 1; min-width: 0; }
.item-title { overflow-wrap: anywhere; font-weight: 500; }
.item .meta { display: flex; gap: 4px; flex-wrap: wrap; }
.item.is-done .item-title { text-decoration: line-through; color: var(--muted); font-weight: 400; }
.check { width: 18px; height: 18px; flex: none; accent-color: var(--accent); cursor: pointer; margin: 0; }
.kind-key { width: 18px; flex: none; display: grid; place-items: center; }

.due { flex: none; font-size: 0.76rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; }
.due-overdue { background: var(--critical-soft); color: var(--critical-text); }
.due-soon { background: var(--soon-soft); color: var(--soon-text); }
.due-later { background: var(--surface-2); color: var(--text-2); }

.pill {
  display: inline-block; font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  padding: 2px 9px; border-radius: 999px; background: var(--surface-2); color: var(--text-2);
}

/* ---------- Chart pieces ---------- */
.key { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.key-task, .key-ontrack { background: var(--series-1); }
.key-next { background: var(--series-2); }
.key-revision { background: var(--series-3); }
.key-late { background: var(--critical); }
.key-none { background: transparent; box-shadow: inset 0 0 0 2px var(--baseline); }
.key-ontrack, .key-late { border-radius: 3px; }

.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 0.8rem; color: var(--text-2); margin-bottom: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Timeline */
.timeline { display: flex; flex-direction: column; }
.lane { display: grid; grid-template-columns: 190px 1fr; align-items: center; gap: 12px; min-height: 40px; border-top: 1px solid var(--grid); }
.lane-axis { border-top: none; min-height: 28px; }
.lane-label { font-size: 0.85rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lane-track { position: relative; height: 40px; }
.lane-axis .lane-track { height: 28px; }
.tick {
  position: absolute; top: 4px; transform: translateX(-50%);
  font-size: 0.74rem; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.lane-track::before, .lane-track::after { content: ""; position: absolute; top: 0; bottom: 0; pointer-events: none; }
.lane-track::before { left: 0; width: var(--od); background: var(--critical-soft); }
.lane-track::after { left: var(--today); width: 1px; background: var(--baseline); }
.tick-today { transform: none; margin-left: 4px; color: var(--text-2); font-weight: 600; }
.key-band { border-radius: 2px; background: var(--critical-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--critical) 35%, transparent); }
.lane-axis .lane-track::before, .lane-axis .lane-track::after { content: none; }

.dot {
  position: absolute; top: 50%; width: 12px; height: 12px; padding: 0; margin: 0;
  transform: translate(-50%, -50%); border: none; border-radius: 50%; cursor: pointer;
  box-shadow: 0 0 0 2px var(--surface); z-index: 1;
}
.dot::before { content: ""; position: absolute; inset: -8px; border-radius: 50%; } /* larger hit area */
.dot:hover, .dot:focus-visible { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); outline: none; z-index: 2; }
.dot-task { background: var(--series-1); }
.dot-next { background: var(--series-2); }
.dot-revision { background: var(--series-3); }
.dot-count {
  position: absolute; left: 10px; top: -10px; font-size: 0.68rem; font-weight: 700; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 5px; line-height: 1.4;
}

/* Calendar */
.cal-head { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.cal-title { font-weight: 600; flex: 1; text-align: center; }
.cal-nav { font-size: 1.3rem; padding: 0 8px; color: var(--text-2); }
.cal-nav:hover { color: var(--accent); background: var(--accent-soft); }
.cal-today { font-size: 0.82rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; }
.cal-wd { text-align: center; font-size: 0.72rem; font-weight: 600; color: var(--muted); padding-bottom: 4px; }
.cal-day {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 3px;
  aspect-ratio: 1 / 1; min-height: 34px; padding: 5px 0 0; font: inherit; font-size: 0.82rem;
  background: none; border: none; border-radius: 8px; cursor: pointer; color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.is-other { color: var(--muted); }
.cal-day.is-other .key { opacity: 0.6; }
.cal-num { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; line-height: 1; }
.cal-day.is-today .cal-num { background: var(--accent); color: var(--accent-text); font-weight: 700; }
.cal-day.is-selected { background: var(--accent-soft); }
.cal-day.has-overdue .cal-num { box-shadow: inset 0 0 0 1.5px var(--critical); }
.cal-day.is-today.has-overdue .cal-num { box-shadow: 0 0 0 1.5px var(--critical); }
.cal-dots { display: flex; gap: 2px; height: 6px; }
.cal-dots .key { width: 6px; height: 6px; }
.cal-legend { margin: 10px 0 0; gap: 10px; font-size: 0.74rem; }
.key-ring { background: transparent; box-shadow: inset 0 0 0 1.5px var(--critical); }
.cal-list { margin-top: 12px; border-top: 1px solid var(--grid); padding-top: 4px; }
.cal-list .subhead { margin-top: 8px; }

/* Horizontal bars (pipeline, workload) */
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 112px 1fr; align-items: center; gap: 10px; }
.bar-label { font-size: 0.85rem; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 8px; }
.step-no { width: 18px; height: 18px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); font-size: 0.7rem; font-weight: 600; color: var(--text-2); }
.bar-track {
  display: flex; align-items: center; gap: 8px; height: 28px; width: 100%;
  padding: 0; border: none; background: none; cursor: default; font: inherit; color: inherit;
  border-left: 1px solid var(--baseline);
}
.bar, .stack { height: 16px; border-radius: 0 4px 4px 0; transition: filter 0.15s; }
.bar { background: var(--series-1); }
.stack { display: flex; gap: 2px; overflow: hidden; }
.seg { height: 100%; }
.seg-ontrack { background: var(--series-1); }
.seg-late { background: var(--critical); }
.bar-track:hover .bar, .bar-track:hover .stack, .bar-track:focus-visible .bar, .bar-track:focus-visible .stack { filter: brightness(1.12); }
.bar-value { font-size: 0.82rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }

/* Tooltip */
.tooltip {
  position: absolute; z-index: 50; max-width: 300px; pointer-events: none;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14); padding: 8px 12px; font-size: 0.82rem;
}
.tip-title { color: var(--text-2); font-size: 0.76rem; margin-bottom: 4px; }
.tip-row { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; padding: 2px 0; }
.tip-row .key { width: 12px; height: 3px; border-radius: 2px; transform: translateY(-3px); }
.tip-row strong { font-weight: 600; }
.tip-label { color: var(--text-2); font-size: 0.76rem; flex-basis: 100%; padding-left: 18px; }
.tip-row:not(:has(.key)) .tip-label { padding-left: 0; }

.stage-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stage-alt { font-size: 0.74rem; font-weight: 400; color: var(--muted); }
.bar-label .stage-name { overflow: hidden; }
.bar-label .stage-name, .stage-alt { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.bar-row { min-height: 28px; }

/* Next action: who we're waiting for */
.field-label { font-size: 0.82rem; color: var(--text-2); margin-bottom: 6px; }
.owners { list-style: none; margin: 0 0 8px; padding: 0; }
.owners li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--grid); }
.owners li:first-child { border-top: none; }
.owner-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; }
.owner-name { font-weight: 500; }
.owners li.is-done .owner-name { color: var(--text-2); }
.owner-state { font-size: 0.74rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; }
.state-waiting { background: var(--soon-soft); color: var(--soon-text); }
.state-done { background: var(--surface-2); color: var(--good-text); }
.owner-add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chip {
  font: inherit; font-size: 0.82rem; cursor: pointer; padding: 3px 10px; border-radius: 999px;
  border: 1px dashed var(--baseline); background: none; color: var(--text-2);
}
.chip:hover { border-style: solid; border-color: var(--accent); color: var(--accent); }
.add-owner { display: flex; gap: 8px; margin-bottom: 12px; }
.add-owner input { flex: 1; min-width: 0; padding: 5px 10px; }
.waiting-line {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 8px; background: var(--surface-2); font-size: 0.88rem; font-weight: 500;
}

/* Team roles */
.team-head { margin: 14px 0 2px; }
.team-head:first-of-type { margin-top: 0; }
.role-select { font-size: 0.8rem; padding: 3px 6px; }
.avatar.avatar-contributor { background: var(--surface-2); color: var(--text-2); }
.role-pick { flex: 1 1 100%; flex-wrap: wrap; order: 2; }
.role-pick label { position: relative; }
.role-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.role-pick span {
  display: block; font-size: 0.85rem; font-weight: 500; color: var(--text-2);
  padding: 5px 12px; border-radius: 6px; cursor: pointer; white-space: nowrap;
}
.role-pick input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.role-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.add-member .btn { order: 1; }

/* Study types */
.type-badge {
  display: inline-block; font-size: 0.74rem; font-weight: 600; white-space: nowrap;
  padding: 2px 8px; border-radius: 6px;
}
.type-review { background: var(--accent-soft); color: var(--accent); }
.type-primary { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
.type-none { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--border); font-weight: 500; }
.card-type { margin: 2px 0 4px; }
.type-row { margin: -12px 0 18px; }
.side-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side-col > .panel { margin-bottom: 0; }
.type-group {
  display: flex; align-items: center; gap: 6px; font: inherit; font-size: 0.78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-2);
  background: none; border: none; padding: 0; margin: 12px 0 6px; cursor: pointer;
}
.type-group:first-of-type { margin-top: 0; }
.type-group:hover { color: var(--accent); }
.bar-track.is-link { cursor: pointer; }

/* Tappable due labels, tiles and the "what's due" pop-up */
.due[role="button"] { cursor: pointer; }
.due[role="button"]:hover { filter: brightness(0.95); text-decoration: underline; }
.due[role="button"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tile-btn { text-align: left; font: inherit; color: inherit; cursor: pointer; width: 100%; }
.tile-btn:hover { border-color: var(--accent); }
.tile-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.due-modal { width: min(520px, 100%); max-height: min(80vh, 640px); overflow: auto; }
.due-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.due-head .icon-btn { font-size: 1.5rem; margin: -4px -6px 0 0; }
.due-list .item:first-child { border-top: none; }
.due-date { flex: none; font-size: 0.78rem; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.due-date.is-late { color: var(--critical-text); }

/* Meetings */
.key-meeting { border-radius: 2px; background: var(--text-2); }
.cal-dots .key-meeting { width: 6px; height: 6px; }
.repeat-icon { color: var(--muted); font-size: 0.9em; margin-left: 2px; }
.meeting-time { flex: none; width: 92px; font-size: 0.82rem; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; display: flex; flex-direction: column; }
.meeting-time small { font-weight: 500; color: var(--text-2); font-size: 0.76rem; }
.meeting-item { align-items: flex-start; }
.meeting-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; font-size: 0.82rem; }
.danger-link { color: var(--critical-text); }
.join-link { font-weight: 600; }
.meeting-form { width: min(520px, 100%); max-height: 90vh; overflow: auto; gap: 4px; }
.meeting-form .row { align-items: flex-end; gap: 10px; }
.meeting-form .field { margin-bottom: 10px; }
.meeting-form [hidden] { display: none; }
.meetings-grid { align-items: start; }
.due-add { margin: 12px 0 0; }
.series-item .meta { margin-top: 2px; }

/* Dialog */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(11, 11, 11, 0.45);
}
.modal {
  width: min(440px, 100%); background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.25); display: flex; flex-direction: column; gap: 12px;
}
.modal h2 { font-size: 1.05rem; }
.modal-msg { margin: 0; color: var(--text-2); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Stage meter */
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.meter-label { font-size: 0.82rem; font-weight: 500; }
.meter-steps { display: flex; gap: 2px; }
.meter-steps i { flex: 1; height: 5px; border-radius: 2px; background: var(--accent-soft); }
.meter-steps i.on { background: var(--accent); }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { text-align: left; color: var(--text-2); font-weight: 500; font-size: 0.78rem; padding: 8px 12px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid var(--grid); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
.cell-project { font-weight: 500; min-width: 220px; }

/* ---------- Board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.column h2 { margin-bottom: 10px; padding: 2px 4px; align-items: flex-start; justify-content: space-between; min-height: 2.6em; }
.card {
  display: block; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; margin-bottom: 8px; box-shadow: var(--shadow);
}
.card:hover { text-decoration: none; border-color: var(--accent); }
.card-title { font-weight: 600; line-height: 1.3; margin-bottom: 4px; overflow-wrap: anywhere; }
.card-next { font-size: 0.84rem; margin: 6px 0; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ---------- Project page ---------- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.grid-2 > .panel { margin-bottom: 0; }
.grid-2 .panel h2 { margin-bottom: 12px; }
.grid-2 .row { align-items: flex-end; }

.stepper { list-style: none; display: flex; padding: 0; margin: 0 0 12px; gap: 4px; flex-wrap: wrap; }
.stepper li { flex: 1; min-width: 90px; }
.stepper button {
  width: 100%; font: inherit; font-size: 0.85rem; cursor: pointer; padding: 8px 4px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 8px;
}
.stepper button:hover { background: var(--surface-2); }
.stepper li.past button { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.stepper li.current button { background: var(--accent); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }

.add-task, .add-member { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.add-task input[name="title"] { flex: 2 1 160px; }
.add-task input[name="owner"] { flex: 1 1 100px; }
.add-member input[name="name"] { flex: 1 1 160px; }
.add-task input[name="due"] { flex: 0 1 150px; }
.add-member { margin-top: 12px; }

.team { list-style: none; margin: 0; padding: 0; }
.team li { display: flex; align-items: center; gap: 10px; padding: 6px 0; }
.team .meta { display: block; }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .search-input { width: 100%; }
  .people-grid { grid-template-columns: 1fr; }
  .project-list th:nth-child(n+4), .project-list td:nth-child(n+4) { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap;
    gap: 8px 12px; padding: 10px 16px; border-right: none; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0; }
  .brand-text { display: none; }
  .nav { flex-direction: row; }
  .new-btn { width: auto; margin-left: auto; padding: 5px 10px; font-size: 0.85rem; }
  .sidebar-foot { order: 9; width: 100%; flex-direction: row; flex-wrap: wrap; gap: 12px; }
  main { padding: 20px 16px 40px; }
  h1 { font-size: 1.3rem; }
  .tiles { gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 1.6rem; }
  .lane { grid-template-columns: 96px 1fr; gap: 8px; }
  .tick:nth-of-type(even) { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .board { grid-template-columns: 1fr; overflow-x: visible; }
  th:nth-child(n+4), td:nth-child(n+4) { display: none; }
  .cell-project { min-width: 140px; }
}

/* ---------- Accounts: sign-in page ---------- */
.sb-mode .shell:not(.ready) { display: none; }

.auth { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; background: var(--page); }
.auth[hidden] { display: none; }
.auth-brand {
  background: var(--brand-bg); color: var(--brand-fg);
  padding: clamp(32px, 6vw, 72px); display: flex; flex-direction: column; justify-content: center; gap: 22px;
}
.brand-mark.big { width: 48px; height: 48px; border-radius: 12px; background: var(--brand-accent); color: var(--brand-bg); }
.brand-mark.big svg { width: 28px; height: 28px; }
.auth-title { font-size: clamp(2rem, 3.6vw, 2.9rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.08; text-wrap: balance; max-width: 14ch; }
.auth-author { margin: -8px 0 0; font-size: 1.05rem; font-weight: 500; }
.auth-author span { display: block; margin-top: 2px; color: var(--brand-muted); font-size: 0.82rem; font-weight: 600; letter-spacing: 0.12em; }

.auth-pipeline { list-style: none; display: flex; margin: 10px 0 0; padding: 0; max-width: 520px; }
.auth-pipeline li {
  flex: 1; position: relative; padding-top: 22px; font-size: 0.72rem; color: var(--brand-muted);
  text-align: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.auth-pipeline li::before {
  content: ""; position: absolute; top: 5px; left: 50%; width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; border: 2px solid var(--brand-line); background: var(--brand-bg); z-index: 1;
}
.auth-pipeline li::after { content: ""; position: absolute; top: 10px; left: -50%; width: 100%; height: 2px; background: var(--brand-line); }
.auth-pipeline li:first-child::after { content: none; }
.auth-pipeline li.done::before { background: var(--brand-accent); border-color: var(--brand-accent); }
.auth-pipeline li.done::after, .auth-pipeline li.now::after { background: var(--brand-accent); }
.auth-pipeline li.now { color: var(--brand-fg); font-weight: 600; }
.auth-pipeline li.now::before { border-color: var(--brand-accent); box-shadow: 0 0 0 4px rgba(127, 178, 245, 0.25); }
.auth-pipeline li.done { color: var(--brand-fg); }

.auth-points { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 46ch; }
.auth-points li { position: relative; padding-left: 22px; color: var(--brand-muted); font-size: 0.95rem; }
.auth-points li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 10px; height: 2px; background: var(--brand-accent); }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; padding: 40px 16px; }
.auth-form {
  width: min(400px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 1px 2px rgba(11, 11, 11, 0.04), 0 12px 32px rgba(15, 39, 71, 0.08); padding: 28px; display: flex; flex-direction: column;
}
.auth-form h2 { font-size: 1.3rem; margin-bottom: 6px; }
.auth-help { margin: 0 0 18px; color: var(--text-2); }
.auth-form .field input { padding: 9px 12px; }
.auth-field[hidden] { display: none; }
.auth-error { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: var(--critical-soft); color: var(--critical-text); font-size: 0.88rem; }
.auth-submit { padding: 10px 14px; font-size: 0.95rem; }
.auth-submit[hidden] { display: none; }
.auth-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 14px; font-size: 0.88rem; }
.auth-links:empty { display: none; }
.auth-foot { color: var(--muted); font-size: 0.8rem; text-align: center; margin: 0; }
.auth[data-mode="loading"] .auth-help { display: none; }

/* Sidebar brand + account */
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-author { font-size: 0.74rem; font-weight: 500; color: var(--muted); margin-top: 2px; }
.account { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; margin-bottom: 4px; border-bottom: 1px solid var(--grid); width: 100%; }
.account[hidden] { display: none; }
.account-name { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }

/* Removing projects */
.select-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 16px; border-radius: 10px; font-size: 0.9rem;
}
.select-bar { background: var(--surface); border: 1px solid var(--border); }
.select-bar .btn { margin-left: auto; }
.select-bar .btn:disabled { opacity: 0.5; cursor: not-allowed; }
.card.is-selectable { cursor: pointer; position: relative; padding-left: 38px; }
.card.is-selectable:hover { border-color: var(--accent); }
.card.is-selected { border-color: var(--critical); box-shadow: 0 0 0 2px var(--critical-soft); }
.card-check { position: absolute; left: 12px; top: 14px; }

/* Projects list + search */
.search-input { width: 230px; padding: 6px 10px; }
.no-results { padding: 24px 0; }
.list-panel { padding: 6px 8px; }
.project-list tbody tr.row-link { cursor: pointer; }
.project-list tr.is-selected td { background: var(--critical-soft); }
.cell-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.cell-check { width: 32px; }
h1 .count { font-size: 0.8rem; vertical-align: middle; }

/* People */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.people-grid .panel { margin-bottom: 0; }
.person-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.person-head h2 { font-size: 1rem; }
.person-head .avatar { width: 38px; height: 38px; font-size: 0.82rem; }
.waiting-on { color: var(--soon-text); font-weight: 600; }
.person-papers { list-style: none; margin: 0; padding: 0; }
.person-papers li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 0; border-top: 1px solid var(--grid); }
.person-papers li a { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.person-paper-meta { flex-basis: 100%; font-size: 0.8rem; color: var(--text-2); }
.role-badge { font-size: 0.72rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.role-first { background: var(--accent); color: var(--accent-text); }
.role-coauthor { background: var(--accent-soft); color: var(--accent); }
.role-contributor { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.role-assigned { background: var(--soon-soft); color: var(--soon-text); }

/* Invitations */
.invite-error {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 10px 14px; border-radius: 10px; background: var(--critical-soft); color: var(--critical-text); font-size: 0.9rem;
}
.invite-error .btn { margin-left: auto; }
.invite-panel { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.invites { list-style: none; margin: 0; padding: 0; }
.invites li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--grid); flex-wrap: wrap; }
.invites li:first-child { border-top: none; padding-top: 0; }
.invite-icon { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.invite-actions { display: flex; gap: 8px; margin-left: auto; }
.nav-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text); font-size: 0.72rem; font-weight: 700;
  display: inline-grid; place-items: center;
}
.nav-badge[hidden] { display: none; }
.flash { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: var(--accent-soft); color: var(--text); font-weight: 500; }

.app-version { font-size: 0.72rem; color: var(--muted); }

/* Sharing */
.share-panel { margin-top: 0; }
.people { list-style: none; margin: 0 0 12px; padding: 0; }
.people li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--grid); }
.people li:first-child { border-top: none; }
.people .meta { display: block; }
.access-badge { font-size: 0.74rem; font-weight: 600; border-radius: 999px; padding: 2px 9px; white-space: nowrap; background: var(--surface-2); color: var(--text-2); }
.access-owner { background: var(--accent-soft); color: var(--accent); }
.access-invited { background: var(--soon-soft); color: var(--soon-text); }
.share-form { display: flex; gap: 8px; flex-wrap: wrap; }
.share-form input { flex: 1 1 220px; }
.share-msg { margin: 10px 0 0; font-size: 0.88rem; color: var(--good-text); }
.share-msg.is-error { color: var(--critical-text); }
.share-msg.is-warn { color: var(--soon-text); }
.share-msg p { margin: 0 0 8px; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.share-actions a.btn { color: var(--text); text-decoration: none; }
.invites li.is-focus { background: var(--accent-soft); border-radius: 10px; padding-left: 10px; padding-right: 10px; }
.share-chip {
  display: inline-block; font-size: 0.72rem; font-weight: 600; white-space: nowrap; padding: 1px 8px;
  border-radius: 999px; color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
}

@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { padding: 28px 20px; gap: 14px; }
  .auth-points { display: none; }
  .auth-pipeline li { font-size: 0.62rem; }
  .auth-panel { justify-content: flex-start; padding: 24px 16px 40px; }
  .auth-form { padding: 22px; }
  .brand-author { display: none; }
}

/* ---------- Phone: app-style bottom tab bar ---------- */
@media (max-width: 760px) {
  .sidebar { padding: 10px 16px; gap: 6px 12px; }
  .brand { font-size: 0.95rem; }
  .brand-mark { width: 28px; height: 28px; }
  .sidebar-foot { font-size: 0.78rem; gap: 4px 12px; }
  #sync-status { display: none; }
  .account { flex-direction: row; align-items: center; gap: 10px; border-bottom: none; padding-bottom: 0; margin-bottom: 0; width: auto; }

  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 0;
    padding: 4px 8px calc(4px + env(safe-area-inset-bottom, 0px));
    background: var(--surface); border-top: 1px solid var(--border);
  }
  .nav a { position: relative; flex-direction: column; gap: 2px; padding: 6px 0; font-size: 0.72rem; justify-content: center; border-radius: 10px; }
  .nav a svg { width: 22px; height: 22px; }
  .nav a.active { background: none; }
  .nav a.active svg { color: var(--accent); }
  .nav-badge { position: absolute; top: 2px; left: calc(50% + 6px); margin: 0; }

  .new-btn {
    position: fixed; z-index: 31; right: 16px; bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    width: auto; margin: 0; padding: 12px 18px; border-radius: 999px; font-size: 0.95rem;
    box-shadow: 0 6px 18px rgba(15, 39, 71, 0.3);
  }
  main { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
  .nav a, .new-btn, .btn, .card, tr.row-link { -webkit-tap-highlight-color: transparent; }
  .page-head [data-action="new-project"] { display: none; }
  .project-list th:nth-child(n+3), .project-list td:nth-child(n+3) { display: none; }
  .project-list:has(.cell-check) th:nth-child(3), .project-list:has(.cell-check) td:nth-child(3) { display: table-cell; }
  .sb-mode .shell:not(.ready) ~ * .nav { display: none; }
}
