/* デモ3本で共通の見た目。日本語・スマホ／iPadでも崩れないことを優先し、作り込みすぎない。 */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --text: #1d2730;
  --muted: #5f6b76;
  --line: #dde3e8;
  --primary: #0e6a86;
  --primary-ink: #ffffff;
  --primary-soft: #e3f1f5;
  --tax: #c2410c;          /* 補助の対象（宿泊税の機能）の色 */
  --tax-soft: #fff1e8;
  --nontax: #64748b;       /* 補助の対象外の色 */
  --nontax-soft: #eef1f4;
  --ok: #15803d;
  --ok-soft: #e7f6ec;
  --warn: #b45309;
  --warn-soft: #fff6e0;
  --err: #b91c1c;
  --err-soft: #fdecec;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.35; margin: 0 0 .6em; }
h1 { font-size: 1.35rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .8em; }
small, .muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---- アプリの枠 ---- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--primary); color: var(--primary-ink);
}
.topbar .brand { font-weight: 700; font-size: 1.02rem; white-space: nowrap; }
.topbar .brand small { color: rgba(255,255,255,.8); font-weight: 400; margin-left: 6px; }
/* お客様ごとの名前（取り違えないように・src/lib/themes.ts の色と一緒に） */
.topbar .brand-name { margin-left: 12px; padding-left: 12px; border-left: 1px solid rgba(255,255,255,.5); font-weight: 700; }
/* 検証環境の帯（STAGE=stg のとき・本番には出ない） */
.stage-band { background: repeating-linear-gradient(45deg, #fde68a 0 14px, #fcd34d 14px 28px); color: #422006; font-weight: 700; text-align: center; padding: 4px 8px; font-size: .85rem; }
/* 設定のテーマの色 */
.theme-list { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 6px; }
.theme-opt .swatch { display: inline-block; width: 18px; height: 18px; border-radius: 4px; vertical-align: -3px; }
.topbar .spacer { flex: 1; }
.topbar .demo-flag { font-size: .78rem; background: rgba(255,255,255,.18); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.topbar select, .topbar input { font: inherit; font-size: .85rem; border-radius: 6px; border: 0; padding: 3px 6px; }
.topbar a { color: #fff; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 52px); }
.sidenav { background: var(--surface); border-right: 1px solid var(--line); padding: 12px 8px 40px; }
.sidenav .group { margin-bottom: 14px; }
.sidenav .group-title { font-size: .76rem; font-weight: 700; color: var(--muted); padding: 4px 10px; display: flex; align-items: center; gap: 6px; }
.sidenav a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; color: var(--text); text-decoration: none; font-size: .93rem; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.sidenav .group.tax { background: var(--tax-soft); border-radius: 10px; padding: 4px 0 6px; border: 1px solid #f6cfb6; }
.sidenav .group.tax .group-title { color: var(--tax); }
.sidenav .group.tax a.active { background: #ffe2cf; color: var(--tax); }
.main { padding: 20px 24px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; flex: 1 1 auto; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .shell { display: block; }
  .sidenav { position: sticky; top: 52px; z-index: 10; display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidenav .group { display: flex; align-items: center; gap: 2px; margin: 0; flex: none; }
  .sidenav .group-title { white-space: nowrap; padding: 4px 6px; }
  .sidenav a { white-space: nowrap; padding: 6px 10px; }
  .sidenav .group.tax { padding: 2px 4px; }
  .main { padding: 16px 16px 60px; }
}

/* ---- 部品 ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.stat .label { font-size: .8rem; color: var(--muted); }
.stat .value { font-size: 1.45rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .8rem; color: var(--muted); }
.stat.tax { border-color: #f6cfb6; background: var(--tax-soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: .92rem; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; min-height: 36px; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.tax { background: var(--tax); border-color: var(--tax); color: #fff; }
.btn.danger { color: var(--err); border-color: #f2c4c4; }
.btn.small { font-size: .82rem; padding: 3px 9px; min-height: 28px; }
.btn.big { font-size: 1.1rem; padding: 14px 22px; min-height: 52px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; border-radius: 999px; padding: 1px 9px; white-space: nowrap; line-height: 1.6; }
.badge.tax { background: var(--tax); color: #fff; }
.badge.nontax { background: var(--nontax-soft); color: var(--nontax); border: 1px solid #d5dbe2; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.err { background: var(--err-soft); color: var(--err); }
.badge.gray { background: var(--nontax-soft); color: var(--muted); }
.badge.blue { background: var(--primary-soft); color: var(--primary); }

.note { border-left: 4px solid var(--primary); background: var(--primary-soft); padding: 10px 12px; border-radius: 6px; margin-bottom: 14px; font-size: .92rem; }
.note.tax { border-color: var(--tax); background: var(--tax-soft); }
.note.warn { border-color: var(--warn); background: var(--warn-soft); }
.note.err { border-color: var(--err); background: var(--err-soft); }

.scope-banner { display: flex; align-items: center; gap: 8px; font-size: .85rem; padding: 6px 12px; border-radius: 8px; margin-bottom: 14px; }
.scope-banner.tax { background: var(--tax-soft); color: var(--tax); border: 1px solid #f6cfb6; }
.scope-banner.nontax { background: var(--nontax-soft); color: var(--nontax); border: 1px solid #d5dbe2; }

/* ---- 表 ---- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table.t { border-collapse: collapse; width: 100%; font-size: .9rem; }
table.t th, table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t thead th { background: var(--surface-2); font-size: .8rem; color: var(--muted); font-weight: 700; text-align: left; white-space: nowrap; position: sticky; top: 0; }
table.t thead th.num { text-align: right; }
table.t tbody tr:hover { background: #fafcfd; }
table.t tfoot td, table.t tr.total td { font-weight: 700; background: var(--surface-2); }
table.t td.calc { background: #f7fafc; }
table.t th.calc { background: #eef3f6; }
table.t tr.invalid td { background: var(--err-soft); }
table.t input, table.t select { font: inherit; font-size: .9rem; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fffef6; width: 100%; min-width: 0; }
table.t input.n { text-align: right; }
table.t tr.clickable { cursor: pointer; }

/* ---- フォーム ---- */
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: 3px; font-weight: 700; }
.field input, .field select, .field textarea { font: inherit; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-height: 40px; }
.field textarea { min-height: 70px; }
.field .hint { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.check { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.check input { width: 20px; height: 20px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs a, .tabs button { font: inherit; font-size: .88rem; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; cursor: pointer; }
.tabs a.active, .tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.tabs .has-data::after { content: "●"; font-size: .6rem; margin-left: 4px; color: var(--tax); vertical-align: middle; }
.tabs a.active.has-data::after { color: #fff; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #1f2933; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: .92rem; z-index: 100; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: calc(100vw - 32px); }

/* ---- 書類（申告書・領収書など）の見た目 ---- */
.doc { background: #fff; border: 1px solid #c9d1d8; padding: 28px 28px 34px; max-width: 820px; margin: 0 auto 16px; font-family: "Hiragino Mincho ProN", "Yu Mincho", "MS Mincho", serif; }
.doc h1 { text-align: center; letter-spacing: .4em; font-size: 1.3rem; margin-bottom: 16px; }
.doc table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.doc th, .doc td { border: 1px solid #333; padding: 6px 8px; }
.doc th { background: #f2f2f2; font-weight: 600; }
.doc .doc-note { font-size: .78rem; color: #444; }
/* 領収書 */
.receipt { max-width: 640px; }
.receipt-head { display: flex; align-items: center; justify-content: center; gap: 12px; }
.receipt-head h1 { margin: 0 0 8px; }
.receipt-mark { border: 2px solid #b91c1c; color: #b91c1c; font-weight: 700; padding: 0 8px; font-family: sans-serif; }
.receipt-meta { text-align: right; font-size: .85rem; }
.receipt-to { font-size: 1.15rem; border-bottom: 1px solid #333; padding-bottom: 4px; max-width: 60%; }
.receipt-total { font-size: 1.6rem; font-weight: 700; text-align: center; border-top: 2px solid #333; border-bottom: 2px solid #333; padding: 8px 0; margin: 14px 0; }
.receipt-total small { font-size: .8rem; font-weight: 400; }
.receipt .num { text-align: right; white-space: nowrap; }
.receipt-note { font-size: .82rem; margin-top: 10px; }
.receipt-issuer { margin-top: 18px; text-align: right; font-size: .9rem; line-height: 1.6; }
.sample-mark { display: inline-block; border: 2px solid var(--err); color: var(--err); font-weight: 700; padding: 0 8px; transform: rotate(-4deg); font-family: sans-serif; }

@media print {
  .topbar, .sidenav, .no-print, .page-head .actions, .toast { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  body, html { background: #fff; }
  .doc { border: 0; padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-break { page-break-before: always; }
  body:has(.receipt) .page-head { display: none; }
  .doc.receipt { max-width: 640px; margin: 0 auto; }
}

/* ---- 正式版で足したもの ---- */
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--err); background: var(--err-soft); }
.field .error { color: var(--err); font-size: .8rem; margin-top: 2px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 1.2rem; margin-bottom: 4px; }
.user-chip { font-size: .82rem; background: rgba(255,255,255,.18); border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.topbar button.link { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; }
.loading { color: var(--muted); padding: 24px 0; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.secret-box { font-family: ui-monospace, "BIZ UDGothic", monospace; font-size: 1.3rem; letter-spacing: .08em; background: var(--warn-soft); border: 1px dashed var(--warn); padding: 10px 14px; border-radius: 8px; display: inline-block; user-select: all; }
.inline-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.kv th { width: 9em; color: var(--muted); font-weight: 600; text-align: left; white-space: nowrap; }
.reg-row { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; background: var(--surface-2); }
.meter { height: 12px; background: #eef2f6; border-radius: 6px; overflow: hidden; }
.meter > div { height: 100%; background: var(--primary); }
.meter.warn > div { background: var(--warn); }
.meter.err > div { background: var(--err); }

/* 保存用の書き出し: 名簿の印刷用 */
.register-print table { font-size: .78rem; }
.register-print th, .register-print td { padding: 3px 5px; }

/* 月の切り替え（前の月・年・月・次の月・今月） */
.month-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.month-nav select { width: auto; min-width: 6em; min-height: 36px; padding: 6px 8px; font-size: 1rem; border: 1px solid var(--border, #d0d5dd); border-radius: 8px; background: #fff; }

/* 検索の欄と「さがす」ボタン */
.search-box { display: flex; gap: 6px; align-items: stretch; }
.search-box input { flex: 1; min-width: 0; }
.search-box .btn { flex: none; }

/* 宿泊者を選ぶ欄・似た宿泊者の候補 */
.guest-pick { grid-column: 1 / -1; }
.gp-chosen { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--primary-soft); }
.gp-list { display: grid; gap: 6px; margin-top: 6px; max-height: 320px; overflow: auto; }
.gp-item { display: block; width: 100%; text-align: left; font: inherit; color: inherit; text-decoration: none; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; min-height: 44px; }
.gp-item:hover, .gp-item:focus { border-color: var(--primary); }
.merge-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }

.guest-pick [hidden] { display: none !important; }

/* カレンダー: 1棟と部屋の在庫がつながって売れない日 */
.cal-block { display: block; border-radius: 6px; padding: 4px 6px; font-size: .72rem; color: var(--muted); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: repeating-linear-gradient(45deg, #e2e8f0 0 6px, #f8fafc 6px 12px); }
.cal-external { background: #fff7ed; border: 1px dashed #f59e0b; color: #9a3412; }
.cal-closed { background: repeating-linear-gradient(135deg, #e2e8f0 0 4px, #f8fafc 4px 8px) !important; }
[data-rk][hidden] { display: none !important; }
