@charset "UTF-8";

/* ============================================================
   DSC 定期申請アプリ モック 共通スタイル
   CDN 不使用・自前CSSのみ(オフライン動作)
   ブランドカラー(髙尾さん提供):
     ヘッダー背景 #D9E1F2 / アクセント #8497B0 / ネイビー系グラデーション
     一覧ヘッダー #829ebc〜#225588 / 合計強調 #225588〜#000066
     主要ボタン #064fda(白文字) / フォント ゴシック体
   ============================================================ */

:root {
  --brand-header-bg: #D9E1F2;
  --brand-accent: #8497B0;
  --brand-navy-from: #225588;
  --brand-navy-to: #000066;
  --table-head-from: #829ebc;
  --table-head-to: #225588;
  --btn-primary: #064fda;
  --border: #c7cfdd;
  --text: #1f2733;
  --muted: #5b6675;
  --bg: #eef2f8;
  --panel: #ffffff;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Meiryo", "メイリオ", "Hiragino Kaku Gothic ProN",
    "MS PGothic", "Yu Gothic", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  font-size: 14px;
}

a {
  color: #064fda;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ===== ヘッダー(青系ネイビーグラデーション) ===== */
.site-header {
  background: linear-gradient(180deg, var(--brand-header-bg) 0%, var(--brand-accent) 60%, var(--brand-navy-from) 100%);
  color: #ffffff;
  border-bottom: 3px solid var(--brand-navy-to);
  box-shadow: 0 2px 6px rgba(0, 0, 102, 0.25);
}

.site-header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.site-title {
  margin: 0;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.04em;
  color: #11224d;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-user {
  text-align: right;
  font-size: 13px;
  color: #11224d;
}

.site-user .user-name {
  font-weight: bold;
}

.role-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #ffffff;
  color: var(--brand-navy-from);
  font-size: 12px;
  border: 1px solid var(--brand-navy-from);
}

/* ===== ナビ(ロール別) ===== */
.site-nav {
  background: linear-gradient(90deg, var(--brand-navy-from) 0%, var(--brand-navy-to) 100%);
}

.site-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.site-nav a {
  display: inline-block;
  padding: 10px 16px;
  color: #e7ecf6;
  font-size: 14px;
  text-decoration: none;
  border-bottom: 3px solid transparent;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.12);
  text-decoration: none;
}

.site-nav a.active {
  color: #ffffff;
  font-weight: bold;
  border-bottom-color: #8fb4ff;
  background: rgba(255, 255, 255, 0.08);
}

.site-nav .nav-spacer {
  margin-left: auto;
}

.logout-form {
  margin: 0;
  display: inline;
}

.logout-form button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #e7ecf6;
  padding: 5px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  margin: 6px 0;
}

.logout-form button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* ===== レイアウト本体 ===== */
.site-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.page-title {
  margin: 0;
  font-size: 22px;
  color: var(--brand-navy-from);
  border-left: 6px solid var(--brand-navy-from);
  padding-left: 10px;
}

.page-sub {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.panel-title {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--brand-navy-from);
  border-bottom: 2px solid #dbe3ef;
  padding-bottom: 6px;
}

/* ===== フラッシュ / エラー / 情報メッセージ ===== */
.flash {
  background: #e8f5e9;
  border: 1px solid #66bb6a;
  border-left: 6px solid #2e7d32;
  color: #1b5e20;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.alert-error {
  background: #fdecea;
  border: 1px solid #ef9a9a;
  border-left: 6px solid #c62828;
  color: #b71c1c;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.alert-info {
  background: #e8eef9;
  border: 1px solid #9db4dd;
  border-left: 6px solid var(--brand-navy-from);
  color: #16335c;
  padding: 10px 14px;
  border-radius: 4px;
  margin-bottom: 16px;
}

.note {
  color: var(--muted);
  font-size: 12.5px;
}

/* ===== テーブル ===== */
.table-wrap {
  overflow-x: auto;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 13.5px;
}

table.grid thead th {
  background: linear-gradient(180deg, var(--table-head-from) 0%, var(--table-head-to) 100%);
  color: #ffffff;
  text-align: left;
  padding: 9px 10px;
  border: 1px solid #5e7596;
  white-space: nowrap;
  font-weight: bold;
}

table.grid tbody td {
  padding: 8px 10px;
  border: 1px solid #d6deea;
  vertical-align: top;
}

table.grid tbody tr:nth-child(even) {
  background: #f5f8fc;
}

table.grid tbody tr:hover {
  background: #eaf1fb;
}

table.grid .num {
  text-align: right;
  white-space: nowrap;
}

table.grid .empty {
  text-align: center;
  color: var(--muted);
  padding: 24px 10px;
}

/* 合計/強調行ヘッダー */
table.grid thead th.emphasis,
.emphasis-head {
  background: linear-gradient(180deg, var(--brand-navy-from) 0%, var(--brand-navy-to) 100%);
  color: #fff;
}

/* ===== 定義リスト(詳細表示) ===== */
dl.detail {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0;
  margin: 0;
  border: 1px solid #d6deea;
  border-radius: 4px;
  overflow: hidden;
}

dl.detail dt {
  background: #eef2f8;
  padding: 9px 12px;
  font-weight: bold;
  color: #2a3b57;
  border-bottom: 1px solid #d6deea;
}

dl.detail dd {
  margin: 0;
  padding: 9px 12px;
  border-bottom: 1px solid #d6deea;
  background: #fff;
}

dl.detail dt:last-of-type,
dl.detail dd:last-of-type {
  border-bottom: none;
}

dl.detail dd.strong {
  font-weight: bold;
  font-size: 15px;
  color: var(--brand-navy-from);
}

/* 経路など改行保持テキスト */
pre.route,
pre.preview {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  margin: 0;
  background: #f7f9fc;
  border: 1px solid #d6deea;
  border-radius: 4px;
  padding: 10px 12px;
}

pre.preview {
  background: #1b2740;
  color: #d8e3ff;
  border-color: #11224d;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 13px;
}

/* 購入証明画像(Base64 データURI を img で表示) */
.proof-img {
  display: block;
  max-width: 320px;
  max-height: 240px;
  width: auto;
  height: auto;
  margin-top: 6px;
  border: 1px solid #d6deea;
  border-radius: 4px;
  background: #fff;
  padding: 4px;
}

.proof-current {
  margin: 8px 0 4px;
}

/* ===== バッジ(ステータス/区分) ===== */
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: bold;
  white-space: nowrap;
  border: 1px solid transparent;
}

/* ステータス色分け(契約docの目安) */
.badge.status-DRAFT {
  background: #eceff1;
  color: #455a64;
  border-color: #b0bec5;
}

.badge.status-APPLIED {
  background: #e3f2fd;
  color: #1565c0;
  border-color: #64b5f6;
}

.badge.status-SUPERVISOR_APPROVED {
  background: #e0f7fa;
  color: #00838f;
  border-color: #4dd0e1;
}

.badge.status-REMANDED {
  background: #fff3e0;
  color: #d84315;
  border-color: #ffab91;
}

.badge.status-CONFIRMED {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #81c784;
}

.badge.status-CANCELED {
  background: #eceff1;
  color: #546e7a;
  border-color: #b0bec5;
  text-decoration: line-through;
}

/* 申請区分バッジ */
.badge.apptype {
  background: #ede7f6;
  color: #4527a0;
  border-color: #b39ddb;
}

/* 非課税枠超過警告 */
.badge.tax-warn {
  background: #fdecea;
  color: #b71c1c;
  border-color: #ef9a9a;
}

/* ===== ボタン ===== */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 5px;
  border: 1px solid transparent;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.2;
}

.btn:hover {
  text-decoration: none;
  opacity: 0.92;
}

.btn-primary {
  background: var(--btn-primary);
  color: #ffffff;
  border-color: #043fae;
}

.btn-secondary {
  background: #ffffff;
  color: var(--brand-navy-from);
  border-color: var(--brand-navy-from);
}

.btn-ghost {
  background: #eef2f8;
  color: #2a3b57;
  border-color: #b9c4d6;
}

.btn-danger {
  background: #c62828;
  color: #ffffff;
  border-color: #8e1c1c;
}

.btn-sm {
  padding: 5px 12px;
  font-size: 12.5px;
}

.btn-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* ===== フォーム ===== */
.form-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 14px 16px;
  align-items: start;
}

.form-grid label.form-label {
  font-weight: bold;
  color: #2a3b57;
  padding-top: 8px;
}

.form-grid label.form-label .req {
  color: #c62828;
  font-size: 12px;
  margin-left: 4px;
}

.form-control {
  width: 100%;
  max-width: 420px;
  padding: 8px 10px;
  border: 1px solid #aeb9cc;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}

textarea.form-control {
  max-width: 520px;
  min-height: 90px;
  resize: vertical;
}

.form-control:focus {
  outline: none;
  border-color: var(--btn-primary);
  box-shadow: 0 0 0 2px rgba(6, 79, 218, 0.15);
}

.field-error {
  color: #c62828;
  font-size: 12.5px;
  margin-top: 4px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.form-control.is-invalid {
  border-color: #c62828;
  background: #fff8f8;
}

/* ===== 差分セクション ===== */
table.diff td.changed,
table.diff th.changed {
  background: #fff3e0;
}

table.diff .chg-cur.changed {
  font-weight: bold;
  color: #d84315;
}

table.diff .chg-flag {
  color: #d84315;
  font-weight: bold;
}

/* ===== コメント(時系列) ===== */
ul.comments {
  list-style: none;
  margin: 0;
  padding: 0;
}

ul.comments li {
  border: 1px solid #d6deea;
  border-left: 4px solid var(--brand-accent);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 10px;
  background: #fff;
}

ul.comments .comment-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

ul.comments .comment-author {
  font-weight: bold;
  color: #2a3b57;
}

ul.comments .comment-role {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 8px;
  background: #eef2f8;
  border: 1px solid #c7cfdd;
  font-size: 11px;
}

ul.comments .comment-body {
  white-space: pre-wrap;
  word-break: break-word;
}

/* ===== ログイン画面 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #D9E1F2 0%, #8497B0 50%, #225588 100%);
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 40px rgba(0, 0, 102, 0.35);
  overflow: hidden;
}

.login-card .login-head {
  background: linear-gradient(90deg, var(--brand-navy-from) 0%, var(--brand-navy-to) 100%);
  color: #fff;
  padding: 20px 26px;
}

.login-card .login-head h1 {
  margin: 0;
  font-size: 20px;
}

.login-card .login-head p {
  margin: 4px 0 0;
  font-size: 12.5px;
  color: #cdd8ef;
}

.login-body {
  padding: 24px 26px;
}

.login-form .form-row {
  margin-bottom: 14px;
}

.login-form label {
  display: block;
  font-weight: bold;
  color: #2a3b57;
  margin-bottom: 4px;
}

.login-form .form-control {
  max-width: none;
}

@media (max-width: 720px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 6px 0;
  }
  .form-grid label.form-label {
    padding-top: 0;
  }
  dl.detail {
    grid-template-columns: 130px 1fr;
  }
}

/* ===== 金額(視認性向上: 一覧表内で目立たせる) =====
   一覧の金額セルに class="num amount-yen" を付与し、
   表示は Thymeleaf 側で先頭に「¥」を付ける(例: ¥12,300)。 */
.amount-yen {
  font-weight: bold;
  color: var(--brand-navy-from);
  font-size: 14px;
}

.amount-yen .yen {
  margin-right: 2px;
  color: var(--brand-navy-to);
  font-weight: bold;
}

/* 詳細画面の金額(<dd class="strong">)はすでに強調されているため
   追加クラスを使うときだけ ¥ の色味を合わせる */
dl.detail dd.amount-yen {
  font-size: 15px;
}

/* ===== 承認フロー(4ステップステッパー) =====
   一覧の最右列および詳細上部に表示する小型ステッパー。
   各 aflow-step は is-done / is-current / is-todo / is-remanded のいずれか。 */
.aflow {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  font-size: 11.5px;
  line-height: 1;
}

.aflow-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 5px;
  border-radius: 14px;
  border: 1px solid #c7cfdd;
  background: #f5f8fc;
  color: #5b6675;
  white-space: nowrap;
}

.aflow-mark {
  display: inline-flex;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #c7cfdd;
  color: #fff;
  font-size: 11px;
  align-items: center;
  justify-content: center;
  font-weight: bold;
}

.aflow-step.is-done {
  background: #e8f5e9;
  border-color: #81c784;
  color: #1b5e20;
}
.aflow-step.is-done .aflow-mark {
  background: #2e7d32;
}

.aflow-step.is-current {
  background: #e3f2fd;
  border-color: #1565c0;
  color: #0d3a72;
  font-weight: bold;
  box-shadow: 0 0 0 2px rgba(21, 101, 192, 0.15);
}
.aflow-step.is-current .aflow-mark {
  background: #1565c0;
}

.aflow-step.is-todo {
  background: #f5f8fc;
  color: #8a95a8;
}
.aflow-step.is-todo .aflow-mark {
  background: #c7cfdd;
}

.aflow-step.is-remanded {
  background: #fff3e0;
  border-color: #d84315;
  color: #b53a0c;
  font-weight: bold;
}
.aflow-step.is-remanded .aflow-mark {
  background: #d84315;
}

.aflow-arrow {
  color: #aab4c4;
  font-weight: bold;
  font-size: 14px;
}
.aflow-arrow.is-remanded {
  color: #d84315;
}
.aflow-arrow.is-remanded::before {
  content: "↶ ";
  font-size: 12px;
}

/* 取り消し時: 全ステップを淡色 + 取消線、補助バッジ表示 */
.aflow-step.is-canceled {
  background: #eceff1;
  border-color: #b0bec5;
  color: #90a4ae;
  text-decoration: line-through;
}
.aflow-step.is-canceled .aflow-mark {
  background: #b0bec5;
}
.aflow-arrow.is-canceled {
  color: #b0bec5;
}
.aflow-cancel-mark {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #546e7a;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: bold;
  white-space: nowrap;
}

.aflow-done-mark {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  background: #2e7d32;
  color: #ffffff;
  font-size: 11.5px;
  font-weight: bold;
  white-space: nowrap;
}

/* 5ステップに増えたので一覧セル内では折返しを許容 */
.aflow {
  flex-wrap: wrap;
  row-gap: 3px;
}

/* 詳細画面の上部に置くときは少しゆったり */
.aflow.aflow-lg {
  font-size: 13px;
  gap: 6px;
}
.aflow.aflow-lg .aflow-step {
  padding: 5px 12px 5px 7px;
}
.aflow.aflow-lg .aflow-mark {
  width: 18px;
  height: 18px;
  font-size: 12px;
}

/* 詳細画面の上部に置くフロー用パネル(余白詰め) */
.panel.aflow-panel {
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel.aflow-panel::before {
  content: "承認フロー";
  font-size: 12px;
  font-weight: bold;
  color: var(--muted);
  white-space: nowrap;
}

/* ===== ユーティリティ ===== */
.text-right { text-align: right; }
.text-muted { color: var(--muted); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.nowrap { white-space: nowrap; }
.deadline-pill {
  display: inline-block;
  background: #fff;
  border: 1px solid var(--brand-navy-from);
  color: var(--brand-navy-from);
  border-radius: 14px;
  padding: 3px 12px;
  font-weight: bold;
  font-size: 13px;
}
