/* Dev Control 共通管理画面。スマホ優先。色はトークンで定義し、ダークモードに対応。 */
:root {
  --bg: #f4f5f7; --surface: #ffffff; --surface-2: #f8f9fb; --fg: #16181d; --muted: #5b6270; --line: #e2e5ea;
  --accent: #2657d6; --accent-fg: #ffffff; --ok: #1f7a46; --warn: #a15c00; --bad: #b42318; --info: #3b5bdb; --wait: #7048c2;
  --ok-bg: #e7f5ec; --warn-bg: #fff4e0; --bad-bg: #fdecea; --info-bg: #e8eefc; --wait-bg: #f1ebfb; --mock-bg: #fff0f6; --mock: #a61e4d;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 12px; --gap: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --surface: #171a21; --surface-2: #1d212a; --fg: #e8eaef; --muted: #9aa3b2; --line: #2a2f3a;
    --accent: #7aa2ff; --accent-fg: #0b1020; --ok: #5fd08f; --warn: #f0b252; --bad: #ff8a80; --info: #8fa8ff; --wait: #b79cff;
    --ok-bg: #16301f; --warn-bg: #33270f; --bad-bg: #3a1a18; --info-bg: #1b2440; --wait-bg: #271f3d; --mock-bg: #3a1526; --mock: #ff8fb8;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.55 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 20px; margin: 0 0 8px; overflow-wrap: anywhere; }
h2 { font-size: 16px; margin: 20px 0 8px; }
h3 { font-size: 15px; margin: 0; overflow-wrap: anywhere; }
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; text-decoration: none; color: var(--fg); white-space: nowrap; }
.top nav { display: none; gap: 4px; margin-left: auto; }
.top nav a, .bottom-nav a { text-decoration: none; color: var(--muted); padding: 8px 10px; border-radius: 8px; position: relative; white-space: nowrap; }
.top nav a.on, .bottom-nav a.on { color: var(--accent); background: var(--info-bg); }
.fresh { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; font-size: 11px; padding: 8px 2px; min-height: 52px; justify-content: center; border-radius: 0; }
.bottom-nav a .ico { font-size: 18px; line-height: 1; }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }
.bottom-nav .count { position: absolute; top: 4px; right: calc(50% - 22px); }
@media (min-width: 860px) {
  body { padding-bottom: 0; }
  .top nav { display: flex; }
  .fresh { margin-left: 12px; }
  .bottom-nav { display: none; }
}
main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.banner { margin: 0; padding: 10px 16px; font-size: 14px; }
.banner.bad { background: var(--bad-bg); color: var(--bad); }
.banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.mock { background: var(--mock-bg); color: var(--mock); }
.grid { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 700px) { .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card.attn { border-color: var(--bad); }
.card-head { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.title-2l { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.running, .chip.verifying, .chip.merging, .chip.fixing { background: var(--info-bg); color: var(--info); border-color: transparent; }
.chip.waiting_answer { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.review { background: var(--wait-bg); color: var(--wait); border-color: transparent; }
.chip.waiting_quota, .chip.waiting_executor, .chip.paused { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.failed { background: var(--bad); color: #fff; border-color: transparent; }
.chip.done { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.mock { background: var(--mock-bg); color: var(--mock); border-color: transparent; }
.chip.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.chip.unknown, .chip.stale { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.exhausted { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.low { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
/* 質問の緊急度（管制が計算）と推定値の印 */
.chip.urg-high { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.chip.urg-medium { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.chip.urg-low { background: var(--surface-2); color: var(--muted); }
.chip.est { background: transparent; color: var(--warn); border: 1px dashed var(--warn); }
.bar { height: 8px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.near > i { background: var(--warn); }
.bar.over > i { background: var(--bad); }
.bar.est { border-style: dashed; }
.bar.est > i { opacity: .75; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font-size: 13px; }
.kv dt { color: var(--muted); white-space: nowrap; }
.kv dd { margin: 0; overflow-wrap: anywhere; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--fg); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.attention { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 700px) { .attention { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.attention a { text-decoration: none; color: inherit; }
.attention .card { padding: 10px 12px; }
.attention .num { font-size: 24px; font-weight: 700; }
.attention .hot { border-color: var(--bad); background: var(--bad-bg); }
.attention .hot .num { color: var(--bad); }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 8px 0; border-top: 1px solid var(--line); }
.list > li:first-child { border-top: 0; }
.q { border-left: 4px solid var(--bad); }
.q.approval { border-left-color: var(--wait); }
.q.done { opacity: .6; border-left-color: var(--ok); }
.opt { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; cursor: pointer; }
.opt input { margin-top: 3px; width: 20px; height: 20px; flex: none; }
.opt.rec { border-color: var(--accent); }
.opt .impact { font-size: 12px; color: var(--muted); }
textarea, input[type=text], input[type=password], input[type=datetime-local], input[type=url], select { width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); min-height: 42px; }
textarea { min-height: 80px; resize: vertical; }
label.field { display: block; margin-top: 12px; font-weight: 600; font-size: 14px; }
label.field .hint { font-weight: 400; color: var(--muted); font-size: 12px; display: block; }
.sticky-actions { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 5; margin-top: 12px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 4px 16px rgba(0,0,0,.12); display: flex; gap: 8px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (min-width: 860px) { .sticky-actions { bottom: 12px; } }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin: 12px 0; }
.tabs button { border: 0; background: none; padding: 10px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
details summary { cursor: pointer; color: var(--accent); font-size: 13px; padding: 4px 0; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12px; max-height: 420px; overflow: auto; margin: 6px 0 0; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th, table.tbl td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
table.tbl, .limits, .attention .num, .count { font-variant-numeric: tabular-nums; }
/* 等幅の ID（タスクキー・セッション ID） */
.mono { font-family: var(--mono); font-size: .92em; }
.id-badge { display: inline-block; margin-right: 6px; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); color: var(--muted); font: 600 12px/20px var(--mono); vertical-align: 1px; white-space: nowrap; }
.limits { color: var(--muted); }
.limits .warn { color: var(--warn); font-weight: 700; }
.warn-note { color: var(--warn); font-weight: 600; overflow-wrap: anywhere; }
.pick-count { font-variant-numeric: tabular-nums; }
.reasons { overflow-wrap: anywhere; }
.no-answer { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--muted); overflow-wrap: anywhere; }
.no-answer strong { color: var(--fg); }
.metric { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.dash-frame { width: 100%; height: 72vh; min-height: 480px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(76px + env(safe-area-inset-bottom)); background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; z-index: 50; max-width: 92vw; font-size: 14px; }
.err { color: var(--bad); }
.okc { color: var(--ok); }
.cap-supported { color: var(--ok); font-weight: 600; }
.cap-documented { color: var(--info); font-weight: 600; }
.cap-unsupported { color: var(--bad); font-weight: 600; }
.cap-unverified { color: var(--warn); font-weight: 600; }
.login { max-width: 380px; margin: 12vh auto; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.pill-link { display: inline-flex; gap: 4px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; font-size: 13px; background: var(--surface); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.block { width: 100%; }
/* 実案件の取り込み（仕様書つきの登録・受け入れ条件・判断の記録・リモート CI） */
.span-all { grid-column: 1 / -1; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list > li + li { margin-top: 2px; }
.plain-list .chip { vertical-align: 1px; }
.kv dd .mono { overflow-wrap: anywhere; }
.code-area { font-family: var(--mono); font-size: 13px; line-height: 1.45; min-height: 360px; tab-size: 2; white-space: pre; overflow-wrap: normal; overflow-x: auto; }
.help-list { margin: 6px 0 0; padding-left: 18px; }
.help-list > li { margin-top: 6px; overflow-wrap: anywhere; }
.check-list > li { display: flex; gap: 8px; align-items: flex-start; overflow-wrap: anywhere; }
.check-list .lvl-ico { flex: none; width: 1.4em; text-align: center; }
.check-list > li.lvl-error { color: var(--bad); }
.check-list > li.lvl-warn { color: var(--warn); }
.ac-preview { margin: 6px 0 0; padding-left: 22px; }
.ac-preview > li { margin-top: 4px; overflow-wrap: anywhere; }
.ac-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.ac-badge { border-color: var(--accent); color: var(--accent); background: var(--info-bg); }
table.tbl tr.grp th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; }
table.tbl td .chip { margin: 1px 0; }
.remote-ci { border-top: 1px solid var(--line); padding-top: 10px; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* 狭い画面では表を縦に積む（受け入れ条件の表など。各セルに見出しを添える） */
@media (max-width: 599px) {
  .kv.kv-stack { grid-template-columns: 1fr; gap: 0; }
  .kv.kv-stack dt { white-space: normal; margin-top: 8px; font-size: 12px; }
  .kv.kv-stack dt:first-child { margin-top: 0; }
  table.tbl.stack tr.head { display: none; }
  table.tbl.stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  table.tbl.stack tr.grp { border-bottom: 0; padding: 0; }
  table.tbl.stack tr.grp th { display: block; }
  table.tbl.stack td { display: block; border: 0; padding: 2px 8px; }
  table.tbl.stack td[data-label]::before { content: attr(data-label); display: block; color: var(--muted); font-size: 11px; font-weight: 600; }
}
