/* ============================================================
   SR Cockpit — design system  (refined academic)
   Calm, precise, editorial. Hairlines, generous whitespace,
   one confident accent. Light + dark, theme-aware.
   ============================================================ */
:root {
  /* neutrals (light) — warm archival paper */
  --bg: #f4f2ec;
  --bg-grad: radial-gradient(1200px 560px at 100% -10%, #efece2 0%, transparent 60%), var(--bg);
  --surface: #fffdf9;
  --surface-2: #f3f0e8;
  --surface-3: #e9e5da;
  --border: #e6e1d5;
  --border-strong: #d2ccbc;
  --text: #23262d;
  --text-soft: #4c515b;
  --muted: #71757f;
  --faint: #9ca0a9;

  /* one confident accent — deep scholarly ink-indigo */
  --accent: #37478d;
  --accent-strong: #2a3770;
  --accent-soft: #eaecf7;
  --accent-ink: #2c3873;

  --good: #1f8f56; --good-soft: #e5f2ea;
  --bad: #c33b3b; --bad-soft: #f8e6e4;
  --warn: #a97711; --warn-soft: #f5ecd6;
  --maybe: #a97711;
  --info: #2b6ab0;

  --shadow-sm: 0 1px 2px rgba(45,40,30,.055);
  --shadow-md: 0 8px 26px rgba(45,40,30,.10), 0 1px 2px rgba(45,40,30,.05);
  --shadow-lg: 0 20px 52px rgba(38,32,22,.18);

  --radius: 12px; --radius-sm: 8px; --radius-lg: 16px;

  /* Motion — decel curves so transitions settle instead of stopping flat.
     --ease = gentle settle (interactive states); --ease-out = entrances. */
  --ease: cubic-bezier(.32, .72, 0, 1);
  --ease-out: cubic-bezier(.22, 1, .36, 1);

  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Segoe UI", Meiryo, sans-serif;
  /* Editorial serif for display headings; Japanese falls back to Mincho = academic. */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Hoefler Text", Georgia, "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Songti SC", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --rail-w: 258px;
  --tb-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1017;
    --bg-grad: radial-gradient(1100px 520px at 100% -8%, #131a2900 0%, transparent 62%), var(--bg);
    --surface: #151a22; --surface-2: #1b212b; --surface-3: #232b37;
    --border: #262d39; --border-strong: #38414f;
    --text: #e7eaf0; --text-soft: #aab4c2; --muted: #7d8897; --faint: #58626f;
    --accent: #6c83f2; --accent-strong: #566ee0; --accent-soft: #182140; --accent-ink: #c6d1fb;
    --good: #3cbe77; --good-soft: #10271b;
    --bad: #ef6b64; --bad-soft: #2a1616;
    --warn: #dca63a; --warn-soft: #271f0f; --maybe: #dca63a; --info: #59a7e2;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
    --shadow-md: 0 8px 26px rgba(0,0,0,.42);
    --shadow-lg: 0 20px 52px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1017;
  --bg-grad: radial-gradient(1100px 520px at 100% -8%, #131a2900 0%, transparent 62%), var(--bg);
  --surface: #151a22; --surface-2: #1b212b; --surface-3: #232b37;
  --border: #262d39; --border-strong: #38414f;
  --text: #e7eaf0; --text-soft: #aab4c2; --muted: #7d8897; --faint: #58626f;
  --accent: #6c83f2; --accent-strong: #566ee0; --accent-soft: #182140; --accent-ink: #c6d1fb;
  --good: #3cbe77; --good-soft: #10271b;
  --bad: #ef6b64; --bad-soft: #2a1616;
  --warn: #dca63a; --warn-soft: #271f0f; --maybe: #dca63a; --info: #59a7e2;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 8px 26px rgba(0,0,0,.42);
  --shadow-lg: 0 20px 52px rgba(0,0,0,.55);
}
:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg-grad); background-attachment: fixed;
  color: var(--text); font-family: var(--sans);
  font-size: 14px; line-height: 1.62; letter-spacing: .01em;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
/* Exact viewport height (not min-height) so the rail + main scroll INSIDE the
   shell instead of the whole window scrolling the rail out of view. */
#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 9px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

/* ---------- top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 0 18px; height: var(--tb-h); flex-shrink: 0;
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(1.5) blur(14px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; flex-shrink: 0; }
.brand .logo { align-self: center; }
.brand .wordmark {
  font-weight: 800; font-size: 21px; line-height: 1; letter-spacing: -.025em;
  background: linear-gradient(112deg, var(--accent-strong) 0%, var(--accent) 52%, #7b90f0 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
}
@media (max-width: 1120px) { .brand small { display: none; } }
@media (max-width: 720px) { .brand .wordmark { font-size: 19px; } }
.brand .logo {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong)); color: #fff;
  font-size: 15px; box-shadow: 0 2px 7px rgba(61,85,196,.45), inset 0 1px 0 rgba(255,255,255,.28);
}
.brand small { color: var(--muted); font-weight: 500; font-size: 11px; letter-spacing: .02em; align-self: center; }
.topbar .spacer { flex: 1; }
.proj-name {
  background: transparent; border: 1px solid transparent;
  color: var(--text); padding: 7px 11px; border-radius: 9px; min-width: 140px; flex: 0 1 320px;
  font-size: 14.5px; font-weight: 620; letter-spacing: -.01em; transition: all .15s var(--ease);
}
.proj-name:hover { background: var(--surface-2); }
.proj-name:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar .btn, .topbar .seg { flex-shrink: 0; }

/* Guideline context bar under the topbar (guideline mode only):
   📋 [ガイドライン] <名前> › <領域> [CQ番号]  … 名前を明快に見せる専用の帯 */
.gl-bar {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 18px; border: 0; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--accent-soft) 55%, var(--surface));
  color: var(--text); font-size: 13px; text-align: left; cursor: pointer;
  transition: background .15s var(--ease);
}
.gl-bar:hover { background: var(--accent-soft); }
.gl-bar-ic { font-size: 14px; flex-shrink: 0; }
.gl-bar-tag {
  flex-shrink: 0; font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
  color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 2px 8px; border-radius: 5px;
}
.gl-bar-name { font-weight: 750; letter-spacing: -.01em; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gl-bar-sep { opacity: .4; flex-shrink: 0; }
.gl-bar-dom { color: var(--muted); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 3; min-width: 0; }
.gl-bar-cq { flex-shrink: 0; background: var(--accent); color: #fff; padding: 1px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.gl-bar-set { font-weight: 600; color: var(--accent-strong); }
.gl-bar-edit { margin-left: auto; flex-shrink: 0; font-size: 11px; font-weight: 600; color: var(--muted); opacity: 0; transition: opacity .15s var(--ease); }
.gl-bar:hover .gl-bar-edit { opacity: 1; }
.gl-bar.empty { background: var(--surface-2); }

/* Guideline workspace: SR pipeline funnel (each stage = done/target) */
.funnel { display: flex; flex-wrap: wrap; gap: 4px; }
.fn-step {
  display: flex; flex-direction: column; align-items: center; gap: 0;
  min-width: 56px; padding: 3px 8px 4px; border-radius: 7px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.fn-step .fn-ic { font-size: 12px; line-height: 1.4; }
.fn-step .fn-lb { font-size: 9.5px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.fn-step .fn-v { font-size: 12px; font-weight: 750; color: var(--text); letter-spacing: -.01em; }
.fn-step.done { background: color-mix(in srgb, var(--good) 12%, var(--surface)); border-color: color-mix(in srgb, var(--good) 30%, transparent); }
.fn-step.done .fn-v { color: var(--good); }
.fn-step.cur { background: var(--accent-soft); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.fn-step.cur .fn-v, .fn-step.cur .fn-lb { color: var(--accent-strong); }

/* ---------- layout ---------- */
.shell { display: flex; flex: 1; min-height: 0; }
.rail {
  width: var(--rail-w); flex-shrink: 0; padding: 16px 12px 26px;
  border-right: 1px solid var(--border); overflow-y: auto;
  background: color-mix(in srgb, var(--surface) 40%, transparent);
}
.rail-group { font-size: 10px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--faint); padding: 14px 12px 6px; }
.rail-group:first-child { padding-top: 4px; }
.step {
  display: flex; align-items: center; gap: 11px; position: relative; width: 100%;
  padding: 8px 11px; border-radius: 9px; cursor: pointer; user-select: none;
  color: var(--text-soft); transition: background .13s var(--ease), color .13s var(--ease), transform .09s var(--ease-out); text-align: left;
  background: none; border: none; font-family: inherit; font-size: 13.5px; letter-spacing: -.005em;
}
.step:hover { background: var(--surface-2); color: var(--text); }
.step:active { transform: scale(.985); }
.step.disabled { cursor: not-allowed; opacity: .5; }
.step.disabled .num { background: var(--surface-2); }
.step.disabled .cnt { background: var(--surface-2); color: var(--faint); font-size: 10px; }
.step.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 620; }
.step.active::before { content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.step .num {
  width: 23px; height: 23px; border-radius: 7px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 11.5px; font-weight: 680;
  background: var(--surface-3); color: var(--muted); transition: all .13s var(--ease);
  font-variant-numeric: tabular-nums;
}
.step.active .num { background: var(--accent); color: #fff; }
.step.done .num { background: var(--good-soft); color: var(--good); }
.step.done .num::after { content: "✓"; }
.step.done .num { font-size: 0; }
.step.done .num::after { font-size: 12px; }
.step .label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step .cnt { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums;
  background: var(--surface-2); padding: 1px 7px; border-radius: 20px; }
.step.active .cnt { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent-ink); }

.main { flex: 1; overflow-y: auto; padding: 30px 40px 90px; min-width: 0; }
.main-inner { max-width: 1000px; margin: 0 auto; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 25px; margin: 0 0 6px; letter-spacing: -.02em; font-weight: 680; line-height: 1.2; }
.page-head .sub { color: var(--muted); margin: 0; font-size: 14px; max-width: 72ch; line-height: 1.6; }
.page-head .minds-ref { display: inline-block; margin-top: 10px; font-size: 11px; color: var(--accent-ink);
  background: var(--accent-soft); padding: 3px 10px; border-radius: 20px; font-weight: 600; letter-spacing: .01em; }

/* ---------- cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.card > h2 { font-size: 14px; margin: 0 0 16px; font-weight: 660; letter-spacing: -.005em; display: flex; align-items: center; gap: 8px; }
.card > h2 .h2-note { font-weight: 440; color: var(--muted); font-size: 12.5px; letter-spacing: 0; }
.card.tight { padding: 15px 18px; }
.card-row { display: flex; gap: 18px; align-items: flex-start; }
@media (max-width: 900px) { .card-row { flex-direction: column; } }

/* ---------- forms ---------- */
.field { margin-bottom: 15px; }
.field:last-child { margin-bottom: 0; }
label.lab { display: block; color: var(--text-soft); font-size: 12px; font-weight: 620; margin-bottom: 6px; letter-spacing: .005em; }
label.lab .opt { color: var(--faint); font-weight: 440; }
input[type=text], input[type=password], input[type=number], input[type=email], textarea, select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px; border-radius: 9px; font-family: var(--sans);
  font-size: 14px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease), background .15s var(--ease);
}
textarea { resize: vertical; min-height: 64px; line-height: 1.62; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.grid2 { display: grid; grid-template-columns: 132px 1fr; gap: 12px 16px; align-items: center; }
.grid2 label.lab { margin: 0; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236c7686' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; cursor: pointer; }

/* ---------- buttons (flat, refined) ---------- */
.btn {
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
  padding: 8px 15px; border-radius: 9px; cursor: pointer; font-size: 13.5px; font-weight: 560;
  font-family: var(--sans); display: inline-flex; align-items: center; gap: 7px; line-height: 1;
  transition: background .13s var(--ease), border-color .13s var(--ease), transform .09s var(--ease-out), box-shadow .13s var(--ease);
  white-space: nowrap; letter-spacing: -.005em;
}
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(61,85,196,.28); }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn.ghost:hover { background: var(--surface-2); border-color: transparent; color: var(--text); }
.btn.danger { color: var(--bad); border-color: transparent; background: transparent; }
.btn.danger:hover { background: var(--bad-soft); border-color: var(--bad); }
/* Decision-state fill buttons (採=緑 / 除=赤 / 保=黄) — usable anywhere: screening, full-text */
.btn.on-inc { background: var(--good); border-color: var(--good); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 1px 3px rgba(0,0,0,.25); }
.btn.on-exc { background: var(--bad); border-color: var(--bad); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 1px 3px rgba(0,0,0,.25); }
.btn.on-may { background: var(--warn); border-color: var(--warn); color: #fff; font-weight: 700; box-shadow: inset 0 0 0 1px rgba(255,255,255,.28), 0 1px 3px rgba(0,0,0,.25); }
.btn.sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: 11px 20px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:focus-visible, .seg button:focus-visible, .step:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 9px 9px 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }

/* ---------- pills / tags / chips ---------- */
.pill { font-size: 11px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--border); color: var(--muted); background: var(--surface-2); font-weight: 560; white-space: nowrap; }
.tag { font-size: 10.5px; padding: 2px 8px; border-radius: 5px; font-weight: 680; white-space: nowrap; letter-spacing: .01em; }
.tag.include, .tag.low { background: var(--good-soft); color: var(--good); }
.tag.exclude, .tag.high, .tag.critical-rob, .tag.serious { background: var(--bad-soft); color: var(--bad); }
.tag.maybe, .tag.pending, .tag.conflict, .tag.moderate, .tag.some { background: var(--warn-soft); color: var(--warn); }
.tag.unscreened { background: var(--surface-3); color: var(--muted); }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 4px 10px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-soft); font-weight: 520; white-space: nowrap; cursor: default; }
button.chip { cursor: pointer; transition: background .13s var(--ease), border-color .13s var(--ease), color .13s var(--ease), transform .09s var(--ease-out); }
button.chip:active { transform: scale(.96); }
button.chip:hover { border-color: var(--border-strong); color: var(--text); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); } .dot.muted { background: var(--faint); }
.pips { display: inline-flex; gap: 1px; font-size: 14px; letter-spacing: 0; }

/* ---------- stats ---------- */
.statgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 12px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 11px; padding: 14px 16px; }
.stat .n { font-size: 27px; font-weight: 640; font-variant-numeric: tabular-nums; line-height: 1.05; letter-spacing: -.03em; font-family: var(--serif); }
.stat .l { color: var(--muted); font-size: 11.5px; margin-top: 4px; letter-spacing: .005em; }

/* ---------- table ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 11px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 10px 13px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl thead th { color: var(--muted); font-weight: 620; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase;
  position: sticky; top: 0; background: var(--surface); z-index: 1; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover td { background: var(--surface-2); }
.rec-title { font-weight: 600; color: var(--text); letter-spacing: -.005em; }
.rec-meta { color: var(--muted); font-size: 11.5px; margin-top: 3px; }

/* ---------- progress ---------- */
.progress { height: 6px; background: var(--surface-3); border-radius: 20px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 20px; transition: width .4s var(--ease-out); }
.spinner { width: 15px; height: 15px; border: 2px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- review card ---------- */
.review-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 12px 0; background: var(--surface-2); transition: box-shadow .15s var(--ease), border-color .15s var(--ease); }
.review-card:hover { box-shadow: var(--shadow-sm); }
.reviewer-box { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; }
.reviewer-box .who { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .01em; }

/* ---------- misc ---------- */
.empty { color: var(--muted); text-align: center; padding: 48px 20px; }
.empty .big { font-size: 28px; margin-bottom: 10px; opacity: .55; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.55; }
.hint.warn { color: var(--warn); }
.muted { color: var(--muted); }
.code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; line-height: 1.6; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
details > summary { cursor: pointer; color: var(--muted); font-size: 12.5px; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "▸ "; }
details[open] > summary::before { content: "▾ "; }

/* segmented control */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; color: var(--text-soft); padding: 5px 13px; border-radius: 7px; font-size: 12.5px; font-weight: 560; cursor: pointer; font-family: var(--sans); transition: background .13s var(--ease), color .13s var(--ease), box-shadow .13s var(--ease); letter-spacing: -.005em; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

/* toast */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 60;
  background: var(--text); color: var(--bg); padding: 11px 20px; border-radius: 11px; font-weight: 560; font-size: 13.5px;
  box-shadow: var(--shadow-lg); animation: toastin .2s ease; letter-spacing: -.005em; }
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(12,16,24,.45); backdrop-filter: blur(4px); z-index: 55; display: grid; place-items: center; padding: 24px; animation: scrimin .2s var(--ease-out); }
@keyframes scrimin { from { opacity: 0; } }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); max-width: 640px; width: 100%; max-height: 86vh; overflow: auto; padding: 24px; animation: modalin .26s var(--ease-out); transform-origin: center; }
@keyframes modalin { from { opacity: 0; transform: scale(.965) translateY(8px); } }
.modal.modal-wide { max-width: 1160px; }

/* Full-text reader (二次スクリーニング「📖 全文」) */
.ft-single p { font-size: 13px; line-height: 1.85; margin: 0 0 12px; white-space: pre-wrap; }
.ft-dual { display: flex; flex-direction: column; gap: 2px; }
.ft-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.ft-pair .ft-src { font-size: 12.5px; line-height: 1.8; color: var(--text-soft); white-space: pre-wrap; }
.ft-pair .ft-ja { font-size: 13px; line-height: 1.9; color: var(--text); white-space: pre-wrap; }
@media (max-width: 720px) { .ft-pair { grid-template-columns: 1fr; gap: 6px; } .ft-pair .ft-ja { padding-top: 6px; border-top: 1px dashed var(--border); } }

/* AI provider picker */
.ai-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .ai-pick { grid-template-columns: 1fr; } }
.ai-opt { position: relative; text-align: left; border: 1.5px solid var(--border-strong); background: var(--surface-2); border-radius: var(--radius); padding: 16px 16px 14px; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease), box-shadow .15s var(--ease), transform .11s var(--ease-out); display: block; width: 100%; }
.ai-opt:hover { border-color: var(--accent); background: var(--accent-soft); }
.ai-opt:active { transform: scale(.99); }
.ai-opt.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.ai-badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.ai-opt .ai-badge { margin-bottom: 8px; }
.ai-badge.free { background: var(--good-soft); color: var(--good); }
.ai-badge.paid { background: var(--accent-soft); color: var(--accent-ink); }
.ai-opt h4 { margin: 0 0 4px; font-size: 15px; }
.ai-opt p { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.5; }
.ai-opt .ai-check { position: absolute; top: 12px; right: 12px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; display: none; place-items: center; font-size: 13px; }
.ai-opt.on .ai-check { display: grid; }
.ai-opt .ai-keyok { position: absolute; top: 14px; right: 40px; font-size: 11px; font-weight: 700; color: var(--good); }
.ai-steps { counter-reset: step; margin: 4px 0 0; padding: 0; list-style: none; }
.ai-steps li { counter-increment: step; position: relative; padding: 8px 0 8px 34px; border-top: 1px solid var(--border); font-size: 13px; line-height: 1.55; }
.ai-steps li:first-child { border-top: none; }
.ai-steps li::before { content: counter(step); position: absolute; left: 0; top: 8px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }

/* search-strategy builder */
.blk { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 10px; background: var(--surface-2); position: relative; }
.blk-label { font-weight: 600; font-size: 14px; border: none; background: transparent; padding: 2px 4px; border-radius: 6px; width: 60%; }
.blk-label:hover, .blk-label:focus { background: var(--surface); outline: 1px solid var(--border-strong); }
.blk-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 6px; }
.blk-tag { flex-shrink: 0; font-size: 10.5px; font-weight: 700; padding: 3px 7px; border-radius: 6px; margin-top: 3px; }
.blk-tag.mesh { background: var(--accent-soft); color: var(--accent-ink); }
.blk-tag.ft { background: var(--good-soft); color: var(--good); }
.blk-and { text-align: center; font-weight: 800; font-size: 11px; color: var(--muted); letter-spacing: .1em; margin: 8px 0 -4px; }
.chipwrap { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; align-items: center; }
.termchip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-family: var(--mono); padding: 3px 6px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--surface); }
.termchip.mesh { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.termchip.ft { border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.termchip button { border: none; background: transparent; color: var(--muted); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; }
.termchip button:hover { color: var(--bad); }
.termchip.add { cursor: pointer; color: var(--good); border-style: dashed; }
.termchip.add:hover { background: var(--good-soft); }
.chipinput { border: none; background: transparent; font-size: 12px; font-family: var(--mono); min-width: 90px; flex: 1; padding: 3px; }
.chipinput:focus { outline: none; }

/* AI prompt row (相談窓) */
.aiprompt { display: flex; gap: 8px; align-items: flex-end; }
.aiprompt-input { flex: 1; resize: none; overflow-y: auto; min-height: 40px; max-height: 160px; line-height: 1.5; padding: 9px 12px; border: 1.5px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-size: 13px; font-family: inherit; }
.aiprompt-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.aiprompt-send { flex-shrink: 0; height: 40px; min-width: 76px; border-radius: 10px; display: inline-grid; place-items: center; }
.ai-draft { white-space: pre-wrap; font-family: inherit; font-size: 12.5px; line-height: 1.55; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin: 0 0 6px; color: var(--text); }
.ai-suggest-block { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 10px; }
.ai-suggest-block:first-of-type { border-top: none; padding-top: 0; margin-top: 0; }

/* Collapsible (progressive disclosure) */
.collapsible { margin: 14px 0; }
.collapsible-head { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: none; border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px 14px;
  cursor: pointer; color: var(--text-soft); font-family: inherit; font-size: 13.5px; transition: all .13s var(--ease); }
.collapsible-head:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
.collapsible.open .collapsible-head { border-style: solid; border-radius: 10px 10px 0 0; border-bottom-color: transparent; color: var(--text); }
.collapsible-caret { display: inline-block; transition: transform .15s; color: var(--muted); font-size: 11px; }
.collapsible.open .collapsible-caret { transform: rotate(90deg); }
.collapsible-title { font-weight: 600; }
.collapsible-note { color: var(--muted); font-size: 12px; margin-left: auto; }
.collapsible-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 10px 10px; padding: 4px 14px 14px; }
.collapsible-body > .card:first-child { margin-top: 12px; }

/* Compact AI status line (shown once a key is configured) */
.ai-status { display: flex; align-items: center; gap: 10px; padding: 11px 16px; margin: 14px 0;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface); font-size: 13.5px; }

/* Study-design signal-word highlights (Rayyan-style) */
mark.sig-rct, mark.sig-obs, mark.sig-dta, mark.sig-excl { padding: 0 2px; border-radius: 3px; color: inherit; }
mark.sig-rct  { background: color-mix(in srgb, var(--good) 26%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--good) 55%, transparent); }
mark.sig-obs  { background: color-mix(in srgb, var(--info, #59a7e2) 26%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--info, #59a7e2) 55%, transparent); }
mark.sig-dta  { background: color-mix(in srgb, var(--accent) 24%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--accent) 55%, transparent); }
mark.sig-excl { background: color-mix(in srgb, var(--bad) 24%, transparent); box-shadow: inset 0 -2px 0 color-mix(in srgb, var(--bad) 55%, transparent); }
.sig-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.sig-chip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.sig-chip.sig-rct  { background: var(--good-soft); color: var(--good); }
.sig-chip.sig-obs  { background: color-mix(in srgb, var(--info, #59a7e2) 16%, transparent); color: var(--info, #2b7fc0); }
.sig-chip.sig-dta  { background: var(--accent-soft); color: var(--accent-ink); }
.sig-chip.sig-excl { background: var(--bad-soft); color: var(--bad); }
.sig-legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 11px; color: var(--muted); margin: 4px 0 10px; }
.sig-legend mark { padding: 0 2px; border-radius: 2px; }
.abstract-box { font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; margin-top: 6px; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; max-height: 260px; overflow: auto; }

/* Expandable excluded-record rows */
.exrow { border-bottom: 1px solid var(--border); }
.exrow-head { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none;
  border: none; padding: 9px 4px; cursor: pointer; font-family: inherit; color: var(--text); }
.exrow-head:hover { background: var(--surface-2); }
.exrow-caret { color: var(--muted); font-size: 11px; transition: transform .13s; flex-shrink: 0; }
.exrow.open .exrow-caret { transform: rotate(90deg); }
.exrow-title { flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exrow.open .exrow-title { white-space: normal; }
.exrow-body { padding: 4px 4px 14px 26px; }

/* Beginner ⓘ info dot + popover */
.infodot-wrap { position: relative; display: inline-block; vertical-align: middle; }
.infodot { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--accent); background: var(--accent-soft);
  color: var(--accent-ink); font-size: 12px; font-weight: 700; font-style: italic; font-family: Georgia, serif;
  cursor: pointer; line-height: 1; display: inline-grid; place-items: center; padding: 0; vertical-align: middle; margin-left: 2px; }
.infodot:hover { background: var(--accent); color: #fff; }
.infopop { position: absolute; top: 26px; left: 0; z-index: 50; width: min(380px, 82vw);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 14px 16px; font-size: 13px; line-height: 1.6; color: var(--text); font-weight: 400; }
.infopop b { font-size: 14px; }
.infopop p { margin: 6px 0; }
.infopop-lbl { display: inline-block; font-size: 11px; font-weight: 700; color: var(--accent-ink);
  background: var(--accent-soft); border-radius: 5px; padding: 1px 7px; margin-right: 6px; }
.infopop-note { background: var(--surface-2); border-radius: 8px; padding: 7px 10px; color: var(--text-soft); font-size: 12.5px; }
.infopop-pitfalls { margin-top: 8px; }
.infopop-pitfalls > summary { cursor: pointer; font-size: 12.5px; font-weight: 700; color: var(--warn); list-style: none; }
.infopop-pitfalls > summary::-webkit-details-marker { display: none; }
.infopop-pitfalls > summary::before { content: "▸ "; }
.infopop-pitfalls[open] > summary::before { content: "▾ "; }
.infopop-pitfalls ul { font-size: 12px; line-height: 1.55; max-height: 240px; overflow: auto; }
.infopop-x { border: none; background: none; color: var(--muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }

/* CQ-setup pipeline strip + "landed here" flash */
.flowstrip { background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.flowstrip-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.flowstrip-step { border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 4px 13px; font-size: 12.5px; font-weight: 650; cursor: pointer; }
.flowstrip-step:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.flowstrip-arrow { color: var(--muted); font-weight: 700; }
@keyframes flashHit { 0%, 55% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.flash-hit { animation: flashHit 1.7s ease-out; border-radius: 12px; }
.flash-hit .card { border-color: var(--accent); }

/* Quick-review rows (全件ざっと確認) */
.qrow { border-bottom: 1px solid var(--border); border-left: 4px solid transparent; }
.qrow-include { border-left-color: var(--good); background: var(--good-soft); }
.qrow-exclude { border-left-color: var(--bad); background: var(--bad-soft); opacity: .82; }
.qrow-maybe { border-left-color: var(--warn); background: var(--warn-soft); }
.qrow-unscreened { border-left-color: var(--border-strong); }
.qrow-head { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; }
.qrow-title { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; text-align: left;
  background: none; border: none; cursor: pointer; font-family: inherit; font-size: 12.5px; line-height: 1.4;
  color: var(--text); overflow: hidden; }
.qrow-title > :last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qrow.qrow-exclude .qrow-title { text-decoration: line-through; text-decoration-color: var(--border-strong); }
.qrow-caret { color: var(--muted); font-size: 10px; flex-shrink: 0; }

/* Right-edge current-decision chip — reads at a glance */
.qrow-state { flex-shrink: 0; font-size: 11px; font-weight: 800; padding: 2px 10px; border-radius: 999px;
  min-width: 52px; text-align: center; letter-spacing: .02em; border: 1px solid transparent; }
.qrow-state.s-include { background: var(--good); color: #fff; }
.qrow-state.s-exclude { background: var(--bad); color: #fff; }
.qrow-state.s-maybe { background: var(--warn); color: #fff; }
.qrow-state.s-unscreened { background: var(--surface-3); color: var(--muted); border-color: var(--border); }

.qrow-btns { flex-shrink: 0; }
/* Unselected = quiet outline; selected = BOLD filled colour so 採/除/保 の現状が一目で分かる。
   特に除外時に「除」が塗りつぶし赤になり見落とさない。 */
.qrow-btns .btn { min-width: 34px; padding: 3px 10px; font-weight: 700; color: var(--text-soft); background: var(--surface); }
.qrow-btns .btn.on-inc, .qrow-btns .btn.on-exc, .qrow-btns .btn.on-may {
  color: #fff; font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.30), 0 1px 4px rgba(0,0,0,.30);
}
.qrow-btns .btn.on-inc { background: var(--good); border-color: var(--good); }
.qrow-btns .btn.on-exc { background: var(--bad); border-color: var(--bad); }
.qrow-btns .btn.on-may { background: var(--warn); border-color: var(--warn); }
.qrow-body { padding: 2px 8px 12px 26px; }

/* RoB per-domain "how to judge" guidance */
.rob-guide { margin: 2px 0 10px; font-size: 12.5px; }
.rob-guide > summary { cursor: pointer; color: var(--accent); font-size: 12px; list-style: none; }
.rob-guide > summary::-webkit-details-marker { display: none; }
.rob-guide[open] > summary { margin-bottom: 6px; }
.rob-guide-body { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; line-height: 1.6; }
.rob-guide-body p { margin: 4px 0; }
.rob-guide-lbl { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; margin-right: 6px;
  background: var(--accent-soft); color: var(--accent-ink); }
.rob-guide-lbl.low { background: var(--good-soft); color: var(--good); }
.rob-guide-lbl.high { background: var(--bad-soft); color: var(--bad); }

/* PDF-retrieval helper links */
.rec-links { margin-top: 4px; font-size: 11.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.rec-links a { color: var(--accent); }
/* Search links can hit a different paper — mark them as non-exact. */
.rec-links a.rec-link-search { color: var(--muted); font-style: italic; }
.rec-links-sep { color: var(--faint); }

/* Mascot with speech bubble */
.mascot-wrap { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.mascot-say { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 14px; font-size: 13px; color: var(--text-soft); max-width: 320px; text-align: center; }
.mascot-say::before { content: ""; position: absolute; top: -7px; left: 50%; transform: translateX(-50%) rotate(45deg);
  width: 12px; height: 12px; background: var(--surface); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }

/* Consistent per-stage flow footer (戻る / ステップ / 次へ) */
.flow-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.flow-footer .flow-step { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* dropzone */
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 32px; text-align: center; color: var(--muted); transition: all .15s var(--ease); cursor: pointer; background: var(--surface-2); }
.dropzone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }

/* traffic-light (robvis-style) */
.tl { width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; }
.tl.low { background: var(--good); } .tl.some { background: var(--warn); } .tl.moderate { background: var(--warn); }
.tl.high { background: var(--bad); } .tl.serious { background: #b23636; } .tl.critical { background: #7d1f1f; }
.tl.ni { background: var(--faint); }

/* keyword highlight (Rayyan-style manual screening) */
mark.hl-inc { background: color-mix(in srgb, var(--good) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.hl-exc { background: color-mix(in srgb, var(--bad) 26%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }

/* help drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(12,16,24,.3); z-index: 58; animation: toastin .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 408px; max-width: 92vw; background: var(--surface);
  border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); z-index: 59; overflow-y: auto; padding: 22px;
  animation: slidein .22s ease; }
@keyframes slidein { from { transform: translateX(24px); opacity: .4; } }
.guide-step { display: flex; gap: 11px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; line-height: 1.55; }
.guide-step .gn { flex-shrink: 0; width: 22px; height: 22px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-ink);
  display: grid; place-items: center; font-size: 12px; font-weight: 700; }

/* first-run / info callout */
.callout { background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent); color: var(--accent-ink);
  border-radius: 12px; padding: 13px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; font-size: 13.5px; line-height: 1.55; }

/* view transition */
.view-enter { animation: fadeup .24s ease; }
@keyframes fadeup { from { opacity: 0; transform: translateY(7px); } }

/* ============================================================
   Refinement pass — editorial / academic polish (layered last)
   ============================================================ */

/* Page title: editorial serif with a short accent rule under the header.
   Japanese renders in Mincho via the --serif fallback. */
.page-head { position: relative; margin-bottom: 30px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.page-head::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 44px; height: 2px; background: var(--accent); border-radius: 2px; }
.page-head h1 { font-family: var(--serif); font-size: 28px; font-weight: 620; letter-spacing: -.005em; line-height: 1.18; color: var(--text); }
.page-head .sub { font-size: 13.5px; color: var(--text-soft); max-width: 74ch; }
.page-head .minds-ref { background: transparent; border: 1px solid var(--border-strong); color: var(--muted); font-weight: 600; letter-spacing: .04em; }

/* Brand wordmark: a quiet logotype feel */
.brand { font-weight: 600; }
.brand .logo { border-radius: 9px; box-shadow: 0 2px 6px rgba(55,71,141,.32), inset 0 1px 0 rgba(255,255,255,.25); }

/* Cards: softer radius, quiet layered shadow, gentle lift on hover */
.card { border-radius: 14px; box-shadow: 0 1px 2px rgba(45,40,30,.045), 0 1px 1px rgba(45,40,30,.03); transition: box-shadow .22s ease, border-color .22s ease, transform .22s ease; }
.card:hover { box-shadow: 0 2px 5px rgba(45,40,30,.05), 0 12px 34px rgba(45,40,30,.07); border-color: var(--border-strong); }
.card > h2 { font-size: 13.5px; font-weight: 680; color: var(--text); }

/* Primary button: subtle depth + confident press */
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 92%, #fff), var(--accent)); box-shadow: 0 1px 2px rgba(42,55,112,.32), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover { background: linear-gradient(180deg, var(--accent), var(--accent-strong)); }
.btn { border-radius: 10px; }
.btn.sm { border-radius: 8px; }

/* Inputs: a touch more radius for a considered feel */
input[type=text], input[type=password], input[type=number], input[type=email], textarea, select { border-radius: 10px; }

/* Stats: numbers in serif, refined plate */
.stat { border-radius: 12px; background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.stat .n { color: var(--text); letter-spacing: -.02em; }

/* Nav rail: refined active pill + calmer group labels */
.rail { background: color-mix(in srgb, var(--surface) 55%, transparent); }
.rail-group { letter-spacing: .1em; color: var(--faint); }
.step.active { background: color-mix(in srgb, var(--accent-soft) 90%, var(--surface)); }
.step.active::before { top: 8px; bottom: 8px; width: 3px; }

/* Top bar: a hair of separation */
.topbar { box-shadow: 0 1px 0 rgba(45,40,30,.03); }

/* Tags/pills: slightly softer */
.tag { border-radius: 6px; }
.pill { border-radius: 999px; }

/* Section detail summaries in serif italic — reads like a footnote */
details.rob-guide > summary { font-style: normal; }

/* ============================================================
   Left rail — refined "progress timeline" (CSS only)
   ============================================================ */
.rail { background: color-mix(in srgb, var(--surface) 60%, transparent); padding-top: 18px; }
.rail-group { font-size: 9.5px; letter-spacing: .13em; color: var(--faint); padding: 16px 12px 7px; }
.rail-group:first-child { padding-top: 2px; }

.step { border-radius: 10px; padding: 7px 11px; gap: 12px; transition: background .15s, color .15s; }
.step:hover { background: var(--surface-2); color: var(--text); }
.step.active { background: color-mix(in srgb, var(--accent-soft) 86%, var(--surface)); color: var(--accent-ink);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent); }
.step.active::before { display: none; } /* drop the old left bar; the badge ring is the cue */

/* Circular numbered badges with clear upcoming / current / done states */
.step .num { position: relative; width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--border-strong); background: var(--surface); color: var(--muted);
  font-weight: 700; font-size: 11px; transition: all .15s var(--ease); }
.step:hover .num { border-color: var(--muted); }
.step.active .num { background: var(--accent); border-color: var(--accent); color: #fff;
  box-shadow: 0 0 0 3px var(--accent-soft); }
.step.done .num { background: var(--good); border-color: var(--good); color: #fff; }

/* Connector line linking each badge up to the previous one (timeline feel).
   Hidden on the first step of each group so segments read per-phase. */
.step .num::before { content: ""; position: absolute; left: 50%; transform: translateX(-50%);
  top: -16px; width: 2px; height: 16px; background: var(--border); border-radius: 2px; }
.rail-group + .step .num::before { display: none; }
.step.done .num::before { background: color-mix(in srgb, var(--good) 48%, var(--border-strong)); }

/* Count badge */
.step .cnt { background: var(--surface-3); color: var(--muted); border-radius: 999px; font-weight: 600; padding: 1px 8px; }
.step.active .cnt { background: color-mix(in srgb, var(--accent) 15%, transparent); color: var(--accent-ink); }

/* AI tutor popup (ⓘ → 🤖 AIに詳しく聞く) */
.tutor-log { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; overflow: auto; padding-right: 4px; }
.tutor-q { align-self: flex-end; max-width: 85%; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); border-radius: 12px 12px 3px 12px; padding: 8px 12px; font-size: 13px; line-height: 1.6; }
.tutor-a { align-self: flex-start; max-width: 92%; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px 12px 12px 3px; padding: 10px 13px; font-size: 13.5px; line-height: 1.7; }
.tutor-a div:empty { min-height: .5em; }

/* Key-clinical-issues: group the domain/topic context + generate button */
.ki-context { background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 14px; }

/* Project-name chip in the top bar — clearly the current, editable project */
.proj-chip { display: inline-flex; align-items: center; gap: 6px; flex: 0 1 340px; min-width: 150px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 4px 10px;
  cursor: text; transition: border-color .15s, box-shadow .15s, background .15s; }
.proj-chip:hover { border-color: var(--border-strong); }
.proj-chip:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.proj-chip-ic { font-size: 13px; opacity: .85; flex-shrink: 0; }
.proj-chip .proj-name { flex: 1; min-width: 0; background: transparent; border: none; padding: 3px 0;
  font-size: 14px; font-weight: 640; letter-spacing: -.01em; }
.proj-chip .proj-name:hover, .proj-chip .proj-name:focus { background: transparent; border: none; box-shadow: none; }

/* Scope stage — one deliberate issue per card */
.issue-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px; margin-top: 12px; background: var(--surface); }
.issue-card .issue-text { width: 100%; min-height: 42px; font-weight: 620; font-size: 14px; }
.issue-card .issue-memo { width: 100%; min-height: 44px; margin-top: 8px; font-size: 13px; }
.issue-lab { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }

/* ---------- accessibility: honor the three system signals ---------- */
/* Reduced motion — collapse transitions/entrances, but keep the spinner
   turning (it communicates ongoing progress). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-delay: 0 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .spinner { animation-duration: .7s !important; }
}
/* Reduced transparency — drop blur/translucency for solid, legible surfaces. */
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--surface); backdrop-filter: none; }
  .rail { background: var(--surface); }
  .modal-bg { backdrop-filter: none; background: rgba(12,16,24,.62); }
}
/* Increased contrast — firm up borders and lift secondary text. */
@media (prefers-contrast: more) {
  .card, .stat, .review-card, .reviewer-box, .blk, .ki-context, .issue-card,
  input, textarea, select, .btn, .pill, .chip { border-color: var(--border-strong); }
  .hint, .muted, .rail-group, .rec-meta, .stat .l { color: var(--text-soft); }
}
