/* しま予約 ― 色とフォントは HP（shima-group.jp）に合わせる。スマホ最優先。 */
:root {
  --green-900: #14452f;
  --green-700: #1f6b4e;
  --green-500: #2e9e6b;
  --green-100: #e3f0e8;
  --ball: #cbe04b;
  --bg: #faf9f5;
  --surface: #ffffff;
  --text: #23261f;
  --text-muted: #5c6357;
  --border: #e2e4dc;
  --input-border: #9da394;
  --danger: #b42318;
  --danger-bg: #fdecea;
  --warn-bg: #fff6db;
  --warn-text: #5b4300;
  --ext-bg: #e8eef8;
  --ext-text: #1e3a6b;
  --visit-bg: #f3ecdc;
  --visit-text: #5b4a1e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 69, 47, 0.06), 0 4px 12px rgba(20, 69, 47, 0.05);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", YuGothic, Meiryo, system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}
a { color: var(--green-700); }
:focus-visible { outline: 3px solid var(--green-900); outline-offset: 2px; }
.site-header :focus-visible { outline-color: var(--ball); }

.skip-link { position: absolute; left: -9999px; top: 0; z-index: 20; background: var(--green-900); color: #fff; padding: 8px 16px; }
.skip-link:focus { left: 8px; top: 8px; }

.wrap { width: min(100% - 32px, 640px); margin-inline: auto; }
.area-admin .wrap { width: min(100% - 32px, 960px); }

/* ---------- ヘッダー ---------- */
.site-header { position: sticky; top: 0; z-index: 10; background: var(--green-900); color: #fff; }
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { flex-shrink: 0; color: #fff; font-weight: 700; font-size: 1.125rem; letter-spacing: 0.04em; text-decoration: none; white-space: nowrap; }
.brand-sub { margin-left: 6px; padding: 2px 8px; border-radius: 99px; background: var(--ball); color: var(--green-900); font-size: 0.75rem; letter-spacing: 0; vertical-align: 2px; }
.area-admin .nav { gap: 0; }
.area-admin .nav-link { padding: 8px 7px; font-size: 0.875rem; white-space: nowrap; }
/* スマホでは管理メニューを2行目に回す（5項目は1行に入らない） */
@media (max-width: 560px) {
  .area-admin .header-inner { flex-wrap: wrap; row-gap: 0; padding-top: 6px; }
  .area-admin .nav { width: calc(100% + 14px); justify-content: space-between; margin: 0 -7px 2px; }
}
.nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 4px; }
.nav form { margin: 0; }
.nav-link { display: inline-block; padding: 8px 10px; border-radius: 8px; color: #fff; font: inherit; font-size: 0.9375rem; font-weight: 700; text-decoration: none; }
.nav-link:hover { background: rgba(255, 255, 255, 0.12); }
.nav-button { background: none; border: 0; cursor: pointer; }

main { padding: 20px 0 48px; }
.site-footer { padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.875rem; text-align: center; }
.site-footer a { color: var(--text-muted); }

/* ---------- 文字 ---------- */
.page-title { margin: 4px 0 16px; font-size: 1.375rem; line-height: 1.4; }
.section-h { margin: 28px 0 10px; font-size: 1.0625rem; }
.sub-h { margin: 20px 0 8px; font-size: 1rem; color: var(--text-muted); }
.card-h { margin: 0 0 8px; font-size: 1rem; }
.muted { color: var(--text-muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }
.pre { white-space: pre-wrap; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.empty { padding: 24px 16px; border: 1px dashed var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-muted); text-align: center; }
.back { margin: 0 0 8px; }
.back a { text-decoration: none; font-weight: 700; }

/* ---------- お知らせ ---------- */
.announce { margin-bottom: 20px; padding: 12px 16px; border-left: 4px solid var(--ext-text); border-radius: var(--radius); background: var(--ext-bg); }
.announce-h { margin: 0 0 4px; font-size: 0.9375rem; color: var(--ext-text); }
.announce-list { margin: 0; padding-left: 1.2em; }
.announce-list li + li { margin-top: 6px; }
.announce-list li.is-important { color: var(--danger); font-weight: 700; }
.announce-list li.is-important a { color: var(--danger); }

/* ---------- 管理：お知らせ ---------- */
.notice-list { display: grid; gap: 8px; margin: 0 0 12px; padding: 0; list-style: none; }
.notice-item { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 8px 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.notice-item.is-important { border-left: 4px solid var(--danger); }
.notice-item p { margin: 4px 0 0; }
.notice-body { flex: 1 1 280px; min-width: 0; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.notice-list.is-past .notice-item { opacity: 0.65; }
.toolbar.tight { margin: 4px 0 0; }
.label { display: block; margin: 0 0 4px; font-weight: 700; }
.hint { margin: 0 0 6px; color: var(--text-muted); font-size: 0.9375rem; }
.roster-cancel { align-items: flex-start; }
.cancel-note { flex: 1 1 100%; font-size: 0.9375rem; }

/* ---------- 日程一覧 ---------- */
.day { margin-bottom: 22px; }
.day-h { margin: 0 0 8px; padding-left: 10px; border-left: 4px solid var(--ball); color: var(--green-900); font-size: 1rem; }
.slot-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.slot-card {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "time badge" "title badge" "venue badge";
  column-gap: 12px;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  text-decoration: none;
}
.slot-card:hover { border-color: var(--green-500); }
.slot-time { grid-area: time; font-weight: 700; font-variant-numeric: tabular-nums; }
.slot-title { grid-area: title; font-weight: 700; line-height: 1.5; }
.slot-venue { grid-area: venue; color: var(--text-muted); font-size: 0.875rem; }
.slot-card .slot-badge { grid-area: badge; align-self: center; }
.is-cancelled .slot-title, .is-cancelled .res-title { text-decoration: line-through; }

.slot-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.8125rem; font-weight: 700; white-space: nowrap; }
.b-open { background: var(--green-100); color: var(--green-900); }
.b-mine { background: var(--green-700); color: #fff; }
.b-full { background: #ececec; color: #4a4a4a; }
.b-ext { background: var(--ext-bg); color: var(--ext-text); }
.b-visit { background: var(--visit-bg); color: var(--visit-text); }
.b-cancel { background: var(--danger-bg); color: var(--danger); }
.b-draft { background: var(--warn-bg); color: var(--warn-text); }

/* ---------- 詳細 ---------- */
.detail-date { margin: 0; color: var(--green-900); font-weight: 700; }
.detail-title { margin-top: 0; }
.detail-list { display: grid; gap: 6px; margin: 0 0 16px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.detail-list div { display: grid; grid-template-columns: 4em 1fr; }
.detail-list dt { color: var(--text-muted); }
.detail-list dd { margin: 0; font-weight: 700; }
.description { margin: 0 0 16px; }
.detail-action { margin-top: 20px; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 700;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn-block { display: flex; width: 100%; }
.btn-small { min-height: 40px; padding: 6px 14px; font-size: 0.9375rem; }
.btn-primary { background: var(--green-700); color: #fff; }
.btn-primary:hover { background: var(--green-900); }
.btn-secondary { border-color: var(--green-700); background: var(--surface); color: var(--green-900); }
.btn-secondary:hover { background: var(--green-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-outline { border-color: var(--danger); background: var(--surface); color: var(--danger); }
.btn:disabled { border-color: #d6d6d6; background: #e6e6e6; color: #555; cursor: not-allowed; }
.btn-stack { display: grid; gap: 10px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 20px; }
form.inline { display: inline; margin: 0; }

/* ---------- 箱・お知らせ ---------- */
.card { margin-bottom: 16px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.notice { margin: 0 0 16px; padding: 12px 14px; border-radius: 12px; font-weight: 700; }
.notice-ok { background: var(--green-100); color: var(--green-900); }
.notice-error { background: var(--danger-bg); color: var(--danger); }
.notice-warn { background: var(--warn-bg); color: var(--warn-text); }
.dev-box { border: 2px dashed var(--ball); }

/* ---------- フォーム ---------- */
.field { margin: 0 0 16px; padding: 0; border: 0; }
fieldset.field { min-width: 0; }
label, legend { display: block; margin-bottom: 4px; font-weight: 700; }
legend { padding: 0; }
input[type="text"], input[type="email"], input[type="date"], input[type="time"], input[type="number"],
input[type="url"], input[type="tel"], select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font: inherit;
}
textarea { min-height: 96px; }
[aria-invalid="true"] { border-color: var(--danger); }
.field-error { margin: 4px 0 0; color: var(--danger); font-size: 0.875rem; font-weight: 700; }
.radio-row { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-row label, label.check { display: flex; align-items: center; gap: 8px; margin: 0; padding: 10px 14px; border: 1px solid var(--input-border); border-radius: 10px; background: #fff; font-weight: 400; cursor: pointer; }
label.check { border: 0; padding: 4px 0; background: none; }
input[type="radio"], input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--green-700); }
.row { display: flex; gap: 8px; }
.row input { flex: 1; }
.inline-form { margin-top: 16px; }
.field-row { display: grid; gap: 0 12px; }
@media (min-width: 600px) {
  .field-row { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
}
/* 種類に合わせて欄を出し分ける（JS なし。:has が使えないブラウザでは全部表示されるだけ） */
.slot-form:has(input[name="kind"][value="regular"]:checked) .external-only,
.slot-form:has(input[name="kind"][value="visit"]:checked) .external-only,
.slot-form:has(input[name="kind"][value="external"]:checked) .regular-only,
.slot-form:has(input[name="kind"][value="visit"]:checked) .regular-only { display: none; }
.external-only input { margin-bottom: 10px; }

/* ---------- マイ予約 ---------- */
.res-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.res-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.res-list.compact .res-card { padding: 8px 14px; }
.res-main { display: grid; min-width: 0; }
.res-card > .btn, .res-card > .slot-badge { flex-shrink: 0; white-space: nowrap; }
.res-date { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.res-title { margin: 0; font-weight: 700; }
.res-venue { font-size: 0.875rem; }

/* ---------- 管理画面 ---------- */
.week-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.week-nav { display: flex; gap: 6px; }
.admin-day { margin: 14px 0 18px; }
.empty-day { display: flex; justify-content: space-between; gap: 12px; margin: 0; padding: 6px 4px; border-bottom: 1px dashed var(--border); color: var(--text-muted); font-size: 0.9375rem; }
.empty-day a { font-weight: 700; white-space: nowrap; }
.admin-slots { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.admin-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); color: var(--text); text-decoration: none; }
a.admin-slot:hover { border-color: var(--green-500); }
.admin-slot.is-skip { opacity: 0.6; }
.admin-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.admin-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: auto; }
.roster { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--border); }
.roster-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.roster-name { font-weight: 700; }
.roster-actions { display: flex; gap: 6px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: 0.9375rem; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table th { background: var(--green-100); color: var(--green-900); white-space: nowrap; }
.is-deleted td { color: var(--text-muted); }

/* ---------- 管理：通知・設定 ---------- */
.big-number { margin: 0; font-size: 2rem; font-weight: 700; color: var(--green-900); font-variant-numeric: tabular-nums; }
.big-number .small { color: var(--text-muted); font-weight: 400; }
.sample-grid { display: grid; gap: 8px; }
@media (min-width: 800px) { .sample-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.sample { margin: 0; padding: 10px 14px; }
.sample summary { cursor: pointer; }
.sample-body { margin: 10px 0 0; padding: 10px 12px; border-radius: 8px; background: var(--bg); font: inherit; font-size: 0.875rem; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.indent { margin: 0 0 8px 28px; }
.logout-card { margin-top: 24px; }

/* ---------- ログイン ---------- */
/* LINE の緑（#06C755）に白文字だとコントラストが足りない（2.3）ので、濃い緑の文字にしている */
.btn-line { background: #06c755; color: #052e16; }
.btn-line:hover { background: #05b34c; }
.friend-card { border: 2px solid #06c755; }
/* 名簿：名前が長くてもボタンの位置がそろうよう、名前の側を折り返す */
.roster-row:not(.roster-cancel) { flex-wrap: nowrap; }
.roster-row:not(.roster-cancel) .roster-name { flex: 1 1 auto; min-width: 0; }
.roster-actions { flex-shrink: 0; }
