:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6eb;
  --text: #16181d;
  --muted: #5f6673;
  --accent: #4b3fd6;
  --accent-soft: #ecebfc;
  --green: #138a52; --green-soft: #e3f5ec;
  --amber: #a86400; --amber-soft: #fdf1dc;
  --red: #c4314b;   --red-soft: #fce7eb;
  --grey-soft: #eceef1;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a20; --surface-2: #1e222a; --border: #2a2f39;
    --text: #e8eaee; --muted: #9aa1ad; --accent: #8f86ff; --accent-soft: #24224a;
    --green: #4cc98a; --green-soft: #13301f; --amber: #f0b44c; --amber-soft: #33270f;
    --red: #ff7a90; --red-soft: #3a1820; --grey-soft: #262a33;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 Inter, system-ui, -apple-system, Segoe UI, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.error { color: var(--red); margin-top: 12px; }

.demo-banner { background: var(--amber-soft); color: var(--amber); padding: 8px 16px; font-size: 13px; text-align: center; }

/* Buttons */
.btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; font-weight: 600; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-ghost { background: transparent; border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-google { display: inline-flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 18px; font-weight: 600; box-shadow: var(--shadow); }
.btn-google:hover { background: var(--surface-2); }

/* Sign-in */
.signin { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.signin-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 40px 32px; max-width: 420px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.signin-card h1 { font-size: 26px; margin: 18px 0 8px; }
.signin-card .muted { margin-bottom: 24px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.logo { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px; }

/* Top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.topbar .sep { color: var(--muted); font-weight: 400; }
.topbar .crumb { font-weight: 500; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs button { background: none; border: 0; padding: 8px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.user { display: flex; align-items: center; gap: 10px; }
.user img { width: 28px; height: 28px; border-radius: 50%; }
.badge { background: var(--accent-soft); color: var(--accent); font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }

.callout { margin: 16px 24px 0; padding: 14px 16px; background: var(--accent-soft); border-radius: var(--radius); display: flex; align-items: center; gap: 16px; justify-content: space-between; flex-wrap: wrap; }

.content { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 32px 0 12px; }

/* Strategy hero */
.hero { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.hero h1 { font-size: 28px; margin-bottom: 10px; }
.hero .goal { font-size: 18px; font-weight: 500; margin-bottom: 12px; }
.countdowns { display: grid; gap: 12px; }
.countdown { display: flex; justify-content: space-between; align-items: baseline; padding: 14px 16px; border-radius: 10px; background: var(--surface-2); }
.countdown .num { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.countdown.urgent .num { color: var(--red); }

/* Milestone path */
.path { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; position: relative; padding-top: 8px; }
.path::before { content: ""; position: absolute; top: 15px; left: 8%; right: 8%; height: 2px; background: var(--border); }
.step { text-align: center; position: relative; padding: 0 6px; }
.step .dot { width: 16px; height: 16px; border-radius: 50%; margin: 0 auto 10px; background: var(--surface); border: 3px solid var(--accent); position: relative; }
.step.past .dot { background: var(--accent); }
.step .date { font-size: 12px; color: var(--muted); }
.step .label { font-weight: 600; font-size: 13px; }

.pillar h3 { font-size: 16px; margin-bottom: 12px; }
.pillar .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--muted); margin: 12px 0 6px; }
.pillar ul { margin: 0; padding-left: 18px; }
.pillar li { margin: 3px 0; }
.pillar .risk { margin-top: 14px; padding: 10px 12px; border-radius: 8px; background: var(--amber-soft); color: var(--text); font-size: 13px; }
.pillar .okr-link { margin-top: 12px; font-size: 13px; color: var(--accent); background: none; border: 0; padding: 0; font-weight: 600; }

.risk-list { list-style: none; margin: 0; padding: 0; }
.risk-list li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.risk-list li:last-child { border-bottom: 0; }
.lvl { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; height: fit-content; text-transform: uppercase; white-space: nowrap; }
.lvl.high { background: var(--red-soft); color: var(--red); }
.lvl.medium { background: var(--amber-soft); color: var(--amber); }
.lvl.low { background: var(--grey-soft); color: var(--muted); }

/* OKRs */
.okr-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.okr-toolbar .seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; }
.okr-toolbar .seg button { background: none; border: 0; padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 500; }
.okr-toolbar .seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.okr-toolbar select { width: auto; }
.summary-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.stat .v { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); }

.objective { margin-bottom: 16px; padding: 0; overflow: hidden; }
.obj-head { padding: 18px 20px; display: grid; grid-template-columns: 1fr 180px; gap: 16px; align-items: center; border-bottom: 1px solid var(--border); }
.obj-head .area { font-size: 12px; color: var(--accent); font-weight: 600; }
.obj-head h3 { font-size: 17px; margin: 2px 0 4px; }
.obj-head .why { color: var(--muted); font-size: 13px; }
.bar { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.bar.done > span { background: var(--green); }
.pct { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; margin-bottom: 6px; }

.kr { display: grid; grid-template-columns: 1fr 150px 90px 140px 110px; gap: 14px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; }
.kr:last-child { border-bottom: 0; }
.kr:hover { background: var(--surface-2); }
.kr .t { font-weight: 500; }
.kr .t .stretch { font-size: 11px; color: var(--green); background: var(--green-soft); border-radius: 999px; padding: 1px 7px; margin-left: 6px; font-weight: 600; }
.kr .owner { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kr .owner.me { color: var(--accent); font-weight: 600; }
.kr .owner.none { font-style: italic; }
.kr .due { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kr .due.overdue { color: var(--red); font-weight: 600; }
.kr .prog { display: grid; gap: 4px; }
.kr .prog .val { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kr-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; cursor: default; padding-top: 10px; padding-bottom: 6px; }
.kr-head:hover { background: none; }

.status { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; justify-self: start; }
.status.not_started { background: var(--grey-soft); color: var(--muted); }
.status.on_track { background: var(--green-soft); color: var(--green); }
.status.at_risk { background: var(--amber-soft); color: var(--amber); }
.status.off_track { background: var(--red-soft); color: var(--red); }
.status.done { background: var(--green); color: #fff; }

/* Timeline */
.tl-wrap { overflow-x: auto; }
.tl { display: grid; grid-template-columns: 150px repeat(6, minmax(170px, 1fr)); min-width: 1180px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tl > div { padding: 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.tl .th { font-weight: 600; background: var(--surface-2); font-size: 13px; }
.tl .th.now { background: var(--accent-soft); color: var(--accent); }
.tl .area { font-weight: 600; background: var(--surface-2); font-size: 13px; }
.tl .cell.now { background: color-mix(in srgb, var(--accent-soft) 40%, transparent); }
.chip { display: block; font-size: 12px; padding: 5px 8px; border-radius: 6px; background: var(--surface-2); margin-bottom: 6px; line-height: 1.35; }
.chip.stretch { background: var(--green-soft); color: var(--green); }
.chip.key { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Drawer */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(10,12,16,.35); z-index: 40; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--surface); z-index: 50; overflow-y: auto; padding: 24px; border-left: 1px solid var(--border); box-shadow: -8px 0 24px rgba(0,0,0,.12); }
.drawer h2 { font-size: 19px; margin: 6px 0 8px; }
.drawer .close { position: absolute; top: 16px; right: 16px; }
.drawer .meta { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 16px 0; font-size: 13px; }
.drawer .meta .k { color: var(--muted); font-size: 12px; }
.drawer form { display: grid; gap: 12px; margin-top: 8px; }
.drawer label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.drawer fieldset { border: 1px solid var(--border); border-radius: 10px; padding: 14px; display: grid; gap: 12px; margin: 0; }
.drawer legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.history .when { color: var(--muted); font-size: 12px; }
.readonly-note { font-size: 13px; color: var(--muted); background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; font-size: 14px !important; }
.check input { width: auto; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; z-index: 60; font-weight: 500; }

@media (max-width: 860px) {
  .topbar { padding: 10px 16px; }
  .tabs { order: 3; width: 100%; margin: 0; }
  .user { margin-left: auto; }
  .user #user-email { display: none; }
  .content { padding: 16px; }
  .hero { grid-template-columns: 1fr; }
  .path { grid-template-columns: 1fr; gap: 12px; text-align: left; }
  .path::before { display: none; }
  .step { display: grid; grid-template-columns: 16px 1fr; gap: 0 12px; text-align: left; }
  .step .dot { margin: 3px 0 0; grid-row: span 2; }
  .obj-head { grid-template-columns: 1fr; }
  .kr { grid-template-columns: 1fr auto; gap: 6px 12px; padding: 12px 16px; }
  .kr .owner, .kr .due { grid-column: 1; }
  .kr .prog { grid-column: 1 / -1; }
  .kr .status { grid-row: 1; grid-column: 2; }
  .kr-head { display: none; }
  .callout { margin: 12px 16px 0; }
}
.overdue { color: var(--red); font-weight: 600; }

.btn-link { background: none; border: 0; padding: 0; color: inherit; text-decoration: underline; font-size: inherit; }
#view-as { width: auto; padding: 4px 8px; }

/* ---- v2: health, blockers, decisions ---- */
.google-btn { display: flex; justify-content: center; min-height: 44px; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 999px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; margin-left: 4px; line-height: 18px; }
.light { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.light.green { background: var(--green); } .light.amber { background: var(--amber); } .light.red { background: var(--red); }
.kr { grid-template-columns: 22px 1fr 150px 90px 140px 110px; }
.kr-head { grid-template-columns: 22px 1fr 150px 90px 140px 110px; }
.kr .flag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 999px; margin-left: 6px; vertical-align: middle; }
.flag.update { background: var(--amber-soft); color: var(--amber); }
.flag.overdue { background: var(--red-soft); color: var(--red); }
.flag.blocked { background: var(--red-soft); color: var(--red); }
.flag.confirmed { background: var(--green-soft); color: var(--green); }
.bar.amber > span { background: var(--amber); } .bar.red > span { background: var(--red); }
.bar { position: relative; }
.bar .expect { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--muted); opacity: .6; }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.light-strip { display: flex; gap: 6px; align-items: center; }
.light-strip .n { font-weight: 600; font-variant-numeric: tabular-nums; }
.attention { margin-bottom: 20px; }
.attention h3 { font-size: 15px; margin-bottom: 10px; }
.attention ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.attention li { display: flex; gap: 10px; align-items: center; font-size: 13px; }
.attention li a, .attention li button { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 600; cursor: pointer; text-align: left; }
.sev { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; white-space: nowrap; }
.sev.low { background: var(--grey-soft); color: var(--muted); } .sev.medium { background: var(--amber-soft); color: var(--amber); }
.sev.high { background: var(--red-soft); color: var(--red); } .sev.critical { background: var(--red); color: #fff; }
.blocker { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start; padding: 14px 20px; border-bottom: 1px solid var(--border); width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; cursor: pointer; }
.blocker:last-child { border-bottom: 0; } .blocker:hover { background: var(--surface-2); }
.blocker .t { font-weight: 600; } .blocker .m { font-size: 13px; color: var(--muted); margin-top: 2px; }
.blocker .links { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.blocker .links span { font-size: 11px; background: var(--surface-2); border-radius: 6px; padding: 2px 6px; }
.blocker.resolved { opacity: .6; }
.status.escalated { background: var(--red); color: #fff; } .status.open { background: var(--amber-soft); color: var(--amber); } .status.resolved { background: var(--green-soft); color: var(--green); }
.status.pending { background: var(--amber-soft); color: var(--amber); } .status.decided { background: var(--green-soft); color: var(--green); } .status.withdrawn { background: var(--grey-soft); color: var(--muted); }
.card.list { padding: 0; overflow: hidden; }
.card.list .hd { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.card.list .hd h3 { font-size: 15px; }
.range { display: flex; align-items: center; gap: 10px; } .range input[type=range] { flex: 1; padding: 0; }
.range output { min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--text); }
.multi { display: grid; gap: 4px; max-height: 180px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 8px; }
.multi label { display: flex; gap: 8px; font-size: 13px; color: var(--text); font-weight: 400; } .multi input { width: auto; }
.history .chg { font-size: 12px; color: var(--muted); }
.history .chg b { color: var(--text); font-weight: 500; }
.drawer .row-2 label, .drawer .row-3 label { min-width: 0; }
.evidence { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-top: 10px; }
.evidence .k { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
@media (max-width: 860px) {
  .kr { grid-template-columns: 22px 1fr auto; }
  .kr .owner, .kr .due { grid-column: 2; }
  .kr .prog { grid-column: 1 / -1; }
  .kr .status { grid-row: 1; grid-column: 3; }
  .blocker { grid-template-columns: 1fr; }
}
