/* K.L.I.M オーダーシステム。注文者のスマホ画面と店舗の画面で共通。明るい配色だけで作る（デモ demo/klim-demo.html の見た目を流用） */
:root {
  --ground: #E9E6DF;
  --surface: #FFFFFF;
  --soft: #F6F4EF;
  --ink: #1C1B19;
  --muted: #5F5B54;
  --line: #E2DED6;
  --line-strong: #C9C4BA;
  --wait-bg: #FFF1DC; --wait-fg: #8A4B00; --wait-line: #E8B567;
  --late-bg: #FDE9E2; --late-fg: #8A2C0A; --late-line: #C2410C;
  --acc-bg: #E3EEFB; --acc-fg: #1D4E89;
  --go-bg: #DDF2EE; --go-fg: #0F5E52;
  --end-bg: #EFECE6; --end-fg: #5F5B54;
  --font: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
body { background: var(--ground); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--acc-fg); outline-offset: 2px; }
.num { font-variant-numeric: tabular-nums; }




/* 注文者のスマホ */
.c-head { background: var(--ink); color: #FFFFFF; padding: 14px 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.c-head .shop { font-size: 17px; font-weight: 700; }
.c-head .row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12px; }
.c-head .link { background: none; border: 1px solid #77736B; color: #FFFFFF; border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.c-bar { background: var(--surface); border-bottom: 1px solid var(--line); height: 52px; padding: 0 6px; display: flex; align-items: center; gap: 4px; font-weight: 700; flex-shrink: 0; }
.iconbtn { width: 44px; height: 44px; border: 0; background: none; display: flex; align-items: center; justify-content: center; border-radius: 8px; }
.c-screen { flex: 1; overflow-y: auto; padding: 12px 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.c-foot { background: var(--surface); border-top: 1px solid var(--line); padding: 10px 14px 14px; flex-shrink: 0; }
.primary { width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: var(--ink); color: #FFFFFF; font-weight: 700; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.primary.center { justify-content: center; }
.primary:disabled { background: #8A857C; }
.secondary { width: 100%; min-height: 46px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); font-weight: 500; }
.outline { width: 100%; min-height: 50px; border: 2px solid var(--ink); border-radius: 12px; background: var(--surface); font-weight: 700; }

.cats { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.cat { flex-shrink: 0; min-height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 14px; font-size: 13px; }
.cat-title { margin: 6px 0 0; font-size: 15px; font-weight: 700; }
.item { background: var(--surface); border-radius: 12px; padding: 10px; display: flex; gap: 10px; align-items: center; }
.ph { width: 64px; height: 64px; border-radius: 8px; background: var(--line); color: var(--muted); font-size: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ph.has { width: 72px; height: 72px; background: none; overflow: hidden; }
.ph.has img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero { display: block; width: 100%; max-height: 220px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; background: var(--line); margin-bottom: 10px; }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item-name { font-weight: 700; }
.small { font-size: 12px; color: var(--muted); }
.pick { min-width: 60px; height: 44px; border: 0; border-radius: 8px; background: var(--ink); color: #FFFFFF; font-weight: 500; }
.soldout { min-width: 60px; height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; color: var(--muted); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 500; }
.item.is-out .item-body { color: var(--muted); }
.notice { border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.notice.closed { background: var(--end-bg); }
.notice.warn { background: var(--late-bg); color: var(--late-fg); }
.notice.info { background: var(--acc-bg); color: var(--acc-fg); }
.notice strong { font-size: 15px; }
.tel { font-weight: 700; font-size: 16px; user-select: all; }

.group { background: var(--surface); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; border: 0; margin: 0; }
.group legend { float: left; width: 100%; padding: 0; margin-bottom: 2px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.req { font-size: 11px; font-weight: 500; background: var(--ink); color: #FFFFFF; border-radius: 4px; padding: 1px 6px; }
.opt { min-height: 44px; text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0 12px; display: flex; align-items: center; gap: 10px; }
.opt[aria-pressed="true"] { border: 2px solid var(--ink); background: var(--soft); }
.opt:disabled { border-style: dashed; color: var(--muted); }
.opt .mark { width: 18px; height: 18px; border: 2px solid #8A857C; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.opt .mark.one { border-radius: 50%; }
.opt .mark.many { border-radius: 4px; }
.opt[aria-pressed="true"] .mark.one { border: 6px solid var(--ink); }
.opt[aria-pressed="true"] .mark.many { background: var(--ink); border-color: var(--ink); color: #FFFFFF; }
.opt .lbl { flex: 1; }
.qty { display: flex; align-items: center; justify-content: space-between; padding: 0 4px; }
.qty-ctl { display: flex; align-items: center; gap: 4px; }
.round { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); font-size: 20px; }
.qty-ctl output { width: 40px; text-align: center; font-size: 18px; font-weight: 700; }

.card { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.line { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.line-main { min-width: 0; }
.linkbtn { border: 0; background: none; color: var(--muted); text-decoration: underline; padding: 4px 0; font-size: 12px; min-height: 32px; }
.total { border-top: 1px solid var(--line); padding-top: 8px; display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; }
.total .num { font-size: 20px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-weight: 700; }
.field input { font: inherit; height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--ink); }
.field input[aria-invalid="true"] { border: 2px solid var(--late-line); }
.err { font-size: 12px; color: var(--late-fg); font-weight: 500; }

.status-card { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--line); }
.status-card.is-late { border: 2px solid var(--late-line); }
.sc-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sc-no { font-size: 18px; font-weight: 700; }
.msg { font-weight: 700; }
.steps { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; font-size: 11px; text-align: center; color: var(--muted); }
.steps li { display: flex; flex-direction: column; gap: 4px; }
.steps li span { height: 6px; border-radius: 3px; background: var(--line); }
.steps li.on { color: var(--ink); }
.steps li.on span { background: var(--go-fg); }

.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.wait { background: var(--wait-bg); color: var(--wait-fg); }
.pill.late { background: var(--late-line); color: #FFFFFF; }
.pill.acc { background: var(--acc-bg); color: var(--acc-fg); }
.pill.go { background: var(--go-bg); color: var(--go-fg); }
.pill.end { background: var(--end-bg); color: var(--end-fg); }
.pills { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.pill.open { background: var(--go-bg); color: var(--go-fg); }

.overlay { position: absolute; inset: 0; background: rgba(28, 27, 25, 0.45); display: flex; align-items: flex-end; justify-content: center; padding: 12px; z-index: 5; }
.mrow { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.mrow .grow { flex: 1; min-width: 150px; }
.mbtn { min-height: 40px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font: inherit; cursor: pointer; color: var(--ink); }
.mbtn.add { border-style: dashed; font-weight: 700; width: 100%; margin-top: 8px; }
.mbtn.del { color: var(--late-line); }
.mbtn:disabled { opacity: 0.4; cursor: default; }
.mtabs { display: flex; gap: 6px; flex-wrap: wrap; }
.mtabs button { min-height: 40px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font: inherit; color: var(--ink); }
.mtabs button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.mtag { display: inline-block; font-size: 12px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 0 8px; margin-left: 6px; color: var(--muted); }
.s-overlay.fix { position: fixed; padding: 24px 16px; overflow: auto; }
.dialog.wide { margin-bottom: 24px; }
.dialog .err { color: var(--late-line); font-weight: 700; font-size: 13px; }
.mgroup { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--surface); }
.dialog {  background: var(--surface); border-radius: 16px; padding: 16px; width: 100%; max-width: 460px; display: flex; flex-direction: column; gap: 12px; }
.dialog h3 { margin: 0; font-size: 16px; }
.dialog .row { display: flex; gap: 8px; }
.dialog .row > * { flex: 1; }
.danger { min-height: 48px; border: 0; border-radius: 10px; background: var(--late-line); color: #FFFFFF; font-weight: 700; }
.danger:disabled { background: #D9A898; }

/* 店舗 */
.store { background: var(--soft); border-radius: 16px; overflow: hidden; border: 1px solid var(--line-strong); position: relative; min-height: 800px; }
.s-head { background: var(--ink); color: #FFFFFF; padding: 10px 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.s-head .title { font-size: 17px; font-weight: 700; }
.s-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 auto; }
.s-nav button { min-height: 40px; border: 0; border-radius: 8px; padding: 0 12px; background: none; color: #FFFFFF; }
.s-nav button[aria-current="page"] { background: #3A3833; font-weight: 700; }
.s-body { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.ctrl { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.ctrl .grow { flex: 1 1 auto; }
.btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); font-weight: 500; }
.btn.blue { background: var(--acc-fg); color: #FFFFFF; border-color: var(--acc-fg); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.btn.on { background: var(--go-bg); color: var(--go-fg); border-color: var(--go-bg); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.btn.pause-on { background: var(--wait-bg); color: var(--wait-fg); border-color: var(--wait-line); font-weight: 700; }
.s-h2 { margin: 0; font-size: 16px; font-weight: 700; }
.s-h2 span { font-weight: 400; color: var(--muted); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.ocard.wait { border: 2px solid var(--wait-line); }
.ocard.late { border: 2px solid var(--late-line); background: var(--late-bg); }
.ocard ul { margin: 0; padding-left: 18px; }
.ocard .no { font-size: 22px; font-weight: 700; }
.ocard .amt { font-weight: 700; text-align: right; }
.acts { display: flex; gap: 8px; }
.act { min-height: 48px; border-radius: 10px; font-weight: 700; flex: 1; }
.act.main { border: 0; background: var(--ink); color: #FFFFFF; flex: 2; }
.act.sub { border: 2px solid var(--ink); background: var(--surface); }
.act.quiet { border: 1px solid #8A857C; background: var(--surface); font-weight: 500; flex: 0 0 auto; padding: 0 12px; }
.empty { background: var(--surface); border-radius: 12px; padding: 20px; color: var(--muted); text-align: center; }
.tablebox { overflow-x: auto; background: var(--surface); border-radius: 12px; }
table { width: 100%; min-width: 640px; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); }
td { padding: 8px 12px; border-bottom: 1px solid #EFECE6; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
.mail { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.mail pre { margin: 0; font-family: var(--font); white-space: pre-wrap; background: var(--soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.toggle { min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
.toggle .state { font-size: 12px; font-weight: 700; border-radius: 999px; padding: 2px 10px; background: var(--go-bg); color: var(--go-fg); white-space: nowrap; }
.toggle[aria-pressed="true"] { border: 2px dashed var(--line-strong); color: var(--muted); }
.toggle[aria-pressed="true"] .state { background: var(--end-bg); color: var(--end-fg); }
.s-overlay { position: absolute; inset: 0; background: rgba(28, 27, 25, 0.45); display: flex; align-items: flex-start; justify-content: center; padding: 80px 16px 16px; z-index: 5; }
.reasons { display: flex; flex-direction: column; gap: 6px; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 6px; align-items: center; z-index: 20; width: min(92vw, 480px); pointer-events: none; }
.toast { background: var(--ink); color: #FFFFFF; border-radius: 10px; padding: 10px 14px; font-size: 13px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); }

/* 所要時間の表と統計。グラフの色は dataviz の検証済みの3色 */
.tablebox table.wide { min-width: 900px; }
td.dim { color: var(--muted); }
.stats-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 40px; padding: 0 9px; border: 0; background: none; white-space: nowrap; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button[aria-pressed="true"] { background: var(--ink); color: #FFFFFF; font-weight: 700; }
/* 数字の欄は6つ。3つずつ（狭い画面では2つずつ、とても狭い画面では1つずつ）並べて、半端な段を作らない */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 380px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 1100px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 22px; font-weight: 700; }
.chart { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.chart h3 { margin: 0; font-size: 15px; }
.chart h4 { margin: 6px 0 0; font-size: 13px; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .ax { fill: #898781; font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .lbl { fill: var(--ink); font-size: 12px; }
.chart .val { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .grid { stroke: #E1E0D9; stroke-width: 1; }
.chart .base { stroke: #C3C2B7; stroke-width: 1; }
.chart .xh { stroke: #898781; stroke-width: 1; opacity: 0; }
.chart .col:hover .xh { opacity: 1; }
.chart .bar:hover path { opacity: 0.75; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend i.ln { width: 16px; height: 2px; border-radius: 1px; vertical-align: 3px; }
.chart details summary { cursor: pointer; font-size: 12px; color: var(--muted); min-height: 32px; display: flex; align-items: center; }
.chart table.mini { min-width: 0; font-size: 12px; }
.chart table.mini td, .chart table.mini th { padding: 4px 10px; }
.tip { position: fixed; z-index: 30; background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 8px; padding: 6px 10px; font-size: 12px; line-height: 1.6; white-space: pre-line; pointer-events: none; box-shadow: 0 4px 12px rgba(0,0,0,0.12); max-width: 260px; }

@media (prefers-reduced-motion: no-preference) {
  .toast { animation: rise 0.2s ease-out; }
  @keyframes rise { from { transform: translateY(6px); opacity: 0.4; } to { transform: none; opacity: 1; } }
}

html, body { margin: 0; height: 100%; }
body { background: var(--soft); }
/* 注文者の画面：スマホいっぱいに出す（広い画面では中央に480pxで出す） */
.cphone { max-width: 480px; margin: 0 auto; height: 100vh; height: 100dvh; background: var(--soft); display: flex; flex-direction: column; position: relative; overflow: hidden; }
.cphone .overlay { position: fixed; inset: 0; }
.cphone .overlay .dialog { max-width: 456px; }
.c-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
/* 店舗の画面 */
.store { min-height: 100vh; border: 0; border-radius: 0; background: var(--soft); }
.store .s-overlay { position: fixed; }
.login { max-width: 360px; margin: 12vh auto 0; padding: 0 16px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { margin: 0; font-size: 20px; }
.conn-lost { background: var(--late-line); color: #FFFFFF; padding: 8px 16px; font-weight: 700; }
.warn-bar { background: var(--late-bg); color: var(--late-fg); border: 2px solid var(--late-line); border-radius: 12px; padding: 10px 14px; font-weight: 700; }
.fieldrow { display: flex; flex-direction: column; gap: 4px; }
.fieldrow label { font-weight: 700; }
.fieldrow input, .fieldrow select, .fieldrow textarea { font: inherit; min-height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 12px; background: var(--surface); color: var(--ink); }
.fieldrow textarea { padding: 8px 12px; min-height: 64px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: flex; align-items: center; gap: 6px; min-height: 32px; }
.tag-note { font-size: 12px; color: var(--muted); }
.pay-wrap { max-width: 480px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }

/* 注文の表は、狭い画面ではカードにする（横に動かさないと見えないため） */
.ocards { display: none; flex-direction: column; gap: 8px; }
.ocard { background: var(--surface); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.ocard-top { display: flex; align-items: baseline; gap: 10px; }
.ocard-top b { font-size: 18px; }
.ocard-top .num { margin-left: auto; font-weight: 700; }
@media (max-width: 940px) {
  .ocards { display: flex; }
  .tablebox:has(table.wide) { display: none; }
}

/* 電話番号：国番号の選択と番号を横に並べる */
.phonerow { display: flex; gap: 8px; }
.phonerow select { font: inherit; height: 44px; border: 1px solid var(--line-strong); border-radius: 8px; padding: 0 8px; background: var(--surface); color: var(--ink); max-width: 46%; }
.phonerow input { flex: 1; min-width: 0; }
.phonerow input[aria-invalid="true"] { border: 2px solid var(--late-line); }
.phonerow.other { flex-wrap: wrap; }
.phonerow.other select { max-width: none; flex: 1 1 100%; }
.phonerow.other input[data-field="phone"] { flex: 1 1 0; }

/* 注文の確認：座席（QR から入る。変えられない） */
.seatbox { display: flex; flex-direction: column; gap: 2px; min-height: 44px; justify-content: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; background: var(--soft); }
.seatbox b { font-size: 20px; }

/* 設定：座席の一覧 */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); }
.chip[aria-pressed="true"] { border-style: dashed; color: var(--muted); text-decoration: line-through; }
