:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #dde1e7;
  --border-strong: #c3c9d2;
  --text: #1c2430;
  --text-2: #4d5866;
  --text-3: #7a8494;
  --accent: #2f4a6d;
  --accent-text: #ffffff;
  --link: #24578f;
  --focus: #3b82f6;

  --ok-bg: #e3f3e8; --ok-fg: #1d6b38;
  --info-bg: #e5eefa; --info-fg: #1f4f8c;
  --warn-bg: #fdf1d8; --warn-fg: #8a5a00;
  --danger-bg: #fbe4e4; --danger-fg: #a12323;
  --muted-bg: #eef0f3; --muted-fg: #6b7482;
  --sample-bg: #fff4cc; --sample-fg: #6b5200;

  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --surface: #1a2028; --surface-2: #222a34; --border: #2e3744; --border-strong: #404b5a;
    --text: #e6eaf0; --text-2: #b4bdca; --text-3: #8892a1; --accent: #6f9bd1; --accent-text: #0e141b; --link: #8db8ec;
    --ok-bg: #1b3826; --ok-fg: #8fd8a7; --info-bg: #1b2f4a; --info-fg: #9cc3f2; --warn-bg: #3d2f12; --warn-fg: #f1c66b;
    --danger-bg: #431f1f; --danger-fg: #f6a3a3; --muted-bg: #262d37; --muted-fg: #9aa3b0; --sample-bg: #3a3214; --sample-fg: #f0d77a;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --surface: #1a2028; --surface-2: #222a34; --border: #2e3744; --border-strong: #404b5a;
  --text: #e6eaf0; --text-2: #b4bdca; --text-3: #8892a1; --accent: #6f9bd1; --accent-text: #0e141b; --link: #8db8ec;
  --ok-bg: #1b3826; --ok-fg: #8fd8a7; --info-bg: #1b2f4a; --info-fg: #9cc3f2; --warn-bg: #3d2f12; --warn-fg: #f1c66b;
  --danger-bg: #431f1f; --danger-fg: #f6a3a3; --muted-bg: #262d37; --muted-fg: #9aa3b0; --sample-bg: #3a3214; --sample-fg: #f0d77a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.6 var(--font); -webkit-text-size-adjust: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.35; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 14px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
[hidden] { display: none !important; }

/* ---------- 上部バー ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; color: var(--text); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a { padding: 6px 12px; border-radius: 6px; color: var(--text-2); white-space: nowrap; }
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.me { display: flex; gap: 12px; align-items: center; white-space: nowrap; font-size: 13px; }
.sample-banner { background: var(--sample-bg); color: var(--sample-fg); padding: 6px 20px; font-size: 13px; }

.main { max-width: 1320px; margin: 0 auto; padding: 20px; outline: none; }

/* ---------- 共通部品 ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); font-size: 13px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border-radius: 6px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger-fg); }
.btn.small { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.7; white-space: nowrap;
  background: var(--muted-bg); color: var(--muted-fg);
}
.chip.ok { background: var(--ok-bg); color: var(--ok-fg); }
.chip.info { background: var(--info-bg); color: var(--info-fg); }
.chip.warn { background: var(--warn-bg); color: var(--warn-fg); }
.chip.danger { background: var(--danger-bg); color: var(--danger-fg); }
.chip.sample { background: var(--sample-bg); color: var(--sample-fg); }
.chip.outline { background: transparent; border: 1px solid var(--border-strong); color: var(--text-2); font-weight: 500; }

.muted { color: var(--text-3); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.danger-text { color: var(--danger-fg); font-weight: 600; }
.warn-text { color: var(--warn-fg); font-weight: 600; }

/* ---------- 表 ---------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
.grid th, .grid td { padding: 9px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.grid th { font-size: 12px; font-weight: 600; color: var(--text-3); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tr.clickable { cursor: pointer; }
.grid tr.clickable:hover td { background: var(--surface-2); }
.grid td.num { text-align: right; }
.cell-title { font-weight: 600; color: var(--text); }
.grid td.stack-title { min-width: 190px; }
.grid td.prod-name { min-width: 0; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.prod-cell { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.prod-cell .note { font-size: 11px; color: var(--text-3); }

/* ---------- フィルター ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; overflow-x: auto; }
.tab {
  padding: 8px 14px; border: 0; background: none; font: inherit; font-size: 13px; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
}
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { margin-left: 6px; font-size: 12px; padding: 0 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); }
.tab .count.alert { background: var(--danger-bg); color: var(--danger-fg); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type="search"] { flex: 1 1 220px; }
.filters select { flex: 0 1 180px; }
.tab-help { font-size: 12px; color: var(--text-3); margin: -4px 0 10px; }

/* ---------- フォーム ---------- */
input, select, textarea {
  font: inherit; font-size: 14px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 6px 10px; min-height: 34px; max-width: 100%;
}
textarea { min-height: 80px; resize: vertical; width: 100%; }
input[type="checkbox"] { min-height: 0; width: 16px; height: 16px; }
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span.label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field input:not([type="checkbox"]), .field select { width: 100%; }
.field .hint { font-size: 12px; color: var(--text-3); }
.field .err { font-size: 12px; color: var(--danger-fg); font-weight: 600; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--danger-fg); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.form-error { background: var(--danger-bg); color: var(--danger-fg); padding: 8px 12px; border-radius: 6px; font-weight: 600; }
.section-label { font-size: 12px; font-weight: 700; color: var(--text-3); margin-top: 4px; }
.checklist { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px; padding: 10px; }

dialog {
  border: 0; border-radius: 10px; padding: 0; width: min(640px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog::backdrop { background: rgba(15, 20, 30, .45); }
.dialog-head { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.dialog-body { padding: 16px 18px; max-height: calc(100vh - 200px); overflow-y: auto; }
.dialog-foot { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 詳細画面 ---------- */
.detail { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 12px; margin: 0; }
.kv dt { color: var(--text-3); font-size: 12px; padding-top: 2px; }
.kv dd { margin: 0; }
.breadcrumb { font-size: 13px; color: var(--text-3); margin-bottom: 4px; }

.prod-table td.prod-name { font-weight: 700; white-space: nowrap; }
.prod-table tr.pm-test td { background: var(--surface-2); font-size: 13px; padding-top: 6px; }
.prod-table .test-grid { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.prod-table .test-grid b { font-weight: 600; color: var(--text-3); font-size: 12px; margin-right: 6px; }

.action-list { list-style: none; margin: 0; padding: 0; }
.action-item { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); align-items: start; }
.action-item:last-child { border-bottom: 0; }
.action-item .content { font-weight: 600; }
.action-item .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.action-item.done .content { text-decoration: line-through; color: var(--text-3); font-weight: 400; }
.action-item input[type="checkbox"] { margin-top: 3px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 16px; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: 0; }
.timeline .when { font-size: 12px; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.timeline .change { font-size: 13px; color: var(--text-2); }

.steps { display: flex; gap: 0; margin: 4px 0 0; padding: 0; list-style: none; flex-wrap: wrap; }
.steps li { flex: 1 1 120px; padding: 10px 12px; border: 1px solid var(--border); margin-left: -1px; background: var(--surface); }
.steps li:first-child { border-radius: 6px 0 0 6px; margin-left: 0; }
.steps li:last-child { border-radius: 0 6px 6px 0; }
.steps li .s-label { font-size: 12px; font-weight: 700; color: var(--text-3); }
.steps li.reached { background: var(--ok-bg); }
.steps li.reached .s-label { color: var(--ok-fg); }
.steps li.current { box-shadow: inset 0 -3px 0 var(--ok-fg); }

.empty { padding: 28px 16px; text-align: center; color: var(--text-3); }
.empty.small { padding: 14px 16px; font-size: 13px; text-align: left; }
.state { padding: 60px 16px; text-align: center; color: var(--text-3); }
.state.error { color: var(--danger-fg); }
.spinner { display: inline-block; width: 18px; height: 18px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -4px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 600; display: flex; gap: 12px; align-items: flex-start; max-width: 420px; }
.toast.ok { background: var(--ok-bg); color: var(--ok-fg); border: 1px solid var(--ok-fg); }
.toast.error { background: var(--danger-bg); color: var(--danger-fg); border: 1px solid var(--danger-fg); }
.toast button { background: none; border: 0; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; padding: 0; }

.auth-wrap { min-height: 80vh; display: grid; place-items: center; }
.auth-card { width: min(400px, 100%); }

.group-head { padding: 10px 16px; background: var(--surface-2); font-weight: 700; display: flex; justify-content: space-between; border-bottom: 1px solid var(--border); }


/* ---------- 一覧の絞り込みボタン・一括操作・ページ送り ---------- */
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 12px; }
.chips-label { font-size: 12px; font-weight: 700; color: var(--text-3); margin: 0 2px 0 6px; }
.chips-label:first-child { margin-left: 0; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font: inherit; font-size: 12px;
}
.fchip .n { font-weight: 700; color: var(--text); }
.fchip:hover { background: var(--surface-2); }
.fchip.warn .n { color: var(--warn-fg); }
.fchip.danger .n { color: var(--danger-fg); }
.fchip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.fchip.active .n { color: var(--accent-text); }
.bulk-bar {
  position: sticky; top: 52px; z-index: 10; display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--radius); background: var(--info-bg); color: var(--info-fg);
}
.pager { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--border); }
.grid .check-col { width: 36px; padding-right: 0; }
.loading { opacity: .5; pointer-events: none; transition: opacity .15s; }

/* ---------- 会社の検索選択 ---------- */
.picker { position: relative; }
.picker input[type="text"] { width: 100%; }
.picker-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 30; max-height: 260px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 6px; box-shadow: var(--shadow);
}
.picker-list button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; }
.picker-list button:hover, .picker-list button:focus { background: var(--surface-2); }

/* ---------- 名刺 ---------- */
.contact-row { display: flex; gap: 12px; align-items: flex-start; }
.contact-main { min-width: 0; flex: 1; }
.card-thumbs { display: flex; flex-direction: column; gap: 4px; flex: 0 0 auto; }
.card-thumb { padding: 0; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); cursor: zoom-in; width: 84px; height: 52px; overflow: hidden; }
.card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-file { display: inline-block; max-width: 84px; }
.card-preview { height: 120px; border: 1px dashed var(--border-strong); border-radius: 6px; display: grid; place-items: center; overflow: hidden; background: var(--surface-2); }
.card-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.image-dialog { width: min(960px, calc(100vw - 32px)); }
.image-dialog img { display: block; max-width: 100%; max-height: calc(100vh - 160px); margin: 0 auto; }

/* ---------- 取込・メール ---------- */
.progress { position: relative; height: 26px; border-radius: 6px; background: var(--surface-2); overflow: hidden; border: 1px solid var(--border); }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--ok-bg); transition: width .2s; }
.progress span { position: relative; display: block; line-height: 24px; padding: 0 10px; }
.summary-box { display: grid; gap: 4px; padding: 12px; border-radius: 6px; background: var(--surface-2); }
.summary-box .big { font-size: 20px; }
.footer-preview { padding: 10px; border-radius: 6px; background: var(--surface-2); color: var(--text-2); }
.clamp { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }


/* ---------- レコード画面（HubSpot型の3カラム） ---------- */
.record { display: grid; grid-template-columns: 300px minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.record > div > .card + .card, .record > div > .card { margin-top: 0; }
.record > div { display: grid; gap: 16px; min-width: 0; }
.manager-box { padding: 10px 12px; margin-bottom: 12px; border-radius: 6px; background: var(--info-bg); }
.manager-box.missing { background: var(--warn-bg); }
.manager-box .section-label { margin-top: 0; }
.card-thumbs.row { flex-direction: row; margin-bottom: 10px; }
.timeline li.sys { padding-top: 6px; padding-bottom: 6px; }
.timeline li.sys .change { font-size: 12px; }
.done-list { border-top: 1px solid var(--border); }
.done-list summary { padding: 8px 16px; cursor: pointer; font-size: 12px; color: var(--text-3); }
.mini-date { min-height: 28px; font-size: 12px; padding: 2px 6px; }

.composer-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.ctab { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12px; cursor: pointer; }
.ctab.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.composer { display: grid; gap: 10px; }
.composer textarea { min-height: 60px; }

/* 狭い列のタスクは操作ボタンを下段に回す */
.record-right .action-item, .dash-grid > div:last-child .action-item { grid-template-columns: 22px minmax(0, 1fr); }
.record-right .action-item > .actions-row, .dash-grid > div:last-child .action-item > .actions-row { grid-column: 2; }

/* ---------- 商談ステージバー ---------- */
.stage-bar { display: flex; list-style: none; margin: 0; padding: 0; overflow-x: auto; gap: 2px; }
.stage-bar li { flex: 1 0 auto; text-align: center; background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.stage-bar li:first-child { border-radius: 6px 0 0 6px; }
.stage-bar li:last-child { border-radius: 0 6px 6px 0; }
.stage-bar li > * { display: block; width: 100%; padding: 8px 10px; border: 0; background: none; font: inherit; color: inherit; white-space: nowrap; }
.stage-bar li button { cursor: pointer; }
.stage-bar li button:hover { text-decoration: underline; }
.stage-bar li.reached { background: var(--ok-bg); color: var(--ok-fg); }
.stage-bar li.current { background: var(--ok-fg); color: var(--surface); font-weight: 700; }

/* ---------- パイプライン（ボード） ---------- */
.board { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.board-col { flex: 0 0 212px; background: var(--surface-2); border-radius: var(--radius); border: 1px solid var(--border); }
.board-col.drop { outline: 2px dashed var(--accent); }
.board-col.won .board-head { box-shadow: inset 0 3px 0 var(--ok-fg); }
.board-col.hold .board-head { box-shadow: inset 0 3px 0 var(--warn-fg); }
.board-head { padding: 10px 12px; border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.board-head .count { margin-left: 6px; font-size: 12px; padding: 0 6px; border-radius: 999px; background: var(--surface); color: var(--text-2); font-weight: 600; }
.board-cards { display: grid; gap: 8px; padding: 8px; min-height: 60px; }
.board-empty { text-align: center; color: var(--text-3); padding: 10px; }
.deal-card { display: grid; gap: 4px; padding: 10px; border-radius: 6px; background: var(--surface); border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); cursor: grab; }
.deal-card:hover { text-decoration: none; border-color: var(--border-strong); }
.deal-card-prods { display: flex; flex-wrap: wrap; gap: 4px; }
.deal-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; color: var(--text-2); }
.seg button.active { background: var(--accent); color: var(--accent-text); }

/* ---------- ダッシュボード ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { display: block; padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
a.stat:hover { text-decoration: none; border-color: var(--border-strong); }
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 600; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.3; margin-top: 2px; }
.stat-value.ok { color: var(--ok-fg); }
.stat-sub { font-size: 12px; color: var(--text-2); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid > div { display: grid; gap: 16px; min-width: 0; }
.dash-grid .card + .card { margin-top: 0; }
.mini-stats { display: flex; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.mini-stats a { color: var(--text); }
.mini-stats strong { font-size: 18px; margin-right: 2px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) 150px; gap: 10px; align-items: center; color: var(--text); padding: 2px 0; border-radius: 4px; }
a.bar-row:hover { text-decoration: none; background: var(--surface-2); }
.bar-label { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 13px; font-weight: 600; text-align: right; white-space: nowrap; }

/* ---------- タブレット・スマートフォン ---------- */
@media (max-width: 1200px) {
  .record { grid-template-columns: 280px minmax(0, 1fr); }
  .record-right { grid-column: 1 / -1; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
}
@media (max-width: 1024px) {
  .detail, .record, .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .record-right { grid-column: auto; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px; }
  .nav { order: 3; flex-basis: 100%; }
  .me { margin-left: auto; }
  .main { padding: 16px; }
  .sample-banner { padding: 6px 16px; }

  /* 一覧表はカード状に積む */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { border-bottom: 1px solid var(--border); padding: 10px 14px; }
  table.stack td { border: 0; padding: 3px 0; display: flex; gap: 10px; }
  table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 96px; font-size: 12px; color: var(--text-3); }
  table.stack td.stack-title { display: block; padding-bottom: 6px; min-width: 0; }
  .filters select { flex: 1 1 calc(50% - 4px); }
  .kv { grid-template-columns: 90px minmax(0, 1fr); }
  .action-item { padding: 10px 14px; grid-template-columns: 22px minmax(0, 1fr); }
  .action-item > .actions-row { grid-column: 2; }
  .prod-table tr.pm-test td { display: block; }
  table.stack td.check-col { position: absolute; right: 14px; width: auto; }
  table.stack tr { position: relative; }
  .bulk-bar { top: 0; }
  .bar-row { grid-template-columns: 90px minmax(0, 1fr) 110px; }
  .stage-bar li > * { padding: 8px 6px; }
}
