:root {
  color-scheme: light;
  --ink: #3c3027;
  --muted: #776b60;
  --paper: #fbf7ef;
  --card: #fffdf9;
  --line: #e9dfd2;
  --green: #c36336;
  --green-dark: #9e4b27;
  --green-soft: #f8e9dc;
  --orange: #c36336;
  --orange-soft: #faebde;
  --red: #a83a35;
  --red-soft: #fff0ee;
  --shadow: 0 14px 36px rgba(77, 52, 33, .07);
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
}
button, input, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
[hidden] { display: none !important; }

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 24px;
  padding: 11px max(20px, calc((100vw - 1120px) / 2));
  border-bottom: 1px solid rgba(233, 223, 210, .92);
  background: rgba(255, 253, 249, .96);
  backdrop-filter: blur(16px);
}
.brand {
  color: var(--green-dark);
  font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", serif;
  font-size: 27px;
  font-weight: 600;
  letter-spacing: .12em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}
.header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 13px; margin-left: auto; min-width: 0; }
.connection-state { max-width: 180px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.connection-state.is-error { color: var(--red); }
.staff-menu { position: relative; }
.staff-menu-toggle {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.staff-menu-toggle:hover, .staff-menu-toggle[aria-expanded="true"] { border-color: #dfb79c; background: var(--green-soft); color: var(--green-dark); }
.staff-menu-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 9px);
  right: 0;
  display: grid;
  min-width: 160px;
  gap: 4px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}
.staff-menu-item { min-height: 46px; padding: 10px 13px; border: 0; border-radius: 11px; background: transparent; color: var(--ink); font-weight: 700; text-align: left; }
.staff-menu-item:hover, .staff-menu-item:focus-visible { background: var(--green-soft); color: var(--green-dark); }

main { width: min(1120px, 100%); margin: 0 auto; padding: 34px 24px 76px; }
.view { display: none; }
.view.is-visible { display: block; animation: enter .24s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.hero-card {
  display: flex;
  min-height: 118px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 23px clamp(21px, 4vw, 34px);
  border: 1px solid #eee0cf;
  border-radius: 20px;
  background: #f7ecdf;
}
.eyebrow { margin: 0 0 7px; color: var(--green-dark); font-size: 11px; font-weight: 650; letter-spacing: .1em; text-transform: uppercase; }
.hero-card h1, .page-heading h1 { margin: 0; font-family: "Yu Mincho", "Hiragino Mincho ProN", "Noto Serif JP", "Yu Gothic", sans-serif; font-size: clamp(30px, 4.5vw, 44px); font-weight: 600; letter-spacing: .06em; line-height: 1.35; }
.public-status-row { display: flex; align-items: center; gap: 13px; margin-top: 21px; }
.status-pill { display: inline-flex; min-height: 31px; align-items: center; border-radius: 999px; padding: 5px 12px; background: var(--green-soft); color: var(--green-dark); font-size: 12px; font-weight: 800; white-space: nowrap; }
.status-pill.is-closed { background: #eceeea; color: #626d66; }
.status-pill.is-error { background: var(--red-soft); color: var(--red); }
.muted { color: var(--muted); }
.small-text { font-size: 12px; }

.customer-grid { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr); align-items: start; gap: 20px; }
.panel { margin-bottom: 18px; padding: clamp(20px, 3vw, 29px); border: 1px solid var(--line); border-radius: 23px; background: var(--card); box-shadow: var(--shadow); }
.order-panel { padding: clamp(21px, 4vw, 34px); }
.product-row { display: flex; align-items: center; gap: 15px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.product-icon { display: grid; width: 58px; height: 58px; flex: 0 0 auto; place-items: center; border-radius: 18px; background: var(--orange-soft); font-size: 30px; }
.product-copy { flex: 1; }
.product-copy h2 { margin: 0; font-size: 21px; font-weight: 650; letter-spacing: .02em; }
.product-copy p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }
.product-state { max-width: 140px; color: var(--green); font-size: 12px; font-weight: 800; text-align: right; }
.product-state.is-closed { color: var(--red); }
.field { display: grid; gap: 8px; color: var(--ink); font-size: 14px; font-weight: 750; }
.quantity-field { grid-template-columns: 1fr auto; align-items: center; padding: 20px 0; }
.quantity-control { display: flex; align-items: center; gap: 5px; padding: 5px; border: 1px solid #eee4d8; border-radius: 15px; background: #faf6ef; }
.quantity-step { width: 46px; height: 46px; border: 0; border-radius: 12px; background: #fffdf9; color: var(--green-dark); font-size: 22px; font-weight: 650; box-shadow: 0 1px 4px rgba(77, 52, 33, .07); }
.quantity-step:hover { background: var(--green-soft); }
.quantity-control input { width: 54px; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 21px; font-weight: 850; text-align: center; appearance: textfield; }
.quantity-control input::-webkit-inner-spin-button, .quantity-control input::-webkit-outer-spin-button { margin: 0; appearance: none; }
.total-row { display: flex; align-items: center; justify-content: space-between; padding: 17px 0 6px; border-top: 1px solid var(--line); font-weight: 800; }
.total-row strong { color: var(--green-dark); font-size: clamp(28px, 5vw, 36px); letter-spacing: -.04em; }
.payment-note { margin: 3px 0 19px; color: var(--muted); font-size: 13px; }
.button { min-height: 44px; padding: 10px 16px; border: 1px solid transparent; border-radius: 13px; font-weight: 800; transition: transform .12s ease, background .16s ease, box-shadow .16s ease; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button-primary { background: var(--green); color: #fff; box-shadow: 0 5px 12px rgba(156, 72, 36, .15); }
.button-primary:hover:not(:disabled) { background: var(--green-dark); box-shadow: 0 7px 16px rgba(156, 72, 36, .2); }
.button-secondary { border-color: var(--line); background: #faf6ef; color: var(--ink); }
.button-secondary:hover:not(:disabled) { border-color: #dfb79c; background: var(--green-soft); }
.button-quiet { border-color: var(--line); background: transparent; color: var(--muted); }
.button-quiet:hover:not(:disabled) { background: #faf6ef; color: var(--ink); }
.button-large { width: 100%; min-height: 58px; font-size: 16px; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid rgba(195, 99, 54, .24); outline-offset: 2px; }
.panel-heading, .page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.panel-heading h2, .page-heading h2 { margin: 0; font-size: 22px; letter-spacing: -.03em; }
.history-panel { min-height: 170px; }
.empty-state { padding: 23px 12px; color: var(--muted); text-align: center; }
.customer-history-list, .order-list, .data-list { display: grid; gap: 10px; }
.customer-order, .order-card, .history-row { border: 1px solid var(--line); border-radius: 16px; padding: 15px; background: #fff; }
.customer-order { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; }
.customer-order strong { font-size: 18px; }
.customer-order .status-label { grid-column: 1 / -1; color: var(--green-dark); font-size: 13px; }
.customer-order button { grid-column: 1 / -1; justify-self: start; }
.notice { min-height: 1.45em; margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.notice.is-error { color: var(--red); font-weight: 700; }
.notice.is-success { color: var(--green-dark); font-weight: 700; }
.order-result { margin-top: 17px; padding: 19px; border: 1px solid #edd8c5; border-radius: 17px; background: #fcf3e9; }
.order-result > strong { display: block; color: var(--green-dark); font-size: clamp(36px, 8vw, 54px); letter-spacing: .02em; line-height: 1.1; }
.order-result .dialog-actions { justify-content: flex-start; flex-wrap: wrap; }

.page-heading { margin: 6px 0 22px; }
.session-actions { display: flex; align-items: center; gap: 12px; }
.login-panel { width: min(100%, 500px); margin: clamp(28px, 7vh, 70px) auto; padding: clamp(24px, 5vw, 38px); }
.login-panel h2 { margin: 0; font-size: 27px; letter-spacing: -.04em; }
.login-panel > .eyebrow { margin-bottom: 4px; }
.stack-form { display: grid; gap: 16px; margin-top: 22px; }
.staff-return-button { width: 100%; margin-top: 14px; }
.field input, .field textarea, .search-field input, .date-range input { width: 100%; min-height: 48px; padding: 11px 13px; border: 1px solid #e7dbcc; border-radius: 13px; outline: 0; background: #fffdf9; color: var(--ink); }
.field input:focus, .field textarea:focus, .search-field input:focus, .date-range input:focus { border-color: #ce8962; box-shadow: 0 0 0 4px rgba(195, 99, 54, .1); }
.password-input { ime-mode: active; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.operating-summary { max-width: 620px; }
.operating-summary strong { display: block; font-size: 18px; }
.operating-summary p { margin: 4px 0 0; }
.toolbar-side { display: flex; align-items: center; justify-content: flex-end; gap: 11px; flex-wrap: wrap; }
.proxy-form { display: flex; align-items: flex-end; gap: 14px; }
.proxy-form .field { max-width: 180px; flex: 1; }
.proxy-panel { padding: 0; overflow: hidden; }
.proxy-order-summary { display: flex; min-height: 70px; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; cursor: pointer; list-style: none; }
.proxy-order-summary::-webkit-details-marker { display: none; }
.proxy-order-summary > span:first-child { display: grid; gap: 2px; }
.proxy-order-summary .eyebrow { margin: 0; font-size: 10px; }
.proxy-order-summary strong { color: var(--green-dark); font-size: 17px; }
.proxy-order-summary:focus-visible { outline: 3px solid rgba(195, 99, 54, .36); outline-offset: -4px; }
.proxy-order-summary::after { content: '＋'; display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--green-dark); font-size: 20px; }
.proxy-panel[open] .proxy-order-summary::after { content: '−'; }
.proxy-panel[open] .proxy-form { align-items: flex-end; padding: 18px 22px 22px; border-top: 1px solid var(--line); }
.proxy-order-notice:empty { display: none; }
.orders-panel { margin-top: 0; }
.orders-heading { align-items: center; }
.search-field { display: grid; min-width: 190px; gap: 4px; color: var(--muted); font-size: 12px; }
.search-field input { width: 100%; min-height: 46px; border: 1px solid #e7dbcc; border-radius: 13px; padding: 10px 13px; background: #fffdf9; color: var(--ink); font: inherit; outline: 0; }
.search-field input:focus { border-color: #ce8962; box-shadow: 0 0 0 4px rgba(195, 99, 54, .1); }
.tabs { display: flex; gap: 5px; overflow-x: auto; margin: 18px 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.tab-button { border: 0; border-radius: 12px; padding: 10px 15px; background: transparent; color: var(--muted); font-weight: 750; white-space: nowrap; }
.tab-button.is-active { background: var(--green-soft); color: var(--green-dark); }
.tab-button span { display: inline-grid; min-width: 22px; place-items: center; margin-left: 5px; border-radius: 999px; padding: 1px 6px; background: #fff; font-size: 11px; }
.order-card { position: relative; display: grid; grid-template-columns: 1fr auto; gap: 8px 14px; padding: 18px; }
.order-card.is-new { border-color: #e6aa61; box-shadow: 0 0 0 3px rgba(230, 170, 97, .15); }
.order-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.order-title strong { color: #513b2a; font-size: 30px; font-variant-numeric: tabular-nums; letter-spacing: .015em; line-height: 1.15; }
.order-card.is-queued { border-left: 4px solid var(--orange); background: #fffdfa; }
.order-card.is-test-order { background: #fff9f1; }
.test-order-tag { border: 1px solid #e2a46e; border-radius: 999px; padding: 3px 8px; background: #fff0df; color: #843e1c; font-size: 11px; font-weight: 800; white-space: nowrap; }
.new-tag { border-radius: 6px; padding: 3px 7px; background: #c86032; color: #fff; font-size: 10px; font-weight: 850; letter-spacing: .08em; }
.order-details { color: var(--muted); font-size: 14px; }
.order-status { justify-self: end; align-self: start; border-radius: 999px; padding: 5px 10px; background: #f5ede3; font-size: 12px; font-weight: 700; }
.order-actions { display: flex; grid-column: 1 / -1; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 7px; }
.order-actions .button { min-height: 42px; }
.order-actions input { width: 76px; min-height: 42px; border: 1px solid var(--line); border-radius: 11px; padding: 8px; }
.date-range { display: flex; align-items: flex-end; gap: 9px; flex-wrap: wrap; }
.date-range label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
.date-range input { min-width: 145px; min-height: 42px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 22px 0; }
.summary-card { border: 1px solid #ecdcc9; border-radius: 17px; padding: 18px; background: #fffaf3; }
.summary-card span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.summary-card strong { display: block; margin-top: 5px; color: var(--green-dark); font-size: clamp(22px, 3.5vw, 32px); letter-spacing: -.04em; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.report-grid h3 { margin: 6px 0 10px; font-size: 15px; }
.data-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 3px; border-bottom: 1px solid var(--line); font-size: 13px; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-row strong { font-size: 17px; }
.dialog-card { width: min(480px, calc(100% - 28px)); border: 1px solid var(--line); border-radius: 24px; padding: 26px; color: var(--ink); box-shadow: 0 25px 90px rgba(0, 0, 0, .22); }
.dialog-card::backdrop { background: rgba(52, 39, 29, .48); backdrop-filter: blur(3px); }
.dialog-card h2 { margin: 4px 0 16px; }
.dialog-card > p:not(.eyebrow):not(.notice) { color: var(--muted); }
.dialog-close { position: absolute; top: 13px; right: 16px; border: 0; background: transparent; color: var(--muted); font-size: 25px; }
.review-total { display: flex; align-items: center; justify-content: space-between; border-radius: 15px; padding: 16px; background: var(--green-soft); font-weight: 750; }
.review-total strong { color: var(--green-dark); font-size: 27px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 18px; }
.dialog-actions .button { min-width: 110px; }
.dialog-card textarea { resize: vertical; }
.manager-operations-panel { border-top: 3px solid var(--orange); }
.manager-operations-panel .panel-heading { align-items: center; }
.manager-operating-state { display: block; margin-top: 4px; font-size: 17px; }
.manager-settings-controls { display: flex; min-width: min(100%, 460px); align-items: center; gap: 10px; flex-wrap: wrap; }
.setting-toggle { display: inline-flex; min-height: 46px; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; font-size: 13px; font-weight: 750; }
.setting-toggle input { width: 20px; height: 20px; accent-color: var(--green); }
.manager-settings-controls .notice { flex-basis: 100%; margin: 0; }
.report-toolbar { display: flex; align-items: flex-end; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.mode-banner { margin: 0 0 14px; border: 1px solid #e2a46e; border-radius: 13px; padding: 11px 14px; background: #fff0df; color: #843e1c; font-size: 13px; font-weight: 750; }
.setting-toggle-test { border-color: #e0a36f; background: #fff4e8; color: #843e1c; }
.sales-chart { display: block; width: 100%; height: 300px; margin-top: 12px; border: 1px solid var(--line); border-radius: 15px; background: #fffaf3; }
.chart-title-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.chart-title-row h3 { margin: 6px 0 10px; }
.chart-metric-select { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.chart-metric-select select { min-height: 38px; border: 1px solid var(--line); border-radius: 10px; padding: 6px 9px; background: var(--card); color: var(--ink); }
.chart-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.chart-actions .notice { margin: 0; }
.order-card.is-paused { opacity: .72; }

@media (max-width: 760px) {
  .site-header { min-height: 64px; gap: 12px; padding: 9px 18px; }
  main { padding: 25px 18px 55px; }
  .customer-grid { grid-template-columns: 1fr; gap: 0; }
  .customer-grid .history-panel { order: 2; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .toolbar-side { justify-content: flex-start; }
  .manager-settings-controls { width: 100%; min-width: 0; }
  .manager-settings-controls > .button { flex: 1; }
  .manager-operations-panel .panel-heading { align-items: stretch; }
  .report-toolbar { width: 100%; justify-content: flex-start; }
  .proxy-form .field { max-width: none; }
  .proxy-form .button { min-height: 48px; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .search-field { width: 100%; }
  .report-grid { grid-template-columns: 1fr; }
  .sales-chart { height: 260px; }
  .chart-actions .button { flex: 1; }
  .date-range { width: 100%; }
  .date-range label { min-width: 120px; flex: 1; }
  .date-range input { min-width: 0; }
  .order-card { padding: 15px; }
  .order-actions .button { flex: 1; }
  .history-row { align-items: flex-start; }
  .session-actions { justify-content: flex-end; flex-wrap: wrap; }
  .summary-card { padding: 15px; }
}

@media (max-width: 480px) {
  .site-header { gap: 8px; padding-right: 12px; padding-left: 12px; }
  .brand { font-size: 24px; }
  .header-actions { gap: 7px; }
  .staff-menu-toggle { min-height: 44px; padding: 8px 11px; }
  .connection-state { max-width: 84px; font-size: 10px; line-height: 1.2; text-align: right; white-space: normal; }
  main { padding: 18px 12px 44px; }
  .hero-card { min-height: 90px; padding: 18px; border-radius: 17px; }
  .public-status-row { align-items: flex-start; flex-direction: column; gap: 8px; }
  .panel { margin-bottom: 14px; padding: 17px; border-radius: 19px; }
  .order-panel { padding: 19px; }
  .product-row { gap: 11px; }
  .product-icon { width: 50px; height: 50px; border-radius: 15px; font-size: 26px; }
  .product-state { max-width: 88px; font-size: 11px; }
  .quantity-step { width: 46px; height: 46px; }
  .quantity-control input { width: 46px; }
  .proxy-form { align-items: stretch; flex-direction: column; }
  .proxy-form .field, .proxy-form .button { width: 100%; }
  .proxy-panel[open] .proxy-form { padding: 16px; }
  .proxy-order-summary { min-height: 68px; padding: 12px 16px; }
  .summary-grid { grid-template-columns: 1fr; gap: 8px; }
  .summary-card { display: flex; align-items: center; justify-content: space-between; }
  .summary-card strong { margin: 0; font-size: 23px; }
  .dialog-card { padding: 23px 18px; }
  .dialog-actions { justify-content: stretch; }
  .dialog-actions .button { min-width: 0; flex: 1; }
  .order-title strong { font-size: 24px; }
  .orders-heading { gap: 13px; }
  .search-field { min-width: 0; }
  .order-card { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .order-details { grid-column: 1 / -1; }
  .report-toolbar { align-items: stretch; flex-direction: column; }
  .report-toolbar > .button { width: 100%; }
}

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