/* ===== RevOps Hub — design tokens ===== */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --ink: #1c2733;
  --ink-2: #4b5a6a;
  --ink-3: #7d8a99;
  --line: #e2e6ec;
  --brand: #0f4c81;
  --brand-soft: #e3edf6;
  --accent: #c88a1c;
  --accent-soft: #fdf3e0;
  --left-wing: #2f6fa7;
  --left-soft: #e7f0f8;
  --center: #c88a1c;
  --center-soft: #fbf0da;
  --right-wing: #3d8f5f;
  --right-soft: #e6f3ea;
  --danger: #b3462e;
  --danger-soft: #f9e9e4;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(28, 39, 51, 0.06), 0 4px 14px rgba(28, 39, 51, 0.05);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.75;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ===== layout ===== */
.shell {
  display: grid;
  grid-template-columns: 232px 1fr;
  grid-template-rows: 56px 1fr;
  grid-template-areas: "topbar topbar" "sidebar main";
  min-height: 100vh;
}
.topbar {
  grid-area: topbar;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--brand);
  color: #fff;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand-mark { font-weight: 700; letter-spacing: -2px; font-size: 18px; opacity: 0.9; }
.brand-name { font-weight: 700; font-size: 17px; letter-spacing: 0.02em; }
.topbar-sub { font-size: 12px; opacity: 0.75; margin-left: 2px; }
.menu-btn {
  display: none;
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}

.sidebar {
  grid-area: sidebar;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.nav-group {
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-3);
  letter-spacing: 0.1em;
  margin: 16px 10px 4px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
}
.nav-ico { width: 20px; text-align: center; font-size: 14px; opacity: 0.8; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 6px;
  font-size: 11px;
  color: var(--ink-3);
  border-top: 1px solid var(--line);
}

.main {
  grid-area: main;
  padding: 32px clamp(20px, 4vw, 48px) 80px;
  max-width: 1080px;
  width: 100%;
  outline: none;
}

/* ===== typography / common ===== */
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: 0.01em; }
.page-head .lede { color: var(--ink-2); margin-top: 8px; max-width: 72ch; }
.section { margin-top: 36px; }
.section > h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-left: 12px;
  border-left: 4px solid var(--brand);
}
.section > h3 { font-size: 15px; font-weight: 700; margin: 18px 0 10px; }
.note {
  background: var(--accent-soft);
  border: 1px solid #efd9a8;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: #6b4d10;
  margin: 12px 0;
}
.principle {
  background: var(--brand);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 22px;
  font-size: 16px;
  font-weight: 700;
  margin: 14px 0;
  box-shadow: var(--shadow);
}
.muted { color: var(--ink-3); font-size: 13px; }

/* ===== cards ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 14px; }
.card h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 6px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.card-grid .card { margin: 0; }

/* ===== tables ===== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: var(--surface-2); font-size: 12px; color: var(--ink-2); white-space: nowrap; position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
td.nowrap, th.nowrap { white-space: nowrap; }

/* ===== chips / badges ===== */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-2);
  font-family: var(--font);
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}
.badge.b-active { background: var(--right-soft); color: var(--right-wing); }
.badge.b-partial { background: var(--center-soft); color: #8a6114; }
.badge.b-defined { background: var(--brand-soft); color: var(--brand); }
.badge.b-idea { background: var(--surface-2); color: var(--ink-3); }
.badge.b-none { background: var(--danger-soft); color: var(--danger); }
.badge.b-stage { background: var(--left-soft); color: var(--left-wing); }
.badge.b-layer { background: #ede8f7; color: #5b3fa8; }

.search-box {
  width: 100%;
  max-width: 380px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: var(--font);
  background: var(--surface);
}
.search-box:focus { outline: 2px solid var(--brand); border-color: transparent; }

/* ===== home ===== */
.hero {
  background: linear-gradient(120deg, var(--brand) 0%, #16639f 55%, #1b7b8f 100%);
  color: #fff;
  border-radius: 16px;
  padding: 36px 34px;
  box-shadow: var(--shadow);
}
.hero h1 { font-size: 28px; font-weight: 800; margin-bottom: 10px; }
.hero p { max-width: 68ch; opacity: 0.92; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-top: 22px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.stat:hover { border-color: var(--brand); }
.stat .num { font-size: 26px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.stat .lbl { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.stat .sub { font-size: 11px; color: var(--ink-3); }

/* ===== bowtie ===== */
.bowtie {
  display: flex;
  align-items: stretch;
  gap: 6px;
  margin: 20px 0 8px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.wing { display: flex; gap: 6px; align-items: stretch; }
.wing-left { clip-path: polygon(0 0, 100% 12%, 100% 88%, 0 100%); background: var(--left-soft); padding: 22px 10px 22px 14px; border-radius: 8px 0 0 8px; }
.wing-center { background: var(--center-soft); padding: 30px 10px; }
.wing-right { clip-path: polygon(0 12%, 100% 0, 100% 100%, 0 88%); background: var(--right-soft); padding: 22px 14px 22px 10px; border-radius: 0 8px 8px 0; }
.stage-btn {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  min-width: 86px;
  border: 1.5px solid transparent;
  background: var(--surface);
  border-radius: 10px;
  padding: 10px 10px;
  cursor: pointer;
  font-family: var(--font);
  text-align: center;
  box-shadow: 0 1px 2px rgba(28,39,51,0.1);
}
.stage-btn .sid { font-size: 11px; font-weight: 800; letter-spacing: 0.04em; }
.stage-btn .snm { font-size: 12.5px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.stage-btn[data-wing="left"] .sid { color: var(--left-wing); }
.stage-btn[data-wing="center"] .sid { color: #a06e0e; }
.stage-btn[data-wing="right"] .sid { color: var(--right-wing); }
.stage-btn:hover { border-color: var(--ink-3); }
.stage-btn.sel[data-wing="left"] { border-color: var(--left-wing); background: #fff; box-shadow: 0 0 0 3px var(--left-soft); }
.stage-btn.sel[data-wing="center"] { border-color: var(--center); box-shadow: 0 0 0 3px var(--center-soft); }
.stage-btn.sel[data-wing="right"] { border-color: var(--right-wing); box-shadow: 0 0 0 3px var(--right-soft); }
.bowtie-legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-bottom: 14px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.stage-detail dl { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin-top: 10px; }
.stage-detail dt { font-size: 12.5px; font-weight: 700; color: var(--ink-3); }
.stage-detail dd { font-size: 14px; }
.kpi-tag { display: inline-block; background: var(--surface-2); border-radius: 6px; padding: 2px 9px; font-size: 12px; margin: 2px 4px 2px 0; color: var(--ink-2); }

/* ===== guardrails checklist ===== */
.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
}
.check-item .q { font-size: 14px; font-weight: 600; }
.check-item .pat { font-size: 12px; color: var(--ink-3); }
.toggle {
  position: relative;
  width: 46px; height: 26px;
  border-radius: 999px;
  border: none;
  background: #cfd6de;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}
.toggle::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
.toggle.on { background: var(--brand); }
.toggle.on::after { left: 23px; }
.gr-card { border-left: 4px solid var(--line); }
.gr-card.hit { border-left-color: var(--danger); background: #fffdf9; }
.gr-card .gr-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.gr-id { font-weight: 800; color: var(--brand); }
.gr-req { margin-left: auto; }
.result-box {
  border: 1.5px dashed var(--brand);
  background: var(--brand-soft);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 16px 0;
  font-size: 14px;
}

/* ===== maturity ===== */
.maturity-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin: 14px 0; }
.mat-cell {
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  background: var(--surface);
  cursor: pointer;
  font-family: var(--font);
  text-align: left;
}
.mat-cell .lv { font-size: 12px; font-weight: 800; color: var(--ink-3); }
.mat-cell .nm { font-weight: 700; font-size: 14px; margin: 2px 0 4px; }
.mat-cell .ds { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.mat-cell.cur { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.mat-cell.tgt { border-color: var(--right-wing); box-shadow: 0 0 0 3px var(--right-soft); }
.mat-cell.cur.tgt { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft), 0 0 0 6px var(--right-soft); }
.mat-mode { display: flex; gap: 8px; margin-bottom: 4px; }

/* ===== rhythm ===== */
.weekly-q {
  display: flex;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 8px;
  align-items: flex-start;
}
.weekly-q input[type="checkbox"] { width: 18px; height: 18px; margin-top: 4px; accent-color: var(--brand); flex-shrink: 0; }
.weekly-q .qq { font-weight: 700; font-size: 14.5px; }
.weekly-q .qw { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.weekly-q.done { opacity: 0.55; }
.action-input {
  width: 100%;
  min-height: 72px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  resize: vertical;
  background: var(--surface);
}
.action-input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.reset-link { background: none; border: none; color: var(--ink-3); font-size: 12px; cursor: pointer; text-decoration: underline; font-family: var(--font); padding: 0; }
.reset-link:hover { color: var(--danger); }

/* ===== steps / flow ===== */
.flow { counter-reset: fstep; }
.flow-item {
  display: flex;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.flow-item:last-child { border-bottom: none; }
.flow-no {
  flex-shrink: 0;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.flow-item .fn { font-weight: 700; font-size: 14.5px; }
.flow-item .fd { font-size: 13.5px; color: var(--ink-2); }

/* ===== footer ===== */
.page-foot { margin-top: 48px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-3); }

/* ===== responsive ===== */
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar {
    position: fixed;
    top: 56px; left: 0; bottom: 0;
    width: 240px;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.15);
    height: auto;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-btn { display: block; }
  .topbar-sub { display: none; }
  .maturity-row { grid-template-columns: 1fr; }
  .stage-detail dl { grid-template-columns: 1fr; gap: 2px 0; }
  .stage-detail dt { margin-top: 8px; }
}
