/*
 * Canjii 管理画面の共通スタイル。
 * 配色は oiwaii のデザイントークン(oiwaii-produce-frontend の styles/variable.scss)を踏襲する。
 * ブランドの基調はシャンパンゴールド(#c9b15e) × アイボリー背景 × チャコールの文字。
 * 外部リソース(Webフォント/CDN)は読み込まず、端末のフォントにフォールバックする。
 */

:root {
  /* ブランド */
  --brand-primary: #c9b15e;        /* シャンパンゴールド */
  --brand-primary-dark: #b8a054;   /* ホバー等の一段濃いゴールド */
  --brand-secondary: #585858;      /* チャコール(見出し・ナビ) */
  --brand-tertiary: #cac6bb;       /* くすんだトープ(罫線・補助) */

  /* 背景 */
  --bg-body: #fffdf5;              /* アイボリー */
  --bg-surface: #ffffff;           /* カード・テーブル面 */
  --bg-muted: #f5f5f5;             /* 見出しセル・薄い面 */
  --bg-hover: #faf7ec;             /* 行ホバー(ゴールド寄りの極薄) */

  /* 文字 */
  --text-primary: #585858;
  --text-secondary: #6d6d6d;
  --text-muted: #808080;

  /* 罫線 */
  --border: #e4e0d6;
  --border-strong: #d9d5c9;

  /* セマンティック */
  --success: #02b966;
  --success-bg: #e8f8f0;
  --danger: #ff5757;
  --danger-bg: #fdeeee;
  --info: #00a5b5;
  --info-bg: #e5f6f8;

  --shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 28px rgba(88, 88, 88, 0.14);
  --radius: 8px;
  --radius-sm: 5px;
  --transition: cubic-bezier(0.445, 0.05, 0.55, 0.95) 0.2s;

  --font-sans: "Noto Sans JP", system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  --font-serif: "Shippori Mincho", "Noto Serif JP", "Hiragino Mincho ProN", "Yu Mincho", serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-primary);
  background: var(--bg-body);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary-dark); }
a:hover { color: var(--brand-primary); }

h1 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--brand-secondary);
  margin: 0 0 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--brand-primary);
  display: flex;
  align-items: center;
  gap: 12px;
}

h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--brand-secondary);
  margin: 28px 0 12px;
}

/* ===== アプリシェル(サイドバー + コンテンツ) ===== */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--brand-secondary);
  padding: 22px 22px 18px;
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
}
.sidebar-brand span { display: block; font-size: 11px; font-family: var(--font-sans); color: var(--text-muted); letter-spacing: 0.08em; }

.sidebar-nav { padding: 14px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: color var(--transition), background var(--transition);
}
.nav-item:hover { background: var(--bg-muted); color: var(--brand-secondary); }
.nav-item.is-active {
  background: var(--bg-hover);
  color: var(--brand-primary-dark);
  border-left-color: var(--brand-primary);
}
.nav-item .nav-label { flex: 1; }
.nav-item .nav-count {
  min-width: 22px;
  text-align: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
/* 手動対応など「人手が要る」件数は注意色にする */
.nav-item .nav-count--warn { background: var(--danger); }

.nav-divider { height: 1px; background: var(--border); margin: 12px 8px; }

.sidebar-foot { padding: 16px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; word-break: break-all; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

main {
  padding: 32px 32px 64px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

/* ===== モードバナー(常時表示・非解除) ===== */
.mode-banner {
  padding: 9px 24px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  position: sticky;
  top: 0;
  z-index: 50;
}
.mode-banner--live { background: var(--danger); color: #fff; }
.mode-banner--dry { background: var(--info-bg); color: #067885; border-bottom: 1px solid #b4e4ea; }

/* ===== ページ見出し ===== */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.page-head h1 { margin-bottom: 6px; }
.crumb { font-size: 13px; margin: 0 0 6px; }
/* 別の箱で送信済み等の注意(二重送信の警告)。送信は可だが目立たせる。 */
.cell-warning { margin-top: 4px; font-size: 12px; color: #8a6d1f; }
.page-sub { color: var(--text-muted); font-size: 13px; margin: 0; }

/* ===== フラッシュ ===== */
.flash {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  border: 1px solid transparent;
}
.flash-notice { background: var(--success-bg); color: #05784a; border-color: #b6e6cf; }
.flash-alert { background: var(--danger-bg); color: #c0392b; border-color: #f5c4c4; }

/* ===== テーブル ===== */
.table-scroll {
  overflow-x: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
table { border-collapse: collapse; width: 100%; }
th, td {
  padding: 10px 14px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
thead th {
  background: var(--bg-muted);
  color: var(--brand-secondary);
  font-weight: 600;
  white-space: nowrap;
  border-bottom: 2px solid var(--border-strong);
}
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-hover); }
tbody tr:last-child td { border-bottom: none; }

/* ===== ステータスバッジ ===== */
.status-badge {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border-strong);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}
/* Submission: success(送信成功) */
.status-badge--success { background: var(--success-bg); color: #05784a; border-color: #b6e6cf; }
/* Submission: failed(失敗) */
.status-badge--failed { background: var(--danger-bg); color: #c0392b; border-color: #f5c4c4; }
/* Submission: needs_manual(手動対応=ブランドゴールドで注意喚起) */
.status-badge--needs_manual { background: #fbf3dd; color: #8a6d1f; border-color: #ecdca6; }
/* Submission: processing(送信中=進行中の青) */
.status-badge--processing { background: var(--info-bg); color: #067885; border-color: #b4e4ea; }
/* Submission: ready(ドライラン済・送信可=淡い成功色) */
.status-badge--ready { background: var(--success-bg); color: #05784a; border-color: #b6e6cf; }
/* dry-run 併記バッジ(グレー) */
.status-badge--dry_run { background: var(--bg-surface); color: var(--text-muted); border-color: var(--border); }
/* 中立: unsent / skipped_duplicate はデフォルトのグレー */

/* 送信日など、バッジに添える日付 */
.state-date { margin-left: 8px; font-size: 12px; color: var(--text-muted); }
/* 状態セルの行内アクション(手動で設定 等) */
.state-action { display: inline-block; margin-left: 8px; font-size: 12px; }
/* 履歴の要手動行に並べる救済アクション群 */
.state-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.state-actions .state-action { margin-left: 0; }
/* ドライラン済 → 確認画面へ誘導する強調リンク */
.state-action--emphasis { font-weight: 600; color: var(--brand-primary-dark); }
/* 送信内容の入力プレビュー(1項目=ラベル+値で読みやすく) */
.fill-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.fill-list--wide { max-width: 720px; }
.fill-item {
  display: grid; grid-template-columns: 160px 1fr; gap: 4px 16px; align-items: baseline;
  padding-bottom: 10px; border-bottom: 1px dashed var(--border);
}
.fill-item:last-child { border-bottom: none; padding-bottom: 0; }
.fill-key { display: flex; flex-direction: column; gap: 2px; }
.fill-label { font-weight: 600; color: var(--brand-secondary); word-break: break-word; }
.fill-selector { font-family: monospace; font-size: 11px; color: var(--text-muted); word-break: break-all; }
.fill-value { color: var(--text-primary); white-space: pre-wrap; word-break: break-word; max-height: 9em; overflow-y: auto; }
/* 失敗理由セル(全文を折り返して見せる) */
.reason-cell { white-space: normal; word-break: break-word; max-width: 320px; }

/* 案内ボックス(ドライラン優先の運用ルールの明示など) */
.notice-box {
  background: var(--info-bg); border: 1px solid #b4e4ea; border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 24px;
}
.notice-box--warn { background: #fbf3dd; border-color: #ecdca6; }
.notice-box-title { margin: 0 0 6px; font-weight: 700; color: var(--brand-secondary); }
.notice-box-body { margin: 0; font-size: 14px; color: var(--text-secondary); }

/* ドライラン確認画面: 一括操作バーと結果カード */
.bulk-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px;
  padding: 14px 18px; margin-bottom: 20px;
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  position: sticky; top: 0; z-index: 10;
}
/* 削除系。控えめな赤リンク/ボタン */
.linklike-danger {
  background: none; border: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--danger); text-decoration: underline;
}
.btn-danger-ghost {
  margin-left: auto; color: var(--danger); border-color: var(--border);
}
.btn-danger-ghost:hover { border-color: var(--danger); }

/* ドライラン実行の切替(常に1実行だけ表示) */

.review-cards { display: flex; flex-direction: column; gap: 16px; }
.review-card {
  background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.review-card-head {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 8px 16px; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.review-card-select { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.review-card-name { font-family: var(--font-serif); font-size: 17px; font-weight: 600; color: var(--brand-secondary); }
.review-card-meta { font-size: 13px; color: var(--text-muted); display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.review-card-time { color: var(--text-muted); }
.review-card .fill-list { max-width: none; }

/* 確認画面のセクション */
.review-block { margin-bottom: 28px; }
.review-block h2 { margin: 0 0 10px; }
.review-body {
  margin: 0; padding: 16px 18px; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); white-space: pre-wrap; word-break: break-word;
  font-family: var(--font-sans); font-size: 14px; line-height: 1.8; color: var(--text-primary);
}

@media (max-width: 560px) {
  .fill-item { grid-template-columns: 1fr; }
}
/* 必須マーク */
.required-mark { margin-left: 6px; font-size: 11px; color: var(--danger); font-weight: 600; }
/* 一覧の件数メタ */
.list-meta { font-size: 13px; color: var(--text-muted); display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* ページ送り */
.pager { display: inline-flex; gap: 8px; align-items: center; }
.pager-link { font-size: 13px; padding: 4px 12px; border: 1px solid var(--border); border-radius: 6px; text-decoration: none; }
.pager-link--disabled { color: var(--text-muted); opacity: 0.5; }
/* タイミングタグ用の中立バッジ(要手動の警告色を流用しない) */
.status-badge--timing { background: var(--bg-surface); color: var(--text-muted); border-color: var(--border); }

/* 設定画面(送信者情報/文面テンプレート)を行き来するタブ */
.settings-tabs { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.settings-tab {
  padding: 10px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.settings-tab:hover { color: var(--brand-secondary); }
.settings-tab.is-active { color: var(--brand-primary-dark); border-bottom-color: var(--brand-primary); }

/* 設定など単票フォームのカード */
.form-card {
  max-width: 560px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 26px;
}
.form-card > form > div { margin-bottom: 16px; }
.form-card label { display: block; margin-bottom: 6px; }
.form-card input[type="text"],
.form-card input[type="email"] { width: 100%; }
.field-hint { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
/* 設定フォームのセクション見出し・2カラム行 */
.form-section { font-size: 14px; color: var(--brand-secondary); margin: 22px 0 12px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.form-section:first-of-type { margin-top: 0; }
.form-row { display: flex; gap: 16px; }
.form-row > div { flex: 1; margin-bottom: 16px; }
/* アクションボタン脇の補足 */
.action-hint { font-size: 12px; color: var(--text-muted); }

/* 送信前確認: 各社フォームに入る値のまとめ */
.fill-values {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px;
  margin-bottom: 20px;
}
.fill-values h2 { font-size: 15px; margin: 0 0 8px; }
.fill-values-note { font-size: 12px; color: var(--text-muted); margin: 0 0 14px; }
.fill-values-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 20px; margin: 0; }
.fill-values-list > div { display: flex; gap: 10px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.fill-values-list dt { min-width: 96px; color: var(--text-muted); font-size: 13px; }
.fill-values-list dd { margin: 0; font-size: 13px; font-weight: 600; color: var(--brand-secondary); word-break: break-all; }

/* ===== 統計カード(サマリー帯) ===== */
.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.stat-card--accent { border-left: 4px solid var(--brand-primary); }
.stat-value {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  line-height: 1.1;
  color: var(--brand-secondary);
  font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }

/* ===== アクションバー(主操作をまとめる) ===== */
.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

/* ===== 空状態 ===== */
.empty {
  text-align: center;
  padding: 56px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.empty-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: var(--success-bg);
  color: var(--success);
  font-size: 28px;
  line-height: 56px;
  font-weight: 700;
}
.empty h2 { color: var(--brand-secondary); margin: 0 0 8px; }
.empty p { color: var(--text-muted); font-size: 13px; max-width: 460px; margin: 0 auto 20px; }

/* ===== 通知カード(準備待ちなど、次の一手を促す) ===== */
.notice-card {
  text-align: center;
  padding: 40px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.notice-card-icon { font-size: 32px; margin-bottom: 10px; }
.notice-card h2 { color: var(--brand-secondary); margin: 0 0 8px; }
.notice-card p { color: var(--text-muted); font-size: 13px; max-width: 480px; margin: 0 auto 16px; }
.notice-card-note { font-size: 12px; margin-top: 14px; margin-bottom: 0; }

/* ===== 文面プレビュー(行内展開) ===== */
.preview summary { cursor: pointer; color: var(--text-secondary); font-size: 13px; }
.preview summary:hover { color: var(--brand-primary-dark); }
.preview-body {
  margin: 10px 0 2px;
  padding: 12px 14px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  max-width: 520px;
}

/* テーブルの補助セル表現 */
.cell-strong { font-weight: 600; color: var(--brand-secondary); }
td.muted, .muted { color: var(--text-muted); }
.col-action { white-space: nowrap; width: 1%; }
.cell-actions { white-space: nowrap; display: flex; gap: 12px; align-items: center; }

/* ===== ボタン ===== */
button,
input[type="submit"],
.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--brand-primary);
  background: var(--brand-primary);
  color: #fff;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
  text-decoration: none;
  display: inline-block;
}
button:hover,
input[type="submit"]:hover,
.btn:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }

/* 主ボタン(既定のゴールドを明示クラスでも使える) */
.btn-primary { background: var(--brand-primary); border-color: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-primary-dark); border-color: var(--brand-primary-dark); }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-block { width: 100%; }

/* 副次的・破壊的なアクションの控えめ表現 */
.btn-secondary,
.btn-ghost,
form.inline button {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
}
.btn-secondary:hover,
.btn-ghost:hover,
form.inline button:hover {
  background: var(--bg-muted);
  color: var(--brand-secondary);
  border-color: var(--brand-tertiary);
}

form.inline { display: inline; }

/* ===== フォーム / 入力 ===== */
label { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
textarea,
select {
  font-family: inherit;
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text-primary);
  transition: border-color var(--transition), box-shadow var(--transition);
  max-width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(201, 177, 94, 0.2);
}

/* 絞り込みフォーム: エリア / 短い項目 / トグル+ボタン を縦に3段で並べる */
.filters {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.filters label { display: inline-block; margin-bottom: 4px; }
/* 短い入力項目の横並び(折り返しあり、下端そろえ) */
.filter-fields { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
/* トグル(チェックボックス)と実行ボタン */
.filter-actions { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.filter-check { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 0; }
/* 本番送信の2段確認チェック(注意色) */
.live-ack { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font-weight: 600; color: #c0392b; }

/* エリア・都道府県: 地方ごとに区切り(地方見出し=一括トグル)、その地方の県を整列グリッドで表示 */
.area-hint { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.pref-regions { display: flex; flex-direction: column; gap: 14px; }
.pref-region { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start; max-width: 860px; }
/* 地方見出し(その地方を一括トグル)。左端に固定幅で置き、県グリッドと役割を分ける */
.pref-region-head {
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--brand-secondary);
  background: var(--bg-hover);
  border: 1px solid var(--brand-tertiary);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
}
.pref-region-head:hover { border-color: var(--brand-primary); background: #f3edd8; }
/* すべて解除 */
.area-clear {
  margin-top: 12px;
  padding: 4px 12px;
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.area-clear:hover { border-color: var(--brand-primary); }
/* 都道府県: 列がそろうグリッド。チェックボックスは隠しラベルをボタン表示、選択中はブランド色 */
.pref-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 6px;
}
.pref-chip { position: relative; margin: 0; }
.pref-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.pref-chip span {
  display: block;
  text-align: center;
  padding: 5px 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
}
.pref-chip span:hover { border-color: var(--brand-primary); }
.pref-chip input:checked + span {
  background: var(--brand-primary-dark);
  border-color: var(--brand-primary-dark);
  color: #fff;
}
.pref-chip input:focus-visible + span { outline: 2px solid var(--brand-primary); outline-offset: 1px; }

/* ===== 本文コンテンツ ===== */
main p { margin: 0 0 14px; }
main ul { margin: 0 0 16px; padding-left: 1.4em; }
main li { margin-bottom: 4px; }
main section { margin-bottom: 36px; }

/* 本文中のリンク(ナビ・ボタンは除外)。既定の青下線をやめ、ゴールドの上品なリンクに。
   ボタン見た目のリンク(.btn-primary 等)は各自の色を保つため除外する。 */
main a:not(.btn):not(.btn-primary):not(.btn-secondary):not(.btn-ghost):not(.nav-card),
.auth-card a {
  color: var(--brand-primary-dark);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}
main a:not(.btn):not(.nav-card):hover,
.auth-card a:hover { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

/* 一覧・トップへ戻る系リンク */
.link-back { font-size: 13px; color: var(--text-secondary); }
.link-back::before { content: "← "; }

/* 見出し直下のアクションをまとめるツールバー */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 20px; }

/* button_to はフォームを生成する。ボタンを行内に並べる */
form.button_to { display: inline-block; margin: 0 8px 8px 0; }

/* 控えめ・小さめのボタン(「最新の状態に更新」「除外する」等の inline) */
button.inline,
.inline button {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-strong);
  padding: 6px 14px;
  font-size: 13px;
}
button.inline:hover,
.inline button:hover { background: var(--bg-muted); color: var(--brand-secondary); border-color: var(--brand-tertiary); }

/* ファイル入力(CSV取込) */
input[type="file"] { font-family: inherit; font-size: 14px; color: var(--text-secondary); }
input[type="file"]::file-selector-button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  margin-right: 12px;
  padding: 8px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--brand-secondary);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
input[type="file"]::file-selector-button:hover { background: var(--bg-muted); border-color: var(--brand-primary); }

/* 単票フォーム(絞り込み以外)の各行の余白 */
main form:not(.filters) > div { margin-bottom: 16px; }
main form:not(.filters) label { display: inline-block; margin-bottom: 6px; }

/* ===== CSV取込(アップロードカード) ===== */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.upload-card { max-width: 620px; }

.dropzone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-surface);
  padding: 44px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.dropzone:hover { border-color: var(--brand-primary); background: var(--bg-hover); }
.dropzone.is-dragover { border-color: var(--brand-primary); background: var(--bg-hover); border-style: solid; }
.dropzone.has-file { border-color: var(--success); background: var(--success-bg); border-style: solid; }

.dropzone-icon {
  width: 52px; height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--brand-primary-dark);
  font-size: 26px; line-height: 52px; font-weight: 700;
}
.dropzone.has-file .dropzone-icon { background: #fff; color: var(--success); }
.dropzone-title { font-size: 15px; font-weight: 600; color: var(--brand-secondary); margin-bottom: 4px; }
.dropzone-hint { font-size: 13px; color: var(--text-muted); }
.dropzone-link { color: var(--brand-primary-dark); font-weight: 600; text-decoration: underline; }
.dropzone-filename { margin-top: 14px; font-size: 13px; font-weight: 600; color: var(--text-secondary); word-break: break-all; }
.dropzone.has-file .dropzone-filename { color: #05784a; }

.upload-actions { display: flex; align-items: center; gap: 20px; margin-top: 20px; }
button[type="submit"]:disabled,
input[type="submit"]:disabled { opacity: 0.5; cursor: not-allowed; }

.hint-box {
  max-width: 620px;
  margin-top: 32px;
  padding: 18px 22px;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.hint-box h2 { font-size: 14px; margin: 0 0 10px; }
.hint-box ol { margin: 0; padding-left: 1.3em; }
.hint-box li { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: var(--bg-muted);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--brand-secondary);
}

/* ===== ログイン等(application レイアウト) ===== */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 36px 32px;
}
.auth-card h2 {
  font-family: var(--font-serif);
  text-align: center;
  margin: 0 0 24px;
}
.auth-card .field { margin-bottom: 16px; }
.auth-card .field label { display: block; margin-bottom: 6px; }
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"] { width: 100%; }
.auth-card .actions { margin-top: 8px; }
.auth-card .actions input[type="submit"],
.auth-card .actions button { width: 100%; }
.auth-card .field-hint { margin-top: 6px; }
.auth-card .field-inline { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; }
.auth-card .field-inline input { width: auto; margin: 0; }
.auth-links { margin-top: 20px; text-align: center; display: flex; gap: 16px; justify-content: center; }
.auth-card .error-list { margin: 0; padding-left: 18px; }
.auth-card .error-list li { margin: 2px 0; }
