/* 院の管理画面。Apps Script の版にも同じ内容を埋め込むので、外部のファイルを読まない */
:root {
  --bg: #f4f0e8; --paper: #fbf8f2; --ink: #23302b; --sub: #5d6a63; --line: #dcd5c8;
  /* 管理画面は濃い赤。お客様の画面（深緑）と見分けるため */
  --green: #8a2b2b; --deep: #5c1515; --open: #ede4e2; --few: #f7e8d3; --few-ink: #7a4a12; --full: #e7e1d6;
  /* 注意と危ない操作は、赤の土台と見分けられる濃い橙 */
  --red: #a1500a; --red-bg: #fdecd6; --first: #fbeed2;
  --bar: 58px; --quick: 57px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Hiragino Sans", "Yu Gothic UI", "Noto Sans JP", Meiryo, sans-serif; font-size: 16px; line-height: 1.6; padding-bottom: calc(var(--bar) + var(--quick) + 84px + env(safe-area-inset-bottom)); }
h1, h2, p, dl, dd, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #c8862c; outline-offset: 2px; }
[hidden] { display: none !important; }

.band { background: #2b0808; color: #fff; font-size: .8125rem; font-weight: 700; letter-spacing: .04em; text-align: center; padding: 6px 16px; }
.band span { display: inline-block; margin-left: 10px; padding: 1px 8px; border: 1px solid rgba(255, 255, 255, .6); border-radius: 999px; font-weight: 400; letter-spacing: 0; }
.top { background: var(--deep); color: #fff; }
.top-tag { display: inline-block; margin-bottom: 4px; padding: 2px 8px; border-radius: 6px; background: #fff; color: var(--deep); font-size: .8125rem; font-weight: 700; }
.top-in { display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 960px; margin: 0 auto; padding: 10px 16px; }
.top-name { font-weight: 700; line-height: 1.3; }
.top-sub { font-size: .8125rem; opacity: .85; }
.top .ghost { color: #fff; border-color: rgba(255, 255, 255, .55); background: transparent; }
.sample { background: var(--first); color: #5a4414; font-size: .8125rem; padding: 6px 16px; text-align: center; }

.main { max-width: 960px; margin: 0 auto; padding: 12px 16px; }
.status { font-size: .875rem; color: var(--sub); padding: 8px 0; }
.status:empty { display: none; }
.status.is-error { color: var(--red); font-weight: 700; }

.notices { display: grid; gap: 6px; margin-bottom: 10px; }
.notices li { padding: 10px 14px; border: 1px solid var(--red); border-radius: 10px; background: var(--red-bg); color: var(--red); font-weight: 700; font-size: .9375rem; }
.notice-row { display: block; width: 100%; min-height: 44px; padding: 0; border: 0; background: none; color: inherit; font-weight: 700; text-align: left; text-decoration: underline; }
.alert { display: block; width: 100%; margin-bottom: 10px; padding: 12px 14px; border: 1px solid var(--red); border-radius: 10px; background: var(--red-bg); color: var(--red); font-weight: 700; text-align: left; min-height: 48px; }

/* 週の送りは日付の行の上に分ける。同じ行に置くと、日付のボタンの幅が 37px、矢印が 34px しか取れなかった（2026-11-10 の監査） */
.week { display: grid; grid-template-columns: 1fr 1fr; gap: 0 4px; align-items: stretch; }
.arrow { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--green); font-size: .9375rem; font-weight: 700; text-align: left; }
.arrow:last-child { text-align: right; }
.days { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; min-width: 0; }
.day { display: grid; justify-items: center; gap: 0; padding: 6px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); min-width: 0; min-height: 66px; }
.day b { font-size: 1.0625rem; line-height: 1.3; }
.day span { font-size: .8125rem; color: var(--sub); line-height: 1.3; }
.day .count { min-height: 1.1em; color: var(--green); font-weight: 700; }
.day.is-sun span:first-child { color: var(--red); }
.day.is-today { border-color: var(--green); }
.day[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.day[aria-pressed="true"] span { color: #fff; }

.day-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; margin: 14px 0 8px; }
.day-title { font-size: 1.25rem; color: var(--deep); }
.day-sum { font-size: .875rem; color: var(--sub); }
.day-off { padding: 12px; border-radius: 10px; background: var(--full); font-size: .9375rem; margin-bottom: 8px; }

.time { display: grid; gap: 4px; margin-top: 8px; }
.link { min-height: 44px; padding: 8px 0; border: 0; background: none; color: var(--green); font-weight: 700; font-size: .875rem; text-decoration: underline; }
.row.is-now .row-time { color: var(--deep); font-weight: 700; }
.row { display: grid; grid-template-columns: 52px 1fr; gap: 8px; align-items: stretch; }
/* 時刻・時間・メニューは、施術の合間に一目で読む字。14px から 16px に（2026-11-10 の監査） */
.row-time { font-size: 1rem; font-variant-numeric: tabular-nums; color: var(--ink); padding-top: 11px; text-align: right; }
.row-body { display: grid; gap: 4px; min-width: 0; }
.free { width: 100%; min-height: 48px; padding: 8px 12px; border: 1px dashed var(--line); border-radius: 10px; background: transparent; color: var(--sub); font-size: 1rem; text-align: left; }
.free.is-few { background: var(--few); border-style: solid; border-color: #ecd3ae; color: var(--few-ink); }
.card { display: grid; gap: 2px; width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-left: 5px solid var(--green); border-radius: 10px; background: var(--paper); text-align: left; min-height: 56px; }
.card.is-plan { border-left-color: #8a7f6c; background: var(--full); }
.card.is-plan .card-sub { color: var(--ink); } /* 灰色の地に灰色の字では 4.35:1 だった */
.card-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-weight: 700; font-size: 1.0625rem; }
.card-sub { font-size: 1rem; color: var(--sub); overflow-wrap: anywhere; }
.badge { padding: 0 6px; border-radius: 6px; background: var(--first); color: #5a4414; font-size: .8125rem; font-weight: 700; }
.badge.is-warn { background: var(--red-bg); color: var(--red); }

.gone { margin-top: 12px; }
.gone summary { min-height: 44px; padding: 10px 0; color: var(--green); font-weight: 700; cursor: pointer; }
.card.is-gone { border-left-color: #8a7f6c; opacity: .85; }
.view-title { font-size: 1.25rem; color: var(--deep); margin-top: 4px; }
.view-lead { font-size: .875rem; color: var(--sub); margin-bottom: 10px; }
.list { display: grid; gap: 6px; }
.empty { padding: 20px 0; color: var(--sub); text-align: center; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats div { padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.stats dt { font-size: .875rem; color: var(--sub); }
.stats dd { font-size: 1.5rem; font-weight: 700; color: var(--deep); line-height: 1.3; }
.stats small { display: block; font-size: .8125rem; font-weight: 400; color: var(--sub); }

/* 片手で届くように、よく使う操作を下に置く */
.quick { position: fixed; left: 0; right: 0; bottom: calc(var(--bar) + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 4px; height: var(--quick); padding: 4px 8px; background: var(--paper); border-top: 1px solid var(--line); }
/* 2026-11-10 の監査（ChatGPT・Copilot・Gemini）：押す所は 44px 以上（下の帯は 48px）、時刻の字は 12px 以上。「最新にする」は仕事の中身より目立たせない */
.quick button { flex: 1 1 auto; min-width: 0; padding: 0 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--deep); font-size: .875rem; font-weight: 700; line-height: 1.2; }
.quick [data-reload] { background: transparent; color: var(--ink); font-weight: 400; }
.quick small { display: block; font-size: .8125rem; font-weight: 400; color: var(--sub); white-space: nowrap; }
.fab { position: fixed; right: 16px; bottom: calc(var(--bar) + var(--quick) + 12px + env(safe-area-inset-bottom)); z-index: 5; display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 0 20px; border: 0; border-radius: 26px; background: var(--deep); color: #fff; font-weight: 700; box-shadow: 0 4px 14px rgba(23, 58, 46, .35); }
.fab span { font-size: 1.25rem; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--paper); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { position: relative; min-height: var(--bar); border: 0; background: none; color: var(--sub); font-weight: 700; font-size: .9375rem; }
.tabs [aria-current="page"] { color: var(--deep); box-shadow: inset 0 3px 0 var(--green); }
.tabs-head { display: none; }
/* ホーム：今日の予約、この先7日の空き、今月。広い画面では横に並ぶ */
.home { display: grid; gap: 12px; }
.panel { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 12px; margin-bottom: 8px; }
.panel-head h2 { font-size: 1.0625rem; color: var(--deep); }
.panel-head .link { padding: 0 0 0 8px; min-height: 44px; }
.panel-sub { font-size: .8125rem; color: var(--sub); }
.panel .stats { grid-template-columns: repeat(3, 1fr); margin-bottom: 10px; }
.panel .stats div { padding: 8px 10px; background: var(--bg); }
.panel .stats dd { font-size: 1.25rem; }
.panel .stats.stats-4 { grid-template-columns: repeat(2, 1fr); }
.view-sub { font-size: 1.0625rem; color: var(--deep); margin-top: 16px; }
.view-sub + .view-lead { margin-top: 2px; }
.tabs { grid-template-columns: repeat(5, 1fr); }
.tabs button { font-size: .875rem; }
#settings-title + .view-lead { margin-bottom: 10px; }
.book-link { margin-bottom: 12px; }
[data-view="settings"] .panel { margin-bottom: 12px; }
.set-list { display: grid; gap: 4px; }
.set-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; text-align: left; }
.set-row b { font-size: .9375rem; }
.set-row small { display: block; color: var(--sub); font-size: .875rem; }
.set-row .set-val { font-variant-numeric: tabular-nums; color: var(--deep); font-weight: 700; white-space: nowrap; }
div.set-row { background: var(--bg); }
.hours-rows { display: grid; gap: 10px; margin-top: 12px; }
.hours-row { display: grid; grid-template-columns: 40px 1fr 1fr; gap: 8px; align-items: end; }
.hours-row b { padding-bottom: 12px; }
.hours-row label { display: grid; gap: 4px; font-size: .8125rem; color: var(--sub); }
.hours-row select { min-height: 48px; padding: 8px; border: 1px solid var(--green); border-radius: 8px; background: #fff; color: var(--ink); font-size: 1rem; }
/* 予約の詳しい内容：お客様へ連絡／予約を変更する／取り消し の3段に分ける */
.actions-head { margin: 4px 0 -2px; font-size: .875rem; font-weight: 700; color: var(--sub); letter-spacing: .04em; }
.actions-danger { margin-top: 22px; padding-top: 12px; border-top: 1px dashed var(--line); }
a.ghost { display: flex; flex-direction: column; align-items: center; justify-content: center; text-decoration: none; text-align: center; }
a.ghost small { font-weight: 400; font-size: .8125rem; color: var(--sub); }
.week-list { display: grid; gap: 4px; }
.remind-list { display: grid; gap: 6px; }
/* 臨時の休みの確かめ：説明の文と、押すボタンを分ける（実機で、下線の長い文がボタンに見えなかった） */
.holiday-ask { display: grid; gap: 10px; margin: 6px 0 10px; padding: 12px; border: 1px solid var(--red); border-radius: 10px; background: var(--red-bg); }
.holiday-ask p { color: var(--red); font-weight: 700; font-size: .9375rem; }
.ask-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; color: var(--ink); font-size: 1rem; font-variant-numeric: tabular-nums; }
.ask-list:empty { display: none; }
.ask-list .ask-head { font-size: .875rem; font-weight: 700; }
.holiday-ask .ask-sub { color: var(--ink); font-weight: 400; font-size: .875rem; }
.holiday-ask .ask-sub:empty { display: none; }
.remind-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; min-height: 48px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.remind-row b { font-variant-numeric: tabular-nums; margin-right: 6px; }
.remind-row small { display: block; color: var(--sub); font-size: .875rem; }
.remind-row .ghost { min-height: 48px; padding: 4px 10px; font-size: .875rem; }
.remind-row.is-done .ghost { color: var(--sub); border-color: var(--line); }
.week-row { display: grid; grid-template-columns: 76px 1fr auto; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 8px; border: 1px solid transparent; border-radius: 8px; background: none; text-align: left; font-size: .875rem; }
.week-row:hover { border-color: var(--line); background: var(--bg); }
.week-row.is-today b { color: var(--deep); }
.week-row.is-sun b { color: var(--red); }
.week-row b { font-variant-numeric: tabular-nums; }
.week-row .bar { height: 8px; border-radius: 4px; background: var(--full); overflow: hidden; }
.week-row .bar span { display: block; height: 100%; background: var(--green); }
.week-row.is-off .bar { opacity: .5; }
.week-row small { color: var(--sub); white-space: nowrap; font-size: .875rem; }
.dot { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 5px; border-radius: 10px; background: var(--red); color: #fff; font-size: .8125rem; line-height: 20px; }

.sheet { scroll-padding: 68px 0 170px; position: fixed; inset: auto 0 0 0; width: 100%; max-width: 560px; max-height: 92dvh; margin: auto auto 0; padding: 0 16px; border: 0; border-radius: 16px 16px 0 0; background: var(--paper); color: var(--ink); overflow: auto; }
.sheet:focus { outline: none; }
.sheet::backdrop { background: rgba(23, 58, 46, .5); }
.sheet-head { position: sticky; top: 0; z-index: 1; display: flex; justify-content: space-between; align-items: center; padding: 12px 0 8px; background: var(--paper); }
.sheet-head h2 { font-size: 1.125rem; color: var(--deep); overflow-wrap: anywhere; }
.close { width: 44px; height: 44px; margin-right: -8px; border: 0; background: none; font-size: 1.5rem; color: var(--sub); }
.field { display: grid; gap: 4px; margin-top: 12px; font-weight: 700; font-size: .9375rem; }
.field small { display: block; font-weight: 400; font-size: .8125rem; color: var(--sub); }
.field input, .field textarea, .field-sub input { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--green); border-radius: 8px; background: #fff; font-weight: 400; font-size: 1rem; }
.field-sub { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 8px; margin-top: 4px; font-weight: 400; font-size: .875rem; color: var(--sub); }
.slots { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; }
/* 幅の狭いスマホでは 4 列にする。5 列のままだと 1 つ 54px で、急いでいるととなりを押しやすい（2026-11-10 の 2 回目の確認） */
@media (max-width: 359px) { .slots { grid-template-columns: repeat(4, 1fr); } }
/* 開始のボタンの「空き／満／あと1人」は、予約できるかどうかを決める字。11px から 13px に、ボタンは 48px に（2026-11-10 の監査で 3 つの AI が一致） */
.slot { min-height: 48px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--open); font-size: .9375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot small { display: block; font-size: .8125rem; line-height: 1.25; color: var(--ink); font-weight: 400; }
.slot.is-few { background: var(--few); }
.slot.is-full { background: var(--full); color: #4a554f; font-weight: 400; }
.slot.is-full small { color: #4a554f; }
.slot[aria-pressed="true"], .chip[aria-pressed="true"] { background: var(--deep); border-color: var(--deep); color: #fff; }
.slot[aria-pressed="true"] small { color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* メニューは「施術」と「院の予定」を見出しで分ける（お客様の予約に、院の予定を選び間違えないように） */
.chips-head { flex: 0 0 100%; margin: 4px 0 -2px; font-size: .875rem; font-weight: 700; color: var(--sub); }
.chips-head:first-child { margin-top: 0; }
.chip { min-height: 44px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 22px; background: #fff; font-size: .9375rem; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 8px; font-weight: 700; font-size: .9375rem; }
.check input { width: 20px; height: 20px; accent-color: var(--green); }
.paste { margin-top: 2px; padding: 2px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.paste summary { min-height: 44px; padding: 10px 0; font-weight: 700; color: var(--green); cursor: pointer; }
.paste[open] { padding-bottom: 8px; }
.paste .field { margin-top: 6px; }
.hits { margin-top: 6px; }
.hits:empty { display: none; }
.note { margin-top: 8px; font-size: .875rem; color: var(--sub); }
.warn { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--few); color: var(--few-ink); font-size: .9375rem; font-weight: 700; }
.sheet-foot { position: sticky; bottom: 0; z-index: 1; display: grid; gap: 8px; margin-top: 12px; padding: 10px 0 calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--paper); }
.sheet-foot .warn { margin-top: 0; max-height: 28dvh; overflow: auto; }
.foot-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.saving { padding: 8px 12px; border-radius: 8px; background: var(--open); color: var(--deep); font-size: .9375rem; font-weight: 700; }
.ask { display: grid; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--red-bg); color: var(--red); font-size: .9375rem; font-weight: 700; }
.primary, .ghost { min-height: 48px; padding: 8px 14px; border-radius: 10px; font-weight: 700; }
.primary { width: 100%; border: 0; background: var(--deep); color: #fff; }
.primary:disabled, .ghost:disabled { opacity: .6; }
.ghost { border: 1px solid var(--green); background: #fff; color: var(--deep); }
.top .ghost { min-height: 40px; font-size: .875rem; }
.wide { width: 100%; }
.danger { border-color: var(--red); color: var(--red); }
.detail { display: grid; gap: 8px; }
.detail dt { font-size: .875rem; color: var(--sub); }
.detail dd { overflow-wrap: anywhere; }
.actions { display: grid; gap: 8px; margin-top: 14px; }
.reply { width: 100%; margin-top: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: .875rem; }

.toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--bar) + var(--quick) + 74px + env(safe-area-inset-bottom)); z-index: 6; display: flex; justify-content: space-between; align-items: center; gap: 12px; max-width: 520px; margin: 0 auto; padding: 10px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-size: .9375rem; }
.toast.is-error { background: var(--red); }
/* 知らせが出ている間は、いちばん下の行（「取り消した予約」など）を知らせの上まで動かせるように、余白を足す */
body.has-toast::after { content: ""; display: block; height: calc(var(--toast-h, 0px) + 16px); }
.toast { flex-wrap: wrap; }
/* 文面のコピーのボタンがあるときは、知らせの文を 1 行目、ボタンを 2 行目に並べる（幅 390px では 3 つが 1 行に入らず、「元に戻す」だけが下に落ちていた） */
.toast.has-act { gap: 2px 12px; }
.toast.has-act [data-toast-text] { flex: 0 0 100%; }
.toast button { min-height: 44px; padding: 0 8px; border: 0; background: none; color: #ffd98e; font-weight: 700; white-space: nowrap; }

@media (min-width: 760px) {
  /* 広い画面では、画面の切りかえを左のメニューにする */
  :root { --side: 184px; }
  body { padding-left: var(--side); padding-bottom: calc(var(--quick) + 84px); }
  .tabs, .tabs.tabs { right: auto; top: 0; width: var(--side); grid-template-columns: 1fr; align-content: start; gap: 2px; padding: 12px 10px; border-top: 0; border-right: 1px solid var(--line); }
  .tabs-head { display: block; margin: 4px 10px 10px; font-size: .8125rem; font-weight: 700; color: var(--sub); letter-spacing: .04em; }
  .tabs button { min-height: 48px; padding: 0 12px; border-radius: 8px; text-align: left; }
  .tabs [aria-current="page"] { background: var(--open); box-shadow: inset 4px 0 0 var(--green); }
  .quick { left: var(--side); bottom: 0; }
  .fab { bottom: calc(var(--quick) + 12px); }
  .toast { left: calc(var(--side) + 16px); bottom: calc(var(--quick) + 74px); }
  .home { grid-template-columns: 1fr 1fr; }
  .home .panel:last-child { grid-column: 1 / -1; }
  .panel .stats.stats-4 { grid-template-columns: repeat(4, 1fr); }
  .sheet { margin: auto; border-radius: 16px; inset: 0 0 0 var(--side); height: fit-content; }
  .row { grid-template-columns: 64px 1fr; }
  .row-body { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .slots { grid-template-columns: repeat(6, 1fr); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] { animation: rise .16s ease-out; }
  @keyframes rise { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
}
