/* スタッフ弁当（2026-10-04）。色は院内アプリの入口ページにそろえた。スマホが主、管理画面は PC でも */
:root {
  --bg: #f4f6f5; --card: #ffffff; --ink: #1c2321; --sub: #5a6461; --line: #dbe2df;
  --accent: #0b6b5e; --accent-ink: #ffffff; --accent-bg: #e6f2ef;
  --warn: #7a4f00; --warn-bg: #fff4dc; --warn-line: #e3b54d;
  --err: #b42318; --err-bg: #fdecea;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111413; --card: #1a1f1d; --ink: #e6ebe9; --sub: #9aa5a1; --line: #2b3330;
    --accent: #36a894; --accent-ink: #08201c; --accent-bg: #16302b;
    --warn: #f2c66d; --warn-bg: #2d2412; --warn-line: #8a6a24;
    --err: #ff8a80; --err-bg: #3a1714;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
main {
  max-width: 520px; margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) 16px max(32px, env(safe-area-inset-bottom));
}
main.wide { max-width: 1080px; }
main.narrow { max-width: 440px; }
.center { text-align: center; }
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 16px; letter-spacing: .02em; }
h2 { font-size: 17px; margin: 0 0 8px; }
p { margin: 0 0 10px; }
.kicker { margin: 0 0 2px; color: var(--sub); font-size: 14px; }
.sub { color: var(--sub); font-size: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin: 0 0 14px;
}
.card > :last-child { margin-bottom: 0; }
.card ul, .card ol { margin: 0; padding-left: 1.3em; }
.flash {
  border-radius: 12px; padding: 12px 14px; margin: 0 0 14px;
  border: 1px solid var(--line); background: var(--card);
}
.flash.ok { background: var(--accent-bg); border-color: var(--accent); }
.flash.warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn); }
.flash.err { background: var(--err-bg); border-color: var(--err); color: var(--err); }

/* ボタン・入力 */
button, .button {
  font: inherit; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 8px 16px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  text-decoration: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
button:focus-visible, .button:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
.big { width: 100%; min-height: 64px; font-size: 22px; border-radius: 16px; }
.small { min-height: 36px; padding: 4px 12px; font-size: 14px; border-radius: 10px; }
.danger { color: var(--err); border-color: var(--err); }
button:disabled { opacity: .55; cursor: default; }
label { display: grid; gap: 4px; font-size: 14px; }
input, select {
  font: inherit; font-size: 16px; min-height: 44px; padding: 6px 10px; width: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink);
}
small { font-size: 13px; }
.stack { display: grid; gap: 14px; }
form.settings { max-width: 560px; }
form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
form.inline label { flex: 1 1 200px; }
form.inline input { width: auto; flex: 1 1 140px; }
.grid-form { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); align-items: end; margin-top: 12px; }

/* 買う画面 */
.who h1 { font-size: 30px; margin-bottom: 14px; }
.price { font-size: 18px; margin-bottom: 14px; }
.price strong { font-size: 24px; }
.qty { border: 0; padding: 0; margin: 0 0 16px; display: flex; gap: 10px; }
.qty legend { font-size: 14px; color: var(--sub); margin-bottom: 6px; padding: 0; }
.qty label { flex: 1; display: block; position: relative; }
.qty input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.qty span {
  display: grid; place-items: center; min-height: 52px; border: 2px solid var(--line);
  border-radius: 12px; font-size: 20px; font-weight: 700; background: var(--card);
}
.qty input:checked + span { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.qty input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.note { margin: 10px 0 0; text-align: center; }
.total { display: flex; justify-content: space-between; font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.card ul.history { list-style: none; margin: 0; padding: 0; }
.history li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px;
  padding: 10px 0; border-top: 1px solid var(--line);
}
.history .when { flex: 1 1 auto; }
.history .q, .history .a { font-variant-numeric: tabular-nums; }
.history form { margin-left: auto; }
.voided { color: var(--sub); }
.voided .q, .voided .a { text-decoration: line-through; }
.tag {
  display: inline-block; font-size: 12px; line-height: 1.6; color: var(--sub);
  border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; white-space: nowrap;
}
.foot { margin-top: 18px; }
.big-name { font-size: 28px; font-weight: 700; margin: 6px 0; }
.ok-card { border-color: var(--accent); }
.ok-card .button { margin-top: 8px; }

/* 管理画面 */
.admin-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.admin-top h1 { margin: 0; }
.tabs {
  display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line);
  margin: 12px 0 16px; scrollbar-width: none;
}
.tabs a {
  padding: 10px 14px; color: var(--sub); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; }
.period-nav h2 { margin: 0; text-align: center; font-size: 16px; }
.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table.list { width: 100%; border-collapse: collapse; font-size: 15px; }
table.list th, table.list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.list thead th { font-size: 13px; color: var(--sub); font-weight: 600; white-space: nowrap; }
table.list tfoot th, table.list tfoot td { font-weight: 700; border-bottom: 0; }
table.list tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.num { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ops { display: grid; gap: 6px; justify-items: start; }
.ops details { font-size: 14px; }
.ops details summary { cursor: pointer; color: var(--sub); }
.ops details form { margin-top: 6px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.ok-text { color: var(--accent); font-weight: 700; }
.ng-text { color: var(--err); font-weight: 700; }
details.card summary { cursor: pointer; font-weight: 700; }

/* 登録用QR */
.qr { width: min(78vw, 320px); aspect-ratio: 1; margin: 8px auto 16px; background: #ffffff; border-radius: 8px; }
.qr svg { display: block; width: 100%; height: 100%; }
.status { padding: 12px 14px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.status.ok { background: var(--accent-bg); border-color: var(--accent); font-weight: 700; }
.status.err { background: var(--err-bg); border-color: var(--err); color: var(--err); }
.steps { text-align: left; margin: 0 auto 12px; max-width: 360px; padding-left: 1.4em; }

/* 印刷用（画面では紙のように見せる。紙は白地に黒） */
body.print { background: var(--bg); }
.print-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--line); margin-bottom: 16px;
}
.print-bar span { color: var(--sub); font-size: 14px; }
.sheet {
  background: #ffffff; color: #000000; width: min(100% - 32px, 210mm); margin: 0 auto 24px;
  padding: 14mm 12mm; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); line-height: 1.5;
}
.sheet-head { text-align: center; margin-bottom: 6mm; }
.sheet-head h1 { font-size: 20pt; margin: 0 0 2mm; letter-spacing: .1em; }
.sheet-period { font-size: 12pt; margin: 0; }
.sheet-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2mm 6mm; font-size: 10pt; margin-bottom: 3mm; }
.sheet-lead { font-size: 10pt; margin-bottom: 4mm; }
.sheet-table { width: 100%; border-collapse: collapse; font-size: 11pt; }
.sheet-table th, .sheet-table td { border: 0.3mm solid #000000; padding: 2.4mm 2.5mm; text-align: left; }
.sheet-table thead th { background: #eeeeee; font-size: 10pt; }
.sheet-table .no { width: 10mm; text-align: center; }
.sheet-table .sign { width: 48mm; }
.sheet-table tbody td { height: 11mm; }
.sheet-table tfoot td { font-weight: 700; }
.sheet-table .empty { text-align: center; color: #555555; }
.sheet-table.compact { table-layout: fixed; }
.sheet-table.compact td { height: auto; padding: 1.2mm 2.5mm; font-size: 10pt; }
.sheet-table.compact td:nth-child(1) { width: 40%; }
.sheet-table.compact td:nth-child(2) { width: 15%; }
.sheet-table.compact td:nth-child(3) { width: 20%; }
.approval { display: flex; justify-content: flex-end; gap: 6mm; margin-top: 8mm; font-size: 10pt; }
.approval div { display: flex; align-items: center; gap: 2mm; }
.approval .box { display: inline-block; width: 22mm; height: 22mm; border: 0.3mm solid #000000; }
.person { break-inside: avoid; margin-bottom: 6mm; }
.person h2 { display: flex; justify-content: space-between; font-size: 12pt; border-bottom: 0.5mm solid #000000; padding-bottom: 1mm; margin-bottom: 2mm; }
.poster { text-align: center; }
.poster h1 { font-size: 32pt; margin: 4mm 0 6mm; }
.poster .qr { width: 110mm; margin: 0 auto 8mm; border-radius: 0; }
.poster-steps { text-align: left; font-size: 18pt; font-weight: 700; margin: 0 auto 6mm; max-width: 160mm; padding-left: 1.4em; }
.poster-steps li { margin-bottom: 3mm; }
.poster-notes { text-align: left; font-size: 12pt; margin: 0 auto 6mm; max-width: 160mm; padding-left: 1.4em; }
.poster-url { font-size: 10pt; color: #555555; word-break: break-all; }

@media print {
  @page { size: A4 portrait; margin: 12mm; }
  body.print { background: #ffffff; }
  .no-print { display: none !important; }
  .sheet { width: auto; margin: 0; padding: 0; box-shadow: none; }
  .sheet + .sheet { break-before: page; }
}
