:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --ink: #1d1b18;
  --ink-2: #4a463f;
  --muted: #8a8478;
  --line: #e7e3da;
  --line-2: #efece5;
  --charcoal: #1f1d1a;
  --brand: #feb81d;
  --brand-ink: #3a2a00;

  --green: #2e9d5b;
  --green-soft: #dcf1e3;
  --yellow: #f2b10c;
  --yellow-soft: #fdf1cc;
  --red: #dc4a3d;
  --red-soft: #fbe2de;
  --blue: #2f6fe4;

  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(29, 27, 24, .06);
  --shadow: 0 1px 2px rgba(29, 27, 24, .05), 0 6px 24px -8px rgba(29, 27, 24, .12);
  --shadow-lg: 0 24px 64px -16px rgba(29, 27, 24, .35);
  --font: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
  --display: 'Barlow Semi Condensed', 'Inter', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 12px 28px;
  background: var(--charcoal);
  color: #f3efe6;
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: rgba(255, 255, 255, .18); }
.brand-title { font-family: var(--display); font-weight: 600; font-size: 19px; letter-spacing: .02em; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.meeting-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 6px 6px 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .05);
  border-radius: 999px; color: #f3efe6;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.meeting-chip:hover { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .24); }
.meeting-chip-text { font-size: 13px; color: #cfc8ba; white-space: nowrap; }
.meeting-chip-text b { color: #fff; font-weight: 600; }
.meeting-chip-cta { background: #fff; color: var(--charcoal); border-radius: 999px; padding: 5px 12px; font-weight: 600; font-size: 12.5px; }
.meeting-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px rgba(254, 184, 29, .18); }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-weight: 600; font-size: 13.5px;
  transition: transform .12s var(--ease), background .15s, box-shadow .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #ffc43f; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.btn-dark { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

.whoami { position: relative; }
.whoami-btn {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border-radius: 999px; border: 1px solid rgba(255, 255, 255, .14); background: transparent; color: #f3efe6;
}
.whoami-btn:hover { background: rgba(255, 255, 255, .08); }
.whoami-btn small { display: block; font-size: 11px; color: #a39c8e; line-height: 1.1; text-align: left; }
.whoami-btn span { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; text-align: left; }

.demo-banner {
  text-align: center; font-size: 12.5px; color: var(--ink-2);
  background: #efe9db; padding: 6px 16px; border-bottom: 1px solid var(--line);
}
.demo-banner button { border: 0; background: none; text-decoration: underline; color: var(--ink); padding: 0 0 0 6px; font-weight: 600; }

/* ---------- Avatars ---------- */
.av {
  --h: 30;
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center; flex: none;
  background: hsl(var(--h) 70% 90%); color: hsl(var(--h) 55% 28%);
  font-weight: 700; font-size: 12px; letter-spacing: -.01em;
  box-shadow: inset 0 0 0 1px hsl(var(--h) 50% 80%);
}
.av.sm { width: 22px; height: 22px; font-size: 10.5px; }
.av.lg { width: 40px; height: 40px; font-size: 15px; }

/* ---------- Page ---------- */
.page { padding: 22px 28px 60px; max-width: 1680px; margin: 0 auto; }

.summary { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat {
  position: relative; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .2s var(--ease), transform .2s var(--ease);
}
.stat:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.stat.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink), var(--shadow); }
.stat-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-top i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.stat-num { font-family: var(--display); font-size: 34px; font-weight: 600; line-height: 1.1; margin-top: 4px; letter-spacing: -.01em; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.active .stat-sub::after { content: ' · filtering'; color: var(--ink); font-weight: 600; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.search {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; width: 280px; color: var(--muted);
  transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(29, 27, 24, .07); }
.search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; color: var(--ink); }
kbd { font: 600 11px var(--font); color: var(--muted); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: var(--surface-2); }

.pm-filter { display: flex; align-items: center; gap: 4px; }
.pm-pill {
  display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px 0 4px;
  border-radius: 999px; border: 1px solid transparent; background: transparent; font-weight: 500; font-size: 13px; color: var(--ink-2);
  transition: background .15s, border-color .15s, opacity .15s;
}
.pm-pill:hover { background: var(--surface); border-color: var(--line); }
.pm-pill.on { background: var(--surface); border-color: var(--ink); color: var(--ink); }
.pm-filter.filtering .pm-pill:not(.on) { opacity: .55; }
.pm-pill .count { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.seg { display: inline-flex; background: #ebe7de; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-ui { width: 30px; height: 18px; border-radius: 999px; background: #d8d3c8; position: relative; transition: background .2s var(--ease); }
.toggle-ui::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.toggle input:checked + .toggle-ui { background: var(--ink); }
.toggle input:checked + .toggle-ui::after { transform: translateX(12px); }
.toggle input:focus-visible + .toggle-ui { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Board ---------- */
.board-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.board-scroll { overflow: auto; max-height: calc(100vh - 300px); min-height: 360px; }
.board { border-collapse: separate; border-spacing: 0; width: 100%; min-width: 1240px; }
.board th, .board td { padding: 0; text-align: left; vertical-align: middle; }

.board thead th {
  position: sticky; top: 0; z-index: 3;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase;
  padding: 10px 10px; white-space: nowrap;
}
.board thead th.ck { text-align: center; width: 58px; padding: 10px 2px; }
.board thead th.sortable { cursor: pointer; }
.board thead th.sortable:hover { color: var(--ink); }
.board thead th .arrow { opacity: .8; margin-left: 2px; }
.board thead th:first-child { left: 0; z-index: 4; }

.board td { border-bottom: 1px solid var(--line-2); height: 58px; padding: 0 10px; }
.board tbody tr.job { transition: background .12s; }
.board tbody tr.job:hover td { background: #fcfbf8; }
.board tbody tr.job:hover td.c-job { background: #fcfbf8; }

.c-job {
  position: sticky; left: 0; z-index: 2; background: var(--surface);
  min-width: 290px; max-width: 320px; padding-left: 0 !important;
  box-shadow: 1px 0 0 var(--line-2);
}
.job-cell { display: flex; align-items: center; gap: 12px; height: 58px; cursor: pointer; padding-right: 8px; }
.health { width: 4px; align-self: stretch; margin: 10px 0; border-radius: 0 4px 4px 0; background: transparent; flex: none; }
.health.h-red { background: var(--red); }
.health.h-yellow { background: var(--yellow); }
.health.h-green { background: var(--green); }
.job-num { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink-2); letter-spacing: .01em; width: 52px; flex: none; font-variant-numeric: tabular-nums; }
.job-main { min-width: 0; flex: 1; }
.job-name { font-weight: 600; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.job-name:hover .job-name-text { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.job-name-text { overflow: hidden; text-overflow: ellipsis; }
.job-meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hot { flex: none; font-size: 10.5px; font-weight: 700; color: #a33b1c; background: #fde4d6; padding: 1px 6px; border-radius: 5px; letter-spacing: .02em; }
.new-pip { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; display: inline-block; box-shadow: 0 0 0 3px rgba(47, 111, 228, .15); }

.c-pm .pm-cell { display: flex; align-items: center; gap: 8px; font-weight: 500; white-space: nowrap; border: 0; background: none; padding: 4px 6px 4px 4px; border-radius: 999px; margin-left: -4px; }
.c-pm .pm-cell:hover { background: var(--line-2); }
.c-pm .pm-cell.locked { cursor: default; }
.c-pm .pm-cell.locked:hover { background: none; }

.stage {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px;
  border-radius: 7px; font-size: 12.5px; font-weight: 600; white-space: nowrap; border: 0;
  background: #eeebe4; color: var(--ink-2);
}
.stage::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.stage.st-design { background: #efe9fb; color: #5b3fb0; }
.stage.st-bid { background: var(--yellow-soft); color: #8a5a00; }
.stage.st-approved { background: #e1f3e8; color: #23703f; }
.stage.st-scheduled { background: #e3edfc; color: #2558b8; }
.stage.st-progress { background: #fff0d4; color: #9a5b00; }
.stage.st-cleanup { background: #e5f1f1; color: #2b6c6c; }
.stage.st-complete { background: #ececec; color: #5a5a5a; }
button.stage:hover { filter: brightness(.97); }

.ready { display: inline-flex; align-items: center; gap: 4px; margin-left: 6px; font-size: 11.5px; font-weight: 700; color: var(--green); white-space: nowrap; }

.progress { display: flex; align-items: center; gap: 10px; cursor: pointer; border: 0; background: none; padding: 6px 0; width: 132px; }
.bar { flex: 1; height: 6px; border-radius: 999px; background: #ece8df; overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--ink-2); transition: width .5s var(--ease); }
.bar.full > i { background: var(--green); }
.pct { font-variant-numeric: tabular-nums; font-size: 12.5px; font-weight: 600; width: 34px; text-align: right; color: var(--ink-2); }

.dur { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.dur small { display: block; color: var(--muted); font-size: 11.5px; }

td.ck { text-align: center; padding: 0 2px !important; }
.cell {
  position: relative; width: 40px; height: 30px; border-radius: 8px; border: 0;
  display: inline-grid; place-items: center; color: #fff;
  transition: transform .12s var(--ease), box-shadow .15s, background .2s;
}
.cell:hover { transform: scale(1.08); box-shadow: 0 2px 8px -2px rgba(0,0,0,.25); }
.cell:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.cell svg { width: 15px; height: 15px; }
.s-done { background: var(--green); }
.s-na { background: var(--green-soft); color: #5aa676; }
.s-wip { background: var(--yellow); color: #4a3500; }
.s-late { background: var(--red); }
.s-upcoming { background: transparent; box-shadow: inset 0 0 0 1.5px #dcd7cc; color: transparent; }
.s-upcoming:hover { box-shadow: inset 0 0 0 1.5px #b9b2a4; color: #b9b2a4; }
.cell.changed::after {
  content: ''; position: absolute; top: -3px; right: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--blue); border: 2px solid var(--surface);
}
.cell.pop { animation: pop .35s var(--ease); }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }

.updated { font-size: 12px; color: var(--muted); white-space: nowrap; }
.updated b { color: var(--ink-2); font-weight: 500; }

.group-row td {
  position: sticky; left: 0; background: var(--bg); height: 40px; padding: 0 16px !important;
  border-bottom: 1px solid var(--line);
}
.group-head { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 13px; }
.group-head small { color: var(--muted); font-weight: 500; font-size: 12.5px; }
.group-head .late-count { color: var(--red); font-weight: 600; font-size: 12.5px; }

.empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 18px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.cell-dot { width: 16px; height: 12px; border-radius: 4px; display: inline-block; }
.legend-new { margin-left: auto; }

/* ---------- Popover ---------- */
.popover {
  position: fixed; z-index: 60; min-width: 230px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; opacity: 0; transform: translateY(-4px) scale(.98); pointer-events: none;
  transition: opacity .14s var(--ease), transform .14s var(--ease);
}
.popover.open { opacity: 1; transform: none; pointer-events: auto; }
.pop-head { padding: 8px 10px 6px; }
.pop-head b { display: block; font-size: 13.5px; }
.pop-head small { color: var(--muted); font-size: 12px; }
.pop-opt {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 0; background: none; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500;
}
.pop-opt:hover, .pop-opt:focus-visible { background: var(--line-2); outline: none; }
.pop-opt.cur { background: var(--line-2); font-weight: 600; }
.pop-opt .cell-dot { width: 20px; height: 16px; border-radius: 5px; }
.pop-opt kbd { margin-left: auto; }
.pop-foot { border-top: 1px solid var(--line-2); margin-top: 4px; padding: 8px 10px 4px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.pop-pcts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; padding: 4px; }
.pop-pcts button { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 0; font-weight: 600; font-size: 13px; }
.pop-pcts button:hover { border-color: var(--ink-2); }
.pop-pcts button.cur { background: var(--ink); color: #fff; border-color: var(--ink); }
.pop-range { padding: 6px 8px 8px; display: flex; align-items: center; gap: 10px; }
.pop-range input { flex: 1; accent-color: var(--ink); }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(29, 27, 24, .28); opacity: 0; pointer-events: none; transition: opacity .25s var(--ease); z-index: 40; backdrop-filter: blur(1px); }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: min(620px, 100vw);
  background: var(--surface); box-shadow: var(--shadow-lg);
  transform: translateX(104%); transition: transform .32s var(--ease);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.dr-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); }
.dr-top { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.dr-top .job-num { width: auto; font-size: 14px; }
.dr-close { margin-left: auto; width: 32px; height: 32px; border-radius: 8px; border: 0; background: none; display: grid; place-items: center; color: var(--ink-2); }
.dr-close:hover { background: var(--line-2); }
.dr-title { font-family: var(--display); font-size: 26px; font-weight: 600; line-height: 1.15; margin: 4px 0 4px; letter-spacing: -.005em; }
.dr-sub { color: var(--ink-2); font-size: 13.5px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.dr-sub a { color: var(--ink); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 3px 8px; margin-left: auto; font-size: 12.5px; }
.dr-sub a:hover { border-color: var(--ink-2); }
.dr-body { overflow: auto; padding: 18px 24px 40px; flex: 1; }
.dr-section { margin-bottom: 24px; }
.dr-label { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.dr-label .lock { text-transform: none; letter-spacing: 0; font-weight: 500; }

.stepper { display: flex; gap: 3px; }
.step {
  flex: 1; border: 0; background: #eeebe4; height: 34px; font-size: 11.5px; font-weight: 600; color: var(--muted);
  display: grid; place-items: center; padding: 0 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .2s var(--ease), color .2s;
}
.step:first-child { border-radius: 8px 0 0 8px; }
.step:last-child { border-radius: 0 8px 8px 0; }
.step.past { background: #d9d4c8; color: var(--ink-2); }
.step.cur { background: var(--ink); color: #fff; }
.step:hover:not(.cur) { background: #cfc9bc; color: var(--ink); }

.dr-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.field { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; }
.field small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.field select, .field input { border: 0; background: none; outline: 0; width: 100%; font-weight: 600; padding: 0; }
.field.locked { opacity: .85; }
.field .pm-static { display: flex; align-items: center; gap: 8px; font-weight: 600; }

.range-row { display: flex; align-items: center; gap: 14px; }
.range-row input[type=range] { flex: 1; accent-color: var(--ink); height: 4px; }
.range-row .big { font-family: var(--display); font-size: 24px; font-weight: 600; width: 64px; text-align: right; font-variant-numeric: tabular-nums; }

.ck-group { margin-bottom: 16px; }
.ck-group-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.ck-group-head small { font-weight: 500; color: var(--muted); }
.ck-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--line-2); }
.ck-row:last-child { border-bottom: 0; }
.ck-row .ck-name { flex: 1; min-width: 0; font-size: 13.5px; }
.ck-row .ck-name small { display: block; color: var(--muted); font-size: 11.5px; }
.ck-row .ck-name .due-late { color: var(--red); font-weight: 600; }
.tri { display: inline-flex; background: #f1eee8; border-radius: 9px; padding: 2px; gap: 2px; flex: none; }
.tri button { min-width: 46px; border: 0; background: transparent; border-radius: 7px; height: 26px; padding: 0 9px; font-size: 12px; font-weight: 600; color: var(--muted); transition: background .15s, color .15s; }
.tri button:hover { color: var(--ink); background: rgba(255,255,255,.7); }
.tri button.v-wip { min-width: 78px; }
.tri button.on.v-done { background: var(--green); color: #fff; }
.tri button.on.v-wip { background: var(--yellow); color: #4a3500; }
.tri button.on.v-todo { background: var(--red); color: #fff; }
.tri button.on.v-todo.notdue { background: #d9d4c8; color: var(--ink-2); }
.tri button.on.v-na { background: var(--green-soft); color: #2f7a4b; }

.actions-list { display: flex; flex-direction: column; gap: 6px; }
.action { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--surface-2); }
.action .chk { width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid #c8c2b5; background: #fff; display: grid; place-items: center; flex: none; padding: 0; }
.action.done .chk { background: var(--green); border-color: var(--green); color: #fff; }
.action.done .a-text { text-decoration: line-through; color: var(--muted); }
.action .a-text { flex: 1; font-size: 13.5px; }
.add-action { display: flex; gap: 6px; margin-top: 8px; }
.add-action input { flex: 1; height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; outline: 0; background: var(--surface); }
.add-action input:focus { border-color: var(--ink-2); }
.add-action select { height: 36px; border: 1px solid var(--line); border-radius: 10px; padding: 0 8px; background: var(--surface); }

textarea.notes { width: 100%; min-height: 80px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; resize: vertical; outline: 0; background: var(--surface-2); }
textarea.notes:focus { border-color: var(--ink-2); background: var(--surface); }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 10px; padding: 8px 0; font-size: 13px; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.feed-item:last-child { border-bottom: 0; }
.feed-item b { color: var(--ink); font-weight: 600; }
.feed-item time { display: block; font-size: 11.5px; color: var(--muted); }
.feed-item.is-new { position: relative; }
.feed-item .tag-new { font-size: 10.5px; font-weight: 700; color: var(--blue); margin-left: 4px; }

.lock { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 12px; background: var(--charcoal); color: #f3efe6;
  padding: 10px 10px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toastIn .3s var(--ease);
}
.toast button { border: 0; background: rgba(255,255,255,.1); color: #fff; border-radius: 8px; padding: 5px 10px; font-weight: 600; font-size: 12.5px; }
.toast button:hover { background: rgba(255,255,255,.18); }
.toast.out { animation: toastOut .25s var(--ease) forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Who am I menu ---------- */
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 260px; z-index: 70;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
}
.menu-label { padding: 8px 10px 4px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 8px; text-align: left; }
.menu button:hover { background: var(--line-2); }
.menu button small { display: block; color: var(--muted); font-size: 11.5px; }
.menu button .check { margin-left: auto; color: var(--green); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(29,27,24,.4); opacity: 0; pointer-events: none; transition: opacity .2s var(--ease); padding: 16px; }
.modal.open { opacity: 1; pointer-events: auto; }
.modal-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-lg); width: min(520px, 100%); padding: 24px; transform: translateY(8px) scale(.98); transition: transform .25s var(--ease); max-height: 90vh; overflow: auto; }
.modal.open .modal-card { transform: none; }
.modal-card h2 { font-family: var(--display); font-weight: 600; font-size: 24px; margin: 0 0 4px; }
.modal-card p { margin: 0 0 18px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form-grid input, .form-grid select { height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; outline: 0; font-weight: 500; background: var(--surface); }
.form-grid input:focus, .form-grid select:focus { border-color: var(--ink-2); box-shadow: 0 0 0 3px rgba(29,27,24,.07); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

/* ---------- Meeting mode ---------- */
.meeting {
  --m-bg: #161513; --m-surface: #201e1b; --m-line: #2f2c27; --m-ink: #f3efe6; --m-muted: #9b9486;
  position: fixed; inset: 0; z-index: 75; background: var(--m-bg); color: var(--m-ink);
  display: grid; grid-template-columns: 300px 1fr; grid-template-rows: auto 1fr auto;
  opacity: 0; pointer-events: none; transform: scale(1.01); transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.meeting.open { opacity: 1; pointer-events: auto; transform: none; }
.m-top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 16px 28px; border-bottom: 1px solid var(--m-line); }
.m-top .brand-logo { height: 28px; }
.m-title { font-family: var(--display); font-weight: 600; font-size: 20px; }
.m-title small { font-family: var(--font); font-weight: 500; color: var(--m-muted); font-size: 13px; margin-left: 10px; }
.m-top .spacer { flex: 1; }
.m-btn { border: 1px solid var(--m-line); background: var(--m-surface); color: var(--m-ink); border-radius: 10px; height: 38px; padding: 0 16px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.m-btn:hover { border-color: #4a463f; }
.m-btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.m-btn.primary:hover { background: #ffc43f; }

.m-agenda { border-right: 1px solid var(--m-line); padding: 18px 14px; overflow: auto; }
.m-agenda h4 { margin: 4px 10px 10px; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--m-muted); font-weight: 600; }
.m-person { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; color: var(--m-ink); padding: 10px; border-radius: 12px; text-align: left; margin-bottom: 2px; }
.m-person:hover { background: var(--m-surface); }
.m-person.cur { background: var(--m-surface); box-shadow: inset 3px 0 0 var(--brand); }
.m-person .nm { font-weight: 600; font-size: 15px; }
.m-person small { display: block; color: var(--m-muted); font-size: 12px; }
.m-person .m-badges { margin-left: auto; display: flex; gap: 4px; }
.m-badge { font-size: 11.5px; font-weight: 700; border-radius: 6px; padding: 2px 7px; }
.m-badge.red { background: rgba(220, 74, 61, .2); color: #ff8b7f; }
.m-badge.blue { background: rgba(47, 111, 228, .22); color: #8db2ff; }
.m-person.reviewed .nm::after { content: ' ✓'; color: var(--green); }

.m-main { overflow: auto; padding: 26px 32px 40px; }
.m-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.m-head h2 { font-family: var(--display); font-weight: 600; font-size: 40px; margin: 0; line-height: 1; }
.m-head p { margin: 6px 0 0; color: var(--m-muted); font-size: 15px; }
.m-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 14px; }
.m-card { background: var(--m-surface); border: 1px solid var(--m-line); border-radius: 16px; padding: 18px; transition: opacity .25s, border-color .2s; position: relative; }
.m-card.discussed { opacity: .45; }
.m-card.has-late { border-color: rgba(220, 74, 61, .45); }
.m-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.m-card-top .job-num { color: var(--m-muted); width: auto; }
.m-card h3 { margin: 0 0 12px; font-size: 19px; font-weight: 600; line-height: 1.25; }
.m-card h3 small { display: block; color: var(--m-muted); font-size: 13px; font-weight: 500; margin-top: 2px; }
.m-strip { display: flex; gap: 4px; margin: 12px 0; }
.m-strip .cell { width: auto; flex: 1; height: 30px; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; padding: 0 2px; }
.m-strip .cell:hover { transform: none; box-shadow: none; }
.meeting .s-upcoming { box-shadow: inset 0 0 0 1.5px #3a3630; color: #6c665b; }
.meeting .s-na { background: rgba(46, 157, 91, .22); color: #7ccf9c; }
.meeting .bar { background: #2f2c27; }
.meeting .bar > i { background: var(--m-ink); }
.meeting .bar.full > i { background: var(--green); }
.meeting .pct { color: var(--m-ink); }
.meeting .stage { background: rgba(255,255,255,.08) !important; color: var(--m-ink) !important; }
.meeting .progress { width: 100%; cursor: default; }
.m-lines { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 13.5px; }
.m-line { display: flex; gap: 8px; align-items: baseline; color: #d8d2c5; }
.m-line .tag { font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 6px; border-radius: 5px; flex: none; }
.m-line .tag.red { background: rgba(220,74,61,.2); color: #ff8b7f; }
.m-line .tag.blue { background: rgba(47,111,228,.22); color: #8db2ff; }
.m-line .tag.yellow { background: rgba(242,177,12,.2); color: #ffd36b; }
.m-line .tag.gray { background: rgba(255,255,255,.08); color: var(--m-muted); }
.m-card-actions { display: flex; gap: 8px; margin-top: 14px; }
.m-card-actions .m-btn { height: 34px; padding: 0 12px; font-size: 13px; }
.m-act-form { display: flex; gap: 6px; margin-top: 10px; }
.m-act-form input, .m-act-form select { height: 36px; background: #16140f; border: 1px solid var(--m-line); color: var(--m-ink); border-radius: 9px; padding: 0 10px; outline: 0; }
.m-act-form input { flex: 1; min-width: 0; }
.m-act-form input:focus { border-color: var(--brand); }
.m-foot { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 14px 28px; border-top: 1px solid var(--m-line); }
.m-foot .m-progress { flex: 1; display: flex; gap: 4px; }
.m-foot .m-progress i { flex: 1; height: 4px; border-radius: 999px; background: #2f2c27; }
.m-foot .m-progress i.done { background: var(--green); }
.m-foot .m-progress i.cur { background: var(--brand); }
.m-empty { color: var(--m-muted); padding: 40px 0; font-size: 16px; }

.wrap-list { display: flex; flex-direction: column; gap: 14px; margin: 8px 0 4px; }
.wrap-person b { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.wrap-person ul { margin: 0; padding-left: 38px; color: var(--ink-2); }
.wrap-person li { margin: 2px 0; }


/* ---------- Responsibility ---------- */
.av.xs { width: 18px; height: 18px; font-size: 9.5px; }
.pm-tag { display: inline-grid; place-items: center; height: 18px; padding: 0 5px; border-radius: 9px; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; background: #ebe7de; color: var(--ink-2); }
.th-own { display: flex; justify-content: center; margin-top: 5px; text-transform: none; letter-spacing: 0; }
.board thead th.ck { vertical-align: top; }
.board thead th.th-dim { opacity: .35; }

.cell.dim { opacity: .16; filter: saturate(.4); }
.cell.dim:hover { opacity: .6; }
.cell-own {
  --h: 30; position: absolute; left: -5px; bottom: -5px; width: 16px; height: 16px; border-radius: 50%;
  display: grid; place-items: center; font-size: 9px; font-weight: 800;
  background: hsl(var(--h) 70% 90%); color: hsl(var(--h) 55% 28%); border: 2px solid var(--surface);
}

.who-filter {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.who-filter select { border: 0; background: transparent; outline: 0; font-weight: 600; color: var(--ink); padding: 0 4px; cursor: pointer; }
.who-filter.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); color: var(--ink); }

.pop-resp { border-top: 1px solid var(--line-2); margin-top: 4px; padding: 10px 10px 6px; }
.pop-resp-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.pop-resp-head small { display: block; color: var(--muted); font-size: 11.5px; }
.pop-own { display: flex; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.own-opt { border: 0; background: none; padding: 2px; border-radius: 50%; transition: transform .12s var(--ease); }
.own-opt:hover { transform: scale(1.12); }
.own-opt.cur { box-shadow: 0 0 0 2px var(--ink); }
.pop-foot { justify-content: flex-start; }

.ck-crew { display: inline-flex; }
.ck-crew .av { margin-left: -4px; box-shadow: 0 0 0 2px var(--surface); }
.own-chip {
  display: inline-flex; align-items: center; gap: 4px; flex: none; width: 88px; height: 28px; padding: 0 4px 0 4px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 12px; font-weight: 600; position: relative;
}
.own-chip select { border: 0; background: transparent; outline: 0; font-weight: 600; font-size: 12px; width: 100%; cursor: pointer; padding: 0; }
.own-chip.override { border-color: var(--ink-2); }
.own-chip.static { color: var(--ink-2); }
.ck-row.mine .ck-name { font-weight: 600; }
.ck-row.mine .ck-name::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); margin-right: 6px; vertical-align: middle; }

.modal-card:has(.wdw) { width: min(620px, 100%); }
.wdw { display: flex; flex-direction: column; gap: 16px; }
.wdw-head { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px; }
.wdw-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); }
.wdw-name { flex: 1; font-size: 13.5px; min-width: 0; }
.wdw-name small { display: block; color: var(--muted); font-size: 11.5px; }
.wdw-key { font-size: 10px; font-weight: 700; color: var(--ink-2); background: #ebe7de; border-radius: 5px; padding: 1px 5px; margin-left: 6px; vertical-align: 1px; }
.wdw-own { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.wdw-own select { height: 34px; border: 1px solid var(--line); border-radius: 9px; padding: 0 8px; background: var(--surface); width: 210px; }
.wdw-own select:disabled { opacity: .7; }

.meeting .cell.dim { opacity: .22; }
.m-line .tag.brand { background: rgba(254,184,29,.18); color: var(--brand); }
.m-who { color: var(--m-ink); font-weight: 600; }

@media (max-width: 860px) {
  .who-filter { order: 3; }
  #whoDoesWhat { display: none; }
  .own-chip { width: 34px; }
  .own-chip select { position: absolute; inset: 0; opacity: 0; }
  .wdw-own select { width: 150px; }
}


/* ---------- New job wizard ---------- */
.modal-card.wz-card { width: min(760px, 100%); padding: 0; display: flex; flex-direction: column; max-height: min(860px, 92vh); overflow: hidden; }
.wz-head { padding: 22px 26px 14px; border-bottom: 1px solid var(--line-2); }
.wz-head h2 { margin: 0 0 12px; }
.wz-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.wz-steps li { flex: 1; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-radius: 10px; background: var(--surface-2); }
.wz-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; background: #e6e1d6; color: var(--ink-2); flex: none; }
.wz-steps li.cur { background: var(--ink); color: #fff; }
.wz-steps li.cur span { background: var(--brand); color: var(--brand-ink); }
.wz-steps li.done { color: var(--ink-2); }
.wz-steps li.done span { background: var(--green); color: #fff; }
.wz-body { padding: 18px 26px 22px; overflow: auto; flex: 1; }
.wz-foot { display: flex; align-items: center; gap: 10px; padding: 14px 26px; border-top: 1px solid var(--line-2); background: var(--surface-2); }
.wz-hint { flex: 1; text-align: right; color: var(--muted); font-size: 12.5px; }
.wz-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.wz-types { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.wz-type { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px 11px; display: flex; flex-direction: column; gap: 2px; transition: border-color .15s, box-shadow .15s, transform .12s var(--ease); }
.wz-type:hover { border-color: #c9c2b4; transform: translateY(-1px); }
.wz-type b { font-size: 13.5px; }
.wz-type small { color: var(--muted); font-size: 11.5px; line-height: 1.3; }
.wz-type em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--ink-2); margin-top: 4px; }
.wz-type.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); background: #fffdf6; }
.wz-type.on em { color: #8a5a00; }
.wz-pms { display: flex; gap: 6px; flex-wrap: wrap; }
.wz-pm { display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 14px 0 6px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; }
.wz-pm.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.shake { animation: shake .4s; border-color: var(--red) !important; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }

.wz-intro { margin: 0 0 12px !important; color: var(--ink-2) !important; }
.wz-tally { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; position: sticky; top: -18px; background: var(--surface); padding: 8px 0; z-index: 1; }
.wz-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 500; }
.wz-chip b { font-weight: 700; }
.wz-group { margin-bottom: 14px; }
.wz-group-head { display: flex; align-items: center; justify-content: space-between; font-weight: 600; font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.wz-group-head small { color: var(--muted); font-weight: 500; }
.wz-phase { font-size: 12px; color: var(--muted); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.wz-phase select { height: 28px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 0 6px; font-size: 12px; }
.wz-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line-2); transition: opacity .15s; }
.wz-row.off .wz-task, .wz-row.off .own-chip { opacity: .4; }
.wz-task { flex: 1; min-width: 0; font-size: 13.5px; }
.wz-task small { display: block; color: var(--muted); font-size: 11.5px; }
.wz-task small b { color: var(--ink); }
.wz-row .own-chip { width: 120px; }
.wz-reset { border: 0; background: none; color: var(--muted); text-decoration: underline; font-size: 12.5px; padding: 4px 0; }
.wz-summary { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 14px 16px; margin-bottom: 18px; }
.wz-summary .job-num { width: auto; }
.wz-summary h3 { font-family: var(--display); font-size: 24px; font-weight: 600; margin: 2px 0; }
.wz-sub { color: var(--ink-2); font-size: 13px; }
.wz-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.wz-person { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.wz-person-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wz-person-head small { margin-left: auto; color: var(--muted); }
.wz-person ul { margin: 0; padding: 0; list-style: none; }
.wz-person li { font-size: 13px; display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line-2); }
.wz-person li:last-child { border-bottom: 0; }
.wz-person li small { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.wz-off { font-size: 12.5px; margin: 12px 0 0 !important; }
@media (max-width: 860px) {
  .wz-types { grid-template-columns: repeat(2, 1fr); }
  .wz-steps li { font-size: 0; justify-content: center; }
  .wz-phase { display: none; }
  .wz-row .own-chip { width: 44px; }
  .wz-hint { display: none; }
  .wz-foot { justify-content: space-between; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pm-pill .nm { display: none; }
}
@media (max-width: 860px) {
  .topbar { padding: 10px 16px; }
  .brand-divider, .brand-title, .meeting-chip-text { display: none; }
  .meeting-chip { padding: 4px; }
  #newJob span { display: none; }
  #newJob { padding: 0 10px; }
  .whoami-btn small, .whoami-btn span { display: none; }
  .whoami-btn { padding: 3px; }
  .page { padding: 16px 16px 40px; }
  .summary { display: flex; overflow-x: auto; gap: 8px; margin: 0 -16px 14px; padding: 0 16px 4px; scroll-snap-type: x mandatory; }
  .stat { flex: 0 0 150px; scroll-snap-align: start; padding: 12px; }
  .stat-num { font-size: 28px; }
  .search { width: 100%; }
  .toolbar-right { margin-left: 0; flex-wrap: wrap; }
  .c-job { min-width: 230px; max-width: 240px; }
  .legend-new { margin-left: 0; }
  .dr-grid { grid-template-columns: 1fr 1fr; }
  .meeting { grid-template-columns: 1fr; }
  .m-agenda { display: none; }
  .m-main { padding: 18px 16px; }
  .m-cards { grid-template-columns: 1fr; }
  .m-head h2 { font-size: 30px; }
  .m-top { padding: 12px 16px; flex-wrap: wrap; }
  .m-foot { padding: 12px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ======================================================================
   Layout switch (V1 grid / V2 boards)
   ====================================================================== */
.layout-switch { display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px; background: rgba(255,255,255,.08); margin-left: 6px; }
.layout-switch button { border: 0; background: none; color: rgba(243,239,230,.7); font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; white-space: nowrap; transition: background .15s var(--ease), color .15s var(--ease); }
.layout-switch button:hover { color: #fff; }
.layout-switch button.on { background: var(--brand); color: var(--brand-ink); }

.v2 { display: none; }
body.layout-v2 { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
body.layout-v2 main.page { display: none; }
body.layout-v2 .v2 { display: grid; grid-template-columns: 292px minmax(0, 1fr); flex: 1; min-height: 0; }

/* ---------- Sidebar ---------- */
.sb { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.sb-top { padding: 14px 12px 10px; display: grid; gap: 4px; border-bottom: 1px solid var(--line-2); }
.sb-nav { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 8px 10px; border-radius: 9px; font-weight: 600; color: var(--ink-2); text-align: left; }
.sb-nav span { flex: 1; }
.sb-nav b { font-size: 12px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.sb-nav:hover { background: var(--line-2); }
.sb-nav.on { background: var(--charcoal); color: #fff; }
.sb-nav.on b { color: rgba(255,255,255,.6); }
.sb-search { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 0 10px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--muted); }
.sb-search:focus-within { border-color: var(--ink-2); background: #fff; }
.sb-search input { border: 0; outline: 0; background: none; flex: 1; min-width: 0; height: 100%; }
.sb-pms { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.sb-pm { display: inline-flex; align-items: center; gap: 5px; border: 1px solid transparent; background: var(--line-2); border-radius: 999px; padding: 2px 9px 2px 3px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.sb-pm:first-child { padding-left: 9px; }
.sb-pm:hover { border-color: var(--line); background: #fff; }
.sb-pm.on { background: #fff; border-color: var(--ink); color: var(--ink); }

.sb-list { flex: 1; overflow-y: auto; padding: 6px 8px 16px; }
.sb-group { margin-top: 6px; }
.sb-group-head { width: 100%; display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 8px 6px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sb-group-head i { width: 8px; height: 8px; border-radius: 50%; background: #cfc9bd; }
.g-attention .sb-group-head i { background: var(--red); }
.g-limbo .sb-group-head i { background: var(--yellow); }
.g-track .sb-group-head i { background: var(--green); }
.sb-group-head b { margin-left: auto; font-weight: 600; color: var(--ink-2); letter-spacing: 0; }
.chev { display: inline-flex; transform: rotate(-90deg); transition: transform .2s var(--ease); }
.chev.open { transform: none; }
.sb-job { width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 7px 8px 7px 10px; border-radius: 9px; text-align: left; position: relative; }
.sb-job:hover { background: var(--line-2); }
.sb-job.on { background: #fff6dd; box-shadow: inset 3px 0 0 var(--brand); }
.sb-job-main { flex: 1; min-width: 0; display: grid; }
.sb-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.sb-name .hot { font-size: 9.5px; }
.sb-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-empty { padding: 4px 10px 8px; font-size: 12.5px; color: var(--muted); }
.sb-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface-2); }

/* ---------- Main board area ---------- */
.v2-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.v2-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 20px 26px 14px; flex-wrap: wrap; }
.v2-head h1 { margin: 2px 0 2px; font-family: var(--display); font-weight: 700; font-size: 28px; letter-spacing: .005em; line-height: 1.1; }
.v2-head h1 .job-num { width: auto; font-size: 22px; color: var(--muted); margin-right: 4px; }
.v2-head p { margin: 0; color: var(--muted); font-size: 13px; }
.v2-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.v2-pills .pill { font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 999px; }
.pill.red { background: var(--red-soft); color: #a7271b; }
.pill.yellow { background: var(--yellow-soft); color: #8a5a00; }
.pill.green { background: var(--green-soft); color: #1f6b3d; }
.crumb { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.crumb:hover { color: var(--ink); }
.jh-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.jh-row .pm-cell { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 3px 12px 3px 3px; line-height: 1.1; text-align: left; }
.jh-row .pm-cell small { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.jh-row .pm-cell.locked { cursor: default; }
.jh-row .stage { border: 0; cursor: pointer; }
.jh-row .progress { width: 150px; }
.jh-people { display: flex; padding-left: 6px; }
.jh-people .av { margin-left: -5px; box-shadow: 0 0 0 2px var(--bg); }
.jh-actions { display: flex; gap: 8px; }
.jh-actions .btn { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }

/* Kanban */
.kb { flex: 1; min-height: 0; display: flex; gap: 14px; padding: 4px 26px 22px; overflow-x: auto; align-items: stretch; }
.col { flex: 1 0 252px; max-width: 340px; display: flex; flex-direction: column; min-height: 0; background: #ece8df; border-radius: 14px; padding: 4px; transition: background .15s var(--ease), box-shadow .15s var(--ease); }
.kb.tasks .col { flex-basis: 270px; max-width: 380px; }
.col.over { background: #fff3cf; box-shadow: inset 0 0 0 2px var(--brand); }
.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px 10px 6px; }
.col-head > b { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; background: rgba(255,255,255,.7); border-radius: 999px; padding: 1px 8px; }
.col-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.col-title i { width: 10px; height: 10px; border-radius: 3px; background: #cfc9bd; }
.c-late .col-title i { background: var(--red); }
.c-wip .col-title i { background: var(--yellow); }
.c-upcoming .col-title i { background: transparent; box-shadow: inset 0 0 0 1.5px #b9b2a4; }
.c-done .col-title i { background: var(--green); }
.c-late { background: #f6e1dc; }
.col-hint { padding: 0 10px 6px; font-size: 11.5px; color: var(--muted); }
.col-body { flex: 1; overflow-y: auto; padding: 2px 4px 8px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { padding: 18px 10px; text-align: center; font-size: 12.5px; color: var(--muted); border: 1.5px dashed #d6d0c3; border-radius: 10px; }

.kcard { background: var(--surface); border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-sm), 0 0 0 1px rgba(29,27,24,.04); cursor: grab; transition: box-shadow .15s var(--ease), transform .15s var(--ease); text-align: left; }
.kcard:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kcard.dragging { opacity: .45; transform: rotate(2deg); }
.kc-top { display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.kc-top .job-num { width: auto; font-size: 13px; color: var(--muted); }
.kc-top .ready { margin-left: 0; }
.kc-top .new-pip { margin-left: auto; }
.kc-title { font-weight: 600; font-size: 14px; line-height: 1.3; }
.kc-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.kc-flag { margin-top: 8px; font-size: 11.5px; font-weight: 600; padding: 4px 8px; border-radius: 6px; line-height: 1.35; }
.kc-flag.red { background: var(--red-soft); color: #a7271b; }
.kc-flag.yellow { background: var(--yellow-soft); color: #7a5000; }
.kc-flag.none { background: var(--line-2); color: var(--muted); font-weight: 500; }
.kc-foot { display: flex; align-items: center; gap: 7px; margin-top: 9px; font-size: 12px; color: var(--ink-2); }
.kc-foot .bar { max-width: 70px; margin-left: auto; height: 5px; }
.kc-foot em { font-style: normal; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mini-strip { display: flex; gap: 3px; margin-top: 9px; }
.mini-strip i { flex: 1; height: 5px; border-radius: 3px; }
.job-card.b-attention { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--red); }
.job-card.b-limbo { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--yellow); }

.task-card .t-top { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.task-card .t-top .new-pip { margin-left: auto; }
.ph { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 6px; border-radius: 4px; }
.ph-pre { background: #efe9fb; color: #5b3fb0; }
.ph-res { background: #e3edfc; color: #2558b8; }
.ph-site { background: #fff0d4; color: #9a5b00; }
.ph-close { background: #e5f1f1; color: #2b6c6c; }
.t-due { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.t-due.red { color: var(--red); }
.t-due.yellow { color: #a06a00; }
.t-due.green { color: var(--green); }
.task-card.t-late { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--red); }
.task-card.t-wip { box-shadow: var(--shadow-sm), inset 3px 0 0 var(--yellow); }
.task-card.t-done .kc-title { color: var(--ink-2); }
.task-card.mine { outline: 1.5px solid var(--brand); outline-offset: -1.5px; }
.t-job { display: block; border: 0; background: none; padding: 0; margin-bottom: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.t-job:hover { color: var(--ink); text-decoration: underline; }
.na-list { margin-top: 6px; padding: 10px 6px 0; border-top: 1px dashed #d6d0c3; display: flex; flex-wrap: wrap; gap: 5px; }
.na-list b { width: 100%; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.na-chip { border: 0; background: rgba(255,255,255,.6); color: var(--muted); font-size: 12px; padding: 3px 8px; border-radius: 6px; text-decoration: line-through; text-decoration-color: rgba(138,132,120,.5); }
.na-chip:hover { background: #fff; color: var(--ink-2); }

/* People */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; padding: 4px 26px 26px; overflow-y: auto; }
.person-card { border: 0; background: var(--surface); border-radius: 14px; padding: 16px; text-align: left; box-shadow: var(--shadow-sm), 0 0 0 1px rgba(29,27,24,.05); transition: box-shadow .15s var(--ease), transform .15s var(--ease); }
.person-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-head b { display: block; font-size: 15px; }
.pc-head small { color: var(--muted); font-size: 12.5px; }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.pc-stats span { display: grid; font-size: 11.5px; color: var(--muted); }
.pc-stats b { font-family: var(--display); font-size: 24px; line-height: 1.1; color: var(--ink); }
.pc-stats .red b { color: var(--red); }
.pc-stats .yellow b { color: #c08a00; }
.who-pill { border: 0; background: none; padding: 2px; border-radius: 50%; opacity: .55; transition: opacity .15s; }
.who-pill:hover, .who-pill.on { opacity: 1; }
.who-pill.on { box-shadow: 0 0 0 2px var(--brand); }

@media (max-width: 860px) {
  .layout-switch button { padding: 5px 9px; font-size: 11.5px; }
  body.layout-v2 { height: auto; overflow: visible; display: block; }
  body.layout-v2 .v2 { display: block; }
  .sb { border-right: 0; border-bottom: 1px solid var(--line); }
  .sb-list { max-height: 260px; }
  .v2-head { padding: 16px; }
  .kb { padding: 4px 16px 18px; scroll-snap-type: x mandatory; }
  .col { flex-basis: 82vw; scroll-snap-align: start; max-height: 70vh; }
  .people-grid { padding: 4px 16px 20px; }
}
@media (max-width: 560px) {
  .topbar .brand { flex-direction: column; align-items: flex-start; gap: 6px; }
  .brand-logo { height: 28px; }
  .topbar .brand { flex: none; }
  .layout-switch { margin-left: 0; }
  .layout-switch button { padding: 4px 8px; font-size: 11px; }
  .topbar-right { gap: 6px; min-width: 0; }
  body.layout-v2 #newJob { display: none; }
}
