:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #efede8; --text: #16181d; --muted: #6b6f78;
  --line: #e2dfd8; --accent: #1f6feb; --accent-text: #ffffff; --good: #1a7f37; --warn: #9a6700;
  --bad: #cf222e; --chip: #ecebe6; --shadow: 0 1px 2px rgba(0,0,0,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1f232c; --text: #e8e9ec; --muted: #9aa0ab;
    --line: #2a2f3a; --accent: #4c8dff; --accent-text: #0b0d11; --good: #3fb950; --warn: #d29922;
    --bad: #f85149; --chip: #232833; --shadow: none;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.4 -apple-system, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.screen.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 16px; padding: 24px; text-align: center; }
.brand { font-size: 28px; font-weight: 700; letter-spacing: .08em; }
form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
input, textarea, select { font: inherit; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); width: 100%; }
.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 12px; padding: 11px 16px; min-height: 44px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.danger { color: var(--bad); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: 14px; }
.btn:disabled { opacity: .5; }
.icon-btn { font-size: 22px; background: none; border: none; color: var(--text); width: 44px; height: 44px; }

header.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); }
.title { font-size: 22px; font-weight: 700; }
.freshness { font-size: 12px; color: var(--muted); }
main { padding: 12px 16px calc(env(safe-area-inset-bottom) + 84px); max-width: 720px; margin: 0 auto; }

nav.tabs { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav.tabs button { position: relative; background: none; border: none; color: var(--muted); font: 12px/1.2 inherit;
  padding: 8px 0 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 56px; }
nav.tabs button span { font-size: 20px; }
nav.tabs button.active { color: var(--accent); font-weight: 600; }
.badge { position: absolute; top: 4px; left: 55%; background: var(--bad); color: #fff; border-radius: 10px;
  font-size: 11px; padding: 1px 6px; font-weight: 700; }

h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 8px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden; }
.row { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--line); min-height: 52px; }
.row:first-child { border-top: none; }
.row.tap { cursor: pointer; }
.row .main { flex: 1; min-width: 0; }
.row .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .side { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.empty { padding: 16px; color: var(--muted); font-size: 14px; }
.chip { display: inline-block; background: var(--chip); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 600; }
.chip.good { color: var(--good); } .chip.warn { color: var(--warn); } .chip.bad { color: var(--bad); }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; }
.chips button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 20px; padding: 6px 12px; font: 14px inherit; }
.chips button.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.stat .n { font-size: 22px; font-weight: 700; } .stat .l { font-size: 12px; color: var(--muted); }
.search { position: sticky; top: 68px; z-index: 4; background: var(--bg); padding: 4px 0 8px; }

.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-end; }
.sheet-body { position: relative; width: 100%; max-height: 88vh; overflow-y: auto; background: var(--bg);
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(env(safe-area-inset-bottom) + 20px); }
.sheet-close { position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; border: none; background: var(--surface-2);
  color: var(--text); border-radius: 20px; font-size: 16px; }
.sheet h3 { margin: 4px 40px 4px 0; font-size: 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; font-size: 14px; margin: 12px 0; }
.kv div:nth-child(odd) { color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.toast { position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 72px); background: var(--text);
  color: var(--bg); padding: 12px 14px; border-radius: 12px; z-index: 30; font-size: 14px; text-align: center; }
.history { font-size: 13px; border-left: 2px solid var(--line); padding-left: 10px; margin: 8px 0; }
.history .d { color: var(--muted); font-size: 12px; }

/* ── Polish round: Today brief, timeline, pipeline board, project file ── */
nav.tabs { grid-template-columns: repeat(4, 1fr); }
.head-actions { display: flex; }
.head-actions .icon-btn { position: relative; }
.head-actions .badge { top: 2px; left: 26px; }
.small { font-size: 13px; }
.prewrap { white-space: pre-wrap; color: var(--text); }
.hello { font-size: 24px; font-weight: 700; margin-top: 6px; }
.brief { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface));
  border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-top: 12px; }
.brief p { margin: 0 0 8px; font-size: 15px; } .brief p:last-child { margin-bottom: 0; }
.brief details { margin-top: 8px; font-size: 14px; } .brief summary { color: var(--accent); font-weight: 600; cursor: pointer; }
.brief pre { white-space: pre-wrap; font: 13px/1.45 inherit; margin: 8px 0 0; color: var(--text); }
.timeline .tl { display: flex; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.timeline .tl:first-child { border-top: none; }
.tl-time { width: 64px; flex: none; font-size: 13px; font-weight: 600; color: var(--accent); padding-top: 2px; }
.tl-body { flex: 1; min-width: 0; } .tl-body .t1 { font-weight: 600; } .tl-body .t2 { font-size: 13px; color: var(--muted); }
.board { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 2px 10px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.col { flex: 0 0 82%; max-width: 340px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; }
.col-head { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; padding: 0 4px; }
.col-head span { background: var(--chip); border-radius: 10px; padding: 0 8px; color: var(--text); }
.pcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); cursor: pointer; }
.pc-client { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pc-name { font-size: 17px; font-weight: 700; margin: 2px 0 6px; line-height: 1.25; }
.pc-when { font-size: 14px; margin-bottom: 8px; } .pc-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bar { height: 6px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.jump { display: flex; gap: 6px; overflow-x: auto; padding: 10px 0 4px; position: sticky; top: -18px; background: var(--bg); z-index: 2; }
.jump a { flex: none; font-size: 13px; padding: 5px 10px; border-radius: 14px; background: var(--chip); color: var(--text); text-decoration: none; }
form.inline { flex-direction: row; max-width: none; margin-top: 8px; } form.inline input { flex: 1; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; }
.pipe { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0 6px; }
.pipe-step { text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 8px 2px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pipe-step b { font-size: 20px; } .pipe-step span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pipe-step.zero { opacity: .45; }
.pipe-step:not(.zero) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.pgrid { display: grid; gap: 10px; }
details.wrapped { margin-top: 18px; } details.wrapped summary { color: var(--muted); font-weight: 600; padding: 8px 4px; cursor: pointer; }
/* Close button stays reachable while a long sheet scrolls */
.sheet-close { position: sticky; top: 0; float: right; margin: -6px -6px 0 8px; z-index: 3; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.pipe-step span { font-size: 9px; letter-spacing: 0; text-align: center; }

/* ── Phase 4A: Daily Brief items ── */
.brief-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.bis { display: grid; gap: 10px; }
.bi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; box-shadow: var(--shadow); }
.bi.p1 { border-left: 4px solid var(--bad); }
.bi-title { font-weight: 700; font-size: 16px; line-height: 1.3; }
.bi-title .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--bad); margin-right: 6px; vertical-align: 2px; }
.bi-why { font-size: 14px; margin-top: 4px; }
.bi-meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.bi-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.btn.ghost { background: none; border-color: transparent; color: var(--muted); }
.drafted { margin-top: 10px; padding: 10px; border-radius: 10px; background: color-mix(in srgb, var(--good) 12%, var(--surface)); font-size: 14px; }
.drafted .draft-text { white-space: pre-wrap; font-size: 13px; color: var(--muted); margin: 6px 0 8px; max-height: 8.5em; overflow: hidden; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 12px 10px; text-align: center; }
.stat-row b { display: block; font-size: 17px; } .stat-row span { font-size: 10px; color: var(--muted); line-height: 1.2; display: block; }
.opts { display: grid; gap: 8px; margin: 12px 0; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
textarea { resize: vertical; }
