/* 初診Web予約 共通スタイル（スマートフォン優先）。院ごとのテーマ色は theme.css の --accent で上書きする */
:root {
  --accent: #a9273e;
  --accent-ink: #ffffff;
  --accent-soft: #f6e9ec;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --fg: #1d2630;
  --muted: #5b6672;
  --line: #d6dbe0;
  --open: #1f6f43;
  --few: #8a5a00;
  --full: #9b2c3a;
  --closed: #8a949e;
  --warn-bg: #fff4dc;
  --warn-line: #e3b45a;
  --error-bg: #fde8eb;
  --error-line: #d5707f;
  --radius: 10px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: var(--accent); word-break: break-all; }
[hidden] { display: none !important; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; letter-spacing: .04em; }

.site-header { background: var(--accent); color: var(--accent-ink); }
.site-header__inner { max-width: 720px; margin: 0 auto; padding: 12px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.site-header__text { flex: 1; min-width: 0; }
.site-header__logo { flex: none; padding: 5px 8px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; }
.site-header__logo img { height: 34px; width: auto; display: block; }
.admin .site-header nav { flex-basis: 100%; }
.site-header__clinic { margin: 0; font-size: 13px; opacity: .9; }
.site-header__title { margin: 0; font-size: 19px; font-weight: 700; }
.page { max-width: 720px; margin: 0 auto; padding: 12px 16px 32px; }
.site-footer { max-width: 720px; margin: 0 auto; padding: 0 16px 32px; font-size: 14px; color: var(--muted); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.card--quiet { background: transparent; }
.card__title { font-size: 19px; margin: 0 0 12px; line-height: 1.45; }
.card__subtitle { font-size: 15px; margin: 0 0 6px; }
.card p { margin: 0 0 8px; }
.note, .hint { color: var(--muted); font-size: 14px; }
.hint { margin: 4px 0 0; }

.steps { display: flex; list-style: none; padding: 0; margin: 4px 0 0; gap: 4px; font-size: 12px; }
.steps li { flex: 1; text-align: center; padding: 6px 0 4px; border-bottom: 3px solid var(--line); color: var(--muted); }
.steps li.is-done { border-color: var(--accent); color: var(--fg); }
.steps li.is-current { border-color: var(--accent); color: var(--accent); font-weight: 700; }

.announce { background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.announce p { margin: 0; }
.notice__list { margin: 0; padding-left: 1.2em; }
.notice__list li { margin: 4px 0; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 10px 18px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--surface); color: var(--accent);
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--danger { background: var(--full); border-color: var(--full); color: #fff; }
.btn--ghost { border-color: transparent; background: transparent; font-weight: 400; text-decoration: underline; }
.btn--small { min-height: 40px; padding: 6px 12px; font-size: 14px; }
.btn:focus-visible, .choice:focus-visible, .slot:focus-visible, .cal__day:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}
.actions { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
@media (min-width: 560px) { .actions { flex-direction: row; flex-wrap: wrap; } }

.choice-list { display: grid; gap: 10px; }
.choice {
  display: block; width: 100%; text-align: left; padding: 16px; min-height: 60px;
  border: 2px solid var(--accent); border-radius: var(--radius); background: var(--accent-soft);
  color: var(--fg); font: inherit; font-weight: 700; font-size: 17px; cursor: pointer;
}
.selected { margin: 0 0 8px; padding: 8px 12px; background: var(--accent-soft); border-radius: 6px; font-weight: 700; font-size: 15px; }

.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.cal-nav__title { margin: 0; font-weight: 700; font-size: 17px; }
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.cal th { font-size: 13px; color: var(--muted); padding: 4px 0; font-weight: 400; }
.cal td { padding: 2px; text-align: center; }
.cal .sun, .cal th.sun { color: var(--full); }
.cal .sat, .cal th.sat { color: #2457a6; }
.cal__day {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 52px; border-radius: 8px; border: 1px solid transparent; background: none; font: inherit; padding: 2px 0;
}
.cal__num { font-size: 15px; line-height: 1.2; }
.cal__mark { font-size: 14px; line-height: 1.2; font-weight: 700; }
button.cal__day { border-color: var(--line); background: var(--surface); cursor: pointer; color: var(--fg); }
button.cal__day:hover { border-color: var(--accent); background: var(--accent-soft); }
.cal__day--open .cal__mark { color: var(--open); }
.cal__day--few .cal__mark { color: var(--few); }
.cal__day--full { color: var(--closed); }
.cal__day--full .cal__mark { color: var(--full); }
.cal__day--closed, .cal__day--closed .cal__mark { color: var(--closed); }
.cal__loading { padding: 24px 0 !important; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.mark { font-weight: 700; margin-right: 2px; }
.mark--open { color: var(--open); } .mark--few { color: var(--few); } .mark--full { color: var(--full); } .mark--closed { color: var(--closed); }

.slot-list { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 560px) { .slot-list { grid-template-columns: 1fr 1fr; } }
.slot {
  display: flex; align-items: baseline; gap: 10px; width: 100%; min-height: 54px; padding: 10px 14px;
  border: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface); font: inherit; color: var(--fg); cursor: pointer; text-align: left;
}
.slot__time { font-size: 20px; font-weight: 700; min-width: 3.2em; }
.slot__visit { font-size: 14px; color: var(--muted); }
.slot--full { border-color: var(--line); background: var(--bg); color: var(--closed); cursor: not-allowed; }

.summary { display: grid; grid-template-columns: 7.5em 1fr; gap: 6px 10px; margin: 0 0 8px; }
.summary dt { color: var(--muted); font-size: 14px; }
.summary dd { margin: 0; font-weight: 700; word-break: break-all; }
.timer { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.timer b { color: var(--fg); }

.field { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
.field legend, .field__label { display: block; font-weight: 700; margin-bottom: 6px; padding: 0; }
.field__label--sub { font-weight: 400; font-size: 14px; margin-top: 10px; }
.row2, .row3 { display: grid; gap: 8px; }
.row2 { grid-template-columns: 1fr 1fr; }
.row3 { grid-template-columns: 1.4fr 1fr 1fr; }
.row2 label, .row3 label { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.row2 label { flex-direction: column; align-items: stretch; gap: 2px; }
input[type=text], input:not([type]), input[type=tel], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 48px; padding: 8px 10px; border: 1px solid #a9b2bb; border-radius: 8px;
  background: #fff; color: var(--fg); font: inherit; font-size: 16px;
}
textarea { min-height: 120px; line-height: 1.6; }
.radio-row { display: flex; gap: 10px; }
.radio, .check { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.radio { flex: 1; }
.radio input, .check input { width: 22px; height: 22px; margin: 0; accent-color: var(--accent); }
.consent__text { font-size: 14px; color: var(--muted); background: var(--bg); padding: 10px 12px; border-radius: 8px; margin-bottom: 8px; }
.consent__text p { margin: 0 0 4px; }
.err { color: var(--full); font-size: 14px; margin: 4px 0 0; }
.err:empty { display: none; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.alert { border-radius: 8px; padding: 10px 12px; margin: 8px 0; font-size: 15px; }
.alert--warn { background: var(--warn-bg); border: 1px solid var(--warn-line); }
.alert--error { background: var(--error-bg); border: 1px solid var(--error-line); }
.alert--ok { background: var(--accent-soft); border: 1px solid var(--accent); }
.done__lead { font-size: 17px; font-weight: 700; }
.done__block { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.debug { white-space: pre-wrap; font-size: 12px; color: var(--muted); }

/* ---- 管理画面 ---- */
.admin .page { max-width: 1100px; }
.admin .site-header__inner, .admin .site-footer { max-width: 1100px; }
.admin-nav { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 8px 0 0; padding: 0; list-style: none; font-size: 14px; }
.admin-nav a { color: var(--accent-ink); }
.admin-nav a[aria-current] { font-weight: 700; text-decoration-thickness: 3px; }
.tbl { overflow-x: auto; margin: 8px 0; }
.tbl table { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--surface); }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: middle; white-space: nowrap; }
.tbl th { background: var(--accent-soft); }
.tbl td.wrap { white-space: normal; }
.inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
.inline-form input, .inline-form select { width: auto; min-height: 38px; padding: 4px 8px; font-size: 14px; }
.inline-form .btn { min-height: 38px; padding: 4px 12px; font-size: 14px; }
.form-grid { display: grid; gap: 14px; max-width: 640px; }
.form-grid label { display: grid; gap: 4px; font-weight: 700; }
.form-grid .help { font-weight: 400; font-size: 13px; color: var(--muted); }
.badge { display: inline-block; padding: 0 8px; border-radius: 4px; font-size: 12px; font-weight: 700; background: var(--bg); border: 1px solid var(--line); }
.badge--web { background: var(--accent-soft); border-color: var(--accent); }
.badge--phone { background: var(--warn-bg); border-color: var(--warn-line); }
.badge--cancelled { color: var(--muted); }
.row-cancelled td { color: var(--muted); text-decoration: line-through; }
.row-cancelled td.nostrike { text-decoration: none; }
.weekdays { display: flex; flex-wrap: wrap; gap: 2px 10px; }
.weekdays label { display: inline-flex; align-items: center; gap: 2px; font-weight: 400; }
.grid-2 { display: grid; gap: 12px; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.badge--danger { background: var(--error-bg); border-color: var(--error-line); color: var(--full); }

/* 管理画面：月の一覧（カレンダー） */
.mcal { width: 100%; border-collapse: collapse; table-layout: fixed; background: var(--surface); }
.mcal th { font-size: 13px; color: var(--muted); font-weight: 400; padding: 4px 0; border-bottom: 1px solid var(--line); }
.mcal th.sun { color: var(--full); }
.mcal th.sat { color: #2457a6; }
.mcal td { border: 1px solid var(--line); vertical-align: top; height: 92px; padding: 0; }
.mcal td a { display: block; height: 100%; padding: 4px 6px; color: var(--fg); text-decoration: none; }
.mcal td a:hover { background: var(--accent-soft); }
.mcal__num { display: block; font-weight: 700; font-size: 15px; }
.mcal__day.sun .mcal__num { color: var(--full); }
.mcal__day.sat .mcal__num { color: #2457a6; }
.mcal__note { display: block; font-size: 11px; color: var(--full); line-height: 1.3; }
.mcal__line { display: block; font-size: 12px; line-height: 1.5; }
.mcal__free { font-weight: 700; color: var(--open); }
.mcal__day--full .mcal__free { color: var(--full); }
.mcal__day--closed { background: var(--bg); }
.mcal__day--closed .mcal__line { color: var(--closed); }
.mcal__day--today { outline: 3px solid var(--accent); outline-offset: -3px; }
.mcal__blank { background: var(--bg); }
@media (max-width: 640px) { .mcal td { height: 76px; } .mcal__line { font-size: 10px; } .mcal td a { padding: 2px 3px; } }
.actions--row { flex-direction: row; }
.actions--row .btn { flex: 1; padding-inline: 8px; }
.nowrap { white-space: nowrap; }
/* 管理画面：予約項目の切り替え */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; border-bottom: 2px solid var(--accent); }
.tabs__item { padding: 8px 14px; border: 1px solid var(--line); border-bottom: none; border-radius: 8px 8px 0 0; background: var(--bg); color: var(--fg); text-decoration: none; font-weight: 700; font-size: 14px; }
.tabs__item[aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
