/* HP営業ダッシュボード 画面スタイル
 * 方針: 一日中開いて使う業務ツール。情報の密度を高めに、装飾は控えめに。
 * 色はすべて変数で持ち、prefers-color-scheme でライト／ダークを切り替える。
 */

:root {
  color-scheme: light dark;

  --bg: #eceff2;
  --surface: #ffffff;
  --surface-2: #f4f6f8;
  --hover: #f0f4f9;
  --ink: #18212c;
  --muted: #5a6573;
  --line: #d6dce3;
  --line-strong: #b4bec9;

  --header-bg: #16283f;
  --header-ink: #e9eef5;
  --header-muted: #a9b7c8;
  --header-mark: #f0b540;

  --accent: #1c4f8f;
  --accent-hover: #163f73;
  --accent-ink: #ffffff;
  --accent-soft: #e3ecf7;

  --ok: #17663a;
  --ok-soft: #e0f1e5;
  --warn: #8a5a00;
  --warn-soft: #fbefd2;
  --warn-lamp: #d39a1c;
  --danger: #a3271f;
  --danger-soft: #fbe6e3;
  --danger-lamp: #c23b30;

  /* ステータスラベルの明るさ（色相は .st-XX 側で決める） */
  --st-bg-l: 92%;
  --st-fg-l: 25%;
  --st-line-l: 74%;
  --st-solid-l: 33%;

  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161b;
    --surface: #1a2027;
    --surface-2: #20272f;
    --hover: #232b35;
    --ink: #e2e7ed;
    --muted: #98a4b2;
    --line: #2e3742;
    --line-strong: #44505e;

    --header-bg: #0d1218;
    --header-ink: #e2e7ed;
    --header-muted: #8e9bab;
    --header-mark: #f0b540;

    --accent: #8ab4ee;
    --accent-hover: #a5c5f3;
    --accent-ink: #0c1624;
    --accent-soft: #1f2f45;

    --ok: #7fd3a0;
    --ok-soft: #173224;
    --warn: #f0c36a;
    --warn-soft: #3a2e12;
    --warn-lamp: #e0a82e;
    --danger: #f2a199;
    --danger-soft: #3d1c19;
    --danger-lamp: #e0594d;

    --st-bg-l: 20%;
    --st-fg-l: 84%;
    --st-line-l: 36%;
    --st-solid-l: 38%;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: 14px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: 17px; }
h2 { font-size: 14px; }
h3 { font-size: 13px; }
p { margin: 0; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
code { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- ヘッダとタブ ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  gap: 24px;
  padding: 0 16px;
  background: var(--header-bg);
  color: var(--header-ink);
}
.brand { display: flex; flex-direction: column; justify-content: center; padding: 6px 0; white-space: nowrap; }
.brand-name { font-weight: 700; font-size: 14px; letter-spacing: .02em; }
.brand-sub { font-size: 11px; color: var(--header-muted); }

.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1; min-width: 0; }
.tabs button {
  appearance: none;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--header-muted);
  font: inherit;
  font-size: 14px;
  padding: 13px 14px 10px;
  white-space: nowrap;
  cursor: pointer;
}
.tabs button:hover { color: var(--header-ink); }
.tabs button[aria-selected="true"] {
  color: #ffffff;
  font-weight: 700;
  border-bottom-color: var(--header-mark);
}
.tabs button:focus-visible { outline-color: var(--header-mark); outline-offset: -3px; }

.operator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--header-muted);
  white-space: nowrap;
}
/* 操作者（押すと名前・会社を変更するダイアログが開く） */
.operator-btn {
  appearance: none; border: 0; background: none;
  padding: 3px 6px; border-radius: 4px;
  color: var(--header-ink); font: inherit; font-size: 12px; cursor: pointer;
  text-decoration: underline; text-decoration-color: var(--header-muted); text-underline-offset: 3px;
}
.operator-btn:hover { background: rgb(255 255 255 / .1); }
.operator-btn:focus-visible { outline-color: var(--header-mark); }

/* ---- 通知 ---- */
.notices {
  position: fixed;
  top: 56px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(600px, calc(100vw - 24px));
  pointer-events: none;
}
.notice {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px 9px 12px;
  border: 1px solid var(--ok);
  border-left-width: 5px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  color: var(--ink);
  box-shadow: 0 6px 20px rgb(0 0 0 / .18);
  font-size: 13px;
}
.notice.error { border-color: var(--danger-lamp); background: var(--danger-soft); }
.notice-kind { font-weight: 700; white-space: nowrap; color: var(--danger); }
dialog .notices { top: 10px; }
.notice-text { flex: 1; overflow-wrap: anywhere; white-space: pre-wrap; }
.notice-close {
  appearance: none; border: 0; background: none; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 2px 4px; cursor: pointer;
}

/* ---- 本文の枠 ---- */
main { padding: 14px 16px 28px; max-width: 1760px; margin: 0 auto; }
.panel > * + * { margin-top: 10px; }
.panel > h2 { margin-top: 18px; }

.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.spacer { flex: 1; }
.count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.count.partial {
  color: var(--warn); background: var(--warn-soft);
  border: 1px solid var(--warn-lamp); border-radius: 4px; padding: 1px 8px; font-weight: 600;
}
.count.due-note, .count.draft-note { color: var(--ink); }
.hint { font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }

.boot-error {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--danger-lamp); border-radius: var(--radius);
  background: var(--danger-soft);
}

/* ---- 入力部品 ---- */
.toolbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.fld { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.fld.grow { flex: 1 1 220px; }
.fld > label, .fld-label { display: block; font-size: 12px; color: var(--muted); }
.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 6px 0; cursor: pointer; white-space: nowrap; }

input[type="text"], input[type="password"], input[type="search"], input[type="tel"], input[type="date"], select, textarea {
  font: inherit;
  font-size: 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  padding: 5px 8px;
  min-height: 30px;
  max-width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .75; }
input:disabled, select:disabled, textarea:disabled { opacity: .6; }
input[aria-invalid="true"], select[aria-invalid="true"], .choices[aria-invalid="true"] {
  border-color: var(--danger-lamp);
  box-shadow: 0 0 0 2px var(--danger-soft);
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
input[type="file"] { font: inherit; font-size: 12px; color: var(--ink); max-width: 260px; }

.req {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 3px;
  font-size: 10px; font-weight: 700; line-height: 16px;
  color: var(--danger); background: var(--danger-soft); border: 1px solid var(--danger-lamp);
}

.btn {
  appearance: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 30px;
  padding: 4px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
  font: inherit; font-size: 13px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn:hover { background: var(--hover); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn.danger { background: var(--danger-lamp); border-color: var(--danger-lamp); color: #ffffff; font-weight: 600; }
.btn.danger:hover { filter: brightness(.93); color: #ffffff; }
.btn.ghost { border-color: transparent; background: none; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--ink); }
.btn.small { min-height: 26px; padding: 2px 9px; font-size: 12px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; filter: none; }

.icon-btn {
  appearance: none; border: 0; background: none; color: var(--muted);
  font-size: 20px; line-height: 1; padding: 2px 6px; border-radius: 4px; cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }

/* ---- 表 ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  max-height: max(340px, calc(100vh - 215px));
}
.table-wrap[aria-busy="true"] { opacity: .65; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.tbl th, .tbl td {
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.tbl thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px; font-weight: 600;
  white-space: nowrap;
  border-bottom: 1px solid var(--line-strong);
}
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: var(--hover); }
.tbl tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--line-strong); border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .nowrap { white-space: nowrap; }
.tbl-genres { min-width: 1280px; }
.tbl-research { min-width: 1640px; }
.tbl-demo { min-width: 1180px; }
.tbl-calls { min-width: 1160px; }
.tbl-stats { min-width: 1150px; }
.tbl-narrow { min-width: 340px; }

.empty-row td { color: var(--muted); padding: 24px 14px; }
.empty-row:hover td { background: none !important; }

.cell-name { font-weight: 600; min-width: 150px; max-width: 260px; overflow-wrap: anywhere; }
.cell-sub { display: block; font-weight: 400; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.cell-text { min-width: 140px; max-width: 280px; overflow-wrap: anywhere; }
.cell-memo { min-width: 180px; max-width: 340px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cell-url { font-size: 12px; white-space: nowrap; }
.cell-url a, .cell-url .plain-url, .cell-url .cell-sub {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cell-url a, .cell-url .plain-url { display: inline-block; vertical-align: bottom; }
.cell-time { white-space: nowrap; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.phone { font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.plain-url { color: var(--muted); }
/* 求人の列（リサーチ記録）と、店名の下に出す「求人あり」の行（架電リスト） */
.cell-job { min-width: 104px; max-width: 200px; }
.cell-job .cell-sub { margin-top: 2px; }
.job-line { margin-top: 3px; }
.job-line .badge { margin-right: 6px; }
/* リサーチ確認の列（リサーチ記録）と、店名の下に出す「リサーチ下書き」の行（デモ・目視確認）。
   列の幅は、確認者の下の日時（YYYY/MM/DD HH:mm）が1行に収まる広さ */
.cell-check { min-width: 136px; }
.draft-line { margin-top: 3px; }

/* 表の中でその場編集する欄（ジャンル選定）。short は業種・エリア・決めた人 */
.cell-input, .cell-select { width: 100%; min-width: 120px; }
.cell-input { min-width: 240px; }
.cell-input.short { min-width: 130px; }

/* 件数の進捗 */
.ratio-of { color: var(--muted); font-size: 12px; }
.meter {
  display: block; height: 4px; margin-top: 4px; margin-left: auto; width: 72px;
  background: var(--line); border-radius: 2px; overflow: hidden;
}
.meter-fill { display: block; height: 100%; background: var(--accent); }

/* ---- ラベル（ステータス・区分） ---- */
.badge {
  --st-h: 212; --st-s: 10%;
  display: inline-flex; align-items: baseline; gap: 5px;
  padding: 1px 8px;
  border-radius: 10px;
  border: 1px solid hsl(var(--st-h) var(--st-s) var(--st-line-l));
  background: hsl(var(--st-h) var(--st-s) var(--st-bg-l));
  color: hsl(var(--st-h) var(--st-s) var(--st-fg-l));
  font-size: 12px; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
}
.badge-code { font-family: var(--mono); font-weight: 400; font-size: 11px; opacity: .8; }
.badge.plain { font-weight: 400; }
.badge.ok { --st-h: 142; --st-s: 50%; }
.badge.warn { --st-h: 38; --st-s: 78%; }
.badge.danger { --st-h: 4; --st-s: 62%; }

/* 架電ステータスごとの色相。文字（コードと表示名）も必ず併記する */
.st-00 { --st-h: 212; --st-s: 10%; }
.st-10 { --st-h: 214; --st-s: 30%; }
.st-20 { --st-h: 38;  --st-s: 78%; }
.st-30 { --st-h: 348; --st-s: 55%; }
.st-31 { --st-h: 172; --st-s: 55%; }
.st-40 { --st-h: 203; --st-s: 68%; }
.st-50 { --st-h: 268; --st-s: 48%; }
.st-60 { --st-h: 232; --st-s: 58%; }
.st-70 { --st-h: 142; --st-s: 56%; }
.st-80 { --st-h: 24;  --st-s: 26%; }
.st-90 { --st-h: 4;   --st-s: 64%; }
.st-91 { --st-h: 212; --st-s: 6%; }
/* 受注・拒否は塗りつぶしで強く見せる */
.badge.st-70, .badge.st-90 {
  background: hsl(var(--st-h) var(--st-s) var(--st-solid-l));
  border-color: hsl(var(--st-h) var(--st-s) var(--st-solid-l));
  color: #ffffff;
}
.badge.st-91 { border-style: dashed; }

.tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---- 目視確認 ---- */
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.check.on { color: var(--ok); }
.check.off { color: var(--muted); }
.check:has(input:disabled) { cursor: not-allowed; }
.check-meta { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.demo-link { font-weight: 600; white-space: nowrap; }

/* ---- 架電リスト ---- */
.tbl-calls td.due { border-left: 5px solid transparent; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl-calls td.due-over { border-left-color: var(--danger-lamp); }
.tbl-calls td.due-today { border-left-color: var(--warn-lamp); }
.tbl-calls td.due-later { border-left-color: var(--line-strong); }
.due-label { display: inline-block; margin-top: 2px; font-size: 11px; font-weight: 700; padding: 0 6px; border-radius: 3px; }
.due-over .due-label { color: var(--danger); background: var(--danger-soft); }
.due-today .due-label { color: var(--warn); background: var(--warn-soft); }
.tbl-calls .phone { font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.tbl-calls .phone a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.tbl-calls .phone a:hover { color: var(--accent); text-decoration-color: var(--accent); }
.row-blocked td { color: var(--muted); }
.row-blocked .cell-name { font-weight: 400; }
.ops { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; }
.ops-note { flex-basis: 100%; font-size: 12px; color: var(--muted); }

/* ---- 取り込み ---- */
.import-panel {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}
.import-panel > * + * { margin-top: 8px; }
.import-input { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-start; }
.import-input textarea { width: 100%; font-family: var(--mono); font-size: 12px; white-space: pre; }
.import-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.import-result { border-top: 1px solid var(--line); padding-top: 8px; }
.import-result > * + * { margin-top: 6px; }
.import-summary { font-weight: 600; }
.import-result .table-wrap { max-height: 220px; }

/* ---- 注意書き ---- */
.callout { padding: 8px 12px; border-radius: 4px; border: 1px solid var(--line-strong); border-left-width: 5px; font-size: 13px; }
.callout.warn { border-color: var(--warn-lamp); background: var(--warn-soft); }
.callout.danger { border-color: var(--danger-lamp); background: var(--danger-soft); font-weight: 600; }

/* ---- ダイアログ ---- */
dialog {
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  width: min(720px, calc(100vw - 20px));
  max-height: calc(100vh - 20px);
  box-shadow: 0 16px 48px rgb(0 0 0 / .3);
  overflow: hidden;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgb(10 16 24 / .55); }
dialog.dialog-wide { width: min(1020px, calc(100vw - 20px)); }
dialog.dialog-narrow { width: min(440px, calc(100vw - 20px)); }
.dialog-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dialog-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px 10px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.dialog-head h2 { font-size: 15px; }
.dialog-body { padding: 14px 16px; overflow: auto; min-height: 0; flex: 1; }
.dialog-body > * + * { margin-top: 10px; }
.dialog-foot {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
.confirm-message { white-space: pre-wrap; font-size: 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid input, .form-grid select, .form-grid textarea { width: 100%; }

/* ---- 操作者の登録・変更 ---- */
#user-form input[type="text"] { width: 100%; }
#user-form .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- ログイン・利用登録（ページ全体。パスワードでログインする環境だけ） ---- */
.auth-screen { display: flex; justify-content: center; padding: 36px 16px 28px; }
.auth-card {
  width: min(420px, 100%);
  padding: 20px 22px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.auth-card > * + *, .auth-card form > * + * { margin-top: 12px; }
.auth-card input[type="text"], .auth-card input[type="password"] { width: 100%; min-height: 34px; }
.auth-card .btn.primary { width: 100%; min-height: 36px; }
.auth-card .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.auth-switch { text-align: center; font-size: 13px; }
.link-btn {
  appearance: none; border: 0; background: none; padding: 2px 4px; border-radius: 4px;
  font: inherit; color: var(--accent); cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-hover); }

/* ---- アカウント（名前・会社の変更、パスワードの変更、ログアウト）とパスワードの再設定 ---- */
#account-dialog input[type="text"], #account-dialog input[type="password"],
#reset-dialog input[type="text"], #reset-dialog input[type="password"] { width: 100%; }
#account-dialog .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#account-dialog input[readonly], #reset-dialog input[readonly] { background: var(--surface-2); color: var(--muted); }
.account-section > * + * { margin-top: 10px; }
.account-section + .account-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.account-section h3 { font-size: 13px; }

/* ---- 設定（メンバー・招待コード・自動化用のトークン） ---- */
.tbl-members { min-width: 920px; }
.tbl-tokens { min-width: 860px; }
#tab-settings .table-wrap { max-height: 420px; }
.cell-id { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; min-width: 110px; max-width: 240px; }
.settings-box {
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.settings-box > * + * { margin-top: 10px; }
.settings-box .row { align-items: flex-end; gap: 8px 10px; }
.settings-box .row:first-child { align-items: center; }
.settings-label { font-size: 12px; color: var(--muted); }
#invite-form .fld { flex: 0 1 360px; }
#invite-form input { width: 100%; }
/* 招待コード・トークンの文字（読み間違えないよう等幅で出す） */
.secret {
  display: inline-block; padding: 3px 8px;
  border: 1px solid var(--line-strong); border-radius: 4px;
  background: var(--surface); color: var(--ink);
  font-size: 13px; user-select: all;
}
.token-issued > * + * { margin-top: 8px; }

/* ---- 架電結果の記録 ---- */
.call-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.call-layout > * { margin-top: 0 !important; min-width: 0; }
.call-main > * + *, #call-form > * + * { margin-top: 12px; }
.call-side { border-left: 1px solid var(--line); padding-left: 16px; }
.call-side h3 { margin-bottom: 8px; color: var(--muted); }

.call-summary {
  display: grid; grid-template-columns: auto 1fr; gap: 3px 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 13px;
}
.call-summary dt { color: var(--muted); font-size: 12px; white-space: nowrap; padding-top: 1px; }
.call-summary dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.call-summary .sum-name { font-size: 16px; font-weight: 700; }
.call-summary .phone { font-size: 18px; font-weight: 700; }
.call-summary .phone a { color: var(--ink); }

.fieldset { border: 0; margin-inline: 0; padding: 0; min-width: 0; }
.fieldset legend { padding: 0; margin-bottom: 4px; font-size: 12px; color: var(--muted); }
.choices {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px;
  border: 1px solid transparent; border-radius: 4px;
}
.choice {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--line-strong);
  border-left: 5px solid hsl(var(--st-h, 212) var(--st-s, 10%) 50%);
  border-radius: 4px;
  background: var(--surface);
  font-size: 13px;
  cursor: pointer;
}
.choice.wide { grid-column: span 2; }
.choice:hover { background: var(--hover); }
.choice:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent);
  border-left-color: hsl(var(--st-h, 212) var(--st-s, 10%) 50%);
  font-weight: 700;
}
.choice:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.choice input { flex: none; }
.choice input:focus-visible { outline: none; }
.choice-code { font-family: var(--mono); font-size: 11px; color: var(--muted); font-weight: 400; }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
#call-memo { width: 100%; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }

.history { font-size: 13px; }
.history-item { padding: 8px 0; border-bottom: 1px solid var(--line); }
.history-item:first-child { padding-top: 0; }
.history-item:last-child { border-bottom: 0; }
.history-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.history-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); white-space: nowrap; }
.history-user { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.history-kind { font-size: 11px; font-weight: 700; color: var(--muted); }
.history-memo { margin-top: 4px; white-space: pre-wrap; overflow-wrap: anywhere; }
.history-line { margin-top: 3px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.history-line b { font-weight: 600; color: var(--ink); }

/* ---- 集計 ---- */
/* 列の上限は auto: 見出しの長い枠（接触率）だけ中身に合わせて広げ、残りの幅は等分する */
.totals {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, auto)); gap: 0;
  margin-bottom: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.total { padding: 9px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 0 -1px -1px 0; }
.total dt { font-size: 12px; color: var(--muted); white-space: nowrap; }
.total dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.total dd small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 2px; }
.total.strong { background: var(--accent-soft); }
.stats-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 16px; margin-top: 18px; }
.stats-cols h2 { margin-bottom: 10px; }
.bar-col { width: 48%; }
.bar-cell { vertical-align: middle !important; white-space: nowrap; }
.bar-track { display: inline-block; width: calc(100% - 48px); vertical-align: middle; }
.bar { display: block; height: 10px; min-width: 2px; background: var(--accent); border-radius: 2px; }
.bar-num { display: inline-block; width: 44px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- 狭い画面 ---- */
@media (max-width: 860px) {
  .app-header { flex-wrap: wrap; gap: 0 14px; padding: 0 10px; }
  .brand { flex: 1; }
  .operator { order: 2; }
  .tabs { order: 3; flex-basis: 100%; }
  .tabs button { padding: 9px 11px 7px; }
  main { padding: 10px 10px 24px; }
  .notices { top: 8px; }
  .table-wrap { max-height: none; }
  .tbl thead th { position: static; }
  .call-layout { grid-template-columns: 1fr; }
  .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .call-side { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 12px; }
  .stats-cols { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span2 { grid-column: auto; }
}
@media (max-width: 480px) {
  #user-form .choices, #account-dialog .choices, .auth-card .choices { grid-template-columns: 1fr; }
  .auth-screen { padding: 18px 10px 24px; }
}

@media print {
  .app-header, .toolbar, .notices, .btn { display: none !important; }
  .table-wrap { max-height: none; overflow: visible; border: 0; }
}
