/* 承認画面。スマホで店主が「今の値と新しい値」を見比べて決める道具。
   方針：白地・色はブランド1色（深い青緑）だけ・残りはグレーの段階。状態は色だけでなく必ず文字で出す。
   色はここのトークンだけで書く（直書きしない）。 */
:root {
  --bg: #ffffff;
  --surface: #f3f4f5;       /* 面の区切り（影の代わり） */
  --line: #d9dcdf;
  --line-strong: #8d949b;
  --ink: #17191c;           /* 本文 */
  --ink-2: #454b52;         /* 補足 */
  --ink-3: #5f666d;         /* さらに下げる補足（白地で AA 5.6:1） */
  --brand: #0b5c63;         /* 主ボタン・確認待ち・変更後の印 */
  --brand-ink: #ffffff;
  --brand-soft: #e6f1f2;
  --warn-ink: #7a3e00;      /* 反映していない／確認中 */
  --warn-soft: #fbf0e2;
  --danger-ink: #8f1d1d;
  --danger-soft: #fbeaea;
  --ok-ink: #1d5b2c;
  --ok-soft: #e8f3eb;
  --radius: 12px;
  --tap: 52px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.7;
}
button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.topbar-title { font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink-3); font-size: 13px; }
.topbar-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.topbar-title { white-space: nowrap; }

.page { max-width: 760px; margin: 0 auto; padding: 16px 16px 120px; }
.plain-message { color: var(--ink-2); }

h1 { font-size: 22px; line-height: 1.4; margin: 8px 0 4px; font-weight: 700; }
h2 { font-size: 17px; margin: 28px 0 8px; font-weight: 700; }
.sub { color: var(--ink-3); font-size: 14px; margin: 0; }

/* ---------- ボタン（主・副の2種類だけ） ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; white-space: nowrap;
  border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--bg); color: var(--ink);
  font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn[disabled] { opacity: .55; cursor: default; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .req:focus-visible {
  outline: 3px solid var(--brand); outline-offset: 2px;
}
.linkish { white-space: nowrap; flex: none; background: none; border: 0; padding: 8px 0; color: var(--brand); font-weight: 600; cursor: pointer; text-decoration: underline; min-height: 44px; }

/* ---------- 入力 ---------- */
.field { display: block; margin: 16px 0; }
.field-label { display: block; font-weight: 600; margin-bottom: 6px; }
.field-help { display: block; color: var(--ink-3); font-size: 14px; margin-top: 4px; }
input[type=email], input[type=text], input[type=datetime-local], input[type=number], input[type=date], select, textarea {
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg);
}
textarea { min-height: 88px; resize: vertical; }
input.code { letter-spacing: .3em; font-size: 22px; text-align: center; }

.notice { padding: 12px 14px; border-radius: 10px; background: var(--surface); color: var(--ink-2); font-size: 15px; margin: 12px 0; }
.notice-error { background: var(--danger-soft); color: var(--danger-ink); }
.notice-ok { background: var(--ok-soft); color: var(--ok-ink); }
.notice-brand { background: var(--brand-soft); color: var(--ink); }
.notice p { margin: 0; }
.notice p + p { margin-top: 6px; }

/* ---------- 一覧 ---------- */
.section-head { display: flex; align-items: baseline; gap: 10px; margin: 24px 0 8px; }
.section-head h2 { margin: 0; }
.count { font-size: 15px; color: var(--ink-3); }
.reqs { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.reqs li { border-bottom: 1px solid var(--line); }
.req {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 14px 4px; color: inherit; text-decoration: none; min-height: 64px;
}
.req-store { font-weight: 700; }
.req-reason { grid-column: 1; color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; }
.req-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.req-meta { grid-column: 1; color: var(--ink-3); font-size: 13px; display: flex; flex-direction: column; }
.req-chevron { grid-row: 1 / span 3; grid-column: 2; color: var(--ink-3); }
.empty { color: var(--ink-3); padding: 14px 4px; margin: 0; }

/* 状態の札：色だけで伝えないよう、必ず文字を入れる */
.badge {
  display: inline-block; padding: 1px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 700; line-height: 1.8; white-space: nowrap;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line);
}
.badge-PENDING { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.badge-APPROVED, .badge-UNKNOWN { background: var(--warn-soft); color: var(--warn-ink); border-color: transparent; }
.badge-APPLIED { background: var(--ok-soft); color: var(--ok-ink); border-color: transparent; }
.badge-CONFLICT, .badge-INVALID { background: var(--danger-soft); color: var(--danger-ink); border-color: transparent; }

/* ---------- 詳細 ---------- */
.status-box { margin: 16px 0; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); }
.status-box .badge { font-size: 15px; }
.status-box p { margin: 6px 0 0; }
.status-box .decided { color: var(--ink-3); font-size: 14px; }

.diff { margin: 0; padding: 0; }
.diff-item { padding: 18px 0; border-top: 1px solid var(--line); }
.diff-item:last-child { border-bottom: 1px solid var(--line); }
.diff-label { font-weight: 700; font-size: 18px; margin: 0 0 10px; }
.diff-cols { display: grid; grid-template-columns: 1fr; gap: 8px; }
.diff-col { margin: 0; padding: 10px 12px; border-radius: 10px; min-width: 0; }
.diff-col dt { font-size: 13px; font-weight: 700; color: var(--ink-3); margin-bottom: 2px; }
.diff-col dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.diff-before { background: var(--surface); color: var(--ink-2); }
.diff-after { background: var(--bg); border: 2px solid var(--brand); }
.diff-after dt { color: var(--brand); }
.unset { color: var(--ink-3); }
.diff-col ul { margin: 0; padding-left: 1.2em; }
.url { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 14px; word-break: break-all; }

@media (min-width: 560px) {
  .diff-cols { grid-template-columns: 1fr 1fr; }
}

/* 営業時間：曜日ごとに 変更前｜変更後 を1行に並べる */
.hours { width: 100%; border-collapse: collapse; font-size: 15px; }
.hours th, .hours td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.hours thead th { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.hours tbody th { width: 4.4em; font-weight: 700; white-space: nowrap; }
.hours td { white-space: pre-line; }
.hours tr.changed td.after { font-weight: 700; color: var(--brand); }
.hours .mark { display: inline-block; font-size: 11px; font-weight: 700; color: var(--brand); border: 1px solid var(--brand); border-radius: 4px; padding: 0 4px; margin-left: 4px; line-height: 1.5; vertical-align: 1px; }
.hours-note { color: var(--ink-3); font-size: 13px; margin: 6px 0 0; }

.fine { color: var(--ink-3); font-size: 14px; }
.fine ul { margin: 6px 0 0; padding-left: 1.2em; }

/* ---------- 決定（親指の届く画面下） ---------- */
.actionbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg); border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
}
.actionbar-inner { max-width: 760px; margin: 0 auto; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; }
.decide-panel { margin-top: 24px; padding: 16px; border-radius: var(--radius); background: var(--surface); }
.decide-panel h2 { margin-top: 0; }
.confirm-lead { font-size: 18px; font-weight: 700; margin: 0 0 6px; }
.btn-row { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 16px; }
.proxy-tag { display: inline-block; font-weight: 700; color: var(--warn-ink); background: var(--warn-soft); border-radius: 6px; padding: 2px 8px; }

.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--brand); font-weight: 600; text-decoration: none; }
.icon { width: 20px; height: 20px; flex: none; }

.radio-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.radio-list label {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap);
  border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); cursor: pointer; font-weight: 600;
}
.radio-list input { width: 18px; height: 18px; accent-color: var(--brand); }

/* ---------- 画面の切り替え（変更の確認／作業の記録） ---------- */
.tabs { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-bottom: 1px solid var(--line); margin: -4px 0 8px; }
.tab {
  display: flex; align-items: center; justify-content: center; min-height: 48px;
  color: var(--ink-3); font-weight: 600; text-decoration: none; border-bottom: 3px solid transparent;
}
.tab[aria-current=page] { color: var(--brand); border-bottom-color: var(--brand); }
.tab:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }

/* ---------- 作業の記録 ---------- */
.plain-fieldset { border: 0; padding: 0; margin: 16px 0; }
.choice-list { display: grid; gap: 8px; }
.choice, .check {
  display: grid; grid-template-columns: auto 1fr; align-items: start; gap: 10px;
  padding: 12px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); cursor: pointer;
}
.choice:has(input:checked), .check:has(input:checked) { border: 2px solid var(--brand); padding: 11px 13px; }
.choice input, .check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--brand); }
.choice-title { display: block; font-weight: 700; }
.choice-help { display: block; color: var(--ink-3); font-size: 14px; }
.check { margin: 16px 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row .field { min-width: 0; }
.work-form { padding-bottom: 8px; }

.worktable { width: 100%; border-collapse: collapse; font-size: 15px; font-variant-numeric: tabular-nums; }
.worktable th, .worktable td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.worktable thead th { font-size: 13px; color: var(--ink-3); font-weight: 700; }
.worktable td { text-align: right; }
.worktable thead th:not(:first-child) { text-align: right; }

.loglist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.loglist li { padding: 12px 4px; border-bottom: 1px solid var(--line); }
.log-head { display: flex; justify-content: space-between; gap: 12px; font-weight: 700; }
.log-min { font-variant-numeric: tabular-nums; white-space: nowrap; }
.log-meta { color: var(--ink-3); font-size: 13px; }
.log-note { color: var(--ink-2); font-size: 15px; overflow-wrap: anywhere; margin-top: 2px; }
.radio-list label:has(input:checked) { border: 2px solid var(--brand); color: var(--brand); }
.unknown { color: var(--warn-ink); font-weight: 700; }

/* 案内の中のリンクはブランド色（ブラウザ既定の青を出さない） */
.notice a { color: var(--brand); font-weight: 600; }

/* 店のつなぎ（#/stores）。店ごとに「見出し → 状態の箱 → ボタン1つ」。新しい色は足さない */
.store-conn { margin-top: 28px; }
.store-conn + .store-conn { border-top: 1px solid var(--line); padding-top: 4px; }
.store-conn .status-box { margin-bottom: 12px; }
