:root {
  color-scheme: light;
  --ink: #17333a;
  --ink-soft: #4d6266;
  --paper: #f4f0e6;
  --surface: #fffdf8;
  --line: #d7d0c2;
  --brand: #173b3f;
  --brand-strong: #0d2b2e;
  --accent: #b44724;
  --accent-strong: #923216;
  --sun: #f2c14e;
  --teal-soft: #d7e9e3;
  --amber-soft: #fff0c7;
  --red-soft: #f8ddd4;
  --gender-male-bg: #e0eff8;
  --gender-male-ink: #205a78;
  --gender-male-border: #8dbbd2;
  --gender-female-bg: #fae4eb;
  --gender-female-ink: #7f2f4d;
  --gender-female-border: #d89aae;
  --gender-neutral-bg: #ece9e2;
  --gender-neutral-ink: #4d6266;
  --gender-neutral-border: #b8b3a8;
  --success: #166a55;
  --danger: #a8322c;
  --focus: #0c68d4;
  --shadow: 0 12px 28px rgba(34, 43, 40, .10);
  font-family: "Noto Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(23, 59, 63, .035) 1px, transparent 1px),
    var(--paper);
  background-size: 100% 32px;
  color: var(--ink);
}

button, input, select { font: inherit; }
button { touch-action: manipulation; }

button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

::selection { background: var(--sun); color: var(--brand-strong); }

.app-shell { min-height: 100vh; padding-bottom: 116px; }

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: var(--brand);
  color: #fffdf8;
  box-shadow: 0 8px 20px rgba(10, 35, 38, .18);
}

.brand-lockup, .topbar-actions, .identity-strip, .shop-heading-row,
.admin-heading, .admin-section-heading, .history-heading-row,
.checkout-total-row, .cart-bar, .product-card-head,
.admin-product-main, .admin-product-actions { display: flex; align-items: center; }

.brand-lockup { gap: 14px; }
.brand-mark { position: relative; width: 42px; height: 42px; display: inline-block; background: var(--sun); border-radius: 10px; }
.brand-mark::before { content: ""; position: absolute; inset: 10px 9px; border: 3px solid var(--brand); border-top-width: 7px; }
.brand-mark span { position: absolute; width: 18px; height: 6px; top: 5px; left: 12px; border-radius: 4px 4px 0 0; background: var(--accent); }
.brand-name, .brand-context, .today, .section-label, .muted, .identity-help, .cart-caption, .cart-total, .empty-state p { margin: 0; }
.brand-name { font-size: 1.18rem; font-weight: 700; letter-spacing: .03em; }
.brand-context { color: #cfe0dd; font-size: .83rem; margin-top: 2px; }
.topbar-actions { gap: 18px; }
.today { color: #deebe8; font-variant-numeric: tabular-nums; }
.site-switch {
  min-height: 54px;
  padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .42);
  border-radius: 11px;
  background: rgba(255, 255, 255, .08);
  color: white;
  text-align: left;
  cursor: pointer;
}
.site-switch:hover { background: rgba(255, 255, 255, .15); }
.site-switch.is-fixed:disabled { opacity: 1; cursor: default; box-shadow: none; }
.site-switch.is-fixed:disabled:hover { background: rgba(255, 255, 255, .08); }
.site-switch span, .site-switch strong { display: block; }
.site-switch span { color: #cfe0dd; font-size: .7rem; font-weight: 600; }
.site-switch strong { margin-top: 1px; font-size: .9rem; }

main { width: min(1240px, 100%); margin: 0 auto; padding: clamp(24px, 4vw, 46px); }

h1, h2, h3 { margin: 0; color: var(--brand-strong); line-height: 1.28; letter-spacing: -.025em; }
h1 { font-size: clamp(1.55rem, 2.7vw, 2.25rem); }
h2 { font-size: clamp(1.25rem, 2vw, 1.55rem); }
h3 { font-size: 1.1rem; }

.section-label { color: var(--accent-strong); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; margin-bottom: 5px; }
.muted, .identity-help { color: var(--ink-soft); line-height: 1.6; }
.identity-help { margin-top: 5px; }

.identity-strip {
  justify-content: space-between;
  gap: 24px;
  padding: clamp(20px, 3vw, 30px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.identity-strip.is-identified { background: var(--teal-soft); border-color: #9ecbc0; }
.identity-strip.is-identified .section-label { color: var(--success); }

.primary-button, .checkout-button, .subtle-button, .text-button,
.danger-button, .icon-text-button, .quantity-button,
.admin-action {
  border: 0;
  border-radius: 12px;
  min-height: 48px;
  padding: 0 18px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease-out, background-color 150ms ease-out, box-shadow 150ms ease-out;
}

.primary-button, .checkout-button { background: var(--accent); color: white; box-shadow: 0 8px 16px rgba(184, 63, 29, .22); }
.primary-button:hover, .checkout-button:hover { background: var(--accent-strong); transform: translateY(-1px); }
.primary-button:active, .checkout-button:active, .subtle-button:active { transform: translateY(1px); }
.identity-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.identity-button { min-width: 224px; min-height: 58px; font-size: 1rem; }
.scan-button { display: inline-flex; align-items: center; justify-content: center; gap: 9px; }
.scan-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.8; }
.identity-name-button { min-width: 136px; min-height: 48px; padding-inline: 14px; font-size: .78rem; }
.subtle-button { background: var(--surface); color: var(--brand); border: 1px solid #aabcb9; }
.subtle-button:hover { background: #edf4f2; }
.text-button, .icon-text-button { background: transparent; color: inherit; min-height: 44px; padding-inline: 10px; text-decoration: underline; text-underline-offset: 4px; }
.topbar .text-button { color: #fffdf8; }
.danger-button { background: transparent; color: var(--danger); border: 1px solid #d7aaa5; }
button:disabled { cursor: not-allowed; opacity: .48; transform: none !important; box-shadow: none; }

.shop-heading-row { justify-content: space-between; gap: 16px; margin: 38px 0 18px; }
.shop-heading-row .muted { margin-top: 5px; }

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }

.product-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 22px rgba(43, 50, 45, .08);
}

.product-card::before { content: ""; display: block; height: 8px; background: var(--brand); }
.product-card[data-reason="expiry"]::before { background: var(--accent); }
.product-card[data-reason="set"]::before { background: #9d7d1f; }
.product-card.is-sold-out { opacity: .66; }
.product-card-body { padding: 20px; }
.product-card-head { justify-content: space-between; gap: 12px; align-items: flex-start; }
.reason-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 4px 10px; border-radius: 999px; background: var(--teal-soft); color: var(--brand); font-size: .78rem; font-weight: 800; }
[data-reason="expiry"] .reason-badge { background: var(--red-soft); color: var(--danger); }
[data-reason="set"] .reason-badge { background: var(--amber-soft); color: #755b0a; }
.stock-label { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.stock-label.is-low { color: var(--danger); }
.product-name { margin-top: 16px; min-height: 2.7em; }
.product-note { margin: 8px 0 0; color: var(--ink-soft); line-height: 1.55; min-height: 3.1em; }
.product-meta { margin-top: 18px; padding-top: 15px; border-top: 1px dashed var(--line); display: flex; justify-content: space-between; align-items: end; gap: 12px; }
.product-price { font-size: 1.7rem; font-weight: 800; color: var(--brand-strong); font-variant-numeric: tabular-nums; }
.product-price small { font-size: .8rem; font-weight: 600; }
.expiry-label { text-align: right; color: var(--ink-soft); font-size: .8rem; line-height: 1.45; }
.expiry-label strong { display: block; color: var(--ink); font-size: .9rem; }
.quantity-row { margin-top: 18px; min-height: 54px; display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; align-items: center; }
.quantity-button { min-height: 52px; padding: 0; font-size: 1.45rem; background: #e8eeec; color: var(--brand); }
.quantity-button:hover { background: #d5e2df; }
.quantity-value { text-align: center; font-weight: 800; font-size: 1.18rem; font-variant-numeric: tabular-nums; }
.locked-message { grid-column: 1 / -1; text-align: center; color: var(--ink-soft); font-size: .9rem; }

.empty-state { padding: 52px 24px; text-align: center; border: 1px dashed #aab4af; border-radius: 18px; background: rgba(255, 253, 248, .7); }
.empty-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 8px !important; }

.cart-bar {
  position: fixed;
  z-index: 20;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(760px, calc(100% - 30px));
  justify-content: space-between;
  gap: 20px;
  padding: 14px 14px 14px 22px;
  background: var(--brand-strong);
  color: white;
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(7, 30, 32, .34);
}
.cart-caption { color: #cbdedb; font-size: .8rem; }
.cart-total { margin-top: 2px; display: flex; gap: 14px; align-items: baseline; }
.cart-total strong { font-size: 1.55rem; font-variant-numeric: tabular-nums; }
.checkout-button { min-height: 54px; min-width: 170px; }

.admin-heading { justify-content: space-between; align-items: flex-start; gap: 22px; margin-bottom: 24px; }
.admin-heading .muted { margin-top: 7px; }
.admin-tabs {
  width: max-content;
  max-width: 100%;
  display: flex;
  gap: 6px;
  margin: -4px 0 24px;
  padding: 6px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 253, 248, .78);
}
.admin-tab {
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--brand);
  font-size: .9rem;
  font-weight: 800;
  white-space: nowrap;
  cursor: pointer;
}
.admin-tab:hover { background: #e8eeec; }
.admin-tab.is-active { background: var(--brand); color: white; box-shadow: 0 6px 14px rgba(13, 43, 46, .18); }
.admin-summary { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); margin-bottom: 28px; }
.summary-item { padding: 18px 22px; }
.summary-item + .summary-item { border-left: 1px solid var(--line); }
.summary-label { margin: 0; color: var(--ink-soft); font-size: .82rem; }
.summary-value { margin: 4px 0 0; font-size: 1.45rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.admin-layout { display: grid; grid-template-columns: minmax(300px, .86fr) minmax(420px, 1.3fr); gap: 22px; align-items: start; }
.admin-editor, .admin-products, .employee-master-section, .history-section { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: clamp(20px, 3vw, 28px); box-shadow: 0 9px 22px rgba(43, 50, 45, .07); }
.admin-section-heading { justify-content: space-between; gap: 14px; margin-bottom: 20px; }
.field-label { display: block; margin: 16px 0 7px; font-size: .87rem; font-weight: 800; color: var(--brand); }
.field-help { margin: 7px 0 0; color: var(--ink-soft); font-size: .78rem; line-height: 1.5; }
.field-control { width: 100%; min-height: 50px; border: 1px solid #aeb9b5; border-radius: 10px; background: white; color: var(--ink); padding: 10px 12px; font-size: 1rem; }
.field-control:hover { border-color: var(--brand); }
.field-control:disabled { opacity: 1; background: #eeeae0; color: var(--ink); border-color: var(--line); }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.input-unit { position: relative; }
.input-unit .field-control { padding-right: 42px; }
.input-unit span { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-soft); }
.template-save-option { display: flex; align-items: flex-start; gap: 11px; margin-top: 18px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px; background: #f7f4ed; cursor: pointer; }
.template-save-option input { width: 21px; height: 21px; margin: 1px 0 0; accent-color: var(--brand); }
.template-save-option span { display: grid; gap: 2px; }
.template-save-option strong { color: var(--brand-strong); font-size: .78rem; }
.template-save-option small { color: var(--ink-soft); font-size: .78rem; line-height: 1.45; }
.form-submit { width: 100%; min-height: 56px; margin-top: 22px; }
.count-label { color: var(--ink-soft); font-size: .9rem; }

.admin-product-list { display: grid; gap: 12px; }
.admin-product-item { padding: 16px; border-block: 1px solid var(--line); }
.admin-product-item + .admin-product-item { margin-top: -13px; border-top: 0; }
.admin-product-main { justify-content: space-between; align-items: flex-start; gap: 12px; }
.admin-product-name { font-weight: 800; }
.admin-product-detail { margin: 5px 0 0; color: var(--ink-soft); font-size: .88rem; line-height: 1.5; }
.admin-product-price { font-size: 1.2rem; font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.admin-product-actions { justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.admin-action { min-height: 48px; padding: 0 13px; background: #e9efed; color: var(--brand); border-radius: 8px; font-size: .86rem; }
.admin-action.pause { color: var(--danger); background: var(--red-soft); }
.status-word { font-weight: 800; }
.status-word.paused { color: var(--danger); }

.employee-master-section { margin-top: 0; }
.employee-master-heading { align-items: flex-end; }
.employee-master-heading .muted { margin-top: 5px; }
.employee-master-layout { display: grid; grid-template-columns: minmax(300px, .86fr) minmax(440px, 1.35fr); gap: 28px; align-items: start; }
.employee-editor { padding-right: 28px; border-right: 1px solid var(--line); }
.employee-editor > .admin-section-heading { margin-bottom: 2px; }
.employee-directory-note { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding-bottom: 12px; }
.employee-directory-note strong { color: var(--brand-strong); }
.employee-directory-note span { color: var(--ink-soft); font-size: .82rem; }
.employee-master-list { display: grid; }
.employee-master-item { padding: 16px 2px; border-top: 1px solid var(--line); }
.employee-master-main, .employee-name-row { display: flex; align-items: center; }
.employee-master-main { justify-content: space-between; gap: 14px; }
.employee-name-row { gap: 9px; flex-wrap: wrap; }
.employee-master-name { margin: 0; font-size: 1.05rem; font-weight: 800; color: var(--brand-strong); }
.employee-master-yomi { margin: 3px 0 0; color: var(--ink-soft); font-size: .8rem; }
.cross-posted-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border-radius: 999px; background: var(--amber-soft); color: #755b0a; font-size: .75rem; font-weight: 800; }
.payroll-badge { display: inline-flex; align-items: center; min-height: 27px; padding: 3px 9px; border-radius: 999px; background: var(--teal-soft); color: var(--brand-strong); font-size: .75rem; font-weight: 800; }
.employee-master-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 13px 0 0; }
.employee-master-meta div { min-width: 0; }
.employee-master-meta dt { color: var(--ink-soft); font-size: .75rem; font-weight: 700; }
.employee-master-meta dd { margin: 3px 0 0; overflow-wrap: anywhere; font-size: .88rem; font-weight: 700; }

.history-section { margin-top: 0; }
.history-heading-row { align-items: flex-end; }
.history-heading-row .muted { margin-top: 5px; }
.history-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.history-list { display: grid; }
.history-row { display: grid; grid-template-columns: 160px 1fr 130px; gap: 16px; align-items: center; padding: 16px 2px; border-top: 1px solid var(--line); }
.history-time { color: var(--ink-soft); font-size: .84rem; font-variant-numeric: tabular-nums; }
.history-employee { font-weight: 800; }
.history-items { color: var(--ink-soft); font-size: .9rem; margin-top: 3px; }
.history-amount { text-align: right; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.history-empty { padding: 30px 0; color: var(--ink-soft); text-align: center; }

.app-dialog { width: min(560px, calc(100% - 28px)); max-height: calc(100vh - 28px); padding: 0; border: 0; border-radius: 20px; background: var(--surface); color: var(--ink); box-shadow: 0 26px 70px rgba(8, 30, 32, .34); }
.app-dialog::backdrop { background: rgba(8, 26, 28, .68); backdrop-filter: blur(4px); }
.compact-dialog { width: min(440px, calc(100% - 28px)); }
.employee-dialog { width: min(760px, calc(100% - 28px)); }
.scanner-dialog { width: min(760px, calc(100% - 28px)); }
.dialog-close-row { display: flex; justify-content: flex-end; padding: 8px 12px 0; }
.dialog-body { padding: 10px clamp(22px, 5vw, 34px) 30px; }
.dialog-body .muted { margin-top: 8px; }
.site-options { display: grid; gap: 9px; margin-top: 20px; }
.site-options button { min-height: 82px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.site-options button:hover { border-color: #7ca59d; background: #edf4f2; }
.site-options button.is-active { border: 2px solid var(--brand); background: var(--teal-soft); }
.site-options strong, .site-options span { display: block; }
.site-options strong { font-size: 1.05rem; color: var(--brand-strong); }
.site-options span { margin-top: 4px; color: var(--ink-soft); font-size: .84rem; }
.employee-search { margin-top: 7px; }
.employee-picker-layout { display: grid; grid-template-columns: 84px 1fr; gap: 14px; margin-top: 16px; min-height: 390px; }
.kana-nav { display: grid; align-content: start; gap: 6px; max-height: min(590px, 52vh); overflow-y: auto; padding-right: 2px; }
.kana-nav button { min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: #eeeae0; color: var(--brand); font-weight: 800; cursor: pointer; }
.kana-nav button:hover { background: #e1eae7; }
.kana-nav button.is-active { border-color: var(--brand); background: var(--brand); color: white; }
.candidate-panel { min-width: 0; }
.candidate-count { margin: 0 0 8px; color: var(--ink-soft); font-size: .84rem; font-weight: 700; }
.employee-candidates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; gap: 8px; max-height: min(590px, 52vh); overflow-y: auto; padding: 1px 3px 2px 1px; }
.employee-candidate { width: 100%; min-height: 68px; display: grid; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.employee-candidate:hover { border-color: #7ca59d; background: #edf4f2; }
.employee-candidate.gender-male { --gender-bg: var(--gender-male-bg); --gender-ink: var(--gender-male-ink); --gender-border: var(--gender-male-border); }
.employee-candidate.gender-female { --gender-bg: var(--gender-female-bg); --gender-ink: var(--gender-female-ink); --gender-border: var(--gender-female-border); }
.employee-candidate.gender-unspecified { --gender-bg: var(--gender-neutral-bg); --gender-ink: var(--gender-neutral-ink); --gender-border: var(--gender-neutral-border); }
.employee-affiliation-mark { flex: 0 0 auto; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--gender-border); border-radius: 50%; background: var(--gender-bg); color: var(--gender-ink); font-size: .94rem; font-weight: 900; }
.employee-candidate-copy { min-width: 0; display: flex; align-items: center; gap: 9px; }
.employee-candidate-name { flex: 1 1 auto; min-width: 0; display: -webkit-box; overflow: hidden; font-size: 1.04rem; font-weight: 800; line-height: 1.25; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.employee-candidate-marks { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; min-width: 0; }
.employee-gender-mark { flex: 0 0 auto; display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid var(--gender-border); border-radius: 50%; background: var(--gender-bg); color: var(--gender-ink); font-size: 1.02rem; font-weight: 900; line-height: 1; }
.employee-department-badge { display: inline-flex; align-items: center; min-height: 28px; max-width: 5.5rem; padding: 3px 8px; overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: #eeeae0; color: var(--brand); font-size: .76rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.employee-empty { min-height: 110px; display: grid; place-content: center; gap: 5px; padding: 18px; border: 1px dashed #aab4af; border-radius: 12px; color: var(--ink-soft); text-align: center; }
.employee-empty strong { color: var(--ink); }
.employee-empty span { font-size: .86rem; }
.pin-input { font-size: 1.55rem; letter-spacing: .32em; text-align: center; font-variant-numeric: tabular-nums; }
.form-error { margin: 10px 0 0; color: var(--danger); font-weight: 700; }

.scanner-camera-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.scanner-camera-row p { margin: 0; color: var(--brand-strong); font-size: .78rem; font-weight: 800; }
.scanner-camera-toggle { min-width: 172px; }
.scanner-stage { position: relative; min-height: 340px; margin-top: 12px; overflow: hidden; border-radius: 18px; background: var(--brand-strong); }
.scanner-stage video { width: 100%; height: min(52vh, 440px); min-height: 340px; display: block; object-fit: cover; }
.scanner-frame { position: absolute; inset: 50% auto auto 50%; width: min(91%, 650px); height: min(70%, 320px); transform: translate(-50%, -50%); border: 3px solid rgba(255, 255, 255, .92); border-radius: 12px; box-shadow: 0 0 0 999px rgba(8, 26, 28, .68); }
.scanner-frame::after { content: ""; position: absolute; left: 5%; right: 5%; top: 50%; height: 2px; background: var(--sun); box-shadow: 0 0 8px var(--sun); }
.scanner-status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; margin-top: 12px; }
.scanner-status { min-height: 1.6em; margin: 0; color: var(--ink-soft); font-size: 1rem; font-weight: 700; line-height: 1.55; }
.scanner-status.is-error { color: var(--danger); }
.scanner-retry { min-width: 132px; }
.scan-guide { margin-top: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.scan-guide-title { margin: 0; color: var(--brand-strong); font-size: .78rem; font-weight: 800; }
.scan-guide ul { margin: 7px 0 0; padding-left: 1.35em; color: var(--ink-soft); font-size: 1rem; line-height: 1.65; }
.scan-guide li + li { margin-top: 2px; }
.scan-fallback { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.scan-fallback-title { margin: 0 0 8px; color: var(--brand-strong); font-size: .78rem; font-weight: 800; }
.scan-code-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
.scan-code-form .field-control { margin: 0; }

.checkout-items { margin-top: 20px; border-block: 1px solid var(--line); }
.checkout-item { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 0; }
.checkout-item + .checkout-item { border-top: 1px solid var(--line); }
.checkout-item p { margin: 0; }
.checkout-item-name { font-weight: 800; }
.checkout-item-detail { color: var(--ink-soft); font-size: .86rem; margin-top: 3px !important; }
.checkout-item-price { font-weight: 800; font-variant-numeric: tabular-nums; }
.checkout-total-row { justify-content: space-between; padding-top: 20px; }
.checkout-total-row strong { font-size: 1.65rem; font-variant-numeric: tabular-nums; }
.success-body { text-align: center; padding-top: 34px; }
.success-mark { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 50%; background: var(--teal-soft); position: relative; }
.success-mark::before { content: "完了"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--success); font-size: .82rem; font-weight: 800; letter-spacing: .08em; }
.success-total { margin: 18px 0 4px; font-size: 1.7rem; font-weight: 800; color: var(--brand-strong); }

.toast { position: fixed; z-index: 40; left: 50%; top: 18px; transform: translate(-50%, -140%); padding: 12px 18px; border-radius: 11px; background: var(--brand-strong); color: white; box-shadow: var(--shadow); transition: transform 260ms cubic-bezier(.16, 1, .3, 1); }
.toast.is-visible { transform: translate(-50%, 0); }

.is-hidden { display: none !important; }

@media (max-width: 900px) {
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-products { order: -1; }
  .employee-master-layout { grid-template-columns: 1fr; }
  .employee-editor { padding-right: 0; padding-bottom: 26px; border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 620px) {
  .app-shell { padding-bottom: 128px; }
  .topbar { min-height: 72px; padding: 10px 16px; }
  .brand-context, .today { display: none; }
  .topbar-actions { gap: 4px; }
  .site-switch { min-height: 48px; padding: 5px 9px; }
  .site-switch span { display: none; }
  .site-switch strong { max-width: 7.5em; font-size: .78rem; line-height: 1.25; }
  .topbar .text-button { padding-inline: 6px; font-size: .78rem; }
  main { padding: 20px 14px 34px; }
  .identity-strip, .admin-heading { align-items: stretch; flex-direction: column; }
  .admin-tabs { width: 100%; }
  .admin-tab { flex: 1 1 0; min-width: max-content; padding-inline: 13px; }
  .identity-actions { width: 100%; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
  .identity-button, .identity-name-button { width: 100%; min-width: 0; }
  .identity-name-button { padding-inline: 9px; font-size: .78rem; }
  .product-grid { grid-template-columns: 1fr; }
  .product-name, .product-note { min-height: auto; }
  .shop-heading-row { margin-top: 28px; }
  .cart-bar { align-items: stretch; padding: 12px; gap: 10px; }
  .checkout-button { min-width: 138px; padding-inline: 14px; }
  .admin-summary { grid-template-columns: 1fr 1fr; }
  .summary-item { padding: 14px 8px; }
  .summary-item + .summary-item { border-left: 1px solid var(--line); }
  .summary-item:nth-child(3) { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--line); }
  .form-pair { grid-template-columns: 1fr; gap: 0; }
  .history-heading-row { align-items: stretch; flex-direction: column; }
  .employee-master-heading { align-items: flex-start; }
  .employee-directory-note { align-items: flex-start; flex-direction: column; gap: 3px; }
  .employee-master-meta { grid-template-columns: 1fr 1fr; }
  .history-actions { margin-top: 14px; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-time { grid-column: 1 / -1; }
  .employee-dialog { width: min(560px, calc(100% - 18px)); }
  .employee-picker-layout { grid-template-columns: 68px 1fr; gap: 9px; }
  .employee-candidates { grid-template-columns: 1fr; }
  .scanner-camera-row { align-items: stretch; flex-direction: column; gap: 7px; }
  .scanner-camera-toggle { width: 100%; }
  .scanner-status-row { grid-template-columns: 1fr; }
  .scanner-retry { width: 100%; }
  .scanner-stage, .scanner-stage video { min-height: 260px; }
  .scan-code-form { grid-template-columns: 1fr; }
}

@media (max-width: 390px) {
  .identity-actions { grid-template-columns: 1fr; }
}

@media (max-height: 680px) {
  .scanner-stage, .scanner-stage video { height: 210px; min-height: 210px; }
  .scanner-dialog .dialog-body { padding-bottom: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
