/* ============================================================
   Space Aviation × CAIL — 共通デザインシステム v2（2026-07-02刷新）
   全WEBサービス共通のトークン・コンポーネント
   - クラスAPIは v1 互換（既存ページはそのまま新デザインが適用される）
   - 追加: 領収書 .receipt / 仕訳パターン .pt-badge / 仕訳表 .journal
   ============================================================ */
:root {
  /* カラー: ミッドナイトネイビー×シャンパンゴールド（刷新） */
  --navy-50: #eef2fb;
  --navy-100: #dbe4f5;
  --navy-900: #070d1d;
  --navy-800: #0c1730;
  --navy-700: #142647;
  --navy-600: #1d3a6e;
  --navy-500: #2b53a0;
  --gold: #c9a961;
  --gold-deep: #a8853e;
  --gold-light: #ecd9a9;
  --ink: #16202e;
  --ink-2: #45536b;
  --ink-3: #7c8aa0;
  --ink-4: #a9b4c6;
  --line: #e3e9f2;
  --line-2: #eef2f8;
  --bg: #f3f6fb;
  --surface: #ffffff;
  --green: #0e9f5d;
  --green-bg: #e3f6ec;
  --amber: #b17a17;
  --amber-bg: #fcf2dc;
  --red: #d43d3d;
  --red-bg: #fdeaea;
  --blue: #2b62d9;
  --blue-bg: #e9f0fd;
  --purple: #7440e0;
  --purple-bg: #f1eafd;
  --teal: #0f8a8a;
  --teal-bg: #e2f4f4;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-1: 0 1px 2px rgba(7,13,29,.05), 0 2px 8px rgba(7,13,29,.05);
  --shadow-2: 0 10px 34px rgba(7,13,29,.14);
  --shadow-gold: 0 3px 14px rgba(201,169,97,.35);
  --focus: 0 0 0 3px rgba(43,98,217,.20);
  --font: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.66; font-size: 14.5px; }
body::before { /* うっすらとした上部グラデーション（高級感の下地） */
  content: ""; position: fixed; inset: 0 0 auto 0; height: 260px; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg, rgba(20,38,71,.045), transparent 70%);
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { max-width: 100%; }
button { font-family: inherit; }
::selection { background: rgba(201,169,97,.3); }

/* ---------- レイアウト ---------- */
.container { max-width: 1240px; margin: 0 auto; padding: 0 20px; position: relative; z-index: 1; }
.container-narrow { max-width: 720px; margin: 0 auto; padding: 0 16px; position: relative; z-index: 1; }

/* ---------- グローバルナビ ---------- */
.appbar {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 55%, #101f3d 100%);
  color: #fff; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 4px 18px rgba(7,13,29,.28);
  border-bottom: 1px solid rgba(201,169,97,.22);
}
.appbar-inner { display: flex; align-items: center; gap: 26px; height: 58px; max-width: 1240px; margin: 0 auto; padding: 0 20px; }
.appbar .brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 15px; letter-spacing: .02em; color: #fff; white-space: nowrap; }
.appbar .brand .logo { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, var(--gold-light), var(--gold) 55%, var(--gold-deep)); display: grid; place-items: center; font-size: 15px; color: var(--navy-900); box-shadow: var(--shadow-gold); }
.appbar .brand small { display: block; font-size: 10px; font-weight: 600; color: var(--gold-light); letter-spacing: .14em; }
.appbar nav { display: flex; gap: 3px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.appbar nav::-webkit-scrollbar { display: none; }
.appbar nav a { color: #b9c5da; padding: 8px 13px; border-radius: 9px; font-size: 13px; font-weight: 600; white-space: nowrap; transition: .15s; text-decoration: none; }
.appbar nav a:hover { color: #fff; background: rgba(255,255,255,.09); text-decoration: none; }
.appbar nav a.active { color: var(--navy-900); background: linear-gradient(135deg, var(--gold-light), var(--gold)); box-shadow: var(--shadow-gold); }
.appbar .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-4); white-space: nowrap; }
.svc-tag { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; color: var(--gold-light); border: 1px solid rgba(201,169,97,.5); padding: 2px 9px; border-radius: 99px; background: rgba(201,169,97,.08); }

/* ---------- ページヘッダ ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 30px 0 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; font-weight: 800; letter-spacing: .005em; display: flex; align-items: center; gap: 9px; }
.page-head h1::before { content: ""; width: 4px; height: 22px; border-radius: 3px; background: linear-gradient(180deg, var(--gold), var(--gold-deep)); }
.page-head p { color: var(--ink-3); font-size: 13px; margin-top: 2px; }

/* ---------- カード ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.card-pad { padding: 20px; }
.card h2, .card .card-title { font-size: 15px; font-weight: 800; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line-2); }
.card-head h2 { font-size: 14.5px; display: flex; align-items: center; gap: 7px; min-width: 0; }

/* ---------- KPIタイル ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow-1); }
.kpi::after { content: ""; position: absolute; right: -26px; top: -26px; width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle, rgba(201,169,97,.10), transparent 70%); }
.kpi .label { font-size: 11.5px; color: var(--ink-3); font-weight: 700; letter-spacing: .04em; }
.kpi .value { font-size: 27px; font-weight: 800; letter-spacing: -.015em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi.accent { border-top: 3px solid var(--gold); }
.kpi.navy { background: linear-gradient(135deg, var(--navy-800), var(--navy-700)); border-color: var(--navy-700); color: #fff; }
.kpi.navy .label, .kpi.navy .sub { color: #a9b8d4; }

/* ---------- テーブル ---------- */
.table-wrap { overflow-x: auto; border-radius: 0 0 var(--radius) var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; padding: 10px 14px; background: #f7f9fd; color: var(--ink-3); font-size: 11px; font-weight: 800; letter-spacing: .06em; border-bottom: 1px solid var(--line); white-space: nowrap; text-transform: uppercase; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; font-variant-numeric: tabular-nums; }
.tbl tbody tr { transition: background .12s; }
.tbl tr:hover td { background: #f8fafd; }
.tbl .mono { font-family: var(--mono); font-size: 12px; }
.tbl tfoot td { background: #f7f9fd; font-weight: 800; border-top: 2px solid var(--line); }

/* ---------- バッジ ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.green { color: var(--green); background: var(--green-bg); }
.badge.amber { color: var(--amber); background: var(--amber-bg); }
.badge.red { color: var(--red); background: var(--red-bg); }
.badge.blue { color: var(--blue); background: var(--blue-bg); }
.badge.purple { color: var(--purple); background: var(--purple-bg); }
.badge.teal { color: var(--teal); background: var(--teal-bg); }
.badge.gray { color: var(--ink-3); background: #edf1f7; }
.badge.navy { color: #fff; background: var(--navy-700); }
.badge.navy::before, .badge.gold::before { background: var(--gold); }
.badge.gold { color: var(--navy-900); background: var(--gold-light); }
.badge.progress { color: var(--blue); background: var(--blue-bg); }
.badge.progress::before { animation: badge-pulse 1.3s ease-in-out infinite; }
.badge.live { color: var(--green); background: var(--green-bg); }
.badge.live::before { box-shadow: 0 0 0 0 rgba(14,159,93,.45); animation: live-ring 1.4s ease-out infinite; }
@keyframes badge-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes live-ring { 0% { box-shadow: 0 0 0 0 rgba(14,159,93,.45); } 100% { box-shadow: 0 0 0 6px rgba(14,159,93,0); } }

/* ---------- 第10章: 会計仕訳パターンバッジ（A〜E） ---------- */
.pt-badge { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; font-size: 12px; font-weight: 800; font-family: var(--mono); flex: none; }
.pt-badge.A { color: #fff; background: linear-gradient(135deg, var(--green), #0b7f4a); }
.pt-badge.B { color: #fff; background: linear-gradient(135deg, var(--amber), #8f6212); }
.pt-badge.C { color: #fff; background: linear-gradient(135deg, var(--blue), #1d4bb0); }
.pt-badge.D { color: #fff; background: linear-gradient(135deg, var(--purple), #5b2fc0); }
.pt-badge.E { color: var(--ink-2); background: #e6ebf3; }
.rev-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; padding: 2px 9px; border-radius: 6px; font-family: var(--mono); letter-spacing: .01em; }
.rev-flag.flight { color: var(--green); background: var(--green-bg); }
.rev-flag.cancellation_100, .rev-flag.cancellation_partial { color: var(--amber); background: var(--amber-bg); }

/* ---------- 第10章: 仕訳表・会計 ---------- */
.journal { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.journal .jr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.journal .jr:last-child { border-bottom: 0; }
.journal .jr > div { padding: 10px 14px; }
.journal .jr .debit { border-right: 1px dashed var(--line); font-weight: 700; }
.journal .jr .credit { border-right: 1px dashed var(--line); font-weight: 700; color: var(--navy-600); }
.journal .jr .amt { font-family: var(--mono); font-weight: 800; text-align: right; min-width: 110px; font-variant-numeric: tabular-nums; }
.journal .jr .note { grid-column: 1 / -1; padding-top: 0; color: var(--ink-3); font-size: 11px; }

/* ---------- 第10章: 領収書（共通テンプレート1種・税表示のみ出し分け） ---------- */
.receipt { background: #fffdf8; border: 1px solid #e7ddc4; border-radius: var(--radius); padding: 26px 28px; max-width: 560px; margin: 0 auto; box-shadow: var(--shadow-1); position: relative; }
.receipt::before { content: ""; position: absolute; inset: 6px; border: 1px solid rgba(201,169,97,.35); border-radius: 10px; pointer-events: none; }
.receipt .r-title { text-align: center; font-size: 19px; font-weight: 800; letter-spacing: .5em; text-indent: .5em; color: var(--navy-800); margin-bottom: 4px; }
.receipt .r-no { text-align: center; font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-bottom: 16px; }
.receipt .r-to { font-size: 15px; font-weight: 700; border-bottom: 2px solid var(--navy-800); padding-bottom: 6px; margin-bottom: 14px; }
.receipt .r-amount { text-align: center; background: var(--navy-800); color: #fff; border-radius: 10px; padding: 12px; font-size: 24px; font-weight: 800; letter-spacing: .02em; margin: 12px 0; font-variant-numeric: tabular-nums; }
.receipt .r-amount small { font-size: 11px; font-weight: 600; color: var(--gold-light); display: block; letter-spacing: .2em; }
.receipt .r-row { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; padding: 5px 0; border-bottom: 1px dashed #e7ddc4; }
.receipt .r-row .k { color: var(--ink-3); font-weight: 700; flex: none; }
.receipt .r-tax { margin-top: 10px; border: 1px solid #e7ddc4; border-radius: 8px; padding: 10px 12px; font-size: 12.5px; background: #fff; }
.receipt .r-tax.notax { color: var(--ink-3); }
.receipt .r-issuer { margin-top: 16px; padding-top: 12px; border-top: 1px solid #e7ddc4; font-size: 12px; line-height: 1.7; display: flex; justify-content: space-between; gap: 12px; align-items: flex-end; }
.receipt .r-issuer b { font-size: 13px; }
.receipt .r-issuer .reg { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); }
.receipt .r-qualified { position: absolute; top: 18px; right: 18px; font-size: 10px; font-weight: 800; color: var(--gold-deep); border: 1.5px solid var(--gold); border-radius: 6px; padding: 3px 8px; transform: rotate(3deg); background: rgba(255,255,255,.8); }

/* ---------- ボタン ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 10px; padding: 9px 18px; min-height: 36px; font-size: 13.5px; font-weight: 700; cursor: pointer; transition: background .15s, border-color .15s, box-shadow .15s, transform .15s, opacity .15s, filter .15s; text-decoration: none; line-height: 1.4; user-select: none; }
.btn:hover { text-decoration: none; }
.btn:hover:not(:disabled):not(.is-disabled):not(.is-loading):not([aria-disabled="true"]) { transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active:not(:disabled):not(.is-disabled):not(.is-loading):not([aria-disabled="true"]) { transform: translateY(1px); box-shadow: none; }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled, .btn.is-disabled, .btn[aria-disabled="true"] { opacity: .46; cursor: not-allowed; filter: grayscale(.35); box-shadow: none; transform: none; }
.btn[aria-disabled="true"] { pointer-events: none; }
.btn.is-active, .btn[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--gold), 0 0 0 3px rgba(201,169,97,.18); }
.btn.is-loading { color: transparent !important; cursor: progress; pointer-events: none; opacity: 1; }
.btn.is-loading .ic { opacity: 0; }
.btn.is-loading::after { content: ""; position: absolute; width: 1.1em; height: 1.1em; border: 2px solid currentColor; border-right-color: transparent; border-bottom-color: transparent; border-radius: 50%; color: inherit; animation: btn-spin .7s linear infinite; }
.btn-primary.is-loading::after, .btn-danger.is-loading::after, .btn-success.is-loading::after, .btn-amber.is-loading::after { border-color: rgba(255,255,255,.9); border-right-color: transparent; border-bottom-color: transparent; }
.btn-gold.is-loading::after, .btn-outline.is-loading::after { border-color: var(--navy-800); border-right-color: transparent; border-bottom-color: transparent; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
.btn-primary { background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); color: #fff; }
.btn-primary:hover { background: var(--navy-600); }
.btn-gold { background: linear-gradient(135deg, #e2c88a, var(--gold) 60%, var(--gold-deep)); color: var(--navy-900); box-shadow: var(--shadow-gold); }
.btn-gold:hover { filter: brightness(1.06); }
.btn-outline { background: #fff; border-color: var(--line); color: var(--ink); }
.btn-outline:hover { border-color: var(--ink-3); }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-amber { background: var(--amber); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; min-height: 30px; }
.btn-lg { padding: 14px 26px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

/* ---------- ヘルプ / ツールチップ ---------- */
.help { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 50%; display: inline-grid; place-items: center; background: #fff; color: var(--ink-3); cursor: help; vertical-align: middle; transition: background .15s, border-color .15s, color .15s, box-shadow .15s; flex: none; }
.help:hover, .help:focus-visible, .help.is-open { color: var(--navy-800); border-color: #c7d2e1; background: var(--navy-50); outline: none; box-shadow: var(--focus); }
.help .ic { font-size: 14px; }
.tip-popover { position: fixed; z-index: 10000; max-width: min(320px, calc(100vw - 28px)); padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12); background: #0d1526; color: #fff; box-shadow: var(--shadow-2); font-size: 12px; line-height: 1.65; pointer-events: none; white-space: normal; }
.tip-popover::before { content: ""; position: absolute; top: -6px; left: var(--tip-arrow-left, 18px); width: 10px; height: 10px; background: #0d1526; transform: rotate(45deg); border-left: 1px solid rgba(255,255,255,.12); border-top: 1px solid rgba(255,255,255,.12); }

/* ---------- 操作状態の凡例 ---------- */
.status-legend { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.status-legend .item { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.status-legend .sample { flex: none; }
.status-legend .txt { min-width: 0; }
.status-legend .txt b { display: block; font-size: 12.5px; }
.status-legend .txt span { display: block; font-size: 11.5px; color: var(--ink-3); line-height: 1.45; }

/* ---------- フォーム ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 700; color: var(--ink-2); margin-bottom: 5px; }
.field label .req { color: var(--red); margin-left: 3px; }
.input, select.input, textarea.input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff; transition: .15s; color: var(--ink); }
.input:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(43,83,160,.13); }
.input:disabled, select.input:disabled, textarea.input:disabled { background: #f3f6fa; color: var(--ink-3); cursor: not-allowed; }
.admin-date-control { min-width: 156px; width: auto; display: inline-flex; align-items: center; justify-content: flex-start; gap: 8px; cursor: pointer; color: var(--ink); }
.admin-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.admin-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(36px, 1fr)); gap: 4px; }
.admin-cal-dow { text-align: center; color: var(--ink-3); font-size: 11px; font-weight: 800; padding: 3px 0; }
.admin-cal-dow.sun { color: var(--red); }
.admin-cal-dow.sat { color: var(--blue); }
.admin-cal-day { min-height: 44px; border: 1.5px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.admin-cal-day:hover { border-color: var(--navy-500); box-shadow: var(--focus); }
.admin-cal-day.blank { border-color: transparent; background: transparent; cursor: default; box-shadow: none; }
.admin-cal-day.on { border-color: var(--gold); background: #fdfaf3; box-shadow: 0 0 0 2px rgba(201,169,97,.22); }
.admin-cal-day.today small { color: var(--blue); font-size: 9px; line-height: 1; }
.hint { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ---------- セグメント選択 ---------- */
.seg { display: flex; background: #e9edf4; border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 8px; font-size: 13px; font-weight: 700; color: var(--ink-3); cursor: pointer; transition: .15s; }
.seg button.on { background: #fff; color: var(--navy-800); box-shadow: var(--shadow-1); }

/* ---------- 選択カード ---------- */
.choice { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: .15s; background: #fff; position: relative; }
.choice:hover { border-color: var(--ink-3); }
.choice.on { border-color: var(--gold); background: #fdfaf3; box-shadow: 0 0 0 3px rgba(201,169,97,.18); }
.choice .t { font-weight: 800; font-size: 14.5px; }
.choice .d { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.choice .p { font-size: 16px; font-weight: 800; color: var(--navy-800); margin-top: 6px; }
.choice .p small { font-size: 11px; color: var(--ink-3); font-weight: 600; }

/* ---------- ステッパー ---------- */
.stepper { display: flex; align-items: center; gap: 0; margin: 18px 0 22px; }
.stepper .st { display: flex; align-items: center; gap: 7px; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }
.stepper .st .n { width: 26px; height: 26px; border-radius: 50%; background: #e4e9f1; display: grid; place-items: center; font-size: 12px; color: var(--ink-3); }
.stepper .st.done .n { background: var(--green); color: #fff; }
.stepper .st.now { color: var(--navy-800); }
.stepper .st.now .n { background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); color: #fff; box-shadow: 0 0 0 4px rgba(29,58,110,.16); }
.stepper .bar { flex: 1; height: 2px; background: var(--line); margin: 0 8px; min-width: 12px; }
.stepper .bar.done { background: var(--green); }
.stepper .st span.lbl { display: none; }
@media (min-width: 480px) { .stepper .st span.lbl { display: inline; } }

/* ---------- 通知・アラート ---------- */
.note { border-radius: var(--radius-sm); padding: 12px 14px; font-size: 12.5px; line-height: 1.6; border: 1px solid transparent; }
.note.info { background: var(--blue-bg); color: #1c3d8f; border-color: #d3e1fb; }
.note.warn { background: var(--amber-bg); color: #8a5a0d; border-color: #f3e3bd; }
.note.error { background: var(--red-bg); color: #98261f; border-color: #f8d3d3; }
.note.ok { background: var(--green-bg); color: #14603c; border-color: #c9ecd9; }

/* ---------- トースト ---------- */
#toast-zone { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 9999; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--navy-900); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-2); display: flex; gap: 10px; align-items: center; animation: toast-in .25s ease; border: 1px solid rgba(255,255,255,.1); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ---------- モーダル ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(7,13,29,.6); backdrop-filter: blur(2px); z-index: 500; display: grid; place-items: center; padding: 18px; animation: toast-in .18s ease; }
.modal { background: #fff; border-radius: 16px; width: min(560px, 100%); max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-2); }
.modal .modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal .modal-head h3 { font-size: 15px; }
.modal .modal-body { padding: 20px; }
.modal .x { border: 0; background: #edf1f7; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 14px; color: var(--ink-2); }

/* ---------- チャット ---------- */
.chat-box { display: flex; flex-direction: column; height: 100%; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: #f0f4f9; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.6; box-shadow: var(--shadow-1); white-space: pre-wrap; word-break: break-word; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, var(--navy-700), var(--navy-800)); color: #fff; border-bottom-right-radius: 4px; }
.msg.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.msg .meta { font-size: 10px; opacity: .65; margin-top: 4px; }
.msg.bot-badge::before { content: "自動応答"; display: block; font-size: 10px; font-weight: 700; color: var(--gold); margin-bottom: 3px; }
.chat-input { display: flex; gap: 8px; padding: 12px; background: #fff; border-top: 1px solid var(--line); }
.chat-input input { flex: 1; border: 1.5px solid var(--line); border-radius: 99px; padding: 10px 16px; font-size: 14px; font-family: inherit; }
.chat-input input:focus { outline: none; border-color: var(--navy-500); }
.chat-input button:not(.btn) { border: 0; background: var(--navy-800); color: #fff; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; font-size: 16px; flex-shrink: 0; }
.chat-input .btn { width: auto; height: 42px; border-radius: 999px; white-space: nowrap; flex-shrink: 0; }

/* ---------- ユーティリティ ---------- */
.muted { color: var(--ink-3); }
.small { font-size: 12px; }
.bold { font-weight: 700; }
.mono { font-family: var(--mono); }
.mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.right { text-align: right; }
.center { text-align: center; }
.price { font-weight: 800; color: var(--navy-800); font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }
.empty { text-align: center; color: var(--ink-3); padding: 36px 16px; font-size: 13px; }
.empty .ico { font-size: 30px; display: block; margin-bottom: 8px; opacity: .5; }
footer.app-foot { text-align: center; color: var(--ink-3); font-size: 11.5px; padding: 36px 16px 28px; }

@media (max-width: 720px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .appbar-inner { gap: 12px; padding: 0 12px; }
  .page-head h1 { font-size: 18px; }
  .journal .jr { grid-template-columns: 1fr 1fr; }
  .journal .jr .amt { grid-column: 1 / -1; border-top: 1px dashed var(--line); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; transition-duration: .001ms !important; }
}

/* ① システム側 言語切替ボタン（appbar内） */
.appbar .lang-sw { display: inline-flex; gap: 4px; margin-right: 6px; }
.appbar .lang-sw button { font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 7px; border: 1px solid rgba(255,255,255,.28); background: transparent; color: #cdd7e6; cursor: pointer; font-family: inherit; }
.appbar .lang-sw button.on { background: var(--gold); border-color: var(--gold); color: #1a1205; }

/* 印刷（領収書の単票印刷に対応） */
@media print {
  body { background: #fff; }
  .appbar, .app-foot, .btn, #toast-zone { display: none !important; }
  .receipt { box-shadow: none; }
}
