/* =====================================================================
   AMN RESERVE UI v1.2 — 実用性重視（仕様書 §4A-2 デザイントークン）
   CSPで inline style を禁止しているため、見た目はすべてこのファイルで定義する。
   ===================================================================== */
:root {
  --primary: #16675D;
  --primary-dark: #0F4B44;
  --primary-tint: #E3F1EE;
  --text: #1E2930;
  --sub: #66747B;
  --field: #B9C3C7;
  --line: #DDE3E5;
  --bg-admin: #F7F8F8;
  --surface: #FFFFFF;
  --muted-bg: #F2F4F5;
  --danger: #A8321E;
  --danger-bg: #FBEFEC;
  --danger-line: #E3B7AE;
  --warn-text: #6B4600;
  --warn-bg: #FFF4D6;
  --warn-line: #E8CF8A;
  --info-text: #1F4E87;
  --info-bg: #E6EFFA;
  --brand: #16675D;           /* 公開ページの店舗色（/r/{slug}/theme.css で上書き） */
  --radius: 8px;
  --font: "Noto Sans JP", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--bg-admin); line-height: 1.6; font-size: 16px; }
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
h1 { font-size: 22px; line-height: 1.35; margin: 0 0 12px; }
h2 { font-size: 18px; line-height: 1.4; margin: 0 0 10px; }
h3 { font-size: 16px; margin: 16px 0 6px; }
code { font-size: .9em; background: var(--muted-bg); padding: 0 .3em; border-radius: 4px; }
code.wrap { word-break: break-all; white-space: normal; }
.muted { color: var(--sub); }
.small { font-size: 14px; }
.nowrap { white-space: nowrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip-link:focus { left: 8px; }

/* ---------------- ボタン・フォーム ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--field); background: var(--surface); color: var(--text); font: inherit; font-size: 15px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: var(--bg-admin); color: var(--text); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { border-color: #C9877A; color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-block { width: 100%; min-height: 52px; font-size: 17px; margin-top: 16px; }
.btn[disabled], .btn.is-disabled { background: var(--field); border-color: var(--field); color: #fff; cursor: not-allowed; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.btn-brand:hover { filter: brightness(.92); color: #fff; }

.form label, .field-label { display: block; font-weight: 700; font-size: 15px; margin: 16px 0 4px; }
.form fieldset { border: 0; padding: 0; margin: 0 0 8px; }
.form legend { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 48px; padding: 0 12px; font-size: 16px; font-family: inherit; color: var(--text);
  border: 1px solid var(--field); border-radius: var(--radius); background: var(--surface);
}
textarea { padding: 10px 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: 0; border-color: var(--primary); }
input[aria-invalid=true] { border: 2px solid var(--danger); background: #FFFAF9; }
.req { font-size: 13px; color: var(--danger); font-weight: 400; margin-left: 6px; }
.hint { font-size: 14px; color: var(--sub); margin: 4px 0 0; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form select { width: auto; min-height: 40px; font-size: 15px; }
.inline-form label { font-size: 14px; font-weight: 700; margin: 0; }
.input-prefix { display: flex; }
.input-prefix span { display: flex; align-items: center; background: var(--muted-bg); border: 1px solid var(--field); border-right: 0; border-radius: var(--radius) 0 0 var(--radius); padding: 0 10px; font-size: 14px; color: var(--sub); white-space: nowrap; max-width: 55%; overflow: hidden; text-overflow: ellipsis; }
.input-prefix input { border-radius: 0 var(--radius) var(--radius) 0; }
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: 1fr 1fr; } }

/* ---------------- 通知・状態 ---------------- */
.alert { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; border: 1px solid; font-size: 15px; }
.alert ul { margin: 4px 0 0; padding-left: 20px; }
.alert-success { background: var(--primary-tint); border-color: #8CC0B5; color: var(--primary-dark); }
.alert-error { background: var(--danger-bg); border-color: var(--danger-line); color: #7D2A1C; }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-text); }
.alert-invite { background: var(--warn-bg); border-color: var(--warn-line); display: flex; flex-direction: column; gap: 6px; }
.copy-field { font-family: ui-monospace, Menlo, monospace; font-size: 14px; }

.badge { display: inline-block; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 4px; background: var(--muted-bg); color: #4A565C; white-space: nowrap; vertical-align: middle; line-height: 1.5; }
.badge-active, .st-confirmed { background: var(--primary-tint); color: var(--primary-dark); }
.badge-draft, .badge-invited, .st-pending_request { background: var(--warn-bg); color: var(--warn-text); }
.badge-suspended, .badge-cancelled, .badge-disabled, .st-no_show { background: #FBE9E6; color: #8C2716; }
.badge-closed, .st-cancelled_by_guest, .st-cancelled_by_store, .st-rejected { background: #EEF1F2; color: #4A565C; }
.st-completed { background: var(--info-bg); color: var(--info-text); }

/* ---------------- 管理画面シェル（左ナビ） ---------------- */
.shell { display: flex; flex-wrap: wrap; min-height: 100vh; }
.sidenav { flex: 1 0 220px; max-width: 240px; background: var(--surface); border-right: 1px solid var(--line); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidenav .brand { font-weight: 800; letter-spacing: .04em; color: var(--primary); padding: 4px 10px 10px; text-decoration: none; }
.sidenav .brand small { display: block; font-weight: 400; color: var(--sub); font-size: 12px; letter-spacing: 0; }
.sidenav a.nav-item, .sidenav span.nav-item { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 15px; }
.sidenav a.nav-item:hover { background: var(--bg-admin); }
.sidenav a.nav-item[aria-current=page] { background: var(--primary-tint); color: var(--primary-dark); font-weight: 700; }
.sidenav span.nav-item { color: #8A979D; }
.sidenav .soon { font-size: 11px; border: 1px solid var(--line); border-radius: 3px; padding: 0 4px; color: var(--sub); }
.sidenav .store-switch { padding: 0 6px 10px; }
.sidenav .store-switch label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 2px; }
.sidenav .store-switch select { min-height: 40px; font-size: 15px; }
.sidenav .store-switch .btn { margin-top: 6px; width: 100%; }
.sidenav .store-name { padding: 0 10px 10px; font-weight: 700; font-size: 15px; }
.sidenav .nav-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--sub); display: flex; flex-direction: column; gap: 6px; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; }
.main-inner { padding: 20px 24px 48px; max-width: 1280px; width: 100%; }
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidenav { max-width: none; flex: none; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px 8px; gap: 4px; }
  .sidenav .brand { padding: 4px 8px; }
  .sidenav .store-switch, .sidenav .store-name { padding: 0 4px; order: 2; width: 100%; }
  .sidenav .store-switch { display: flex; gap: 6px; align-items: flex-end; }
  .sidenav .store-switch div { flex: 1; }
  .sidenav .store-switch .btn { width: auto; margin: 0; }
  .sidenav .nav-items { order: 3; display: flex; flex-direction: row; overflow-x: auto; width: 100%; gap: 2px; -webkit-overflow-scrolling: touch; }
  .sidenav .nav-item .soon { display: none; }
  .sidenav span.nav-item { display: none; }
  .sidenav .nav-item { white-space: nowrap; }
  .sidenav .nav-foot { order: 1; margin: 0 0 0 auto; border: 0; padding: 0; flex-direction: row; align-items: center; }
  .main-inner { padding: 12px 12px 40px; }
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); }
.toolbar h1 { margin: 0 4px; font-size: 20px; white-space: nowrap; }
.datenav { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--field); border-radius: 6px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 18px; }
.icon-btn:hover { background: var(--bg-admin); }
.seg { display: flex; border: 1px solid var(--field); border-radius: 6px; overflow-x: auto; max-width: 100%; }
.seg > * { white-space: nowrap; }
.toolbar input[type=date] { width: auto; min-height: 44px; }
.toolbar .inline-form { flex-wrap: nowrap; }
@media (max-width: 640px) { .seg span[aria-disabled=true] { display: none; } .toolbar h1 { font-size: 17px; } }
.seg a, .seg span { min-height: 42px; padding: 0 14px; display: flex; align-items: center; font-size: 15px; text-decoration: none; color: var(--text); background: var(--surface); }
.seg > * + * { border-left: 1px solid var(--field); }
.seg [aria-selected=true] { background: var(--primary); color: #fff; }
.seg span[aria-disabled=true] { color: #8A979D; }
.seg small { font-size: 11px; margin-left: 4px; }
.summary-line { margin: 0; padding: 10px 24px; display: flex; flex-wrap: wrap; gap: 4px 20px; font-size: 15px; background: var(--surface); border-bottom: 1px solid var(--line); }
@media (max-width: 800px) { .toolbar, .summary-line { padding-left: 12px; padding-right: 12px; } }

/* 予約台帳 */
.ledger { display: flex; flex-wrap: wrap; align-items: flex-start; }
.ledger-list { flex: 999 1 520px; min-width: 0; background: var(--surface); }
.ledger-detail { flex: 1 1 320px; max-width: 400px; background: var(--surface); border-left: 1px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; align-self: stretch; }
@media (max-width: 900px) { .ledger-detail { max-width: none; border-left: 0; border-top: 8px solid var(--bg-admin); } }
.res-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.res-table th { text-align: left; font-size: 13px; color: var(--sub); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.res-table td { padding: 0; border-bottom: 1px solid var(--line); }
.res-table td a { display: block; padding: 14px 12px; color: inherit; text-decoration: none; }
.res-table th:first-child, .res-table td:first-child a { padding-left: 24px; }
.res-table tr:hover td { background: var(--bg-admin); }
.res-table tr.is-selected td { background: #EEF6F4; }
.res-table tr.is-selected td:first-child { box-shadow: inset 4px 0 0 var(--primary); }
.res-table .time { font-weight: 700; font-size: 17px; }
.res-table tr.is-cancelled td { color: var(--sub); }
.res-table tr.is-cancelled .time { text-decoration: line-through; }
.alert-text { color: var(--danger); }
.res-cards { display: none; list-style: none; margin: 0; padding: 12px; flex-direction: column; gap: 8px; }
.res-cards a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); text-decoration: none; }
.res-cards .row1 { display: flex; align-items: baseline; gap: 10px; }
.res-cards .row1 .badge { margin-left: auto; }
.res-cards .time { font-size: 20px; font-weight: 700; }
.res-cards li.is-pending a { border-left: 4px solid #8A5A00; }
.res-cards li.is-cancelled a { color: var(--sub); }
@media (max-width: 640px) { .res-table { display: none; } .res-cards { display: flex; } }
.empty-state { margin: 24px; padding: 28px 20px; border: 1px dashed var(--field); border-radius: var(--radius); text-align: center; background: var(--surface); }
.empty-state p { margin: 4px 0; }
.dl { display: grid; grid-template-columns: 7em 1fr; gap: 6px 12px; margin: 0; font-size: 15px; }
.dl dt { color: var(--sub); }
.dl dd { margin: 0; }
.dl dd.big { font-weight: 700; font-size: 17px; }
.note-alert { padding: 6px 8px; background: var(--danger-bg); border-radius: 4px; color: #7D2A1C; }

/* 本部・汎用 */
.page-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 0 0 16px; padding: 12px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; }
.facts b { font-size: 18px; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { font-size: 13px; color: var(--sub); font-weight: 600; white-space: nowrap; }
table.data td.num, table.data th.num { text-align: right; }
table.data td.ok { color: var(--primary); font-weight: 700; }
table.data td.ng { color: var(--danger); font-weight: 700; }
table.data.small td { font-size: 14px; }
.search { display: flex; gap: 8px; margin-bottom: 16px; max-width: 480px; }
.roadmap { list-style: none; padding: 0; margin: 0; font-size: 15px; }
.roadmap li { padding: 4px 0 4px 26px; position: relative; color: var(--sub); }
.roadmap li::before { content: "○"; position: absolute; left: 0; }
.roadmap li.done { color: var(--text); }
.roadmap li.done::before { content: "✓"; color: var(--primary); font-weight: 700; }

/* ---------------- ログイン等 ---------------- */
body.plain { background: var(--bg-admin); }
.narrow { width: 100%; max-width: 420px; margin: 0 auto; padding: 48px 16px; }
.plain-brand { text-align: center; font-weight: 800; letter-spacing: .06em; color: var(--primary); margin: 0 0 16px; }
.plain .panel h1 { font-size: 20px; }
.error-code { font-size: 36px; margin: 0; color: var(--sub); }
.link-list { padding-left: 20px; }

/* ---------------- 公開店舗ページ ---------------- */
body.public { background: var(--surface); padding-bottom: 88px; }
.pub-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); max-width: 760px; margin: 0 auto; }
.pub-logo { width: 44px; height: 44px; border-radius: var(--radius); background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: none; }
.pub-title { font-size: 18px; font-weight: 700; line-height: 1.3; margin: 0; }
.pub-sub { font-size: 14px; color: var(--sub); }
.pub-hero { max-width: 760px; margin: 0 auto; height: 8px; background: var(--brand); }
.pub-main { max-width: 760px; margin: 0 auto; }
.book-box { margin: 16px 12px 0; border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.book-box h2 { margin: 0; }
.book-box .status-msg { margin: 0; padding: 10px 12px; background: var(--muted-bg); border-radius: var(--radius); font-size: 15px; }
.pub-section { padding: 24px 16px 8px; }
.pub-section h2 { border-left: 4px solid var(--brand); padding-left: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pub-section h2 small { font-size: 14px; font-weight: 400; color: var(--sub); }
.reco-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
.reco { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.reco-photo { aspect-ratio: 4 / 3; background: var(--muted-bg); display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 13px; }
.reco-body { padding: 8px 10px 10px; }
.reco-name { font-weight: 700; font-size: 15px; line-height: 1.4; }
.reco-desc { font-size: 14px; color: var(--sub); margin: 2px 0 0; }
.price { font-weight: 700; white-space: nowrap; }
.price small { font-size: 12px; font-weight: 400; color: var(--sub); }
.is-sold-out .reco-name, .is-sold-out .menu-name, .is-sold-out .price { color: var(--sub); }
.sold-out { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 700; background: var(--text); color: #fff; border-radius: 3px; padding: 1px 6px; vertical-align: middle; }
.menu-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 8px; padding: 0; list-style: none; }
.menu-tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--field); color: var(--text); text-decoration: none; font-size: 15px; }
.menu-list { list-style: none; margin: 0 0 8px; padding: 0; }
.menu-list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.menu-name { font-weight: 700; }
.menu-desc { font-size: 14px; color: var(--sub); margin: 0; }
.menu-cat { margin-top: 20px; font-size: 16px; scroll-margin-top: 12px; }
.info-dl { display: grid; grid-template-columns: 5em 1fr; gap: 6px 12px; margin: 0; font-size: 15px; }
.info-dl dt { color: var(--sub); }
.info-dl dd { margin: 0; }
.hours { list-style: none; padding: 0; margin: 0; }
.hours li span:first-child { display: inline-block; width: 1.8em; color: var(--sub); }
.notice { background: var(--bg-admin); border-radius: var(--radius); padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.sticky-cta { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface); border-top: 1px solid var(--line); padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); z-index: 5; }
.sticky-cta-inner { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; }
.sticky-cta .btn { min-height: 52px; font-size: 17px; flex: 1; }
.sticky-cta .note { flex: 1; display: flex; align-items: center; font-size: 14px; color: var(--sub); }
.pub-footer { text-align: center; color: var(--sub); font-size: 13px; padding: 24px 16px; }
