/* MIRA UI — ブランドカラー: オレンジ */
:root {
  --brand: #e8590c;
  --brand-soft: #fff0e6;
  --brand-dark: #c94a08;
  --ink: #1f2430;
  --ink-2: #4b5363;
  --ink-3: #8a93a5;
  --bg: #f4f6f9;
  --card: #ffffff;
  --line: #e3e7ee;
  --green: #2f9e44;
  --green-soft: #e6f6e9;
  --red: #e03131;
  --red-soft: #fdecec;
  --amber: #e8a10c;
  --amber-soft: #fdf5e0;
  --blue: #1971c2;
  --blue-soft: #e7f1fb;
  --purple: #7048e8;
  --purple-soft: #f0ebfd;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, 0.07);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: "Hiragino Sans", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}

.layout { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: 224px; flex-shrink: 0;
  background: #20242e; color: #d6dae2;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 20px 18px 16px; }
.brand-logo {
  width: 38px; height: 38px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #f76707);
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-name { font-weight: 800; font-size: 18px; letter-spacing: 1px; color: #fff; }
.brand-sub { font-size: 9.5px; color: #9aa1b0; line-height: 1.3; }
#nav { flex: 1; padding: 8px 10px; }
#nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; margin: 2px 0;
  color: #c2c8d4; text-decoration: none;
  border-radius: 8px; font-size: 13.5px;
}
#nav a:hover { background: rgba(255, 255, 255, 0.07); }
#nav a.active { background: var(--brand); color: #fff; }
.nav-icon { width: 20px; text-align: center; font-size: 13px; opacity: 0.85; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,0.08); }
.flow-hint { font-size: 11px; color: #9aa1b0; line-height: 1.5; }
.version { font-size: 10.5px; color: #666d7e; margin-top: 4px; }

/* ---- Main ---- */
.main { flex: 1; padding: 24px 30px 60px; max-width: 1240px; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 4px; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; }
.page-desc { color: var(--ink-3); font-size: 12.5px; margin-bottom: 16px; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.breadcrumb { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.breadcrumb a { color: var(--blue); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Cards ---- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 18px; margin-bottom: 14px;
}
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } }

.stat-value { font-size: 28px; font-weight: 800; line-height: 1.2; }
.stat-label { color: var(--ink-3); font-size: 12px; }

/* ---- Badges ---- */
.badge {
  display: inline-block; padding: 1px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.b-gray { background: #eef0f4; color: var(--ink-2); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-amber { background: var(--amber-soft); color: #b07d0a; }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-brand { background: var(--brand-soft); color: var(--brand-dark); }
.tag-badge {
  display: inline-block; padding: 0 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700; background: #eef0f4; color: var(--ink-3);
  border: 1px dashed #ccd2dc;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: inherit; text-decoration: none;
}
.btn:hover { background: #f6f7f9; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-green:hover { opacity: 0.9; }
.btn-sm { padding: 3px 10px; font-size: 12px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-3); }
.btn-ghost:hover { color: var(--red); background: var(--red-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---- Table ---- */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 11.5px; color: var(--ink-3);
  font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; }
tr:last-child td { border-bottom: none; }
.table-scroll { overflow-x: auto; }

/* ---- ゲート滞留ボード (標準ジャーニーフロー型) ---- */
.flow-board {
  display: flex; align-items: flex-start;
  overflow-x: auto; padding: 20px 6px 10px;
}
.fb-phase {
  margin-top: 16px; min-width: 128px; max-width: 160px; flex-shrink: 0;
  border: 1.5px solid var(--line); border-radius: 10px; background: #fafbfd;
  padding: 10px 12px; text-align: center;
}
.fb-phase .fbp-name { font-weight: 800; font-size: 13.5px; }
.fb-phase .fbp-desc { font-size: 10px; color: var(--ink-3); line-height: 1.45; margin-top: 2px; }
.fb-line { margin-top: 38px; width: 22px; height: 2px; background: #ccd2dc; flex-shrink: 0; }
.fb-line.long { width: 30px; }
.fb-gate {
  display: flex; flex-direction: column; align-items: center;
  min-width: 168px; max-width: 190px; flex-shrink: 0; margin: 0 4px;
}
.fb-diamond {
  width: 34px; height: 34px; margin-top: 6px;
  transform: rotate(45deg); border-radius: 8px;
  border: 3px solid #c3cad6; background: #fff;
  display: flex; align-items: center; justify-content: center;
}
.fb-diamond span { transform: rotate(-45deg); font-weight: 800; font-size: 14px; color: var(--ink-2); }
.fb-diamond.stuck {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 5px rgba(232, 89, 12, 0.14);
}
.fb-diamond.stuck span { color: var(--brand-dark); }
.fb-gate-name {
  font-size: 11px; font-weight: 700; color: var(--ink-2);
  margin-top: 10px; text-align: center; line-height: 1.3;
}
.fb-stuck-count {
  font-size: 10.5px; font-weight: 700; color: var(--brand-dark);
  background: var(--brand-soft); border-radius: 20px; padding: 0 9px; margin-top: 3px;
}
.fb-stuck-none { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
.fb-cards { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.gate-code {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--brand); color: #fff; font-weight: 800; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.gate-theme-card {
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 10px; box-shadow: var(--shadow);
  cursor: pointer; font-size: 12px;
}
.gate-theme-card:hover { border-color: var(--brand); }
.gate-theme-card .gt-title { font-weight: 600; line-height: 1.4; }
.gate-theme-card .gt-meta { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

/* ---- My Journey ---- */
.journey-phase {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 4px; overflow: hidden;
}
.jp-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  background: linear-gradient(to right, #f8f4f0, #fff); border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.jp-name { font-size: 15px; font-weight: 700; }
.jp-body { padding: 10px 16px 14px; }
.journey-connector { text-align: center; color: #ccd2dc; font-size: 14px; padding: 2px 0; }

.gate-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; margin: 6px 0; flex-wrap: wrap;
  background: var(--amber-soft); border: 1px solid #f3e3b5;
}
.gate-row.g-passed { background: var(--green-soft); border-color: #cfe9d4; }
.gate-row.g-rejected { background: var(--red-soft); border-color: #f5cccc; }
.gate-row .gate-icon { font-size: 15px; }
.gate-row .gate-name { font-weight: 700; font-size: 13px; }
.gate-row .gate-comment { font-size: 11.5px; color: var(--ink-2); width: 100%; padding-left: 26px; }

.cp-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid #f0f2f6; flex-wrap: wrap;
}
.cp-row:last-child { border-bottom: none; }
.cp-status-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.cs-not_started { background: #d5dae2; }
.cs-in_progress { background: var(--blue); }
.cs-done { background: var(--green); }
.cp-name { font-weight: 600; font-size: 13px; }
.cp-name a { color: var(--ink); text-decoration: none; }
.cp-name a:hover { color: var(--brand); }
.cp-tool { font-size: 11px; }
.cp-right { margin-left: auto; display: flex; gap: 6px; align-items: center; }

.add-row { padding: 8px 12px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- ワークシート ---- */
.ws-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ws-layout { grid-template-columns: 1fr; } }
.ws-field { margin-bottom: 14px; }
.ws-field label { display: block; font-size: 12.5px; font-weight: 700; margin-bottom: 3px; }
.ws-field .hint { font-size: 11px; color: var(--ink-3); font-weight: 400; margin-left: 6px; }
.ws-field textarea { min-height: 74px; }
/* 項目ごとの根拠 (AI提案の取り込み履歴) */
.ws-sources { margin-top: 5px; font-size: 11.5px; }
.ws-sources summary {
  cursor: pointer; color: var(--ink-3); font-size: 11px;
  padding: 2px 0; user-select: none;
}
.ws-sources summary:hover { color: var(--brand-dark); }
.ws-source {
  border-left: 2px solid var(--line); padding: 5px 0 5px 9px; margin-top: 5px;
}
.ws-source-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 10.5px; }
.ws-source-head .btn { margin-left: auto; }
.ws-source-excerpt { margin: 3px 0; line-height: 1.5; color: var(--ink-2); }

.ai-panel { position: sticky; top: 20px; }
.ai-suggestion {
  background: var(--brand-soft); border: 1px solid #f5d9c4; border-radius: 8px;
  padding: 9px 11px; margin-bottom: 8px; font-size: 12px;
}
.ai-suggestion .sug-field { font-weight: 700; color: var(--brand-dark); font-size: 11.5px; }
.ai-suggestion .sug-excerpt { margin: 3px 0; line-height: 1.5; }
.ai-suggestion .sug-meta { display: flex; gap: 6px; align-items: center; font-size: 10.5px; color: var(--ink-3); }
/* AIフィードバック (項目単位の講評) */
.fb-overall {
  font-size: 12px; line-height: 1.6; background: #f6f8fa;
  border-radius: 8px; padding: 9px 11px;
}
.fb-item {
  border-left: 3px solid var(--line); border-radius: 0 8px 8px 0;
  padding: 7px 10px; margin-bottom: 7px; font-size: 12px; background: #fafbfd;
}
.fb-item.fb-risk     { border-left-color: var(--red);   background: var(--red-soft); }
.fb-item.fb-gap      { border-left-color: var(--amber); background: var(--amber-soft); }
.fb-item.fb-strength { border-left-color: var(--green); background: var(--green-soft); }
.fb-head { display: flex; gap: 7px; align-items: center; margin-bottom: 3px; }
.fb-kind { font-size: 10.5px; font-weight: 700; }
.fb-risk .fb-kind     { color: var(--red); }
.fb-gap .fb-kind      { color: #b07d1a; }
.fb-strength .fb-kind { color: var(--green); }
.fb-comment { line-height: 1.55; }
.fb-factor { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }

.canvas-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 800px) { .canvas-grid { grid-template-columns: 1fr; } }

/* ---- 採点 ---- */
.score-hero { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.score-total {
  width: 110px; height: 110px; border-radius: 50%; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 6px solid var(--brand); background: #fff;
}
.score-total .num { font-size: 30px; font-weight: 800; line-height: 1.1; }
.score-total .lbl { font-size: 10px; color: var(--ink-3); }
.score-bars { flex: 1; min-width: 240px; }
.score-bar-row { margin-bottom: 10px; }
.score-bar-label { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 3px; }
.score-bar { height: 10px; background: #edf0f4; border-radius: 6px; overflow: hidden; }
.score-bar .fill-s { height: 100%; background: var(--green); }
.score-bar .fill-f { height: 100%; background: var(--red); }
.factor-item { display: flex; gap: 10px; padding: 7px 0; border-bottom: 1px solid #f0f2f6; font-size: 12.5px; align-items: baseline; }
.factor-item:last-child { border-bottom: none; }
.factor-fill { font-weight: 800; width: 44px; flex-shrink: 0; text-align: right; }
.factor-evidence { color: var(--ink-3); font-size: 11.5px; }

/* ---- ツールカード ---- */
.tool-card { cursor: pointer; }
.tool-card:hover { border-color: var(--brand); }
.tool-card .tool-name { font-weight: 700; font-size: 14px; }
.tool-fields-preview { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.6; }

/* ---- Forms / Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 20, 30, 0.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 50px 20px; z-index: 50; overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 12px; width: 100%; max-width: 600px;
  padding: 22px 24px; box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.modal h3 { font-size: 16px; margin-bottom: 14px; }
.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
input, textarea, select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 13px; font-family: inherit; background: #fff;
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
textarea { resize: vertical; min-height: 64px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.hidden { display: none !important; }
select.inline { width: auto; padding: 3px 8px; font-size: 12px; }
input.inline { width: auto; padding: 4px 10px; font-size: 12.5px; }

/* ---- Toast ---- */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  max-width: 380px;
}

/* ---- Misc ---- */
.empty { color: var(--ink-3); text-align: center; padding: 26px 0; font-size: 13px; }
.section-title { font-size: 14.5px; font-weight: 700; margin-bottom: 10px; }
.muted { color: var(--ink-3); font-size: 12px; }
.mini-readiness { display: flex; align-items: center; gap: 8px; }
.mini-bar { width: 70px; height: 7px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.mini-fill { height: 100%; background: linear-gradient(90deg, var(--brand), #f76707); }
.link { color: var(--blue); cursor: pointer; }
.link:hover { text-decoration: underline; }
.title-link { font-weight: 700; cursor: pointer; color: var(--ink); }
.title-link:hover { color: var(--brand); }

@media print {
  .sidebar, .header-actions, .toast, .modal-backdrop, .no-print { display: none !important; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  /* 判断パッケージ: 見出しやカードがページ境界で割れないようにする */
  .pkg-h2, .pkg-block-title, .pkg-phase-name { break-after: avoid; }
  .pkg-cp, .pkg-item, .pkg-entry, .pkg-risks { break-inside: avoid; }
  .pkg-risk { box-shadow: none; }
}

/* ============================================================
   次アクション (ダッシュボード / チェックポイント行)
   ============================================================ */
.na-row {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 8px 0; border-bottom: 1px solid #f0f2f6; font-size: 12.5px;
}
.na-row:last-child { border-bottom: none; }
.na-due {
  flex: 0 0 92px; font-size: 11.5px; font-weight: 600; color: var(--ink-3);
  font-variant-numeric: tabular-nums; padding-top: 1px;
}
.na-row.overdue .na-due { color: var(--red); }
.na-body { flex: 1; min-width: 0; }
.na-action { margin-top: 3px; line-height: 1.5; }
.na-owner { flex: 0 0 auto; font-size: 11.5px; color: var(--ink-3); white-space: nowrap; }

.cp-next {
  flex-basis: 100%; margin: 4px 0 0 20px; font-size: 11.5px;
  color: var(--ink-2); line-height: 1.5;
}
.cp-next-due {
  font-weight: 600; color: var(--ink-3); margin-right: 6px;
  font-variant-numeric: tabular-nums;
}
.cp-next.overdue, .cp-next.overdue .cp-next-due { color: var(--red); }

/* ============================================================
   ゲート判断パッケージ
   ============================================================ */
.pkg { max-width: 900px; font-size: 13px; }
.pkg-head { border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 20px; }
.pkg-kicker { font-size: 11px; font-weight: 700; letter-spacing: .12em; color: var(--brand); }
.pkg-title { font-size: 21px; font-weight: 700; margin: 5px 0 6px; line-height: 1.35; }
.pkg-sub { font-size: 13px; margin-bottom: 6px; }
.pkg-meta { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; }
.pkg-purpose {
  margin-top: 9px; padding: 8px 11px; background: #f6f8fa;
  border-left: 3px solid var(--brand); font-size: 12px; border-radius: 0 6px 6px 0;
}
.pkg-h2 {
  font-size: 14px; font-weight: 700; margin: 26px 0 10px;
  padding-bottom: 5px; border-bottom: 1px solid var(--line);
}
.pkg-h2 .muted { font-weight: 400; font-size: 11px; }

.pkg-risks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (max-width: 700px) { .pkg-risks { grid-template-columns: repeat(2, 1fr); } }
.pkg-risk { border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fff; }
.pkg-risk.ok   { border-color: #bfe3c9; background: #f4fbf6; }
.pkg-risk.warn { border-color: #f3e3b5; background: var(--amber-soft); }
.pkg-risk.bad  { border-color: #f0c4c4; background: #fdf5f5; }
.pkg-risk-num { font-size: 22px; font-weight: 700; line-height: 1.1; }
.pkg-risk-label { font-size: 11px; margin-top: 2px; }
.pkg-risk-label .muted { font-size: 10px; }

.pkg-block { margin-bottom: 14px; }
.pkg-block-title { font-size: 12px; font-weight: 700; margin-bottom: 5px; }
.pkg-block-title.bad { color: var(--red); }
.pkg-block-title.warn { color: #b07d1a; }
.pkg-item { padding: 5px 0; border-bottom: 1px solid #f2f4f8; font-size: 12.5px; line-height: 1.55; }

.pkg-score { display: flex; align-items: baseline; gap: 14px; margin-bottom: 6px; }
.pkg-score-total { font-size: 30px; font-weight: 700; }
.pkg-score-total span { font-size: 11px; font-weight: 400; color: var(--ink-3); margin-left: 6px; }

.pkg-phase { margin-bottom: 16px; }
.pkg-phase-name {
  font-size: 12.5px; font-weight: 700; background: #eef1f6;
  padding: 5px 10px; border-radius: 6px; margin-bottom: 8px;
}
.pkg-cp { margin: 0 0 12px 10px; padding-left: 10px; border-left: 2px solid var(--line); }
.pkg-cp-head { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: 12.5px; margin-bottom: 5px; }
.pkg-entry { margin-bottom: 7px; }
.pkg-entry-label { font-size: 11px; font-weight: 700; color: var(--ink-3); }
.pkg-entry-value { font-size: 12.5px; line-height: 1.6; white-space: pre-wrap; }
.pkg-entry-value.empty { color: #b8bfcc; }
.pkg-entry-src { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; }

/* ============================================================
   ジャーニー図 (フェーズ=ボックス / ゲート=ダイヤ)
   ============================================================ */
.journey-strip {
  display: flex; align-items: stretch; gap: 0;
  overflow-x: auto; padding: 14px 4px 6px;
}
.strip-seg { display: flex; align-items: center; }
.strip-phase {
  min-width: 150px; max-width: 200px;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; padding: 10px 14px; text-align: center;
  display: flex; flex-direction: column; justify-content: center; gap: 2px;
}
.strip-phase .sp-name { font-weight: 700; font-size: 13px; line-height: 1.35; }
.strip-phase .sp-tag { font-size: 10px; color: var(--ink-3); }
.strip-phase .sp-meta { font-size: 10.5px; color: var(--ink-3); }
.strip-phase.current {
  border-color: var(--brand); background: var(--brand-soft);
  box-shadow: 0 0 0 3px rgba(232, 89, 12, 0.12);
}
.strip-phase.done-phase { border-color: #cfe9d4; background: #f7fcf8; }
.strip-gate-wrap {
  display: flex; flex-direction: column; align-items: center;
  margin: 0 14px; min-width: 60px; position: relative;
}
.strip-gate {
  width: 22px; height: 22px; transform: rotate(45deg);
  border: 2.5px solid var(--amber); background: #fff; border-radius: 4px;
}
.strip-gate.g-passed { border-color: var(--green); background: var(--green); }
.strip-gate.g-conditional { border-color: var(--blue); background: var(--blue-soft); }
.strip-gate.g-rejected { border-color: var(--red); background: var(--red-soft); }
.strip-gate.g-pending.next { box-shadow: 0 0 0 4px rgba(232, 161, 12, 0.22); }
.strip-gate-label {
  font-size: 10px; color: var(--ink-2); font-weight: 700;
  margin-top: 7px; text-align: center; line-height: 1.3; max-width: 96px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.strip-gate-status { font-size: 9.5px; }
.strip-line { width: 26px; height: 2px; background: #ccd2dc; flex-shrink: 0; }
.strip-line.long { width: 34px; }
.journey-strip.compact .strip-phase { min-width: 110px; padding: 7px 10px; }
.journey-strip.compact .strip-gate { width: 16px; height: 16px; border-width: 2px; }
.journey-strip.compact .strip-gate-wrap { margin: 0 8px; min-width: 44px; }
.journey-strip.compact .strip-gate-label { font-size: 9px; max-width: 70px; }
.journey-strip.compact { padding: 8px 2px 2px; }

/* テーマカード (ダッシュボード) */
.theme-journey-card { padding: 14px 18px; }
.tj-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tj-title { font-weight: 700; font-size: 14px; cursor: pointer; }
.tj-title:hover { color: var(--brand); }
.tj-meta { color: var(--ink-3); font-size: 12px; }
.tj-score { margin-left: auto; font-weight: 800; font-size: 14px; }

/* ============================================================
   テンプレート設計画面
   ============================================================ */
.tpl-flow {
  display: flex; align-items: flex-start; gap: 0;
  overflow-x: auto; padding: 16px 4px;
}
.tpl-phase-col { min-width: 220px; max-width: 260px; flex-shrink: 0; }
.tpl-phase-box {
  border: 1.5px solid var(--line); border-radius: 10px; background: #fff;
  padding: 12px 14px;
}
.tpl-phase-box .tp-name { font-weight: 800; font-size: 14px; }
.tpl-phase-box .tp-desc { font-size: 11px; color: var(--ink-3); line-height: 1.5; margin: 2px 0 8px; }
.tpl-cp {
  border-top: 1px solid #f0f2f6; padding: 6px 0; font-size: 12px;
  display: flex; gap: 6px; align-items: baseline;
}
.tpl-cp .cp-tool-name { color: var(--brand-dark); font-size: 10.5px; }
.tpl-gate-slot {
  display: flex; flex-direction: column; align-items: center;
  padding-top: 26px; margin: 0 10px; min-width: 70px; flex-shrink: 0;
}
.tpl-gate-slot .strip-gate { border-color: var(--brand); }
.tpl-connector { display: flex; align-items: center; padding-top: 40px; }

/* ============================================================
   ログイン画面
   ============================================================ */
#login-root:not(:empty) { position: fixed; inset: 0; z-index: 200; }
body.login-mode .layout { display: none; }
.login-bg {
  width: 100%; height: 100%;
  background: linear-gradient(135deg, #1b1e27 0%, #2a2330 55%, #52250c 100%);
  display: flex; align-items: center; justify-content: center;
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: ''; position: absolute; width: 640px; height: 640px; border-radius: 50%;
  background: radial-gradient(circle, rgba(232, 89, 12, 0.28), transparent 65%);
  top: -180px; right: -140px;
}
.login-bg::after {
  content: ''; position: absolute; width: 480px; height: 480px; border-radius: 50%;
  background: radial-gradient(circle, rgba(247, 103, 7, 0.14), transparent 65%);
  bottom: -160px; left: -120px;
}
.login-card {
  position: relative; z-index: 1;
  width: 400px; max-width: calc(100vw - 40px);
  background: #fff; border-radius: 16px; padding: 36px 36px 30px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.login-logo {
  width: 46px; height: 46px; border-radius: 11px;
  background: linear-gradient(135deg, var(--brand), #f76707);
  color: #fff; font-weight: 800; font-size: 24px;
  display: flex; align-items: center; justify-content: center;
}
.login-name { font-size: 24px; font-weight: 800; letter-spacing: 1.5px; }
.login-full { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.3px; }
.login-tagline {
  font-size: 12.5px; color: var(--ink-2); line-height: 1.7;
  margin: 14px 0 22px; padding-left: 12px; border-left: 3px solid var(--brand);
}
.login-error { color: var(--red); font-size: 12px; margin-bottom: 10px; min-height: 18px; }
.login-btn {
  width: 100%; justify-content: center; padding: 11px; font-size: 14px; margin-top: 4px;
}
.login-hint {
  margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--line);
  font-size: 11px; color: var(--ink-3); line-height: 1.7;
}
.login-journey {
  display: flex; align-items: center; gap: 6px; margin-top: 18px; justify-content: center;
}
.login-journey .lj-box { width: 34px; height: 12px; border-radius: 3px; background: #edf0f4; }
.login-journey .lj-box.lit { background: var(--brand-soft); border: 1px solid var(--brand); }
.login-journey .lj-gate { width: 9px; height: 9px; transform: rotate(45deg); border-radius: 2px; }
.login-journey .lj-gate.amber { background: var(--amber); }
.login-journey .lj-gate.green { background: var(--green); }
.login-journey .lj-line { width: 12px; height: 2px; background: #dde2ea; }

/* サイドバー ユーザーボックス */
#user-box { font-size: 12px; }
#user-box .ub-name { color: #fff; font-weight: 700; }
#user-box .ub-role { color: #9aa1b0; font-size: 10.5px; margin-bottom: 6px; }
#user-box button {
  background: transparent; border: 1px solid rgba(255,255,255,0.25); color: #c2c8d4;
  border-radius: 6px; padding: 3px 10px; font-size: 11px; cursor: pointer; font-family: inherit;
}
#user-box button:hover { background: rgba(255,255,255,0.08); }
