/* 規則の置き場所。値は tokens.css だけを参照する */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-body); font-size: var(--text-md); line-height: 1.6;
  font-variant-numeric: tabular-nums; line-break: strict; overflow-wrap: anywhere;
}
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; }
h1 { font-size: var(--text-xl); }
h2 { font-size: var(--text-lg); }
h3 { font-size: var(--text-md); }
p { margin: 0; }
a { color: var(--focus); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.muted { color: var(--ink-3); }
.sub { color: var(--ink-2); font-size: var(--text-sm); }
.num { font-family: var(--font-num); }
.nw { white-space: nowrap; }
.stack > * + * { margin-top: var(--s4); }
.stack-sm > * + * { margin-top: var(--s2); }
.row { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

/* ===== 骨組み：上の帯＋左の並び＋作業面 ===== */
.shell { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }
.rail { background: var(--shell); color: var(--shell-ink); padding: var(--s4) 0; display: flex; flex-direction: column; gap: var(--s1); }
.rail-brand { padding: 0 var(--s4) var(--s4); font-weight: 700; font-size: var(--text-md); }
.rail-tenant { padding: 0 var(--s4) var(--s3); color: var(--shell-ink-2); font-size: var(--text-xs); }
.rail-group { padding: var(--s3) var(--s4) var(--s1); color: var(--shell-ink-2); font-size: var(--text-2xs); letter-spacing: .04em; }
.rail a { display: block; padding: var(--s2) var(--s4); color: var(--shell-ink); text-decoration: none; border-left: 3px solid transparent; }
.rail a:hover { background: var(--shell-2); }
.rail a[aria-current="page"] { border-left-color: var(--shell-mark); background: var(--shell-2); font-weight: 700; }
.rail-foot { margin-top: auto; padding: var(--s4); font-size: var(--text-xs); color: var(--shell-ink-2); }
.rail-foot .btn-quiet { color: var(--shell-ink); padding: 0; min-height: 0; }
.main { padding: var(--s5) var(--s6); min-width: 0; max-width: 1280px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s5); }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--s1); padding: var(--s2); }
  .rail-group, .rail-tenant { display: none; }
  .rail-brand { padding: 0 var(--s2); }
  .rail a { padding: var(--s1) var(--s2); border-left: 0; border-bottom: 3px solid transparent; }
  .rail a[aria-current="page"] { border-bottom-color: var(--shell-mark); }
  .rail-foot { margin: 0 0 0 auto; padding: 0 var(--s2); display: flex; gap: var(--s3); align-items: center; }
  .rail-foot > div:nth-child(2) { display: none; }
  .main { padding: var(--s4); }
}

/* ===== 入口（ログインなど）：真ん中に1枚 ===== */
.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--s4); }
.gate-card { width: min(420px, 100%); background: var(--paper-2); border: var(--hair) solid var(--rule); border-radius: var(--r-lg); padding: var(--s6) var(--s5); }
.gate-brand { font-weight: 700; color: var(--ink-2); margin-bottom: var(--s4); }
.qr svg { width: 200px; height: 200px; display: block; margin: 0 auto; background: white; }
.secret { font-family: var(--font-num); letter-spacing: .08em; font-size: var(--text-sm); background: var(--paper-sink); padding: var(--s2) var(--s3); border-radius: var(--r-sm); word-break: break-all; }

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: var(--control-h); padding: 0 var(--s4); border: var(--hair) solid var(--rule-2);
  border-radius: var(--r-md); background: var(--paper-2); color: var(--ink);
  font: inherit; font-weight: 700; font-size: var(--text-sm); text-decoration: none; white-space: nowrap; cursor: pointer;
  transition: background-color var(--dur-2) var(--ease-out);
}
.btn:hover { background: var(--paper-3); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hi); }
.btn-danger { color: var(--alert); border-color: var(--alert); background: transparent; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--ink-2); padding-inline: var(--s2); }
.btn-lg { min-height: var(--control-h-lg); font-size: var(--text-md); }
.btn-block { width: 100%; }
.btn-sm { min-height: var(--control-h-sm); padding: 0 var(--s3); font-size: var(--text-xs); }

/* 発信ボタン：緑の受話器。押すと zoomphonecall:// で PC の Zoom アプリがかける */
.dial {
  display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--control-h-sm);
  padding: 0 var(--s3); border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink);
  font-weight: 700; font-size: var(--text-xs); text-decoration: none; white-space: nowrap;
}
.dial:hover { background: var(--accent-hi); }
.dial::before { content: "☎"; }
.dial-lg { min-height: var(--control-h-lg); font-size: var(--text-md); padding: 0 var(--s5); }
.dial.is-sent { background: var(--accent-hi); }

/* ===== 入力 ===== */
.field { display: grid; gap: var(--s1); min-width: 0; }
.field-label { font-size: var(--text-sm); color: var(--ink-2); font-weight: 700; }
.field-help { font-size: var(--text-xs); color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; min-height: var(--control-h-lg); padding: 0 var(--s3); border: var(--hair) solid var(--rule-2);
  border-radius: var(--r-md); background: var(--paper-2); font: inherit; color: var(--ink);
}
.textarea { padding: var(--s2) var(--s3); min-height: 96px; resize: vertical; }
.input-sm, .select-sm { min-height: var(--control-h); }
.check { display: inline-flex; align-items: center; gap: var(--s2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s4); }
.form-grid .wide { grid-column: 1 / -1; }

/* ===== 面・表 ===== */
.card { background: var(--paper-2); border: var(--hair) solid var(--rule); border-radius: var(--r-lg); padding: var(--s5); }
.card-tight { padding: var(--s4); }
.table-wrap { overflow-x: auto; background: var(--paper-2); border: var(--hair) solid var(--rule); border-radius: var(--r-lg); }
table.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.table th { background: var(--head); color: var(--head-ink); text-align: left; font-weight: 700; padding: var(--s2) var(--s3); white-space: nowrap; border-bottom: var(--hair) solid var(--rule); }
.table td { padding: var(--s2) var(--s3); border-bottom: var(--hair) solid var(--rule); vertical-align: middle; }
.table tr:nth-child(even) td { background: var(--row-alt); }
.table tr:last-child td { border-bottom: 0; }
.table a.rowlink { color: var(--ink); font-weight: 700; text-decoration: none; white-space: nowrap; }
.table a.rowlink:hover { text-decoration: underline; }
.empty { padding: var(--s6); text-align: center; color: var(--ink-3); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); }
.kv dt { color: var(--ink-3); font-size: var(--text-sm); }
.kv dd { margin: 0; }

/* ===== タブ（ステータス・設定） ===== */
.tabs { display: flex; gap: var(--s1); flex-wrap: wrap; border-bottom: var(--hair) solid var(--rule); margin-bottom: var(--s4); }
.tabs a { padding: var(--s2) var(--s3); text-decoration: none; color: var(--ink-2); border-bottom: 3px solid transparent; margin-bottom: -1px; font-size: var(--text-sm); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 700; }
.tabs .count { color: var(--ink-3); font-size: var(--text-2xs); margin-left: var(--s1); }

/* ===== ステータスの札 ===== */
.badge { display: inline-flex; align-items: center; padding: 0 var(--s2); border-radius: var(--r-pill); font-size: var(--text-xs); font-weight: 700; white-space: nowrap; line-height: 1.8; }
.st-gray { background: var(--st-gray-bg); color: var(--st-gray-ink); }
.st-blue { background: var(--st-blue-bg); color: var(--st-blue-ink); }
.st-green { background: var(--st-green-bg); color: var(--st-green-ink); }
.st-amber { background: var(--st-amber-bg); color: var(--st-amber-ink); }
.st-red { background: var(--st-red-bg); color: var(--st-red-ink); }
.st-purple { background: var(--st-purple-bg); color: var(--st-purple-ink); }
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; margin-right: var(--s1); }
.dot.st-gray { background: var(--st-gray-ink); }
.dot.st-blue { background: var(--st-blue-ink); }
.dot.st-green { background: var(--st-green-ink); }
.dot.st-amber { background: var(--st-amber-ink); }
.dot.st-red { background: var(--st-red-ink); }
.dot.st-purple { background: var(--st-purple-ink); }

/* ===== お知らせ ===== */
.notice { padding: var(--s3) var(--s4); border-radius: var(--r-md); font-size: var(--text-sm); }
.notice-success { background: var(--ok-wash); color: var(--ok); }
.notice-error { background: var(--alert-wash); color: var(--alert); }
.notice-warn { background: var(--warn-wash); color: var(--warn); }
.notice-info { background: var(--paper-sink); color: var(--ink-2); }
.messages { display: grid; gap: var(--s2); margin-bottom: var(--s4); }

/* ===== 通話の記録 ===== */
.call { border-top: var(--hair) solid var(--rule); padding: var(--s3) 0; }
.call:first-child { border-top: 0; }
.call-head { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: baseline; font-size: var(--text-sm); }
.call details { margin-top: var(--s2); }
.call summary { cursor: pointer; color: var(--focus); font-size: var(--text-sm); }
.transcript { white-space: pre-wrap; font-size: var(--text-sm); background: var(--paper-sink); border-radius: var(--r-md); padding: var(--s3); margin-top: var(--s2); max-height: 420px; overflow: auto; }

.record-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); gap: var(--s5); align-items: start; }
@media (max-width: 1100px) { .record-layout { grid-template-columns: minmax(0, 1fr); } }   /* 1fr だと目次の幅で列が広がり横にはみ出す */
.dial-bar { display: flex; flex-wrap: wrap; gap: var(--s2); }
.pager { display: flex; gap: var(--s2); align-items: center; justify-content: flex-end; margin-top: var(--s3); font-size: var(--text-sm); }
.link-box { display: flex; gap: var(--s2); }
.link-box .input { font-family: var(--font-num); font-size: var(--text-xs); }
.steps { margin: 0; padding-left: 1.4em; }
.steps li + li { margin-top: var(--s2); }
code { font-family: var(--font-num); background: var(--paper-sink); padding: 0 var(--s1); border-radius: var(--r-sm); font-size: .92em; }

/* ===== 広い作業面（コール画面・ダッシュボード） ===== */
.main.main-wide { max-width: 1560px; }

/* ===== コール画面：左＝相手（発信・項目・履歴）／右＝結果の入力と次の相手 ===== */
.work-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s4); }
.work-top h1 { font-size: var(--text-lg); }
.modes { display: inline-flex; gap: 2px; padding: 2px; background: var(--paper-sink); border-radius: var(--r-md); flex-wrap: wrap; }
.modes a { padding: var(--s1) var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-size: var(--text-sm); font-weight: 700; white-space: nowrap; }
.modes a[aria-current="page"] { background: var(--paper-2); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.today { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--text-sm); color: var(--ink-2); }
.today b { font-family: var(--font-num); font-size: var(--text-lg); color: var(--ink); margin-left: var(--s1); }
.work { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--s5); align-items: start; }
@media (max-width: 1180px) { .work { grid-template-columns: 1fr; } }
.who { display: grid; gap: var(--s3); }
.who-name { font-size: var(--text-2xl); font-weight: 700; line-height: 1.25; }
.who-meta { display: flex; gap: var(--s2) var(--s4); flex-wrap: wrap; align-items: center; font-size: var(--text-sm); color: var(--ink-2); }
.who-meta .num { color: var(--ink); }
.overdue { color: var(--alert); font-weight: 700; }
.dials { display: flex; gap: var(--s2); flex-wrap: wrap; }
.dial-xl { min-height: 56px; font-size: var(--text-lg); padding: 0 var(--s5); border-radius: var(--r-md); }
.dial-xl small { font-weight: 400; font-size: var(--text-xs); opacity: .9; }
.sections { display: grid; gap: var(--s4); }
.section h3 { font-size: var(--text-sm); color: var(--ink-2); padding-bottom: var(--s1); border-bottom: var(--hair) solid var(--rule); margin-bottom: var(--s2); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s2) var(--s4); margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: var(--text-xs); color: var(--ink-3); }
.facts dd { margin: 0; font-size: var(--text-sm); white-space: pre-wrap; }
.facts dd:empty::before { content: "―"; color: var(--rule-2); }
.facts .wide { grid-column: 1 / -1; }

/* 結果の入力：分類ごとに札を並べる。押した札は枠で示す */
.panel { position: sticky; top: var(--s4); display: grid; gap: var(--s4); }
.result-groups { display: grid; gap: var(--s3); }
.result-group-label { font-size: var(--text-2xs); color: var(--ink-3); font-weight: 700; margin-bottom: var(--s1); }
.chips { display: flex; flex-wrap: wrap; gap: var(--s1); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex; align-items: center; min-height: var(--control-h); padding: 0 var(--s3);
  border-radius: var(--r-md); font-weight: 700; font-size: var(--text-sm); cursor: pointer; white-space: nowrap;
  border: 2px solid transparent;
}
.chip input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--paper-2); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.recall-quick { display: flex; flex-wrap: wrap; gap: var(--s1); }
.recall-quick label span {
  display: inline-flex; align-items: center; min-height: var(--control-h-sm); padding: 0 var(--s3);
  border: var(--hair) solid var(--rule-2); border-radius: var(--r-pill); font-size: var(--text-xs); cursor: pointer; background: var(--paper-2);
}
.recall-quick input { position: absolute; opacity: 0; pointer-events: none; }
.recall-quick input:checked + span { background: var(--st-blue-bg); color: var(--st-blue-ink); border-color: var(--st-blue-ink); font-weight: 700; }
.recall-quick input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.panel-actions { display: grid; grid-template-columns: 1fr auto auto; gap: var(--s2); }
.kbd { font-family: var(--font-num); font-size: var(--text-2xs); color: var(--ink-3); }
.queue { list-style: none; margin: 0; padding: 0; }
.queue li + li { border-top: var(--hair) solid var(--rule); }
.queue a { display: grid; grid-template-columns: 1fr auto; gap: var(--s2); padding: var(--s2) 0; color: var(--ink); text-decoration: none; font-size: var(--text-sm); }
.queue a:hover .q-name { text-decoration: underline; }
.q-name { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.q-when { font-family: var(--font-num); font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }

/* 履歴：対応記録と通話を1本の時系列に */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 112px 1fr; gap: var(--s3); padding: var(--s3) 0; border-top: var(--hair) solid var(--rule); }
.timeline > li:first-child { border-top: 0; }
.tl-at { font-family: var(--font-num); font-size: var(--text-xs); color: var(--ink-3); white-space: nowrap; }
.tl-body { min-width: 0; display: grid; gap: var(--s1); font-size: var(--text-sm); }
.tl-head { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.tl-memo { white-space: pre-wrap; color: var(--ink); }
.tl-call { color: var(--ink-2); }
@media (max-width: 560px) { .timeline > li { grid-template-columns: 1fr; gap: var(--s1); } }

/* ===== ダッシュボード ===== */
.periods { display: inline-flex; gap: 2px; padding: 2px; background: var(--paper-sink); border-radius: var(--r-md); }
.periods a { padding: var(--s1) var(--s3); border-radius: var(--r-sm); text-decoration: none; color: var(--ink-2); font-size: var(--text-sm); font-weight: 700; }
.periods a[aria-current="page"] { background: var(--paper-2); color: var(--ink); box-shadow: 0 0 0 1px var(--rule); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); }
.kpi { background: var(--paper-2); border: var(--hair) solid var(--rule); border-radius: var(--r-lg); padding: var(--s4); display: grid; gap: var(--s1); align-content: start; }
.kpi-label { font-size: var(--text-xs); color: var(--ink-2); font-weight: 700; }
.kpi-value { font-family: var(--font-num); font-size: 2rem; font-weight: 700; line-height: 1.1; }
.kpi-value small { font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); margin-left: 2px; }
.kpi-sub { font-size: var(--text-xs); color: var(--ink-3); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr); gap: var(--s4); align-items: stretch; }
.dash-grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 1180px) { .dash-grid { grid-template-columns: 1fr; } }
.alerts { display: flex; gap: var(--s2); flex-wrap: wrap; }
.alerts a, .alerts span { text-decoration: none; }

/* 時間帯の棒：接続（緑）を下に、未接続（青）を上に積む。間に2pxの地 */
.legend { display: flex; gap: var(--s4); flex-wrap: wrap; font-size: var(--text-xs); color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: var(--s1); vertical-align: -1px; }
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 160px; margin-top: var(--s3); border-bottom: var(--hair) solid var(--rule-2); }
.bar { display: flex; flex-direction: column-reverse; gap: 2px; height: 100%; justify-content: flex-start; position: relative; }
.bar .b-on { background: var(--g-won); border-radius: 0 0 0 0; }
.bar .b-off { background: var(--g-new); border-radius: 4px 4px 0 0; }
.bar .b-on:only-child, .bar .b-on.top { border-radius: 4px 4px 0 0; }
.bar:hover { background: var(--paper-sink); }
.bar-labels { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; font-family: var(--font-num); font-size: var(--text-2xs); color: var(--ink-3); text-align: center; margin-top: var(--s1); }

/* 進み具合の帯：区分ごとに色。区分の間に2pxの地 */
.progress { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; background: var(--paper-sink); }
.progress > span { display: block; min-width: 3px; }
.g-won { background: var(--g-won); }
.g-active { background: var(--g-active); }
.g-new { background: var(--g-new); }
.g-lost { background: var(--g-lost); }
.g-invalid { background: var(--g-invalid); }
.list-progress + .list-progress { border-top: var(--hair) solid var(--rule); padding-top: var(--s4); margin-top: var(--s4); }
.list-progress .legend b { font-family: var(--font-num); color: var(--ink); margin-left: 2px; }

/* 一覧：選んで担当をまとめて変える帯 */
.bulk { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; padding: var(--s2) var(--s3); background: var(--paper-sink); border-radius: var(--r-md); margin-bottom: var(--s3); font-size: var(--text-sm); }
.bulk .select { width: auto; min-width: 180px; }
.cell-sel { width: 36px; }
.filters { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s3); }
.filters .select, .filters .input { width: auto; }

/* リストの入口：カードに件数と［コール開始］ */
.list-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.list-card { display: grid; gap: var(--s3); align-content: start; }
.list-card h2 a { color: var(--ink); text-decoration: none; }
.list-card h2 a:hover { text-decoration: underline; }
.list-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.list-stats div { background: var(--paper-sink); border-radius: var(--r-md); padding: var(--s2) var(--s3); }
.list-stats dt { font-size: var(--text-2xs); color: var(--ink-3); }
.list-stats dd { margin: 0; font-family: var(--font-num); font-size: var(--text-lg); font-weight: 700; }
.list-card .actions { display: flex; gap: var(--s2); flex-wrap: wrap; }

/* ===== 削除の確認 ===== */
.danger-zone { border-color: var(--alert); }
.del-list { margin: var(--s2) 0 0; padding-left: 1.2em; font-size: var(--text-sm); }
.del-list b { margin: 0 2px 0 var(--s2); }
.confirm-word { font-family: var(--font-num); background: var(--alert-wash); color: var(--alert); padding: 0 var(--s1); border-radius: var(--r-sm); user-select: all; }
.btn-danger.btn-solid { background: var(--alert); color: var(--paper-2); }

/* 長いフォームの保存の帯：画面の上に貼り付ける（列が多くても下まで送らずに押せる） */
.form-bar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
  margin: calc(var(--s5) * -1) calc(var(--s5) * -1) 0; padding: var(--s3) var(--s5);
  background: var(--paper-2); border-bottom: var(--hair) solid var(--rule); border-radius: var(--r-lg) var(--r-lg) 0 0;
}

/* ===== ダッシュボード（売上・推移・漏斗） 2026-11-17 ===== */
.kpis-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi-money { background: var(--accent-wash); border-color: oklch(85% 0.05 155); }
.kpi-value-sm { font-size: 1.5rem; }
.kpi-empty { color: var(--ink-3); }
.kpi-delta { font-size: var(--text-xs); min-height: 1.2em; }
.delta { font-family: var(--font-num); font-weight: 700; color: var(--ink-2); }
.delta.up { color: var(--ok); }
.delta.down { color: var(--alert); }
.month-head { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); margin-top: var(--s3); }
.month-head > div { display: grid; gap: 2px; align-content: start; }
.month-head b { font-family: var(--font-num); font-size: var(--text-lg); }
.month-head b.big { font-size: var(--text-2xl); }
@media (max-width: 640px) { .month-head { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.goal { position: relative; height: 10px; border-radius: var(--r-pill); background: var(--paper-sink); margin-top: var(--s3); }
.goal-fill { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-pill); background: var(--g-won); }
.goal-pace { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-2); }
.chart { display: block; width: 100%; height: auto; margin-top: var(--s3); overflow: visible; }
.chart .grid { stroke: var(--rule); stroke-width: 1; }
.chart .tick { fill: var(--ink-3); font-family: var(--font-num); font-size: 11px; }
.chart .area-won { fill: var(--g-won); opacity: .10; }
.chart .line-won { fill: none; stroke: var(--g-won); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .line-forecast { fill: none; stroke: var(--g-won); stroke-width: 2; stroke-dasharray: 6 5; opacity: .8; }
.chart .line-target { fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-dasharray: 3 4; }
.chart .pt-now { fill: var(--g-won); stroke: var(--paper-2); stroke-width: 2; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--ink); opacity: .05; }
.legend i.g-dash { background: repeating-linear-gradient(90deg, var(--g-won) 0 4px, transparent 4px 6px); height: 3px; vertical-align: 3px; }
.legend i.g-target { background: repeating-linear-gradient(90deg, var(--ink-3) 0 2px, transparent 2px 4px); height: 2px; vertical-align: 3px; }
/* 日ごとの棒：列の数は画面で渡す。積み上げは .bar を流用、獲得と確定は2本並び */
.tbars { display: grid; gap: 3px; align-items: end; height: 170px; margin-top: var(--s3); border-bottom: var(--hair) solid var(--rule-2); }
.tbars + .bar-labels { gap: 3px; }
.gbar { display: flex; gap: 2px; align-items: flex-end; height: 100%; }
.gbar > span { flex: 1; border-radius: 3px 3px 0 0; min-height: 0; }
.gbar:hover, .tbars .bar:hover { background: var(--paper-sink); }
.bar-labels span { white-space: nowrap; overflow: visible; }
.bar-labels .we { color: var(--alert); }
.axis-note { font-size: var(--text-2xs); color: var(--ink-3); margin-top: var(--s1); text-align: right; }
.funnel { display: grid; gap: var(--s3); margin-top: var(--s4); }
.funnel-row { display: grid; grid-template-columns: 5.5em minmax(0, 1fr) 4.5em 3.5em; gap: var(--s2); align-items: center; }
.funnel-label { font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); }
.funnel-track { height: 22px; background: var(--paper-sink); border-radius: 4px; overflow: hidden; }
.funnel-bar { display: block; height: 100%; border-radius: 4px; background: var(--g-new); }
.funnel-bar.f-done, .funnel-bar.f-entries, .funnel-bar.f-opened { background: var(--g-won); }
.funnel-n { font-family: var(--font-num); text-align: right; }
.funnel-step { font-size: var(--text-xs); color: var(--ink-3); text-align: right; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); margin: var(--s4) 0 0; padding-top: var(--s4); border-top: var(--hair) solid var(--rule); }
.mini-stats div { display: grid; gap: 2px; }
.mini-stats dt { font-size: var(--text-2xs); color: var(--ink-2); font-weight: 700; }
.mini-stats dd { margin: 0; font-family: var(--font-num); font-size: var(--text-lg); font-weight: 700; }
.col-bar { min-width: 150px; }
td.col-bar { display: flex; align-items: center; gap: var(--s2); }
.databar { flex: 1; height: 8px; background: var(--paper-sink); border-radius: var(--r-pill); overflow: hidden; }
.databar > span { display: block; height: 100%; background: var(--g-new); border-radius: var(--r-pill); }
.col-bar b { font-family: var(--font-num); min-width: 2.5em; text-align: right; }

/* 架電禁止の番号：発信ボタンの代わり */
.dial-blocked { display: inline-flex; align-items: center; gap: var(--s1); min-height: var(--control-h-lg); padding: 0 var(--s4);
  border: var(--hair) dashed var(--st-red-ink); border-radius: var(--r-md); color: var(--st-red-ink); background: var(--st-red-bg);
  font-weight: 700; font-size: var(--text-sm); }
.dial-blocked-xl { min-height: 56px; font-size: var(--text-lg); }
.dial-blocked small { font-weight: 400; font-size: var(--text-xs); }

/* ===== 案件（進捗・不備・入金） 2026-11-17 ===== */
.status-tabs { display: flex; flex-wrap: wrap; gap: var(--s2); }
.status-tabs a { display: inline-flex; align-items: center; gap: var(--s1); padding: var(--s1) var(--s3); border: var(--hair) solid var(--rule);
  border-radius: var(--r-pill); background: var(--paper-2); color: var(--ink-2); text-decoration: none; font-size: var(--text-sm); font-weight: 700; }
.status-tabs a b { font-family: var(--font-num); color: var(--ink-3); font-weight: 700; }
.status-tabs a[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: var(--paper-2); }
.status-tabs a[aria-current="page"] b { color: var(--paper-3); }
.grid-form { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 760px) { .grid-form { grid-template-columns: 1fr; } }
.stepper { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 0; }
.stepper li { display: grid; gap: 2px; padding: var(--s3); background: var(--paper-sink); border-radius: var(--r-md); border-top: 4px solid var(--rule-2); }
.stepper li.is-done { border-top-color: var(--g-won); }
.stepper li.is-current { border-top-color: var(--g-won); background: var(--accent-wash); }
.stepper li.is-alert { border-top-color: var(--alert); background: var(--alert-wash); }
.stepper-label { font-weight: 700; font-size: var(--text-sm); }
.stepper-date { font-size: var(--text-xs); color: var(--ink-2); }
@media (max-width: 640px) { .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.task-list li { padding: var(--s3); border: var(--hair) solid var(--rule); border-radius: var(--r-md); display: grid; gap: var(--s1); }
.task-list li.is-done { opacity: .6; }
.task-list li.is-overdue { border-color: var(--alert); background: var(--alert-wash); }
tr.is-current td { background: var(--accent-wash); }
.stage-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.stage-row a { display: grid; gap: 2px; padding: var(--s3); border-radius: var(--r-md); background: var(--paper-sink); text-decoration: none; color: var(--ink); }
.stage-row a b { font-family: var(--font-num); font-size: var(--text-xl); }
.stage-row a span { font-size: var(--text-xs); color: var(--ink-2); font-weight: 700; }
@media (max-width: 640px) { .stage-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.pay-bars { display: grid; gap: 6px; align-items: end; height: 170px; margin-top: var(--s3); border-bottom: var(--hair) solid var(--rule-2); }
.pay-bars + .bar-labels { gap: 6px; }
/* 架電順の設定とコール画面の表示 */
.queue-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 640px) { .queue-slots { grid-template-columns: 1fr; } }
.queue-order { margin-top: var(--s1); }
/* 一覧：行のクリックで詳細へ・ステータスの変更（選んで［変更］の2段・直後に［元に戻す］） */
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--paper-3); }
.cell-status { white-space: nowrap; cursor: default; }
.st-pick summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 2px; border-radius: var(--r-pill); }
.st-pick summary::-webkit-details-marker { display: none; }
.st-pick summary:hover .badge, .st-pick[open] summary .badge { box-shadow: 0 0 0 2px var(--rule-2); }
.st-pick summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.st-caret { font-size: var(--text-2xs); color: var(--ink-3); }
.st-pick-menu { position: fixed; z-index: 50; width: min(380px, calc(100vw - 16px)); max-height: min(70vh, 520px); overflow: auto;
  background: var(--paper-2); border: var(--hair) solid var(--rule-2); border-radius: var(--r-lg); box-shadow: 0 8px 24px rgb(0 0 0 / .18);
  padding: var(--s3); display: grid; gap: var(--s1); cursor: default; white-space: normal; }
.st-pick-head { font-weight: 700; font-size: var(--text-sm); margin-bottom: var(--s1); }
.chip-sm span { min-height: var(--control-h-sm); font-size: var(--text-xs); padding: 0 var(--s2); }
.chip input:disabled + span { opacity: .45; cursor: default; }
.st-pick-actions { position: sticky; bottom: calc(-1 * var(--s3)); margin: var(--s2) calc(-1 * var(--s3)) calc(-1 * var(--s3)); padding: var(--s2) var(--s3); background: var(--paper-2); border-top: var(--hair) solid var(--rule); }
.undo-bar { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: var(--s3); }
/* 区分（基本情報・住所など）：見出しの帯＋白と灰の交互 */
.section-block { border: var(--hair) solid var(--rule); border-radius: var(--r-md); overflow: hidden; background: var(--paper-2); }
.section-block.is-alt { background: var(--paper-sink); }
.section-block > h3 { margin: 0; padding: var(--s2) var(--s4); background: var(--head); color: var(--ink); font-size: var(--text-md); font-weight: 700; border-left: 4px solid var(--accent); border-bottom: var(--hair) solid var(--rule); }
.section-block > .form-grid, .section-block > .facts { padding: var(--s4); }
/* 設定の表：つまみで並び替え */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.table .cell-drag { width: 1%; padding-right: 0; }
.drag-handle { border: 0; background: none; color: var(--ink-3); font-size: var(--text-lg); line-height: 1; cursor: grab; padding: var(--s1); border-radius: var(--r-sm); touch-action: none; }
.drag-handle:hover { color: var(--ink); background: var(--paper-3); }
.drag-handle:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.table tr.is-dragging td { background: var(--accent-wash); }
.table tr.is-dragging .drag-handle { cursor: grabbing; }
body.is-reordering { user-select: none; cursor: grabbing; }
.cell-choices { min-width: 12em; }
.textarea-auto { min-height: var(--control-h-sm); resize: vertical; overflow-y: auto; }
.choices-none { color: var(--ink-3); }
/* ？の説明：押すかホバーで出す */
.help-tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: 2px; border-radius: 50%; border: var(--hair) solid var(--ink-3); background: var(--paper-2); color: var(--ink-2); font-size: 11px; font-weight: 700; line-height: 1; cursor: help; vertical-align: 1px; padding: 0; }
.help-tip:hover, .help-tip[aria-expanded="true"] { background: var(--ink-2); color: var(--paper-2); border-color: var(--ink-2); }
.help-tip:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.tip-pop { position: fixed; z-index: 60; max-width: min(280px, calc(100vw - 16px)); padding: var(--s2) var(--s3); border-radius: var(--r-md); background: var(--ink); color: var(--paper-2); font-size: var(--text-xs); font-weight: 400; line-height: 1.6; box-shadow: 0 6px 18px rgb(0 0 0 / .2); pointer-events: none; }
/* 列の設定：見出しの区分の中に列を並べる（見出しごとに＋で追加・つまみで見出しをまたいで並び替え） */
.fields-editor { --fe-cols: 28px minmax(160px, 1.3fr) 150px minmax(170px, 1.5fr) 76px 132px; }
.fe-toolbar { display: flex; align-items: center; gap: var(--s2) var(--s3); flex-wrap: wrap; }
.fe-filter { max-width: 240px; }
.fe-status { color: var(--ok); font-weight: 700; }
.frow { display: grid; grid-template-columns: var(--fe-cols); gap: var(--s2) var(--s3); align-items: center; padding: var(--s2) var(--s3); border-bottom: var(--hair) solid var(--rule); background: var(--paper-2); }
.frow-head { background: none; border: 0; padding-block: 0; font-size: var(--text-xs); font-weight: 700; color: var(--ink-2); }
.fe-groups { display: grid; gap: var(--s3); }
.fgroup { border: var(--hair) solid var(--rule); border-radius: var(--r-lg); overflow: hidden; background: var(--paper-2); }
.fgroup-head { display: flex; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3); background: var(--head); border-left: 4px solid var(--accent); }
.fgroup:not(.is-collapsed) .fgroup-head { border-bottom: var(--hair) solid var(--rule); }
.fgroup-toggle { border: 0; background: none; color: var(--ink-2); width: 24px; height: 24px; border-radius: var(--r-sm); cursor: pointer; transition: transform var(--dur-1) var(--ease-out); }
.fgroup-toggle:hover { background: var(--paper-3); }
.fgroup.is-collapsed .fgroup-toggle { transform: rotate(-90deg); }
.fgroup-name { flex: 0 1 22em; min-width: 6em; font: inherit; font-size: var(--text-md); font-weight: 700; color: var(--ink); background: transparent; border: var(--hair) solid transparent; border-radius: var(--r-sm); padding: 2px var(--s2); }
.fgroup-name:hover { border-color: var(--rule-2); background: var(--paper-2); }
.fgroup-name:focus { outline: none; border-color: var(--focus); background: var(--paper-2); box-shadow: 0 0 0 2px var(--focus); }
.fgroup-name::placeholder { color: var(--ink-3); font-weight: 400; }
.fgroup-count { color: var(--ink-3); font-size: var(--text-xs); white-space: nowrap; }
.fgroup-add-btn { margin-left: auto; white-space: nowrap; }
.fgroup.is-collapsed .flist, .fgroup.is-collapsed .frow-add { display: none; }
.fgroup.is-collapsed.is-filter-open .flist { display: block; }
.flist > .frow:last-child { border-bottom: 0; }
.flist.is-empty::before { content: "列なし"; display: block; margin: var(--s2) var(--s3); padding: var(--s3); border: 2px dashed var(--rule-2); border-radius: var(--r-md); color: var(--ink-3); font-size: var(--text-xs); text-align: center; }
.frow .drag-handle { justify-self: start; }
.frow.is-dragging { background: var(--accent-wash); box-shadow: 0 6px 18px rgb(0 0 0 / .12); position: relative; z-index: 2; }
.fgroup.is-dragging { box-shadow: 0 10px 28px rgb(0 0 0 / .18); outline: 2px solid var(--accent); }
.frow.is-dirty { box-shadow: inset 4px 0 0 var(--warn); background: var(--warn-wash); }
.frow.is-new { animation: fe-new 2.4s var(--ease-out); }
@keyframes fe-new { 0%, 40% { background: var(--accent-wash); } 100% { background: var(--paper-2); } }
.frow-actions { display: flex; gap: var(--s1); justify-content: flex-end; }
.frow-add { background: var(--accent-wash); border-top: var(--hair) solid var(--rule); border-bottom: 0; }
.frow-addmark { color: var(--accent); font-weight: 700; text-align: center; }
.fe-newgroup-btn { width: 100%; padding: var(--s3); border: 2px dashed var(--rule-2); border-radius: var(--r-lg); background: none; color: var(--ink-2); font: inherit; font-weight: 700; cursor: pointer; }
.fe-newgroup-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-wash); }
.fe-newgroup-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.fields-editor .cell-choices { min-width: 0; }
@media (max-width: 860px) {
  .frow-head { display: none; }
  .frow { grid-template-columns: 28px minmax(0, 1fr) auto; grid-template-areas: "h l l" ". t s" ". c c" ". a a"; }
  .frow .fe-h { grid-area: h; } .frow .fe-l { grid-area: l; } .frow .fe-t { grid-area: t; } .frow .fe-s { grid-area: s; }
  .frow .fe-c { grid-area: c; } .frow .fe-a { grid-area: a; }
  .frow .fe-c:has(.choices-none:not([hidden])) { display: none; }   /* 選択肢でない列だけ畳む（要約を出している列は残す） */
  .fgroup-head { flex-wrap: wrap; }
  .fgroup-add-btn { margin-left: 0; }
}
/* 列の設定：上の帯（絞り込み・列見出し）を固定・保存は変えた行だけ・選択肢は1行の要約 */
.fe-sticky { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: var(--s2) 0; display: grid; gap: var(--s2); border-bottom: var(--hair) solid var(--rule); }
.frow:not(.is-dirty) [data-row-save] { visibility: hidden; }
.choices-view { display: flex; align-items: center; gap: var(--s2); width: 100%; min-height: var(--control-h); padding: 0 var(--s3); border: var(--hair) solid var(--rule-2); border-radius: var(--r-md); background: var(--paper-2); font: inherit; font-size: var(--text-sm); color: var(--ink); text-align: left; cursor: pointer; min-width: 0; }
.choices-view:hover { border-color: var(--ink-3); }
.choices-view:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.choices-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.choices-n { flex: none; font-size: var(--text-2xs); color: var(--ink-3); }
.fgroup-toggle { font-size: var(--text-md); width: 28px; height: 28px; }
/* 固定した上の帯の裏に飛び先が隠れないよう余白をとる（#f-◯ への移動・追加直後の表示） */
.fields-editor .frow, .fields-editor .fgroup { scroll-margin-top: 170px; }
/* レコード名（題）に使う列の札・スマホ幅の見出しの帯 */
.fe-label { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.fe-label .input { flex: 1; min-width: 0; }
.title-badge { flex: none; padding: 0 var(--s2); border-radius: var(--r-pill); background: var(--st-blue-bg); color: var(--st-blue-ink); font-size: var(--text-2xs); font-weight: 700; line-height: 1.8; white-space: nowrap; cursor: help; }
.frow:not(.is-title) .title-badge { display: none; }
@media (max-width: 860px) {
  .fgroup-name { flex: 1 1 0; }
  .fgroup-head { row-gap: var(--s1); }
}
/* ---- 点検の指摘を受けた直し（2026-11-18） ---- */
/* 見出しの帯：見出しのつまみは列のつまみと別の形（濃い地の四角）・見出し名は鉛筆の印と下線で「直せる欄」と分かるように・件数は名前のすぐ後ろ・開閉は右端 */
.group-handle { width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: var(--paper-2); border: var(--hair) solid var(--rule-2); color: var(--ink-2); font-size: var(--text-md); }
.group-handle:hover { border-color: var(--ink-3); }
.fgroup-name-wrap { display: inline-flex; align-items: center; gap: 2px; min-width: 0; cursor: text; }
.fgroup-name { flex: 0 1 auto; field-sizing: content; min-width: 3.5em; max-width: 26em; border-bottom: 1px dashed var(--rule-2); border-radius: var(--r-sm) var(--r-sm) 0 0; }
.fgroup-pen { color: var(--ink-3); font-size: var(--text-sm); }
.fgroup-name-wrap:hover .fgroup-pen { color: var(--ink); }
.fgroup-head.is-dirty { background: var(--warn-wash); }
.fgroup-head.is-dirty .fgroup-name { border-bottom-color: var(--warn); }
.fgroup-add-btn { margin-left: 0; }
/* 列の行：ホバーで地色・持ち上げ中（キー）の印 */
.flist > .frow:hover { background: var(--paper-3); }
.flist > .frow.is-dirty:hover { background: var(--warn-wash); }
.is-lifted { outline: 2px dashed var(--accent); outline-offset: -2px; background: var(--accent-wash) !important; }
/* 上の帯の未保存の件数 */
.fe-dirty { display: inline-flex; align-items: center; gap: var(--s2); padding: 2px var(--s2) 2px var(--s3); border-radius: var(--r-pill); background: var(--warn-wash); color: var(--warn); font-size: var(--text-sm); font-weight: 700; }
/* ステータスの設定：保存は変えた行だけ・色の札は折り返さない */
.status-editor tbody tr:not(.is-dirty) [data-row-save] { visibility: hidden; }
.status-editor tbody tr.is-dirty td { background: var(--warn-wash); }
.status-editor tbody tr.is-dirty td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
.cell-color { white-space: nowrap; }
.row-menu-btn { min-width: 32px; padding: 0 var(--s2); font-size: var(--text-md); letter-spacing: 1px; }
/* 行の操作メニュー（⋯） */
.menu-pop { position: fixed; z-index: 60; min-width: 200px; max-width: min(300px, calc(100vw - 16px)); padding: var(--s1); background: var(--paper-2); border: var(--hair) solid var(--rule-2); border-radius: var(--r-md); box-shadow: 0 8px 24px rgb(0 0 0 / .18); display: grid; }
.menu-item { display: block; width: 100%; text-align: left; padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-sm); background: none; font: inherit; font-size: var(--text-sm); color: var(--ink); cursor: pointer; }
.menu-item:hover:not([disabled]), .menu-item:focus-visible { background: var(--paper-3); outline: none; }
.menu-item[disabled] { color: var(--ink-3); cursor: default; }
.menu-item.is-danger { color: var(--alert); }
.menu-head { margin: var(--s1) var(--s3) 0; padding-top: var(--s1); border-top: var(--hair) solid var(--rule); font-size: var(--text-2xs); color: var(--ink-3); font-weight: 700; }
.menu-head:empty { padding-top: 0; }
.menu-scroll { max-height: 240px; overflow-y: auto; display: grid; }
/* 1180px 未満：選択肢の欄を2段目へ回して列名の欄の幅を保つ（選択肢でない列は2段目を出さない） */
@media (min-width: 861px) and (max-width: 1180px) {
  .fields-editor { --fe-cols: 28px minmax(0, 1fr) 150px 92px auto; }
  .frow { grid-template-areas: "h l t s a" ". c c c c"; }
  .frow .fe-h { grid-area: h; } .frow .fe-l { grid-area: l; } .frow .fe-t { grid-area: t; } .frow .fe-s { grid-area: s; }
  .frow .fe-c { grid-area: c; } .frow .fe-a { grid-area: a; }
  .frow .fe-c:has(.choices-none:not([hidden])) { display: none; }
  .frow-head .fe-c { display: none; }
}
/* 一覧のステータスの選択欄：今のステータスに印 */
.st-pick-menu .chip input:disabled + span { opacity: 1; box-shadow: inset 0 0 0 2px currentColor; }
.st-pick-menu .chip input:disabled + span::before { content: "✓ "; }
/* レコード詳細：保存の帯に区分の目次（横に送れる）・区分は帯の高さ分ずらして止める・履歴は画面に固定して中で送る */
.sec-index { display: flex; gap: var(--s1); flex: 1 1 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.sec-index a { flex: none; padding: 2px var(--s3); border: var(--hair) solid var(--rule-2); border-radius: var(--r-pill); font-size: var(--text-xs); color: var(--ink-2); text-decoration: none; white-space: nowrap; background: var(--paper-2); }
.sec-index a:hover { border-color: var(--accent); color: var(--accent); }
.section-block[id^="sec-"] { scroll-margin-top: 130px; }
@media (min-width: 1101px) {   /* 2段組みの時だけ（1100px 以下は1段） */
  .record-history { position: sticky; top: var(--s4); max-height: calc(100vh - var(--s4) * 2); overflow-y: auto; }
}
/* 閉じた見出しへ運んでいる間の置き先の印 */
.fgroup.is-drop-target .fgroup-head { background: var(--accent-wash); box-shadow: inset 0 0 0 2px var(--accent); }
/* 1180px 未満：操作の列を固定の幅にして、列見出しの行（中身が空）と各行の列の位置をそろえる */
@media (min-width: 861px) and (max-width: 1180px) {
  .fields-editor { --fe-cols: 28px minmax(0, 1fr) 150px 92px 100px; }
}
/* レコード詳細の目次：スクロールバーは出さず、右端を薄くして続きがあることを示す。今いる区分に印 */
.sec-index { scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 32px), transparent); padding-right: 32px; }
.sec-index::-webkit-scrollbar { display: none; }
.sec-index a.is-current { background: var(--accent-wash); border-color: var(--accent); color: var(--ink); font-weight: 700; }
/* ---- 2周目の点検の指摘（2026-11-18） ---- */
/* ステータスの設定：列の幅を決めて潰れない・重ならない（狭い幅では枠の中で横に送る）。上の帯は貼り付け */
.status-table { min-width: 940px; }
.status-table [name=name] { min-width: 10em; }
.status-table select { min-width: 6.5em; }
.status-table td, .status-table th { white-space: nowrap; }
.status-editor > .fe-toolbar { position: sticky; top: 0; z-index: 5; background: var(--paper); padding: var(--s1) 0; min-height: var(--control-h-sm); }
.fe-dirty b { margin: 0 2px; }
/* 閉じた見出しへ運んでいる間も、運んでいる行だけは帯のすぐ下に見せる（行が消えて見出しの位置がずれないように） */
.fgroup.is-collapsed .flist:has(> .is-dragging) { display: block; }
.fgroup.is-collapsed .flist:has(> .is-dragging) > .frow:not(.is-dragging) { display: none; }
/* 一覧：文字の列は1行で省略（狭い列で縦に何行も折り返さない） */
.table-records td:not(.cell-status):not(.cell-sel) { white-space: nowrap; max-width: 14em; overflow: hidden; text-overflow: ellipsis; }
/* 列の設定・スマホ幅：操作（保存・⋯）は列名の右へ。つまみとチェックの当たりを広げる。上の帯は貼り付けず、未保存の帯だけ画面の下に出す */
@media (max-width: 860px) {
  .frow { grid-template-areas: "h l a" ". t s" ". c c"; }
  .frow .drag-handle { min-width: 40px; min-height: 40px; }
  .frow .fe-s { padding: var(--s2) 0; }
  .frow .fe-s input { width: 20px; height: 20px; }
  .fe-sticky { position: static; }
  .fields-editor .fe-dirty:not([hidden]), .status-editor .fe-dirty:not([hidden]) { position: fixed; left: var(--s4); right: var(--s4); bottom: var(--s4); z-index: 20; justify-content: space-between; padding: var(--s2) var(--s3); border-radius: var(--r-lg); box-shadow: 0 6px 20px rgb(0 0 0 / .2); }
}
/* ステータスの設定の上の帯：未保存も状態の表示も無い間は高さ0（表の上に空白を作らない） */
.status-editor > .fe-toolbar:not(:has([data-dirty-bar]:not([hidden]))):not(:has([data-live-status]:not(:empty))) { min-height: 0; padding: 0; }
.status-editor { gap: var(--s2); }
/* 架電禁止に登録するステータスの印（ほかの NG と見分ける） */
.dnc-mark { margin-left: var(--s1); padding: 0 4px; border-radius: var(--r-sm); background: var(--alert); color: var(--paper-2); font-size: var(--text-2xs); font-weight: 700; }
/* コール画面：ほかの人が対応中は発信できない見た目。保存のボタンは右の枠の下に貼り付け（長い結果の札でも押せる） */
.dials.is-taken .dial { pointer-events: none; opacity: .4; }
#result-form .panel-actions { position: sticky; bottom: 0; z-index: 2; background: var(--paper-2); padding: var(--s2) 0; margin-bottom: calc(var(--s2) * -1); border-top: var(--hair) solid var(--rule); }
/* コール画面：再コールが効かない結果では早押しを薄く・スキップは保存と離す */
.recall-quick.is-off { opacity: .45; }
.panel-actions [value=skip] { margin-left: var(--s5); }   /* 保存の隣に並べず間を空ける（押し間違い防止） */
/* レコード画面：種類の形に合わない値は文字のまま出して印を付ける */
.mismatch-wrap { display: flex; align-items: center; gap: var(--s2); }
.mismatch-wrap .input { flex: 1; min-width: 0; }
/* 一覧：表は画面の高さに収め、横のスクロールバーを画面の中に出す（見出しの行は上に貼り付け） */
.table-records-wrap { max-height: calc(100vh - 160px); overflow: auto; }
.table-records thead th { position: sticky; top: 0; z-index: 1; }
/* レコード詳細の目次：左右の送りボタン */
.sec-index-wrap { display: flex; align-items: center; gap: var(--s1); flex: 1 1 100%; min-width: 0; }
.sec-index-wrap .sec-index { flex: 1 1 auto; min-width: 0; }
.sec-index-btn { flex: none; width: 28px; height: 28px; border: var(--hair) solid var(--rule-2); border-radius: 50%; background: var(--paper-2); color: var(--ink-2); font-size: var(--text-md); line-height: 1; cursor: pointer; }
.sec-index-btn:hover { border-color: var(--accent); color: var(--accent); }

/* 今月目標達成状況：指標ごとの達成率の帯（縦線＝本日時点目標） */
.goal-tbl th[scope="row"] { font-weight: 700; color: var(--ink); background: none; }
.goal-tbl td, .goal-tbl th { vertical-align: middle; }
.goal-actual { font-family: var(--font-num); font-size: var(--text-md); }
.goal-actual small { font-size: var(--text-2xs); color: var(--ink-2); margin-left: 1px; }
.goal-of { display: block; font-size: var(--text-2xs); color: var(--ink-3); }
.col-goal { width: 38%; min-width: 160px; }
.col-goal .num { display: inline-block; min-width: 3.2em; text-align: right; margin-left: var(--s2); }
.goal-sm { display: inline-block; vertical-align: middle; width: calc(100% - 4em); height: 10px; margin-top: 0; }
.goal-tbl td, .goal-tbl th { padding-left: var(--s2); padding-right: var(--s2); }
.goal-fc { display: block; }
.goal-tbl .badge { margin-top: 2px; }
.goal-behind { color: var(--alert); font-weight: 700; }
/* 月別売上推移：売上（緑）・粗利（青）・今月の着地予測（緑の枠） */
.chart .bar-sales { fill: var(--g-won); }
.chart .bar-profit { fill: var(--g-new); }
.chart .bar-fc { fill: var(--accent-wash); stroke: var(--g-won); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .tick-now { fill: var(--ink); font-weight: 700; }
.legend i.g-fc { background: var(--accent-wash); outline: 1.5px dashed var(--g-won); outline-offset: -1.5px; }
/* 曜日別：時間帯の下に7本 */
.wd-block { margin-top: var(--s4); padding-top: var(--s4); border-top: var(--hair) solid var(--rule); }
.sub-h { margin: 0; font-size: var(--text-sm); font-weight: 700; color: var(--ink); }
.bars-wd { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.bars.bars-wd { height: 110px; gap: 10px; padding: 0 var(--s4); }
.bar-labels.bars-wd { gap: 10px; padding: 0 var(--s4); line-height: 1.35; }
.bar-labels.bars-wd b { color: var(--ink-2); font-weight: 700; }
/* 企業設定：月間目標 */
.target-set { border: var(--hair) solid var(--rule); border-radius: var(--r-md); padding: var(--s3) var(--s4) var(--s4); margin: 0; }
.target-set legend { font-weight: 700; font-size: var(--text-sm); padding: 0 var(--s1); }
.target-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s3); margin-top: var(--s2); }
/* 1列のとき段組みが中身（表）の幅まで伸びないように（スマホで横にはみ出していた） */
@media (max-width: 1180px) { .dash-grid, .dash-grid-even { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .col-goal { min-width: 120px; } .goal-sm { width: calc(100% - 3.4em); } }

/* ---- 選択肢の編集（別ウィンドウ）：1件ずつの行・左の − で削除・右の ⠿ で並び替え ---- */
.sheet { border: 0; padding: 0 0 var(--s4); border-radius: 14px; width: min(440px, calc(100vw - 32px)); max-height: min(640px, calc(100vh - 48px)); background: var(--paper); color: var(--ink); box-shadow: 0 24px 64px rgb(0 0 0 / .28); overflow: hidden; flex-direction: column; }
.sheet[open] { display: flex; }
.sheet::backdrop { background: rgb(15 20 30 / .45); }
.sheet-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: var(--s2); border-bottom: var(--hair) solid var(--rule); background: var(--paper-2); }
.sheet-title { margin: 0; font-size: var(--text-md); font-weight: 700; text-align: center; }
.sheet-btn { justify-self: start; background: none; border: 0; color: var(--accent); font: inherit; font-size: var(--text-md); padding: var(--s2) var(--s3); border-radius: var(--r-sm); cursor: pointer; }
.sheet-btn:hover { background: var(--accent-wash); }
.sheet-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.sheet-done { justify-self: end; font-weight: 700; }
.sheet-sub { margin: var(--s3) var(--s4) 0; color: var(--ink-2); font-size: var(--text-sm); }
.sheet-sub:empty { display: none; }
.cs-list { list-style: none; margin: var(--s3) var(--s3) 0; padding: 0; background: var(--paper-2); border: var(--hair) solid var(--rule); border-radius: 12px; overflow: auto; min-height: 0; flex: 0 1 auto; }
.cs-row { display: flex; align-items: center; gap: var(--s3); min-height: 48px; padding: 0 var(--s1) 0 var(--s3); border-bottom: var(--hair) solid var(--rule); background: var(--paper-2); }
.cs-row:last-child { border-bottom: 0; }
.cs-row.is-lifted { position: relative; z-index: 1; box-shadow: 0 8px 24px rgb(0 0 0 / .18); }
.cs-del { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: var(--alert); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.cs-del:focus-visible, .cs-handle:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.cs-input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: var(--text-md); color: var(--ink); padding: var(--s3) var(--s1); outline: none; }
.cs-input:focus { box-shadow: inset 0 -2px 0 var(--focus); }
.cs-input.is-dup { color: var(--alert); box-shadow: inset 0 -2px 0 var(--alert); }
.cs-handle { flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--ink-3); font-size: 20px; border-radius: var(--r-sm); cursor: grab; touch-action: none; }
.cs-handle:active { cursor: grabbing; }
.cs-add { display: flex; align-items: center; gap: var(--s3); margin: var(--s2) var(--s3) 0; padding: var(--s3); border: var(--hair) solid var(--rule); border-radius: 12px; background: var(--paper-2); color: var(--accent); font: inherit; font-size: var(--text-md); text-align: left; cursor: pointer; }
.cs-add:hover { background: var(--accent-wash); }
.cs-add:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.cs-plus { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 16px; }
.sheet-note { margin: var(--s2) var(--s4) 0; color: var(--ink-2); font-size: var(--text-xs); }
.cs-error { margin: var(--s2) var(--s4) 0; color: var(--alert); font-size: var(--text-sm); font-weight: 700; }
@media (max-width: 640px) {
  .sheet { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 16px 16px 0 0; max-height: 88vh; }
}

/* ---- 添付ファイル ---- */
.file-field { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s2); }
.file-list:empty { display: none; }
.file-item { display: flex; align-items: center; gap: var(--s3); padding: var(--s2); border: var(--hair) solid var(--rule); border-radius: var(--r-md); background: var(--paper-2); min-width: 0; }
.file-thumb, .file-icon { flex: none; display: grid; place-items: center; width: 56px; height: 56px; border-radius: var(--r-sm); overflow: hidden; background: var(--paper-3); }
.file-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.file-icon { border: var(--hair) solid var(--rule); color: var(--alert); font-size: var(--text-xs); font-weight: 700; text-decoration: none; }
.file-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-actions { flex: none; display: flex; gap: var(--s1); }
.file-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--s4); border: 2px dashed var(--rule-2); border-radius: var(--r-md); background: var(--paper); text-align: center; cursor: pointer; }
.file-drop:hover, .file-drop.is-over { border-color: var(--accent); background: var(--accent-wash); }
.file-drop:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.file-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-drop-main { color: var(--accent); font-weight: 700; }
.file-field.is-busy .file-drop { opacity: .6; pointer-events: none; }
.file-status { font-size: var(--text-sm); color: var(--ok); }
.file-status:empty { display: none; }
.file-status.is-error { color: var(--alert); }
.file-list-sm .file-item { padding: var(--s1); }
.file-list-sm .file-thumb, .file-list-sm .file-icon { width: 40px; height: 40px; }
.file-chip { display: inline-block; max-width: 100%; padding: 1px var(--s2); border-radius: var(--r-pill); background: var(--paper-3); font-size: var(--text-xs); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
@media (max-width: 640px) {
  .file-item { flex-wrap: wrap; }
  .file-actions { width: 100%; justify-content: flex-end; }
}

/* ---- 表示切替（管理者がオペレーターの見え方で確かめる・デモ用） ---- */
.view-switch { display: flex; flex-direction: column; gap: 4px; margin: var(--s2) 0; }
.view-switch-label { font-size: var(--text-xs); color: var(--shell-ink-2); }
.seg { display: inline-flex; width: max-content; border: var(--hair) solid var(--shell-ink-2); border-radius: var(--r-pill); overflow: hidden; }
.seg button { border: 0; background: transparent; color: var(--shell-ink); padding: 4px 10px; font: inherit; font-size: var(--text-xs); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--shell-mark); color: var(--shell); font-weight: 700; }
.seg button:focus-visible { outline: 2px solid var(--shell-mark); outline-offset: -2px; }
.view-as-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); padding: var(--s2) var(--s3); border: var(--hair) solid var(--warn); border-radius: var(--r-md); background: var(--warn-wash); font-weight: 700; }
@media (max-width: 860px) {
  .view-switch { flex-direction: row; align-items: center; margin: 0; }
  .view-switch-label { display: none; }
}
