/* Layout: sidebar + work area on desktop; bottom tab bar + full-screen drawer on phones. */
:root {
  --bg: #edf1f2;
  --surface: #ffffff;
  --surface-2: #f5f8f8;
  --line: #d8e0e3;
  --line-strong: #bfcbd0;
  --fg: #14232b;
  --muted: #5b6c75;
  --accent: #0c6970;
  --accent-ink: #ffffff;
  --accent-soft: #daeeee;
  --warn: #b5470f;
  --warn-soft: #fbe5d8;
  --amber: #9a6400;
  --amber-soft: #f7ebcf;
  --ok: #2b7549;
  --ok-soft: #ddefe3;
  --violet: #5b4fc4;
  --shadow: 0 1px 2px rgb(14 38 46 / .06), 0 10px 28px rgb(14 38 46 / .10);
  --font-display: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --r: 10px;
  --tabbar-h: 62px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d161a; --surface: #142126; --surface-2: #19292f; --line: #24363d; --line-strong: #33494f;
    --fg: #e3ebed; --muted: #92a4ab; --accent: #45b6b8; --accent-ink: #052628; --accent-soft: #143a3d;
    --warn: #f0895a; --warn-soft: #3a2117; --amber: #e2ab3d; --amber-soft: #33290f;
    --ok: #5dc38b; --ok-soft: #163225; --violet: #a39bf0;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px rgb(0 0 0 / .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d161a; --surface: #142126; --surface-2: #19292f; --line: #24363d; --line-strong: #33494f;
  --fg: #e3ebed; --muted: #92a4ab; --accent: #45b6b8; --accent-ink: #052628; --accent-soft: #143a3d;
  --warn: #f0895a; --warn-soft: #3a2117; --amber: #e2ab3d; --amber-soft: #33290f;
  --ok: #5dc38b; --ok-soft: #163225; --violet: #a39bf0;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px rgb(0 0 0 / .35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  font-family: var(--font-body); font-size: 14.5px; line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: .01em; text-wrap: balance; margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); height: 100%; }
.side {
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 18px; padding: 18px 12px; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 8px 6px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.brand-name { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: .02em; }
.mode-pill { margin-left: auto; font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); background: var(--amber-soft); padding: 2px 7px; border-radius: 99px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-size: 11px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 0 10px 6px; display: flex; align-items: center; justify-content: space-between; }
.nav-label button { border: 0; background: none; color: var(--muted); padding: 2px; border-radius: 6px; display: grid; }
.nav-label button:hover { color: var(--accent); background: var(--accent-soft); }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px;
  color: var(--fg); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); }
.nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav a .count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav a .count.hot { color: var(--warn); font-weight: 700; }
.dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.side-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 12px; }
.me-btn { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px; border: 0; background: none; border-radius: 8px; text-align: left; }
.me-btn:hover { background: var(--surface-2); }
.me-btn small { display: block; color: var(--muted); font-size: 12px; }

.main { min-width: 0; overflow-y: auto; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bg);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: 18px 12px;
  padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.topbar h1 { font-size: 28px; line-height: 1.1; }
.topbar .subhead { color: var(--muted); font-size: 13px; }
.topbar .spacer { flex: 1; }
.view { padding-block: 4px 40px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line-strong); background: var(--surface);
  padding: 8px 13px; border-radius: 8px; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.danger { color: var(--warn); border-color: var(--warn-soft); }
.btn.danger:hover { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
textarea.input { resize: vertical; min-height: 78px; }
.input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters select { width: auto; }

/* ---------- quick add ---------- */
.quick {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 6px 6px 6px 14px; box-shadow: 0 1px 2px rgb(14 38 46 / .04);
}
.quick:focus-within { border-color: var(--accent); }
.quick input { flex: 1; border: 0; background: none; padding: 8px 0; min-width: 0; outline: none; font-size: 15px; }
.quick-hint { font-size: 12.5px; color: var(--muted); margin-top: -10px; padding-left: 2px; }
.quick-hint code { font-family: inherit; font-weight: 700; color: var(--fg); background: var(--surface-2); padding: 0 4px; border-radius: 4px; border: 1px solid var(--line); }
.parse-preview { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- task lists ---------- */
.group { display: flex; flex-direction: column; gap: 6px; }
.group-head { display: flex; align-items: baseline; gap: 8px; font-family: var(--font-display); font-size: 15px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.group-head.hot { color: var(--warn); }
.group-head .n { font-family: var(--font-body); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tasks { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.task { display: flex; align-items: flex-start; gap: 12px; padding: 11px 14px; border-top: 1px solid var(--line); cursor: pointer; }
.task:first-child { border-top: 0; }
.task:hover { background: var(--surface-2); }
.task.is-open { background: var(--accent-soft); }
.check {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface);
  display: grid; place-items: center; flex: none; padding: 0; color: transparent;
}
.check:hover { border-color: var(--ok); color: var(--ok); }
.check svg { width: 13px; height: 13px; stroke-width: 3; }
.is-done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task-main { flex: 1; min-width: 0; }
.task-title { font-weight: 550; overflow-wrap: anywhere; }
.is-done .task-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--muted); align-items: center; }
.meta > span { display: inline-flex; align-items: center; gap: 5px; }
.meta svg.i { width: 14px; height: 14px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.chip.late { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.chip.soon { background: var(--amber-soft); border-color: transparent; color: var(--amber); }
.chip.doing { background: var(--accent-soft); border-color: transparent; color: var(--accent); }
.chip.ok { background: var(--ok-soft); border-color: transparent; color: var(--ok); }
.flag { display: inline-block; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; margin-right: 7px; vertical-align: 1px; }
.flag.high { background: var(--amber-soft); color: var(--amber); }
.flag.urgent { background: var(--warn); color: #fff; }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-size: 11.5px; font-weight: 700; color: #fff; letter-spacing: .02em;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 13px; }
.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--r); padding: 26px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--fg); font-size: 15px; margin-bottom: 4px; }
.linkish { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; }

/* ---------- board ---------- */
.board { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 6px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.col.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 4px; font-family: var(--font-display); font-weight: 600; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; }
.col-head .n { margin-left: auto; font-family: var(--font-body); font-size: 12px; color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.card .row { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.progress { height: 4px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--ok); }

/* project cards */
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.proj-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; text-decoration: none; color: var(--fg); display: flex; flex-direction: column; gap: 10px; }
.proj-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.proj-card h3 { font-size: 19px; display: flex; align-items: center; gap: 9px; }
.proj-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.proj-stats b { color: var(--fg); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgb(8 20 26 / .35); z-index: 30; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100%); background: var(--surface); z-index: 31;
  box-shadow: var(--shadow); display: flex; flex-direction: column; border-left: 1px solid var(--line);
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-right: env(safe-area-inset-right, 0px);
  animation: slide .18s ease-out;
}
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.drawer-head .crumb { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.icon-btn { border: 0; background: none; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 28px; display: flex; flex-direction: column; gap: 18px; }
.title-input { font-family: var(--font-display); font-size: 25px; font-weight: 600; line-height: 1.15; border: 1px solid transparent; border-radius: 8px; padding: 4px 6px; margin: -4px -6px; background: none; width: calc(100% + 12px); resize: none; overflow: hidden; }
.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--accent); }
.status-seg { display: grid; grid-template-columns: repeat(3, 1fr); }
.status-seg button.on[data-v="done"] { background: var(--ok-soft); color: var(--ok); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.section-label { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.section-label .n { font-variant-numeric: tabular-nums; letter-spacing: 0; }
.subs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.sub { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); }
.sub:first-child { border-top: 0; }
.sub .check { width: 20px; height: 20px; }
.sub span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sub.is-done span { color: var(--muted); text-decoration: line-through; }
.sub small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.sub .icon-btn { width: 28px; height: 28px; opacity: .5; }
.sub:hover .icon-btn { opacity: 1; }
.sub-add { display: flex; gap: 8px; }
.link-box { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); }
.link-box a { color: var(--accent); font-weight: 600; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.link-box a:hover { text-decoration: underline; }
.od-badge { width: 30px; height: 30px; border-radius: 7px; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; flex: none; }
.handoff { border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 10px; font-size: 13px; }
.timeline .when { color: var(--muted); font-size: 12px; white-space: nowrap; margin-left: auto; padding-left: 8px; }
.timeline .note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; margin-top: 4px; overflow-wrap: anywhere; }
.confirm { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--warn-soft); color: var(--warn); padding: 10px 12px; border-radius: 9px; font-weight: 600; }

/* ---------- modal ---------- */
.modal {
  position: fixed; z-index: 41; left: 50%; top: 8vh; transform: translateX(-50%); width: min(560px, calc(100% - 24px));
  max-height: 84vh; overflow-y: auto; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 2px solid transparent; }
.swatches button.on { border-color: var(--fg); }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.kpi .label { font-size: 11.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpi .value { font-family: var(--font-display); font-size: 34px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12.5px; color: var(--muted); }
.kpi.hot .value { color: var(--warn); }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.panel h2 { font-size: 19px; }
.panel-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: space-between; }
.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.load { display: flex; flex-direction: column; gap: 10px; }
.load-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.load-row .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.load-row .who span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--surface-2); }
.bar i { display: block; height: 100%; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data th { text-align: left; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
table.data td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; vertical-align: middle; }
table.data th.r, table.data td.r { text-align: right; }
table.data tr.click { cursor: pointer; }
table.data tr.click:hover td { background: var(--surface-2); }
.person { display: flex; align-items: center; gap: 9px; font-weight: 600; white-space: nowrap; }
.pct { display: inline-flex; align-items: center; gap: 8px; }
.pct .track { width: 54px; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; }
.pct .track i { display: block; height: 100%; background: var(--ok); }

/* ---------- login ---------- */
.login-wrap { min-height: 100%; display: grid; place-items: center; padding-block: 32px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.login h1 { font-size: 30px; }
.who-list { display: flex; flex-direction: column; gap: 6px; }
.who-list button { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); text-align: left; }
.who-list button:hover { border-color: var(--accent); background: var(--accent-soft); }
.who-list small { display: block; color: var(--muted); font-size: 12px; }
.err { color: var(--warn); font-size: 13px; font-weight: 600; }
.note-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: var(--muted); }

/* ---------- toast / mobile ---------- */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(24px + env(safe-area-inset-bottom, 0px)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; z-index: 50; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); }
.toast button { border: 0; background: none; color: var(--accent-soft); font-weight: 700; padding: 0; }
.tabbar { display: none; }
.fab { display: none; }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); }
  .topbar { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 14px 10px; }
  .topbar h1 { font-size: 25px; }
  .view { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .tabbar {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
  }
  .tabbar a { height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
  .tabbar a.on { color: var(--accent); }
  .tabbar svg.i { width: 22px; height: 22px; }
  .fab {
    display: grid; place-items: center; position: fixed; z-index: 21; width: 56px; height: 56px; border-radius: 16px; border: 0;
    right: calc(16px + env(safe-area-inset-right, 0px)); bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom, 0px));
    background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow);
  }
  .fab svg.i { width: 26px; height: 26px; }
  .hide-sm { display: none !important; }
  .board { grid-template-columns: repeat(3, minmax(250px, 82vw)); scroll-snap-type: x mandatory; }
  .col { scroll-snap-align: start; }
  .drawer { width: 100%; border-left: 0; }
  .grid2 { grid-template-columns: 1fr; }
  .modal { top: auto; bottom: 0; transform: translateX(-50%); width: 100%; border-radius: 16px 16px 0 0; max-height: 92vh; padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px)); }
  .toast { bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom, 0px)); }
  .load-row { grid-template-columns: 96px 1fr 28px; }
}
@media (prefers-reduced-motion: reduce) { .drawer { animation: none; } }

/* ---------- v2: shared jobs + admin work record ---------- */
.stack { display: inline-flex; flex: none; }
.stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.stack .avatar + .avatar { margin-left: -7px; }
.avatar.more { background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.assignees { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.achip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 3px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); font-weight: 600; font-size: 13px; }
.achip button { border: 0; background: none; color: var(--muted); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; padding: 0; }
.achip button:hover { background: var(--warn-soft); color: var(--warn); }
.achip button svg.i { width: 14px; height: 14px; }
select.add-person { width: auto; padding: 5px 8px; font-size: 13px; border-style: dashed; color: var(--accent); font-weight: 600; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick label { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px 4px 5px; border: 1px solid var(--line-strong); border-radius: 99px; cursor: pointer; font-weight: 600; font-size: 13px; background: var(--surface); }
.pick label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick label:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.sub-text { display: flex; flex-direction: column; gap: 2px; }
.sub.is-done .sub-text { text-decoration: none; }
.sub.is-done .sub-text { color: var(--muted); }
.stamp { display: inline-flex; align-items: center; gap: 4px; color: var(--accent) !important; font-weight: 600; font-size: 11.5px; text-decoration: none; white-space: normal !important; }
.stamp svg.i { width: 12px; height: 12px; }
.stamp em { font-style: normal; color: var(--muted); font-weight: 500; }
select.sub-who { width: auto; max-width: 110px; border: 1px solid transparent; background: var(--surface-2); border-radius: 6px; font-size: 12px; padding: 3px 4px; color: var(--muted); }
select.sub-who:hover, select.sub-who:focus { border-color: var(--line-strong); }
select.sub-owner-new { width: auto; max-width: 120px; }
.worklog { border: 1px solid var(--accent); border-left-width: 1px; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--accent-soft); }
.worklog .section-label { color: var(--accent); }
.worklog .timeline .when { color: var(--muted); }
.lock-note { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.closed-line { font-size: 13.5px; }
.shares { display: flex; flex-direction: column; gap: 7px; }
.share-row { display: grid; grid-template-columns: 110px 1fr 40px; gap: 10px; align-items: center; font-size: 13px; }
.share-row .who { display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; }
.share-row .bar { background: var(--surface); }
.share-row b { text-align: right; }
.explain { margin: 0; font-size: 13px; color: var(--muted); max-width: 75ch; }
.subhead { display: inline-flex; align-items: center; gap: 6px; }
.subhead svg.i { width: 14px; height: 14px; }
.click-row { cursor: pointer; border-radius: 6px; }
.click-row:hover { background: var(--surface-2); }
@media (max-width: 820px) {
  .grid3 { grid-template-columns: 1fr 1fr; }
  .grid3 > :first-child { grid-column: 1 / -1; }
  .share-row { grid-template-columns: 90px 1fr 38px; }
}

#app { height: 100%; }
