/* ダビデ アナリティクス — 共通スタイル
   白地 + 紺(#10203f) + 金(#c2a25e) の差し色。外部フォント・CDNは使わずシステムフォントのみ。
   prefers-reduced-motion を尊重(動きは opacity のみ)。 */

:root {
  --color-bg: #f4f6fb;
  --color-surface: #ffffff;
  --color-navy: #10203f;
  --color-navy-soft: #1c3564;
  --color-gold: #c2a25e;
  --color-gold-soft: #e8dcc0;
  --color-text: #2b2f38;
  --color-text-muted: #667085;
  --color-text-faint: #5f6b81;
  --color-border: #e2e6f0;
  --color-border-soft: #edf0f7;

  --series-1: #2e5fa3; /* 青系: 訪問 / 開始 */
  --series-2: #c98500; /* 金系: ページビュー / 完了 */

  --status-good-bg: #e6f4ea;
  --status-good-text: #1a7a3d;
  --status-neutral-bg: #eef0f3;
  --status-neutral-text: #5b6472;
  --status-up-bg: #e6f4ea;
  --status-up-text: #1a7a3d;
  --status-down-bg: #fbeaea;
  --status-down-text: #a3282c;
  --badge-suppressed-bg: #eef1f7;
  --badge-suppressed-text: #44506b;
  --urgent-bg: #fff1e3;
  --urgent-text: #9a4a12;

  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 6px;
  --shadow-card: 0 1px 2px rgba(16, 32, 63, 0.06), 0 2px 8px rgba(16, 32, 63, 0.06);

  color-scheme: light;
}

* { box-sizing: border-box; }

/* [hidden] は UA スタイルシート由来のため、.card-error{display:flex} や
   .kpi-grid{display:grid} など display を直接指定するクラスと詳細度が同点になり、
   後勝ちの author 規則に負けて非表示にならない。JS の el.hidden 切替を全箇所で
   確実に効かせるための上書き。 */
[hidden] { display: none !important; }

html, body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  min-width: 320px;
  overflow-x: hidden;
}

a { color: var(--color-navy-soft); }
a:hover { color: var(--color-navy); }

h1, h2, h3 { margin: 0; color: var(--color-navy); font-weight: 700; }

button, input, select { font: inherit; color: inherit; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------------------
   認証画面(login / view / account): 中央カード
--------------------------------------------------------------------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 32px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-gold);
  flex: none;
}

.brand-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--color-navy);
}

.auth-card h1 {
  font-size: 19px;
  margin-bottom: 20px;
}

.auth-sub {
  color: var(--color-text-muted);
  font-size: 14px;
  margin: -12px 0 20px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

.field input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: 15px;
}

.field input:focus {
  outline: 2px solid var(--series-1);
  outline-offset: 1px;
  border-color: var(--series-1);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-navy);
  color: #ffffff;
  width: 100%;
  padding: 12px 18px;
  font-size: 15px;
}
.btn-primary:hover { background: var(--color-navy-soft); }

.btn-ghost {
  background: var(--color-surface);
  color: var(--color-navy);
  border-color: var(--color-border);
}
.btn-ghost:hover { border-color: var(--color-navy-soft); }

/* 2026-09-14(v81): 6px だとタップ領域が34.8pxで44px未満(市場比較 §D)。
   見た目はほぼ変えず、上下だけ広げて44px以上にする。 */
.btn-sm { padding: 11px 12px; font-size: 13px; }

.btn:disabled { opacity: .55; cursor: not-allowed; }

.auth-footer {
  margin-top: 18px;
  text-align: center;
  font-size: 14px;
}
/* 2026-09-14(v81): 素のテキストリンクだとタップ領域が19pxで44px未満(市場比較 §D)。
   inline-block化して上下にpaddingを足す(文字の見た目は変えない)。 */
.auth-footer a {
  display: inline-block;
  padding: 13px 8px;
}

.error-banner {
  background: var(--status-down-bg);
  color: var(--status-down-text);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-banner {
  background: var(--status-good-bg);
  color: var(--status-good-text);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* ---------------------------------------------------------------------
   アプリ全体レイアウト
--------------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 20px;
}
/* 2026-09-23(目視の提案 P5): 767px 以下では見出しの帯(院名・院の切り替え・期間・更新・CSV)が折り返して高くなり、
   固定のままだと 375×667 で 262px(画面の 39%)を取り続け、QA の枠などの頭も隠していた。この幅では固定をやめて
   頁と一緒に流す(上へ戻れば操作できる)。768px 以上は 1〜2 行に収まるので今までどおり固定。 */
@media (max-width: 767px) {
  .app-header { position: static; }
}

.app-header-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  max-width: 1200px;
  margin: 0 auto;
}

.app-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* 2026-09-22是正(独立検査 低-2): 表示するかどうかは close-return-detect.js が body より前に
   付ける印(:root[data-close-return="1"])で決める(既定は非表示)。.app-header-row/
   .app-header-controls の込み合った grid には触れず、position:fixed でふつうの流れの外に
   置く(釦の有無でヘッダーの高さが一切変わらない= 1280/375/320 のどの幅でも高さ同じ)。
   右上ではなく右下に置く理由: ヘッダーは幅によって院名/検索/期間/更新/CSV/ログアウト等が
   1行または複数行に並ぶ込み合った帯なので、右上固定だと幅によって既存の釦や院名に重なって
   隠してしまう(実測で確認: 1280は「更新」釦、375は院切替、320は院名の文字に重なった)。
   右下はヘッダーからもフッターからも独立していて、どの幅でも他の操作要素と重ならない。 */
.close-return-float {
  display: none;
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 60;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
:root[data-close-return="1"] .close-return-float { display: flex; }
/* 2026-09-22是正(独立検査 低-1): hidden属性は使わない。中身が空の間はテキストノードが
   無いので行ボックスが生まれず高さ0(margin/padding/borderも0=余白・枠も無い)。
   app.js が300ms後に textContent を入れた時だけ、釦の近くに重なる小さな札にする。 */
.close-return-note { margin: 0; color: var(--color-text-muted); font-size: 13px; text-align: right; }
.close-return-note:not(:empty) {
  background: var(--color-surface);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
}
@media (max-width: 767px) {
  /* 2026-09-23是正(独立検査 低-4、同じ「隠れる」指摘のため方法を変える。QAの記録画面
     (中-1)と同じ方法に揃える): 767px以下は重ねて置かない。HTML上の位置
     (<header>より前)のまま position:static に戻し、ページの一番上の帯として流す
     (フッターの院名 app-footer と構造上重ならなくなる)。この幅では余白確保
     (scroll-padding-bottom/padding-bottom)も不要なので元に戻す(768px以上だけに絞る)。 */
  .close-return-float {
    position: static;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px 20px 0;
    box-sizing: border-box;
  }
  :root[data-close-return="1"] { scroll-padding-bottom: 0; }
  :root[data-close-return="1"] .app-main { padding-bottom: 20px; }
}

/* 2026-09-14(v81): サイト切替セレクトのタップ領域が35pxで44px未満(市場比較 §D の
   別枠改善)。同じ理由でdate-inputも合わせて広げる(値・選択肢は変えない)。 */
.select-input, .date-input {
  padding: 14px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: 13px;
}

.range-presets {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

/* 2026-09-14(v81): タップ領域が34.8pxで44px未満(市場比較 §D の別枠改善)。上下だけ広げる。 */
.range-presets button {
  border: none;
  background: var(--color-surface);
  padding: 12px 12px;
  font-size: 13px;
  cursor: pointer;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.range-presets button:first-child { border-left: none; }
.range-presets button[aria-pressed="true"] {
  background: var(--color-navy);
  color: #fff;
  font-weight: 600;
}

.custom-range {
  display: none;
  align-items: center;
  gap: 6px;
}
.custom-range.is-open { display: inline-flex; }

.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
/* 2026-09-22是正(独立検査 低-3): 右下に浮かせた「閉じて戻る」(.close-return-float、
   釦+案内で最大約130px)が、スクロールした先の本文を隠すことがあった。釦を出す時だけ
   main の下に釦の帯ぶんの余白を足し、キーボード操作やハッシュ移動での自動スクロールも
   その分手前で止める(scroll-padding-bottom)。釦を出さない通常時は変えない。 */
:root[data-close-return="1"] {
  scroll-padding-bottom: 140px;
}
:root[data-close-return="1"] .app-main {
  padding-bottom: 140px;
}

.form-note {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ---------------------------------------------------------------------
   サイト一覧(index.html)
--------------------------------------------------------------------- */

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.search-row {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* 2026-09-14(v81): タップ領域が42.39pxで44px未満(市場比較 §D の別枠改善)。 */
.search-row input {
  flex: 1;
  max-width: 320px;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
}

/* 2026-09-14(v81): サイト名リンクの実クリック域が19pxで44px未満(市場比較 §D の別枠改善)。
   行の高さ(推移スパークラインの列で決まる、384pxなど据え置き)は変えず、既にある
   余白の中でリンク自体の当たり判定だけを広げる(セル側のpaddingは0にしてリンクへ移す)。 */
.site-table td.col-name { padding: 0; }
.site-table td.col-name a {
  display: flex;
  align-items: center;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 10px;
  font-weight: 600;
  text-decoration: none;
}
.site-table td.col-name a:hover { text-decoration: underline; }

.sparkline-cell canvas {
  width: 90px;
  height: 28px;
  display: block;
}

/* ---------------------------------------------------------------------
   カード
--------------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 20px;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.card-head h2 {
  font-size: 15px;
}

.card-head .hint {
  font-size: 12px;
  color: var(--color-text-faint);
}

/* QA は集計をスクロールせず、アナリティクスの先頭から受験できる。 */
.qa-test-launch .card-head { align-items: center; flex-wrap: wrap; }
.qa-test-launch .card-head h2 { font-size: 18px; }
.qa-entry-note { margin: 0 0 14px; color: var(--color-text-muted); font-size: 14px; line-height: 1.7; }
.qa-entry-links { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.qa-entry-links[hidden] { display: none; }
.qa-entry-links .btn { min-height: 48px; min-width: 0; white-space: normal; text-wrap: balance; text-align: center; }
.qa-test-launch .qa-exam-link { width: auto; max-width: 100%; min-height: 44px; white-space: normal; }
@media (max-width: 560px) {
  .qa-entry-links { grid-template-columns: 1fr; }
}

.card-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--status-down-bg);
  color: var(--status-down-text);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 14px;
}

.card-loading {
  color: var(--color-text-faint);
  font-size: 14px;
  padding: 8px 0;
}

/* KPIカード */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-label {
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-weight: 600;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.2;
}

.kpi-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  min-height: 18px;
}

/* v85(a11yレーン、依頼6): 11.5pxで12px未満だった(基準の実測どおり)。文言・配色は変えず床だけ確保。 */
.kpi-note {
  font-size: 12.5px;
  color: var(--color-text-faint);
}

.delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 7px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
}
.delta.up { background: var(--status-up-bg); color: var(--status-up-text); }
.delta.down { background: var(--status-down-bg); color: var(--status-down-text); }
.delta.flat { background: var(--status-neutral-bg); color: var(--status-neutral-text); }

.badge-suppressed {
  display: inline-block;
  background: var(--badge-suppressed-bg);
  color: var(--badge-suppressed-text);
  border-radius: 999px;
  padding: 1px 9px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.dash { color: var(--color-text-faint); }

/* 導線クリック / 緊急の相談 */

.cta-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .cta-grid { grid-template-columns: repeat(2, 1fr); }
}

.cta-tile {
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  text-align: center;
}
.cta-tile.primary {
  border-color: var(--color-gold-soft);
  background: #fdfaf3;
}
.cta-tile .cta-label { font-size: 12.5px; color: var(--color-text-muted); font-weight: 600; }
.cta-tile .cta-value { font-size: 20px; font-weight: 700; color: var(--color-navy); margin-top: 3px; }

.cta-card { margin-top: 12px; }
.section-subhead { font-size: 13.5px; color: var(--color-text-muted); margin-bottom: 8px; }
.chart-box-gap-lg { margin-bottom: 20px; }
.table-scroll-gap { margin-bottom: 16px; }

/* 時系列チャートの凡例ドット(CSP style-src 'self' のため固定2色をクラスで用意) */
.dot-series-1 { background: var(--series-1); }
.dot-series-2 { background: var(--series-2); }

/* バーリストの可変長メーター(CSP対応: 幅はvalue/max属性で表現し、インラインstyleを使わない) */
.bar-meter {
  width: 100%;
  height: 10px;
  border: none;
  border-radius: 999px;
  vertical-align: middle;
  accent-color: var(--series-1);
}
.bar-meter::-webkit-meter-bar {
  background: var(--color-border-soft);
  border: none;
  border-radius: 999px;
  height: 10px;
}
.bar-meter::-webkit-meter-optimum-value {
  background: var(--series-1);
  border-radius: 999px;
}
.bar-meter::-moz-meter-bar {
  background: var(--series-1);
  border-radius: 999px;
}

.urgent-callout {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--urgent-bg);
  color: var(--urgent-text);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
}
.urgent-callout .n { font-size: 18px; }

/* ---------------------------------------------------------------------
   時系列チャート
--------------------------------------------------------------------- */

.chart-toggle {
  display: inline-flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
/* 2026-09-14(v81): タップ領域が32.8pxで44px未満(市場比較 §D の別枠改善)。上下だけ広げる。 */
.chart-toggle button {
  border: none;
  background: var(--color-surface);
  padding: 12px 12px;
  font-size: 13px;
  cursor: pointer;
  border-left: 1px solid var(--color-border);
  color: var(--color-text-muted);
}
.chart-toggle button:first-child { border-left: none; }
.chart-toggle button[aria-pressed="true"] {
  background: var(--color-navy);
  color: #fff;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 10px;
}
/* 凡例の名前は語の途中で折らない(2026-09-23 目視の検査 低-8: 390 で「訪/問」になっていた)。 */
.chart-legend > span:not(.hint) { white-space: nowrap; }
.chart-legend .dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}

/* Chart.js は responsive:true + maintainAspectRatio:false のとき親要素の高さに
   合わせて描画する。親の高さを明示しないと「canvasの高さ→親の高さ→canvasの高さ…」
   の循環で際限なく伸びるため、必ず固定/段階の高さをここで持たせる。 */
.chart-box { position: relative; height: 280px; }
.chart-box canvas { max-width: 100%; }
.chart-box-fixed { height: 240px; }
/* v88 S-01: 固定の高さは canvas を包む内側の箱だけが持つ。凡例はその下の兄弟
   （普通の流れ）なので、狭い幅で 2 行になっても次のカードに重ならない。 */
.chart-box-series { height: 300px; }
.funnel-h-sm { height: 260px; }
.funnel-h-md { height: 420px; }
.funnel-h-lg { height: 560px; }
.funnel-h-xl { height: 700px; }

/* ---------------------------------------------------------------------
   タブ(ページ別/端末/参照元/時間帯)
--------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

/* 2026-09-14(v81): タップ領域が42.39pxで44px未満(市場比較 §D)。上下だけわずかに広げる。 */
.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tab-btn[aria-selected="true"] {
  color: var(--color-navy);
  border-bottom-color: var(--color-gold);
}

.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  min-width: 380px;
}

table.data-table th, table.data-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--color-border-soft);
  white-space: nowrap;
}

table.data-table th {
  font-size: 12.5px;
  color: var(--color-text-muted);
  font-weight: 700;
}

table.data-table td.num, table.data-table th.num { text-align: right; }

table.data-table tbody tr:hover { background: var(--color-border-soft); }

.bar-cell {
  position: relative;
}
.bar-cell .bar-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: rgba(46, 95, 163, 0.12);
  z-index: 0;
}
.bar-cell .bar-text { position: relative; z-index: 1; }

/* ---------------------------------------------------------------------
   バーリスト(肌タイプ/プラン/相談/導線/仕上がり等の簡易内訳)
--------------------------------------------------------------------- */

.bar-list-group {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 24px;
}
@media (max-width: 720px) {
  .bar-list-group { grid-template-columns: 1fr; }
}

.bar-list h3 {
  font-size: 13.5px;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.bar-row {
  display: grid;
  /* 2026-09-08(v74 再確認): 見出しの列は 96px だと「渋谷 VIO 都度払い 1回」
     「新宿 AGA治療（注入）」などの提案コース名が途中で切れる(実測で必要幅 138px、
     390/768/1280 のすべてで 26 行中 7 行が省略記号になっていた)。列を 140px にすると
     いちばん長い表示名まで収まり、いちばん狭い 390px でもバーは 90px 以上残る。 */
  grid-template-columns: 140px 1fr 64px;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13.5px;
}

.bar-row .bar-label {
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-row .bar-n {
  text-align: right;
  font-weight: 600;
  color: var(--color-navy);
}

.empty-note {
  color: var(--color-text-faint);
  font-size: 13.5px;
  padding: 6px 0;
}

/* ---------------------------------------------------------------------
   QA / QA受験記録
--------------------------------------------------------------------- */

.pass-badge, .fail-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
}
.pass-badge { background: var(--status-good-bg); color: var(--status-good-text); }
.fail-badge { background: var(--status-neutral-bg); color: var(--status-neutral-text); }

.qa-cats-detail {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
  margin: -2px 0 8px 104px;
}
/* 分野別の「正答率」は .bar-row の直後に挿む別の行(app.js の insertAdjacentElement)。
   左端はバーの左端、つまり「見出しの列幅 + gap」に合わせる。2026-09-09: 見出しの列を
   96px → 140px にしたぶんここも 104px → 148px にする(実測: 104px のままだと
   390/768/1280 のすべてでバーの左端より 44px 手前で始まっていた)。
   同じ class は QA受験記録の <td> にも付くので、横棒の中だけに限定する。 */
.bar-list > .qa-cats-detail { margin-left: 148px; }
/* 2026-09-23(目視の検査 中-4): QA受験記録の表の「分野別正答」の欄。上の .qa-cats-detail
   (横棒の下の行)とは別にし、表の欄のまま(display:block・左の余白を持ち込まない)小さく出す。 */
.data-table td.qa-cats-cell { font-size: 12px; color: var(--color-text-muted); min-width: 18em; white-space: normal; }

.section-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

/* 2026-09-14(v81): タップ領域が39.59pxで44px未満(市場比較 §D の別枠改善)。 */
.section-toolbar input[type="search"] {
  padding: 11px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  min-width: 180px;
}

/* ---------------------------------------------------------------------
   アカウント画面
--------------------------------------------------------------------- */

.page-shell {
  max-width: 480px;
  margin: 40px auto;
  padding: 0 20px;
}

/* ---------------------------------------------------------------------
   フッター / 読み込み中
--------------------------------------------------------------------- */

.app-footer {
  max-width: 1200px;
  margin: 8px auto 30px;
  padding: 0 20px;
  color: var(--color-text-faint);
  font-size: 12.5px;
  text-align: center;
}

.spinner-line {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-navy);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .spinner-line { animation: none; opacity: .6; }
  * { transition: none !important; }
}

.fade-in { animation: fadein .25s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .fade-in { animation: none; }
}

/* レスポンシブ全体調整 */
@media (max-width: 480px) {
  .app-header { padding: 10px 14px; }
  .app-main { padding: 14px; gap: 16px; }
  .card { padding: 14px 14px; }
  .kpi-value { font-size: 22px; }
}

/* ---------------------------------------------------------------------
   v78(2026-09-10) 設問別の回答分布 / 院内(受付端末)
--------------------------------------------------------------------- */

/* 節の下に置く一行の説明。card-head の外でも同じ見え方にする。 */
p.hint {
  font-size: 12px;
  color: var(--color-text-faint);
  margin: -2px 0 10px;
}

.answer-block { margin-bottom: 18px; }

.answer-block h4 {
  font-size: 13.5px;
  color: var(--color-text);
  font-weight: 600;
  margin-bottom: 2px;
}

.answer-block .answer-total {
  font-size: 12px;
  color: var(--color-text-faint);
  margin-bottom: 6px;
}

/* 件数のうしろに割合を薄く添える(列は増やさない)。 */
.bar-n .bar-rate {
  font-weight: 400;
  color: var(--color-text-faint);
  margin-left: 4px;
}

/* 選択肢名は提案コース名より長い(実測: 「1ヶ月以内に日焼けをした」「プロテーゼなどの
   注入がある」など 140px では途中で切れる)。この節は 1 段組で幅が余るので、
   広い画面では見出しの列を広げる。狭い画面は従来どおり 140px のまま。 */
.answer-block .bar-row { grid-template-columns: 140px 1fr 88px; }
@media (min-width: 721px) {
  .answer-block .bar-row { grid-template-columns: 280px 1fr 88px; }
}
/* 狭い画面では 140px でも足りない(390px 実測で 6 行が省略記号になった)。
   選択肢名は読めないと意味が無いので、折り返して全部見せる。 */
@media (max-width: 720px) {
  .answer-block .bar-row .bar-label { white-space: normal; overflow: visible; }
}

/* ---------------------------------------------------------------------
   v85 R-01 / R-10(2026-09-16)
--------------------------------------------------------------------- */

/* v85 R-01: サイト詳細の上部の操作が 768 で 1 行に収まらず、flex の折り返し任せだったため
   「ログアウト」だけが 2 行目に 1 つで落ちていた(実測 768: 子の top が 79/80/90/134 の
   4 種、最後の段は 1 個)。900px 以下では並びを決め打ちにして「期間の段」と「操作の段」の
   2 段にする(期間の札は 1 行目、最終更新・更新・CSV・アカウント・ログアウトは 2 行目)。
   align は grid 既定の stretch のままにして、同じ段の要素の top をそろえる。
   901px 以上(1280 を含む)は従来の flex のままなので位置は変わらない。 */
@media (max-width: 900px) {
  body[data-page="site"] .app-header-controls {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    /* 既定の align-items:center は、同じ段でも高さの違う要素(26px の一行と 45px の釦)の
       top をずらす。段の高さいっぱいに伸ばして top をそろえる。 */
    align-items: stretch;
    column-gap: 8px;
    row-gap: 8px;
    width: 100%;
    margin-left: 0;
  }
  body[data-page="site"] .app-header-controls > .range-presets,
  body[data-page="site"] .app-header-controls > .custom-range { grid-column: 1 / -1; justify-self: start; }
  /* 高さ 26px の一行を段の高さいっぱいに伸ばし、中で縦中央に置く(同じ段の top をそろえる) */
  body[data-page="site"] .app-header-controls > #last-updated {
    display: flex;
    align-items: center;
    min-width: 0;
  }
}
/* 560px 以下は「期間」「最終更新」「操作の 4 つ」の 3 段。1 行に 5 つ並べると横に
   はみ出す(375 実測: 操作の 4 つだけで 317px + 隙間、最終更新は 258px)。 */
@media (max-width: 560px) {
  body[data-page="site"] .app-header-controls {
    grid-template-columns: repeat(4, auto);
    justify-content: start;
  }
  body[data-page="site"] .app-header-controls > #last-updated { grid-column: 1 / -1; }
}
/* 901px 以上は従来の flex のまま。ただし「最終更新」に「(日本時間)」(R-03)が付いて
   1 行が 250px → 328px になり、1280 で上の段の残り幅(実測 810px)を超えて操作の入れ物ごと
   2 段目へ落ちていた(ヘッダー 70px → 129px)。この一行だけ元の幅で折り返し、
   ほかの要素の位置を前と同じに保つ。 */
@media (min-width: 901px) {
  /* 2 行になっても入れ物(期間の札 47px)より高くならない行送りにして、段の高さ・
     ほかの要素の top を前のままに保つ(行送りを持たないと 1 行 25.6px = 2 行 51px で 4px 高くなる)。 */
  /* 折り返しは語の切れ目で(keep-all が無いと「(30秒 / ごとに更新)」のように括弧の途中で切れる)。 */
  body[data-page="site"] .app-header-controls > #last-updated { max-width: 250px; line-height: 1.5; word-break: keep-all; }
}

/* v85 R-10: アカウント画面の「ログイン中: <ユーザー名>」の 1 行(app.js が /api/me から入れる)。
   p.hint の 12px・薄字のまま、カードの上に置く。 */
.account-user { margin: 0 0 10px; }

/* v87 S-02: 狭い一覧では各サイトを札にし、横送りせず4項目を読めるようにする。
   560pxより広い表とサイト詳細のカードには適用しない。 */
@media (max-width: 560px) {
  #sites-table-wrap { overflow: visible; margin-top: 12px; }
  #sites-table-wrap .site-table,
  #sites-table-wrap .site-table tbody { display: block; min-width: 0; }
  #sites-table-wrap .site-table thead { display: none; }
  #sites-table-wrap .site-table tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
  }
  #sites-table-wrap .site-table tbody tr + tr { margin-top: 12px; }
  #sites-table-wrap .site-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  #sites-table-wrap .site-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--color-text-muted);
    font-size: 12.5px;
    font-weight: 600;
  }
  #sites-table-wrap .site-table td.col-name,
  #sites-table-wrap .site-table td.col-last-received { grid-column: 1 / -1; }
  #sites-table-wrap .site-table td.col-name a { padding: 0; }
  #sites-table-wrap .site-table td.sparkline-cell { display: none; }
}

/* ══ v88（2026-09-16）一覧の表: 院名が長くても横に送らない（S-02）══════
 * 院名 20 字のとき 768 では表の中身が 802px になり、枠 672px から 130px 横へ
 * 送れた（.table-scroll の overflow-x: auto）。横に送れることは見て分からないので、
 * 院名の列だけ折り返しを許して枠の中に収める（647 行の nowrap をこの列だけ打ち消す）。
 * 列の幅は自動なので、余裕のある 1280 では今までどおり 1 行のまま（実測で全セル同値）。
 * 560px 以下の札（v87 S-02）は別の規則なので変わらない。 */
.site-table td.col-name { white-space: normal; overflow-wrap: anywhere; }
.site-table td.col-name a { white-space: normal; }

/* ══ v95 V-03(2026-09-18)4 つのタブの注記を、狭い画面では短い 1 行に ══════
 * v94 U-01 で入れた「どちらを数えているか」の注記は、375 では 2〜3 行になり、
 * ページ別の面が 194.6 → 262.1px(+67.5)、端末・参照元が 155.2 → 203.5px、
 * 時間帯が 269.2 → 288.4px と高くなっていた(表が 1 画面目から押し出される)。
 * 480px 以下では同じ意味の短い 1 行(site.html の .hint-short)に差し替える。
 * 文は長短 2 つとも文書に置き、ここで幅によって出し分けるだけ。
 * 釦や details は足さない(押す場所= 44px の対象を増やさないため)。
 * 481px 以上は今までどおり長い文で、見た目・高さは v94 と同じ。 */
.hint-short { display: none; }

@media (max-width: 480px) {
  .hint-long { display: none; }
  .hint-short { display: inline; }
  /* 1 行になったぶん、注記と表・グラフの間も詰める(面の高さを v93 + 24px 以内にする)。
     この 4 つのタブの中だけ= ほかの p.hint の見え方は変えない。 */
  .tab-panel p.hint { margin-bottom: 4px; }
}
