/* =====================================================================
   AGENT WORKBENCH — styles.css
   Editorial workbench: paper, cards, calm productivity.
   No dark-space / aurora / particle motifs (intentionally different
   from LOCAL SHIFT).
   ===================================================================== */

:root {
  --paper: #f4f1e8;
  --paper-2: #ebe6d9;
  --ink: #191a1d;
  --ink-soft: #575b63;
  --line: rgba(25, 26, 29, 0.16);
  --panel: rgba(255, 255, 255, 0.72);
  --blue: #315efb;
  --coral: #ef6b57;
  --lime: #b7d83f;
  --yellow: #f2c94c;
  --human: #ef6b57;
  --ai: #315efb;
  --shared: #7d5ce7;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow-soft: 0 2px 4px rgba(25, 26, 29, 0.06), 0 8px 24px rgba(25, 26, 29, 0.06);
  --shadow-lift: 0 10px 28px rgba(25, 26, 29, 0.18);

  /* layout width tokens */
  --page-max: 1280px;
  --reading-max: 1100px;
  --cta-max: 900px;
  --page-gutter: clamp(16px, 4vw, 48px);

  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--paper);
  /* subtle paper noise via layered gradients (no external image) */
  background-image:
    radial-gradient(rgba(25, 26, 29, 0.022) 1px, transparent 1px),
    radial-gradient(rgba(25, 26, 29, 0.018) 1px, transparent 1px);
  background-size: 22px 22px, 13px 13px;
  background-position: 0 0, 7px 7px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.01em; margin: 0; }

a { color: var(--ai); text-underline-offset: 3px; }

img { max-width: 100%; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------- skip link ---------- */
.skip-link {
  position: absolute;
  left: -999px; top: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 16px;
  z-index: 200;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* ---------- focus visibility ---------- */
:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

/* keep anchor targets clear of the sticky header */
section[id] { scroll-margin-top: 80px; }

/* hero title: avoid awkward mid-word break; keep the closing phrase on one line */
.hero-title-nowrap { white-space: nowrap; }

/* =====================================================================
   Buttons
   ===================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { box-shadow: var(--shadow-soft); }
.btn:active { transform: translateY(2px); box-shadow: none; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; }
.btn-ghost { background: transparent; }
.btn-soft { background: var(--paper-2); }
.btn-run {
  background: var(--blue); color: #fff; border-color: var(--blue);
}
.btn-run:hover { background: #1f48d6; }
.btn-approve { background: var(--lime); color: #1c2a00; border-color: #9fc12b; }
.btn-reject { background: #fff; color: #b83a26; border-color: #b83a26; }

/* =====================================================================
   Header
   ===================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(244, 241, 232, 0.86);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px clamp(16px, 4vw, 48px);
  max-width: var(--page-max, 1280px);
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; text-decoration: none; color: var(--ink); }
.brand-mark { display: inline-flex; align-items: center; gap: 3px; }
.bm-card {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 5px;
  font-size: 0.75rem; font-weight: 800; color: #fff;
}
.bm-ai { background: var(--ai); }
.bm-human { background: var(--human); }
.bm-arrow { color: var(--ink-soft); font-weight: 700; }
.brand-name { letter-spacing: 0.04em; }
.site-nav { display: flex; gap: 18px; }
.site-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.9rem; }
.site-nav a:hover { color: var(--ink); }

/* Home new sections */
.hero-intent { max-width: 46ch; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.7; margin: 0 0 14px; }
.trust-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; padding: 0; margin: 0 0 18px; }
.trust-strip li { background: var(--paper-2); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 0.85rem; font-weight: 600; }
.decision-cards, .guide-cards, .tpl-cards { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.decision-card, .guide-card, .tpl-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.decision-card .dc-num, .guide-card h3, .tpl-card h3 { font-weight: 800; }
.decision-card h3, .tpl-card h3 { margin: 6px 0 4px; font-size: 1.1rem; }
.decision-card p, .guide-card p, .tpl-card p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.6; }
.decision-card a, .guide-card a { display: inline-block; margin-top: 8px; color: var(--blue); font-weight: 700; text-decoration: none; }
.tpl-meta { font-size: 0.82rem; color: var(--ink); font-weight: 700; }
.tpl-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
/* Home content sections: align to the shared 1100px central column.
   These sections previously had NO max-width/margin rule, so they stretched
   to the full viewport width and left-aligned — visually breaking the page's
   central axis (regression: left-shifted content). Reuse the exact centering
   token already applied to .how / .principles / .approval-section. */
.decisions,
.guide-hub,
.home-templates,
.home-faq {
  max-width: 1100px;
  margin: clamp(36px, 6vw, 72px) auto 0;
  padding: 0 clamp(16px, 4vw, 48px);
}
.home-faq .faq { max-width: var(--reading-max, 760px); margin-inline: auto; }
.home-faq dt { font-weight: 700; margin-top: 14px; }
.home-faq dd { margin: 4px 0 0; color: var(--ink-soft); }

/* =====================================================================
   Hero
   ===================================================================== */
.hero {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: center;
  padding: clamp(40px, 7vw, 88px) clamp(16px, 4vw, 48px) clamp(32px, 5vw, 64px);
  max-width: 1240px;
  margin: 0 auto;
}
.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--ink-soft);
  margin: 0 0 14px;
}
.hero h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  font-weight: 800;
}
.hero-sub {
  margin: 18px 0 8px;
  font-size: clamp(1.05rem, 2.4vw, 1.5rem);
  font-weight: 700;
  color: var(--ink);
}
.hero-lead { color: var(--ink-soft); margin: 6px 0 22px; max-width: 40ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

.hero-stage {
  position: relative;
  min-height: 320px;
  border-radius: 16px;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 27px, var(--line) 28px),
    linear-gradient(180deg, #fff, var(--paper-2));
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}
.hero-fallback {
  position: absolute; inset: 0;
  display: flex; flex-wrap: wrap; gap: 12px;
  align-content: center; justify-content: center;
  padding: 24px;
}
.card-fallback {
  background: #fff; border: 1px solid var(--line);
  border-radius: 8px; padding: 14px 18px; font-weight: 700;
  box-shadow: var(--shadow-soft);
}
.owner-ai { border-top: 4px solid var(--ai); }
.owner-human { border-top: 4px solid var(--human); }
.owner-shared { border-top: 4px solid var(--shared); }

/* floating cards injected by JS into hero-stage */
.hero-card {
  position: absolute;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  will-change: transform;
  border-top: 4px solid var(--line);
}
.hero-card.is-ai { border-top-color: var(--ai); }
.hero-card.is-human { border-top-color: var(--human); }
.hero-card.is-shared { border-top-color: var(--shared); }

/* =====================================================================
   Section heads
   ===================================================================== */
.section-head { max-width: 1280px; margin: 0 auto; padding: 0 var(--page-gutter); }
.section-head h2 {
  font-size: clamp(1.6rem, 3.6vw, 2.4rem);
  font-weight: 800;
}
.section-lead { color: var(--ink-soft); max-width: 60ch; margin-top: 8px; }

/* =====================================================================
   Workbench
   ===================================================================== */
.workbench-section { padding: clamp(28px, 5vw, 56px) 0; }

#workbench-live { max-width: 1280px; margin: 24px auto 0; padding: 0 var(--page-gutter); }

.wb-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.wb-preset { display: flex; align-items: center; gap: 8px; }
.wb-preset label { font-weight: 700; font-size: 0.85rem; color: var(--ink-soft); }
.wb-preset select {
  font-family: inherit; font-size: 0.95rem;
  padding: 8px 12px; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink);
}
.wb-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.wb-grid {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 16px;
  margin-top: 16px;
  align-items: start;
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 8px;
}
.panel-head h3 { font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.12em; color: var(--ink-soft); }
.panel-hint { font-size: 0.78rem; color: var(--ink-soft); margin: 0 0 8px; }

.wb-drawer, .wb-lane, .wb-inspector {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px;
}
.drawer-scroll { max-height: 560px; overflow: auto; }
.drawer-toggle { display: none; }

/* ---- task cards (drawer) ---- */
.task-card {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  margin-bottom: 8px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-left: 5px solid var(--line);
  font-size: 0.9rem; font-weight: 600;
  cursor: grab;
  text-align: left;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}
.task-card:hover { box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.task-card:active { cursor: grabbing; }
.task-card .tc-title { flex: 1; }
.task-card[data-owner="ai"] { border-left-color: var(--ai); }
.task-card[data-owner="human"] { border-left-color: var(--human); }
.task-card[data-owner="shared"] { border-left-color: var(--shared); }

/* ---- workflow lane ---- */
.lane-stage { position: relative; }
.workflow-lane {
  list-style: none;
  margin: 0; padding: 8px;
  min-height: 420px;
  border: 2px dashed var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.4);
  display: flex; flex-direction: column; gap: 8px;
}
.workflow-lane.drop-active { border-color: var(--blue); background: rgba(49,94,251,0.06); }
.lane-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--ink-soft);
  padding: 24px 16px; font-size: 0.9rem;
  pointer-events: none;
}
.lane-empty .lane-empty-title { font-weight: 800; font-size: 1.05rem; color: var(--ink); margin: 0 0 6px; }
.lane-empty p { margin: 0 0 14px; }
.lane-quick-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.lane-count { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-soft); }

/* ---- workflow card (in lane) ---- */
.wf-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  border-left: 5px solid var(--line);
  box-shadow: var(--shadow-soft);
  cursor: grab;
}
.wf-card[data-owner="ai"] { border-left-color: var(--ai); }
.wf-card[data-owner="human"] { border-left-color: var(--human); }
.wf-card[data-owner="shared"] { border-left-color: var(--shared); }
.wf-card.selected { outline: 3px solid var(--blue); outline-offset: 1px; }
.wf-card.dragging { opacity: 0.4; }
.wf-card.drop-before { box-shadow: 0 -3px 0 0 var(--blue); }
.wf-card.drop-after { box-shadow: 0 3px 0 0 var(--blue); }
.wf-card.running-now { box-shadow: 0 0 0 3px var(--blue), var(--shadow-lift); background: rgba(49,94,251,0.05); }

/* drawer category label */
.drawer-cat {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.1em;
  color: var(--ink-soft); text-transform: uppercase;
  margin: 10px 2px 4px; padding-bottom: 2px; border-bottom: 1px dotted var(--line);
}
.drawer-cat:first-child { margin-top: 0; }

.wf-index {
  font-family: var(--mono); font-size: 0.78rem; font-weight: 700;
  color: var(--ink-soft); min-width: 22px; text-align: center;
}
.wf-main { min-width: 0; }
.wf-title { font-weight: 700; font-size: 0.95rem; }
.wf-owner {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: 999px;
  margin-top: 4px;
}
.owner-badge-ai { background: rgba(49,94,251,0.12); color: #1a3fc0; }
.owner-badge-human { background: rgba(239,107,87,0.16); color: #b83a26; }
.owner-badge-shared { background: rgba(125,92,231,0.16); color: #4b2da8; }
.wf-flag {
  display: inline-block; font-size: 0.68rem; font-weight: 700;
  color: var(--human); margin-top: 4px; margin-left: 6px;
}

/* mobile reorder buttons inside wf-card */
.wf-move { display: none; gap: 4px; }
.wf-move button {
  width: 44px; height: 44px; border-radius: 6px;
  border: 1px solid var(--line); background: var(--paper-2);
  font-weight: 800; cursor: pointer; color: var(--ink);
}
.wf-move button:active { transform: translateY(1px); }

/* ---- inspector ---- */
.inspector-body { font-size: 0.9rem; }
.inspector-empty { color: var(--ink-soft); margin: 0 0 10px; }
.inspector-empty-list { margin: 0; padding-left: 18px; color: var(--ink-soft); display: grid; gap: 6px; }
.inspector-empty-list strong { color: var(--ink); }
.insp-title { font-size: 1.15rem; font-weight: 800; margin-bottom: 8px; }
.insp-row { margin-bottom: 12px; }
.insp-row h4 { font-size: 0.74rem; letter-spacing: 0.08em; color: var(--ink-soft); text-transform: uppercase; margin-bottom: 4px; }
.insp-row p { margin: 0; }
.insp-owner-options { display: flex; gap: 6px; flex-wrap: wrap; }
.owner-opt {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; min-height: 44px;
  border: 1px solid var(--line); border-radius: 999px;
  background: #fff; cursor: pointer; font-weight: 700; font-size: 0.82rem;
}
.owner-opt[aria-pressed="true"] { box-shadow: inset 0 0 0 2px currentColor; }
.owner-opt.opt-ai { color: var(--ai); }
.owner-opt.opt-human { color: var(--coral); }
.owner-opt.opt-shared { color: var(--shared); }
.insp-after { font-size: 0.82rem; color: var(--ink-soft); }
.insp-after code { background: var(--paper-2); padding: 1px 6px; border-radius: 4px; }
.insp-warn { border-left: 3px solid var(--yellow); padding-left: 10px; color: var(--ink-soft); }

/* =====================================================================
   Run area
   ===================================================================== */
.run-area {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-soft);
}
.run-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.run-status { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-soft); }
.run-approval {
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--human); border-radius: 8px;
  background: rgba(239,107,87,0.07);
}
.approval-prompt { font-weight: 700; margin: 0 0 10px; }
.approval-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.run-log-wrap { margin-top: 14px; }
.run-log-wrap h4 { font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.1em; color: var(--ink-soft); margin-bottom: 6px; }
.run-log { list-style: none; margin: 0; padding: 0; font-family: var(--mono); font-size: 0.85rem; }
.run-log li {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 10px; border-radius: 6px; border: 1px solid var(--line);
  margin-bottom: 6px; background: #fff;
}
.run-log li .rl-idx { color: var(--ink-soft); min-width: 28px; }
.run-log li.done-ai { border-left: 4px solid var(--ai); }
.run-log li.done-human { border-left: 4px solid var(--human); }
.run-log li.done-shared { border-left: 4px solid var(--shared); }
.run-log li.current { outline: 2px solid var(--blue); }
.run-log li.wait-approval { border-left: 4px solid var(--human); background: rgba(239,107,87,0.06); }
.run-log li.rejected { border-left: 4px solid var(--human); text-decoration: line-through; opacity: 0.6; }

.sim-note {
  font-size: 0.78rem; color: var(--ink-soft);
  margin: 12px 0 0; padding: 8px 10px;
  border-left: 3px solid var(--line); background: rgba(255,255,255,0.5);
}

/* =====================================================================
   Result panel
   ===================================================================== */
.result-panel {
  max-width: 1280px; margin: 24px auto 0;
  padding: 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); box-shadow: var(--shadow-soft);
}
.result-body { display: grid; gap: 12px; }
.result-verdict {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 1.2rem; font-weight: 800;
  padding: 10px 16px; border-radius: 10px; width: fit-content;
}
.v-good { background: rgba(183,216,63,0.22); color: #4d6b00; }
.v-check { background: rgba(242,201,76,0.22); color: #8a6400; }
.v-warn { background: rgba(239,107,87,0.16); color: #9c3320; }
.v-bad { background: rgba(25,26,29,0.08); color: var(--ink); }
.v-score { font-family: var(--mono); font-size: 0.85rem; color: var(--ink-soft); }
.result-issues { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.result-issues li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.result-issues li.ok { border-left: 4px solid var(--lime); }
.result-issues li.issue { border-left: 4px solid var(--yellow); }
.result-issues li.crit { border-left: 4px solid var(--coral); }
.result-stamp {
  font-family: var(--mono); font-size: 0.8rem; color: var(--ink-soft);
}

.auto-save-note { text-align: center; font-size: 0.8rem; color: var(--ink-soft); margin-top: 12px; min-height: 1.2em; }

.workbench-meta {
  width: min(1280px, calc(100% - 2 * var(--page-gutter)));
  margin: 12px auto 0;
}
.storage-note {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  color: var(--ink-soft); font-size: 0.85rem;
  margin: 0;
}
.storage-note p { margin: 0; }

/* =====================================================================
   How / Principles
   ===================================================================== */
.how { max-width: 1100px; margin: clamp(36px,6vw,72px) auto 0; padding: 0 clamp(16px,4vw,48px); }
.how-steps { display: grid; gap: 10px; padding-left: 0; list-style: none; counter-reset: how; }
.how-steps li {
  counter-increment: how;
  position: relative; padding: 14px 16px 14px 56px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.how-steps li::before {
  content: counter(how);
  position: absolute; left: 14px; top: 12px;
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--ink); color: #fff; border-radius: 8px; font-weight: 800;
}

.principles { max-width: 1100px; margin: clamp(36px,6vw,72px) auto 0; padding: 0 clamp(16px,4vw,48px); }
.principle-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.principle {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-soft);
  border-top: 5px solid var(--blue);
}
.principle[data-principle="checkpoint"] { border-top-color: var(--coral); }
.principle[data-principle="done"] { border-top-color: var(--shared); }
.principle-num { font-family: var(--mono); color: var(--ink-soft); font-weight: 700; }
.principle h3 { margin: 6px 0 8px; font-size: 1.15rem; letter-spacing: 0.02em; }
.principle p { margin: 0; color: var(--ink-soft); }

/* =====================================================================
   Approval demo
   ===================================================================== */
.approval-section { max-width: 1100px; margin: clamp(36px,6vw,72px) auto 0; padding: 0 clamp(16px,4vw,48px); }
.approval-demo {
  margin-top: 20px; padding: 22px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}
.handoff { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.handoff-side { display: grid; gap: 8px; }
.handoff-label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-soft); }
.handoff-card {
  padding: 18px; border-radius: 10px; background: #fff; border: 1px solid var(--line);
  border-top: 5px solid var(--ai); font-weight: 800; font-size: 1.1rem; text-align: center;
  box-shadow: var(--shadow-soft);
}
.handoff-arrow { font-size: 1.8rem; color: var(--ink-soft); font-weight: 800; }
.handoff-target {
  min-height: 70px; border: 2px dashed var(--line); border-radius: 10px;
  display: grid; place-items: center; padding: 12px; text-align: center;
  background: rgba(255,255,255,0.5);
}
.handoff-placeholder { color: var(--ink-soft); font-size: 0.9rem; }
.stamp-ok {
  font-weight: 800; color: #4d6b00; border: 3px solid var(--lime);
  padding: 10px 16px; border-radius: 8px; transform: rotate(-4deg);
  background: rgba(183,216,63,0.18);
}
.handoff-rejected { color: var(--coral); font-weight: 700; }
.approval-demo-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

/* =====================================================================
   CTA + Footer
   ===================================================================== */
.cta {
  width: min(900px, calc(100% - 2 * var(--page-gutter)));
  max-width: 900px;
  margin: clamp(48px, 8vw, 96px) auto 0;
  padding: clamp(28px, 6vw, 64px) clamp(16px, 4vw, 48px);
  text-align: center;
  background: var(--ink); color: #fff; border-radius: 18px;
}
.cta h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.cta p { color: rgba(255,255,255,0.78); max-width: 52ch; margin: 12px auto 22px; }
.cta .btn-primary { background: #fff; color: var(--ink); border-color: #fff; }
.cta .btn-ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,0.5); }
.cta .btn-ghost:hover { border-color: #fff; }

.site-footer { margin-top: clamp(40px,7vw,80px); border-top: 1px solid var(--line); padding: 28px clamp(16px,4vw,48px); }
.footer-inner { max-width: 1100px; margin: 0 auto; display: grid; gap: 8px; }
.footer-brand { font-weight: 800; }
.footer-note { color: var(--ink-soft); font-size: 0.85rem; margin: 0; }
.footer-nav { display: flex; gap: 16px; flex-wrap: wrap; }
.footer-nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.footer-nav a:hover { color: var(--ink); }
.footer-copy { color: var(--ink-soft); font-size: 0.8rem; }
.site-footer__inner { max-width: var(--page-max, 1280px); margin: 0 auto; display: grid; gap: 8px; }
.site-footer__brand { font-weight: 800; margin: 0; }
.site-footer__nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer__nav a { color: var(--ink-soft); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.site-footer__nav a:hover { color: var(--ink); }
.site-footer__release { color: var(--ink-soft); font-size: 0.8rem; margin: 0; }

/* =====================================================================
   Noscript sample + tags
   ===================================================================== */
.noscript-sample {
  max-width: 720px; margin: 24px auto; padding: 20px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.noscript-sample h3 { margin-bottom: 10px; }
.sample-flow { display: grid; gap: 8px; padding-left: 0; list-style: none; }
.sample-flow li { padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tag-ai, .tag-human, .tag-shared {
  display: inline-block; font-size: 0.7rem; font-weight: 800;
  padding: 1px 7px; border-radius: 999px; margin-right: 6px;
}
.tag-ai { background: rgba(49,94,251,0.12); color: var(--ai); }
.tag-human { background: rgba(239,107,87,0.14); color: var(--coral); }
.tag-shared { background: rgba(125,92,231,0.14); color: var(--shared); }

/* =====================================================================
   Mobile drawer bottom sheet
   ===================================================================== */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(25,26,29,0.4);
  z-index: 90;
}
.drawer-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: var(--paper);
  border-top-left-radius: 18px; border-top-right-radius: 18px;
  box-shadow: 0 -8px 30px rgba(25,26,29,0.25);
  padding: 16px clamp(16px,4vw,24px) calc(20px + env(safe-area-inset-bottom));
  max-height: 80vh; overflow: auto;
  transform: translateY(100%);
  transition: transform 0.25s ease;
}
.drawer-sheet.open { transform: translateY(0); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h2 { font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.12em; color: var(--ink-soft); }
.sheet-close {
  width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font-size: 1.1rem; cursor: pointer; color: var(--ink);
}
.sheet-body { display: grid; gap: 8px; }

/* floating add FAB for mobile */
.mobile-add-fab { display: none; }

/* =====================================================================
   Responsive — Tablet
   ===================================================================== */
@media (max-width: 1024px) {
  .wb-grid { grid-template-columns: 240px 1fr; }
  .wb-inspector { grid-column: 1 / -1; }
  .principle-grid { grid-template-columns: 1fr; }
}

/* =====================================================================
   Responsive — Mobile (smartphone)
   Do NOT scale down desktop; restructure instead.
   ===================================================================== */
@media (max-width: 680px) {
  .site-nav { display: none; }
  .hero { grid-template-columns: 1fr; }
  .hero-stage { min-height: 240px; }
  .wb-grid { grid-template-columns: 1fr; }
  .wb-drawer { display: none; }
  .drawer-toggle { display: inline-flex; }
  .wb-toolbar { position: sticky; top: 60px; z-index: 20; }
  .workflow-lane { min-height: 300px; }
  .wf-move { display: inline-flex; }
  .wf-card { grid-template-columns: auto 1fr auto auto; }
  .cta { margin-left: 16px; margin-right: 16px; }

  /* floating add button shown on mobile */
  .mobile-add-fab {
    display: inline-flex; position: fixed; right: 16px; bottom: 16px; z-index: 80;
    width: 56px; height: 56px; border-radius: 999px; border: none;
    background: var(--blue); color: #fff; font-size: 1.6rem; font-weight: 800;
    box-shadow: var(--shadow-lift); align-items: center; justify-content: center;
  }
  .handoff { grid-template-columns: 1fr; }
  .handoff-arrow { transform: rotate(90deg); }
}

@media (max-width: 380px) {
  .hero h1 { font-size: 1.9rem; }
  .btn { padding: 10px 14px; font-size: 0.9rem; }
}

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .drawer-sheet { transition: none; }
  .hero-card { will-change: auto; }
}

/* =====================================================================
   Delegation matrix table — responsive (avoid mobile horizontal overflow)
   ===================================================================== */
.matrix-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.matrix-table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.4;
}
.matrix-table th,
.matrix-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: normal;
  word-break: break-word;
}
.matrix-table thead th {
  background: var(--paper-2);
  position: sticky;
  top: 0;
}
.matrix-table caption {
  text-align: left;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
@media (max-width: 480px) {
  .matrix-table { font-size: 0.82rem; }
  .matrix-table th,
  .matrix-table td { padding: 6px 7px; }
}
