/* 支店情報アプリ（branch）と Signs by SBS Group の共通の見た目。色は今の Bubble 版の画面に合わせる（docs/bubble/screens.md §3） */
:root {
  --navy: #091747;
  --ink: #1a1b20;
  /* 今の主色の赤 #FF0000 は白い文字との明暗の差が足りないので、見た目を保って少し暗くする */
  --red: #e00000;
  --red-dark: #b80000;
  --yellow: #fab515;
  --base: #f2f5f9;
  --surface: #e4eaf1;
  --card-line: #848aa3;
  --muted: #5b6275;
  --success: #0f7b3a;
  --radius: 8px;
  --font-sans: 'Noto Sans JP', system-ui, sans-serif;
  --font-serif: 'Noto Serif JP', serif;
}

*, *::before, *::after { box-sizing: border-box; }
/* hidden 属性は、display を指定した部品（ボタンなど）でも必ず隠す */
[hidden] { display: none !important; }
/* 見た目は隠し、読み上げには残す */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; font-family: var(--font-sans); line-height: 1.7; color: var(--navy); background: var(--base); }
body.product-signs { background: #f9f9ff; color: var(--ink); }
a { color: #435e91; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 12px; }
p { margin: 0 0 12px; }

/* ---------- ヘッダー ---------- */
.site-header { background: #fff; border-bottom: 1px solid #dfe4ec; }
.site-header__bar { width: min(1140px, 94vw); min-height: 72px; margin: 0 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 10px 0; }
.brand { text-decoration: none; color: var(--navy); }
.brand__name { font-size: 1.9rem; font-weight: 700; letter-spacing: 0.02em; }
.brand__name--signs { font-family: var(--font-serif); color: var(--ink); }
.brand__name--signs small { font-family: var(--font-sans); font-size: 0.95rem; font-weight: 500; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 18px; margin-left: auto; }
.site-nav a { color: #252525; text-decoration: none; font-weight: 700; padding: 6px 2px; border-bottom: 2px solid transparent; }
.site-nav a[aria-current='page'] { color: var(--red); border-bottom-color: var(--red); }
.site-nav__logout { margin: 0; }
.product-signs .site-header { border-bottom: 3px solid transparent; border-image: linear-gradient(90deg, var(--red), var(--yellow)) 1; }

/* ---------- 本体 ---------- */
.page { width: min(1140px, 94vw); margin: 32px auto 48px; flex: 1; }
.page--narrow { width: min(520px, 92vw); }
.card { background: #fff; border: 1px solid var(--card-line); border-radius: var(--radius); padding: 28px; }
.card__title { font-size: 1.4rem; }
.product-signs .card__title { font-family: var(--font-serif); }
.muted { color: var(--muted); }
.notice { background: var(--surface); border-radius: var(--radius); padding: 12px 14px; font-size: 0.95rem; }
.flash { border-radius: var(--radius); padding: 12px 16px; margin: 0 0 20px; font-weight: 700; }
.flash--success { background: #e7f5ec; color: var(--success); }
.flash--error { background: #fdecec; color: var(--red-dark); }

/* ---------- 入力 ---------- */
.stack { display: grid; gap: 18px; margin: 0; }
.stack + p { margin: 16px 0 0; }
.field { display: grid; gap: 6px; }
.field__label { font-weight: 700; }
.input { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--card-line); border-radius: var(--radius); font: inherit; color: var(--ink); background: #fff; }
.input:focus { outline: 3px solid rgba(224, 0, 0, 0.25); border-color: var(--red); }
.input--code { font-size: 1.4rem; letter-spacing: 0.3em; }
.form-error { color: var(--red-dark); font-weight: 700; }

/* ---------- ボタン ---------- */
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 22px; border-radius: 4px; border: 1px solid transparent; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.button--primary { background: var(--red); color: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15); }
.button--primary:hover { background: var(--red-dark); }
.button--outline { background: #fff; color: var(--red); border-color: var(--red); }
.button--small { min-height: 34px; padding: 0 14px; font-size: 0.9rem; }
.button--block { width: 100%; }

/* ---------- フッター ---------- */
.site-footer { padding: 18px; text-align: center; font-size: 0.85rem; color: var(--muted); background: #fff; border-top: 1px solid #dfe4ec; }
.product-signs .site-footer { font-family: var(--font-serif); font-weight: 700; color: var(--ink); }

/* ---------- 共通の見出し・戻るリンク ---------- */
.page-title { font-size: 1.75rem; font-weight: 700; padding-bottom: 10px; margin-bottom: 20px; border-bottom: 1px solid #c9d0dc; }
.back-link { margin: 0 0 8px; }
.pre { white-space: pre-wrap; }

/* ---------- 支店リスト ---------- */
.filter { margin-bottom: 16px; }
.filter__title { font-size: 1.1rem; }
.filter__form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; }
.filter__form .field { flex: 1 1 220px; }
.result-count { font-weight: 700; }
.result-count a { margin-left: 12px; font-weight: 500; }
.branch-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.branch-card { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; min-height: 84px; padding: 16px 24px; background: #fff; border: 1px solid var(--red); border-radius: var(--radius); text-decoration: none; }
.branch-card:hover, .branch-card:focus-visible { box-shadow: 0 2px 8px rgba(224, 0, 0, 0.15); }
.branch-card__name { color: var(--red); font-weight: 700; font-size: 1.15rem; }
.branch-card__updated { color: var(--navy); }

/* ---------- 支店の詳細 ---------- */
.detail-section { margin-bottom: 16px; }
.detail-section h2 { font-size: 1.2rem; margin: 0; }
.detail-section__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.detail-section > h2 { margin-bottom: 12px; }
.detail-list { margin: 0; display: grid; gap: 0; }
.detail-list__row { display: grid; grid-template-columns: minmax(8em, 14em) 1fr; gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid #e4e8ef; }
.detail-list__row:last-child { border-bottom: 0; }
.detail-list dt { font-weight: 700; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.detail-list--columns { grid-template-columns: 1fr 1fr; column-gap: 32px; }
.detail-list--columns .detail-list__row--wide { grid-column: 1 / -1; }
.editor-list { margin: 0; padding-left: 1.2em; }
.editor-list__item span + span { margin-left: 1em; }
.map { margin-top: 16px; display: grid; gap: 6px; }
.map__frame { width: 100%; height: 220px; border: 0; border-radius: var(--radius); }

/* ---------- 情報更新トップ ---------- */
.branch-switch { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.branch-switch__item { padding: 6px 14px; border: 1px solid var(--red); border-radius: 4px; color: var(--red); text-decoration: none; font-weight: 700; background: #fff; }
.branch-switch__item[aria-current='page'] { background: var(--red); color: #fff; }
.tiles { list-style: none; margin: 0 0 20px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { display: grid; gap: 8px; height: 100%; padding: 22px; background: #fff; border: 1px solid var(--card-line); border-radius: var(--radius); text-decoration: none; color: var(--navy); }
.tile:hover .tile__summary, .tile:focus-visible .tile__summary { text-decoration: underline; }
.tile__title { font-size: 1.2rem; font-weight: 700; color: var(--red); }
.tile__summary { font-size: 0.95rem; }

/* ---------- 区分の編集 ---------- */
.edit-form { display: grid; gap: 18px; }
.edit-form--columns { grid-template-columns: 1fr 1fr; column-gap: 32px; }
.edit-form--columns .field:has(textarea), .edit-form--columns .edit-form__actions { grid-column: 1 / -1; }
.edit-form__actions { display: flex; justify-content: flex-end; }
.input--note { min-height: 6em; resize: vertical; }
.field__count { display: flex; align-items: center; gap: 8px; }
.input--count { max-width: 10em; text-align: right; }
.field__unit { white-space: nowrap; }
.field__error { color: var(--red-dark); font-weight: 700; font-size: 0.9rem; }
.field__error:empty { display: none; }
.field--computed { margin: 0; }
.choices { border: 0; margin: 0; padding: 0; min-width: 0; }
.choices__options { display: flex; flex-wrap: wrap; gap: 8px 20px; padding-top: 4px; }
.choice { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; cursor: pointer; }
.choice input { width: 18px; height: 18px; accent-color: var(--red); }
.autosave-status { position: fixed; right: 16px; bottom: 16px; margin: 0; padding: 8px 14px; border-radius: var(--radius); background: #e7f5ec; color: var(--success); font-weight: 700; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12); }
.autosave-status:empty { display: none; }
.autosave-status--error { background: #fdecec; color: var(--red-dark); }

@media (max-width: 640px) {
  .page-title { font-size: 1.4rem; }
  .detail-list__row { grid-template-columns: 1fr; }
  .detail-list--columns, .edit-form--columns { grid-template-columns: 1fr; }
  .card { padding: 20px 16px; }
}

/* ---------- 支店の写真 ---------- */
.branch-photo { display: block; max-width: 100%; max-height: 360px; border-radius: var(--radius); border: 1px solid #e4e8ef; }
.photo-edit { margin-top: 16px; display: grid; gap: 14px; }
.photo-edit h2 { font-size: 1.2rem; margin: 0; }
.photo-edit__actions { display: flex; justify-content: flex-start; }

/* ---------- 自己登録の URL と QR ---------- */
.signup-share__url { font-weight: 700; overflow-wrap: anywhere; }
.signup-share__qr { display: block; max-width: 100%; height: auto; image-rendering: pixelated; border: 1px solid #e4e8ef; margin-bottom: 12px; }

/* ---------- 表（ユーザー管理） ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #e4e8ef; vertical-align: top; }
/* 表の見出しの灰は、Bubble 版の色では文字が薄すぎたので濃くする（screens.md §4.2 #25） */
.table th { color: #3c4357; background: #f7f9fc; font-weight: 700; white-space: nowrap; }
.table__email { overflow-wrap: anywhere; }
.table__nowrap { white-space: nowrap; }
.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 16px; margin-bottom: 16px; }
.toolbar__search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; flex: 1 1 420px; }
.toolbar__search .field { flex: 1 1 260px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; margin-top: 12px; }
.inline-form .field { flex: 1 1 260px; }
.choices__options--stack { flex-direction: column; align-items: flex-start; }
.assigned-list { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 8px; }
.assigned-list__item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; padding: 8px 12px; border: 1px solid #e4e8ef; border-radius: var(--radius); }
.assigned-list__item form { margin: 0; }

/* ---------- リマインド ---------- */
.input--tall { min-height: 14em; }
.footer-preview { margin: 0; padding: 12px 14px; background: var(--surface); border-radius: var(--radius); font-family: inherit; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }

/* ---------- 管理者のホーム ---------- */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 16px; }
/* 黄の地に白い文字は読みにくい（screens.md §4.2 #23）ので、文字は紺にする */
.stat-card { display: grid; align-content: space-between; gap: 12px; min-height: 140px; padding: 18px 20px; border-radius: var(--radius); background: var(--yellow); color: var(--navy); }
.stat-card__label { font-weight: 700; }
.stat-card__value { font-size: 2.6rem; font-weight: 700; line-height: 1; }
.latest-band { margin-bottom: 16px; border-top: 6px solid transparent; border-image: linear-gradient(90deg, var(--yellow), #fa5914, var(--red)) 1; }
.latest-band h2 { font-size: 1.1rem; margin: 0 0 8px; }
.latest-band__body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin: 0; }
.latest-band__name { font-size: 1.4rem; font-weight: 700; color: var(--red); }
.chart { margin: 0; }
.chart__svg { display: block; width: 100%; height: auto; }
.update-list { list-style: none; margin: 0; padding: 0; display: grid; }
.update-list__item { display: grid; grid-template-columns: minmax(10em, 1.4fr) minmax(6em, 1fr) minmax(10em, 1.2fr) minmax(6em, 1fr); gap: 4px 16px; padding: 8px 0; border-bottom: 1px solid #e4e8ef; }
.update-list__item:last-child { border-bottom: 0; }
@media (max-width: 640px) {
  .update-list__item { grid-template-columns: 1fr 1fr; }
}

/* ---------- Signs の管理画面 ---------- */
.text-danger { color: var(--red-dark); }
.reception { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid #e4e8ef; }
.reception:last-child { border-bottom: 0; }
.reception__url { font-weight: 700; overflow-wrap: anywhere; margin: 0; }

/* ---------- 署名ページ・ダウンロード（署名者。スマホが基本） ---------- */
body.sign-page { background: #f5f5f5; }
.sign-page .site-header__bar { justify-content: center; }
.page--sign { width: min(560px, 100%); margin: 0 auto 32px; padding: 0 12px; }
.sign-card { background: #fff; padding: 28px 20px 32px; font-family: var(--font-serif); color: #1a1b20; line-height: 1.7; }
.sign-card--message { text-align: center; }
.doc__title { margin: 0 0 20px; text-align: center; line-height: 1.3; }
.doc__title--shodakusho { font-size: 2.2rem; font-weight: 500; }
/* 15 字の見出しをスマホの幅でも 1 行に収める */
.doc__title--doui { font-size: clamp(1.05rem, 5.2vw, 1.35rem); font-weight: 700; }
.doc__to { margin: 28px 0 16px; font-size: 1.1rem; white-space: pre-wrap; }
.doc__p { margin: 16px 0; font-weight: 500; }
.doc__rows { display: grid; gap: 2px; margin: 12px 0; font-weight: 500; }
.doc__rows--indent { margin-left: 4px; }
.doc__row { display: flex; }
.doc__label { flex: none; white-space: pre; padding-right: 4px; }
.doc__text { flex: 1; }
.doc__date { margin: 28px 0 8px; font-size: 1.1rem; }
.doc__company { margin: 16px 0 0; }
.doc__company strong { display: block; font-size: 1.1rem; }
.sign-form { margin-top: 8px; }
.sign-form .field__label { font-weight: 400; font-size: 1.05rem; }
.sign-form .input { border-color: #1a1b20; border-radius: 10px; font-family: var(--font-sans); }
.sign-note { margin: 8px 0 0; }
/* 黄の地に白い文字は読みにくい（screens.md §4.2 #23）ので、文字は紺にする */
.button--sign { width: 100%; min-height: 52px; background: var(--yellow); color: var(--navy); font-family: var(--font-serif); font-size: 1.1rem; font-weight: 600; border-radius: 6px; }
.button--sign:hover { filter: brightness(0.96); }

/* ---------- 同意書の一覧・詳細 ---------- */
.consent-status { font-weight: 700; margin: 0 0 12px; }
.consent-status--expired { color: var(--red-dark); }
.consent-status--deleted, .consent-status--incomplete { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.actions form { margin: 0; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 16px; }
.dashboard-grid > .detail-section { margin-bottom: 0; }
.stat-card--plain { background: #fff; border: 1px solid var(--card-line); min-height: 110px; }
.consent-cards { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 10px; }
.consent-card { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--card-line); border-radius: var(--radius); background: #fff; }
.consent-card__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.consent-card__name { font-weight: 700; font-size: 1.05rem; }
.consent-card .consent-status { margin: 0; }
.pager { display: flex; justify-content: space-between; margin-top: 16px; }
