/* 代理店監査システム Web版 スタイル
   画面はデスクトップ版の情報量を保ちつつ、一覧の視認性を優先した構成。
   印刷（回答内容確認書）でも崩れないよう @media print を用意している。 */

:root {
  --fg: #1c2530;
  --fg-sub: #5a6672;
  --line: #d6dde5;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --accent: #1a3a6b;
  --accent-weak: #e8eef8;
  --ok: #006400;
  --warn: #b35a00;
  --err: #c00000;
  --sev-bg: #ffe6e6; --sev-fg: #c00000;
  --imp-bg: #fff4e0; --imp-fg: #b35a00;
  --gen-bg: #eef3fb; --gen-fg: #33507a;
  --atr-bg: #f0f0f0; --atr-fg: #666666;
  /* 見どころ画面の配色（デスクトップ版 modules/guidance.py と同一） */
  --g-title: #1f3864;   /* 項目名・点数帯 */
  --g-head:  #2e5fa3;   /* 小見出し */
  --g-alert: #c00000;   /* 留意事項・必須注意 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Meiryo", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 14px;
  color: var(--fg);
  background: var(--bg);
}

a { color: var(--accent); }

/* ── ヘッダ・ナビ ───────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; background: var(--accent); color: #fff;
}
.topbar .brand a { color: #fff; text-decoration: none; font-size: 18px; font-weight: bold; }
.topbar .ver { margin-left: 12px; font-size: 12px; opacity: .85; }
.yearform { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.yearform select { padding: 4px 6px; font-size: 14px; }

.mainnav {
  display: flex; flex-wrap: wrap; gap: 2px;
  background: #24446f; padding: 0 12px;
}
.mainnav a {
  color: #dce6f4; text-decoration: none; padding: 9px 14px; font-size: 13px;
}
.mainnav a:hover { background: #34588a; color: #fff; }
.mainnav a.on { background: var(--bg); color: var(--accent); font-weight: bold; }

main { padding: 16px 18px 40px; max-width: 1500px; margin: 0 auto; }

.foot {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 10px 18px; font-size: 12px; color: var(--fg-sub);
  border-top: 1px solid var(--line); background: #fff;
}
.foot .note { color: var(--warn); }

/* ── パネル・見出し ─────────────────────────────────────── */
h1 { font-size: 20px; margin: 4px 0 14px; }
h2 { font-size: 16px; margin: 22px 0 8px; border-left: 5px solid var(--accent); padding-left: 8px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--accent); }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 14px 16px; margin-bottom: 16px;
}
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.muted { color: var(--fg-sub); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; }
.stat .label { font-size: 12px; color: var(--fg-sub); }
.stat .value { font-size: 24px; font-weight: bold; color: var(--accent); }
.stat .sub { font-size: 12px; color: var(--fg-sub); }

/* ── フラッシュメッセージ ───────────────────────────────── */
.flashes { margin-bottom: 12px; }
.flash { padding: 10px 14px; border-radius: 4px; margin-bottom: 6px; font-size: 13px; }
.flash.ok    { background: #e8f5e9; border: 1px solid #99c9a1; color: var(--ok); }
.flash.warn  { background: #fff8e1; border: 1px solid #e3c778; color: var(--warn); }
.flash.error { background: #fdecea; border: 1px solid #e6a2a2; color: var(--err); }

/* ── フォーム ───────────────────────────────────────────── */
label { font-size: 13px; }
input[type=text], input[type=number], input[type=date], input[type=search],
select, textarea {
  font-family: inherit; font-size: 14px; padding: 5px 7px;
  border: 1px solid #b9c3ce; border-radius: 3px; background: #fff; color: var(--fg);
}
textarea { width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fb3e0; outline-offset: 0; }

.btn {
  display: inline-block; padding: 7px 14px; font-size: 13px; font-family: inherit;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  border-radius: 4px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: #24558f; }
.btn.sub { background: #fff; color: var(--accent); }
.btn.sub:hover { background: var(--accent-weak); }
.btn.danger { background: #a52020; border-color: #a52020; }
.btn.danger:hover { background: #c03030; }
.btn.small { padding: 3px 9px; font-size: 12px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.toolbar .spacer { flex: 1; }

/* ── テーブル ───────────────────────────────────────────── */
table.list { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.list th, table.list td { border: 1px solid var(--line); padding: 5px 8px; text-align: left; vertical-align: top; }
table.list th { background: var(--accent-weak); color: var(--accent); font-weight: bold; white-space: nowrap; }
table.list tr:nth-child(even) td { background: #fafbfd; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list td.center, table.list th.center { text-align: center; }

.badge { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.badge.answered { background: #e8f5e9; color: var(--ok); border: 1px solid #99c9a1; }
.badge.draft    { background: #fff8e1; color: var(--warn); border: 1px solid #e3c778; }
.badge.unanswered { background: #f1f3f5; color: var(--fg-sub); border: 1px solid #ccd2d8; }
.badge.target   { background: var(--accent-weak); color: var(--accent); border: 1px solid #a8c0e0; }

.risk { display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: 11px; white-space: nowrap; }
.risk.sev { background: var(--sev-bg); color: var(--sev-fg); }
.risk.imp { background: var(--imp-bg); color: var(--imp-fg); }
.risk.gen { background: var(--gen-bg); color: var(--gen-fg); }
.risk.atr { background: var(--atr-bg); color: var(--atr-fg); }

.pager { display: flex; gap: 6px; align-items: center; margin-top: 10px; font-size: 13px; }

/* ── 監査回答入力 ───────────────────────────────────────── */
.qtable { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
.qtable th, .qtable td { border: 1px solid var(--line); padding: 5px 7px; vertical-align: top; }
.qtable th { background: var(--accent-weak); color: var(--accent); font-size: 12px; white-space: nowrap; }
.qtable tr.section td { background: #eef2f7; color: var(--accent); font-weight: bold; }
.qtable .qname { font-weight: bold; }
.qtable .checkitem { color: var(--fg-sub); font-size: 12px; white-space: pre-wrap; }
.qtable input.imp { width: 62px; text-align: right; font-size: 15px; }
.qtable input.rem { width: 100%; }
.qtable td.pt { text-align: right; white-space: nowrap; color: var(--ok); font-weight: bold; }
.qtable tr.na-on td { background: #f4f4f4; color: #888; }
.qtable tr.need-remarks input.rem { background: #fff8d0; }

.summary-bar {
  position: sticky; bottom: 0; z-index: 5;
  background: #f7f9fc; border: 1px solid var(--line); border-top: 2px solid var(--accent);
  padding: 8px 12px; font-weight: bold; color: var(--accent);
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
}
.summary-bar .warnpart { color: var(--err); }

.infogrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 18px; font-size: 13px; }
.infogrid div span.k { color: var(--fg-sub); margin-right: 6px; }

/* ── モーダル（見どころ） ───────────────────────────────── */
.modal-back {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: none; align-items: center; justify-content: center; z-index: 50;
}
.modal-back.show { display: flex; }
.modal {
  background: #fff; border-radius: 6px; max-width: 820px; width: 92%;
  max-height: 86vh; overflow: auto; padding: 18px 22px;
}
.modal h3 {
  margin: 0 0 10px; padding-bottom: 8px; font-size: 15px;
  color: var(--g-title); border-bottom: 2px solid var(--accent);
}

/* 見どころ本文（配色はデスクトップ版に合わせる。
   見出し=青／項目名・点数帯=濃紺／留意事項=赤／条文=灰） */
.g-head {
  background: var(--accent-weak); border-left: 5px solid var(--g-title);
  border-radius: 4px; padding: 9px 12px; margin-bottom: 12px;
}
.g-title { font-size: 15px; font-weight: bold; color: var(--g-title); line-height: 1.5; }
.g-meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.g-base { color: var(--g-alert); font-weight: bold; font-size: 12px; }

.g-sec { margin-bottom: 14px; }
.g-sec h4 {
  margin: 0 0 5px; font-size: 13px; font-weight: bold; color: var(--g-head);
}
.g-body { margin: 0; line-height: 1.7; color: var(--fg); }

.g-look { margin: 0; padding: 0; list-style: none; }
.g-look li {
  position: relative; padding: 5px 8px 5px 34px; line-height: 1.65;
  border-bottom: 1px dotted var(--line);
}
.g-look li:last-child { border-bottom: none; }
.g-num {
  position: absolute; left: 6px; top: 5px;
  display: inline-block; min-width: 20px; height: 20px; line-height: 20px;
  text-align: center; border-radius: 50%; font-size: 11px; font-weight: bold;
  background: var(--g-head); color: #fff;
}

.g-anchor { width: 100%; border-collapse: collapse; font-size: 13px; }
.g-anchor td { padding: 5px 8px; border-bottom: 1px solid var(--line); line-height: 1.6; }
.g-anchor tr:last-child td { border-bottom: none; }
.g-anchor td.band {
  white-space: nowrap; width: 1%; font-weight: bold; text-align: center;
  color: var(--g-title); background: var(--accent-weak); border-radius: 3px;
}
.g-anchor td.blabel { white-space: nowrap; font-weight: bold; color: var(--g-head); }

.g-note {
  margin: 0; padding: 8px 10px; line-height: 1.7;
  color: var(--g-alert); background: #fdecea; border-left: 4px solid var(--g-alert);
  border-radius: 3px;
}
.g-law { margin: 0; color: var(--fg-sub); font-size: 12px; }
.g-warn {
  margin: 14px 0 0; padding: 9px 12px; font-size: 12.5px; line-height: 1.7;
  color: var(--g-alert); background: #fff5f5; border: 1px solid #e6a2a2;
  border-radius: 4px; font-weight: bold;
}
.modal .risk { font-size: 12px; padding: 2px 8px; }

/* ── 印刷 ───────────────────────────────────────────────── */
@media print {
  .topbar, .mainnav, .foot, .toolbar, .flashes, .summary-bar { display: none !important; }
  body { background: #fff; font-size: 11px; }
  main { padding: 0; max-width: none; }
  .panel { border: none; padding: 0; }
  table.list, .qtable { font-size: 10px; }
}

/* ── コード直接検索（代理店CD＋支店CD） ─────────────────── */
.codepanel { background: var(--accent-weak); border-color: #a8c0e0; padding: 10px 14px; }
.codesearch { margin: 0; gap: 6px; }
.codesearch strong { color: var(--accent); margin-right: 6px; }
.codesearch input[type=text] {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 17px; letter-spacing: 2px; text-align: center; padding: 5px 4px;
}
.codesearch span { color: var(--fg-sub); }

/* ── ログイン画面 ───────────────────────────────────────────
   意匠は既存システム（audit-test）のログイン画面に合わせている。
   入口を分かりやすく統一し、利用者が別システムと誤認しないようにするため。 */
body.login-page {
  background: linear-gradient(135deg, #1e3a5f 0%, #2a4d7a 50%, #1e3a5f 100%);
  min-height: 100vh;
}
.login-card {
  background: #fff; border-radius: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  padding: 40px 36px 32px; max-width: 380px; margin: 8vh auto;
  border-top: 3px solid #c9a227;
}
.login-card .brand { text-align: center; margin-bottom: 28px; }
.login-card .brand-mark {
  display: inline-block; width: 56px; height: 56px; line-height: 56px;
  background: var(--accent); color: #fff;
  font-size: 22px; font-weight: 600; border-radius: 50%; margin-bottom: 13px;
}
.login-card h4 {
  margin: 0; font-size: 18px; color: var(--accent); letter-spacing: .04em;
}
.login-card .subtitle { color: var(--fg-sub); font-size: 13px; margin-top: 3px; }
.lf-label { display: block; font-size: 13px; margin-bottom: 5px; color: var(--fg); }
.lf-input {
  width: 100%; font-size: 20px; letter-spacing: 4px; text-align: center;
  padding: 9px 10px; margin-bottom: 16px;
  font-family: "Consolas", "Courier New", monospace;
}
.lf-btn { width: 100%; padding: 10px; font-size: 15px; }
.lf-note {
  color: var(--fg-sub); font-size: 12px; text-align: center; margin: 26px 0 0;
}
.lf-ver { color: #aab2bb; font-size: 11px; text-align: center; margin: 6px 0 0; }
.login-card .flash { margin-bottom: 14px; }

/* ナビ右端のログアウト（他のメニューと同じ見た目のボタン） */
.navlogout { margin-left: auto; display: flex; align-items: center; }
.navlogout button {
  background: none; border: none; cursor: pointer;
  color: #dce6f4; font-family: inherit; font-size: 13px; padding: 9px 14px;
}
.navlogout button:hover { background: #34588a; color: #fff; }
