:root {
  --paper: #fafaf8;
  --paper-2: #f3f2ec;
  --paper-3: #ecebe3;
  --ink: #23261f;
  --ink-2: #55584d;
  --ink-3: #66665f; /* WCAG 4.5:1+ on all site bgs (worst #ecebe3 = 4.84:1) */
  --line: #dddccf;
  --line-2: #e6e5db;
  --accent: #2f5d4f;
  --accent-soft: #e6efe9;
  --accent-ink: #24493d;
  --warn: #8a5a1a;
  --warn-soft: #f5ecdc;
  --danger: #8c3b32;
  --danger-soft: #f6e4e1;
  --radius: 8px;
  --font: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Pretendard",
    "Segoe UI", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body { padding-bottom: 40px; }

h1, h2, h3, h4 { font-weight: 650; line-height: 1.3; margin: 0; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- header / tabs ---- */
header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 12px 18px 0;
}
.brand { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.brand h1 { font-size: 17px; letter-spacing: -0.01em; }
.brand .sub { color: var(--ink-3); font-size: 12.5px; }

.tabs {
  display: flex;
  gap: 2px;
  margin-top: 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  appearance: none;
  border: none;
  background: none;
  color: var(--ink-2);
  font-family: inherit;
  font-size: 14px;
  font-weight: 550;
  padding: 9px 14px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--accent-ink); border-bottom-color: var(--accent); }

main { max-width: 920px; margin: 0 auto; padding: 20px 18px 0; }
.panel { display: none; }
.panel.active { display: block; animation: fade .15s ease; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ---- generic card ---- */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.card.tone { background: var(--paper-2); }
.card h2 { font-size: 15px; margin-bottom: 10px; }
.card h3 { font-size: 13.5px; color: var(--ink-2); margin-bottom: 8px; }

.muted { color: var(--ink-3); font-size: 12.5px; }
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 6px;
}

/* ---- badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--paper-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfe0d7; }
.badge.hypo { background: var(--warn-soft); color: var(--warn); border-color: #e7d6b8; cursor: help; }
.badge.core { background: #fff; color: var(--accent-ink); border-color: #cfe0d7; }
.badge.optional { color: var(--ink-3); }
.badge.lane { font-weight: 550; }
.badge.combined { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfe0d7; }

/* ---- today tab ---- */
.now-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.now-gate {
  font-size: 13px;
  color: var(--accent-ink);
  font-weight: 600;
}
.hero-task {
  background: #fff;
  border: 1px solid #cfe0d7;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
}
.hero-task .label { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.hero-task h2 { font-size: 21px; margin: 8px 0; letter-spacing: -0.01em; line-height: 1.25; }
.hero-task .desc { color: var(--ink-2); font-size: 13.5px; }
.hero-task .meta { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hero-task .dod { margin-top: 12px; font-size: 12.5px; color: var(--ink-2); background: var(--paper-2); padding: 8px 10px; border-radius: 6px; }
.next-task {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 0; border-top: 1px solid var(--line-2);
}
.next-task:first-child { border-top: none; }
.next-task .ntitle { font-weight: 550; font-size: 14px; }
.next-task .nmeta { margin-top: 3px; }
.check {
  flex: none;
  width: 20px; height: 20px;
  border: 1.5px solid var(--line);
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  margin-top: 1px;
  padding: 0;
}
.check[aria-checked="true"] { background: var(--accent); border-color: var(--accent); }
.check[aria-checked="true"]::after { content: "✓"; color: #fff; font-size: 13px; line-height: 1; }

.f4-badge {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 14px;
}
.f4-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }

/* ---- progress ---- */
.bar {
  height: 7px; background: var(--paper-3); border-radius: 20px; overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 20px; transition: width .3s ease; }
.progress-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.progress-row .plabel { font-size: 12.5px; width: 128px; flex: none; color: var(--ink-2); }
.progress-row .bar { flex: 1; }
.progress-row .ppct { font-size: 12px; width: 62px; text-align: right; color: var(--ink-3); flex: none; font-variant-numeric: tabular-nums; }

/* ---- roadmap timeline ---- */
.timeline { display: flex; flex-direction: column; gap: 10px; }
.gate {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}
.gate.current { border-color: #b9d2c7; box-shadow: 0 0 0 1px #cfe0d7; }
.gate-head {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; cursor: pointer; user-select: none;
}
.gate-head:hover { background: var(--paper-2); }
.gate-marker {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--paper-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--ink-2);
}
.gate.current .gate-marker { background: var(--accent); color: #fff; border-color: var(--accent); }
.gate-title { flex: 1; min-width: 0; }
.gate-title .gt { font-size: 14.5px; font-weight: 600; }
.gate-title .gw { font-size: 12px; color: var(--ink-3); }
.gate-right { display: flex; align-items: center; gap: 10px; flex: none; }
.gate-pct { font-size: 12px; color: var(--ink-3); width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.gate-mini-bar { width: 60px; height: 5px; background: var(--paper-3); border-radius: 20px; overflow: hidden; }
.gate-mini-bar > span { display: block; height: 100%; background: var(--accent); }
.chev { color: var(--ink-3); transition: transform .2s; font-size: 12px; }
.gate.open .chev { transform: rotate(90deg); }
.gate-body { display: none; padding: 4px 16px 14px; border-top: 1px solid var(--line-2); }
.gate.open .gate-body { display: block; }
.gate-summary { font-size: 12.5px; color: var(--ink-2); margin: 10px 0; }
.gate-dod { font-size: 12px; color: var(--ink-2); background: var(--paper-2); padding: 8px 10px; border-radius: 6px; margin-bottom: 10px; }
.set-current {
  appearance: none; border: 1px solid var(--line); background: #fff;
  font-family: inherit; font-size: 12px; color: var(--accent-ink);
  padding: 4px 10px; border-radius: 6px; cursor: pointer; margin-bottom: 8px;
}
.set-current:hover { background: var(--accent-soft); }
.set-current[disabled] { color: var(--ink-3); cursor: default; background: var(--paper-2); }

/* ---- item row ---- */
.item {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 11px 0; border-top: 1px solid var(--line-2);
}
.item:first-of-type { border-top: none; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 550; }
.item.done .item-title { color: var(--ink-3); text-decoration: line-through; }
.item-desc { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.item-tags { margin-top: 7px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.item-dod { margin-top: 6px; font-size: 12px; color: var(--ink-3); }
.item-dod b { color: var(--ink-2); font-weight: 600; }
.res-links { margin-top: 6px; display: flex; gap: 8px; flex-wrap: wrap; }
.res-links a, .res-links span.int {
  font-size: 12px; color: var(--accent-ink);
  border: 1px solid var(--line); background: var(--paper-2);
  padding: 2px 8px; border-radius: 20px;
}
.res-links span.int { color: var(--ink-3); }

/* ---- funnel tab ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; color: var(--ink-2); font-weight: 550; }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  border: 1px solid var(--line); border-radius: 6px;
  padding: 7px 9px; background: #fff; width: 100%;
}
.field textarea { resize: vertical; min-height: 44px; }
.check-inline { flex-direction: row; align-items: center; gap: 7px; }
.check-inline input { width: auto; }
.btn {
  appearance: none; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 8px 16px; border-radius: 6px; cursor: pointer;
}
.btn:hover { background: var(--accent-ink); }
.btn.ghost { background: #fff; color: var(--accent-ink); }
.btn.ghost:hover { background: var(--accent-soft); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; }

.counter-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.counter {
  flex: 1; min-width: 120px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px;
}
.counter .cnum { font-size: 24px; font-weight: 700; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.counter .clabel { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.counter .csub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.alert {
  border-radius: var(--radius); padding: 13px 15px; margin-bottom: 14px;
  font-size: 13px; border: 1px solid;
}
.alert.exp { background: var(--warn-soft); border-color: #e7d6b8; color: var(--warn); }
.alert.reselect { background: var(--danger-soft); border-color: #e8c9c3; color: var(--danger); }
.alert.ok { background: var(--accent-soft); border-color: #cfe0d7; color: var(--accent-ink); }
.alert b { font-weight: 700; }
.alert .sub { margin-top: 5px; font-size: 12px; opacity: 0.92; }

.rec {
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 11px 13px; margin-bottom: 9px; background: #fff;
}
.rec-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.rec-co { font-weight: 600; font-size: 14px; }
.rec-meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.rec-del {
  appearance: none; border: none; background: none; color: var(--ink-3);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 2px 4px;
}
.rec-del:hover { color: var(--danger); }
.pill { font-size: 11px; padding: 1px 7px; border-radius: 20px; background: var(--paper-2); border: 1px solid var(--line); }
.pill.fit { background: var(--accent-soft); color: var(--accent-ink); border-color: #cfe0d7; }
.pill.stage { background: #fff; }

/* ---- tables ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 380px; }
table.data th, table.data td {
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line-2);
  vertical-align: top;
}
table.data th { color: var(--ink-2); font-weight: 600; background: var(--paper-2); }
table.data tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--ink-2); font-weight: 550; }
.kv dd { margin: 0; }

ul.tight { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
ul.tight li { margin-bottom: 4px; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.toolbar .spacer { flex: 1; }

.section-title { font-size: 13px; font-weight: 650; color: var(--ink); margin: 18px 0 8px; }
.section-title:first-child { margin-top: 0; }

.tooltip-host { position: relative; }
.tooltip {
  display: none; position: absolute; z-index: 30; bottom: calc(100% + 6px); left: 0;
  width: 240px; background: var(--ink); color: #f4f3ec;
  font-size: 11.5px; font-weight: 400; line-height: 1.45;
  padding: 8px 10px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.tooltip-host:hover .tooltip, .tooltip-host:focus-within .tooltip { display: block; }

@media (max-width: 560px) {
  main { padding: 16px 13px 0; }
  .top-inner { padding: 11px 13px 0; }
  .form-grid { grid-template-columns: 1fr; }
  .hero-task h2 { font-size: 18px; }
  .progress-row .plabel { width: 96px; font-size: 12px; }
  .card { padding: 14px; }
}
