:root {
  color-scheme: light;
  --ink: #172027;
  --muted: #66727d;
  --line: #d8e0e6;
  --panel: #ffffff;
  --soft: #f4f7f8;
  --accent: #147a73;
  --accent-dark: #0f5e59;
  --warn: #b84b2a;
  --gold: #d49328;
  --blue: #2e6f9e;
  --shadow: 0 18px 38px rgba(22, 35, 44, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #edf2f4;
  color: var(--ink);
  font-family: "Segoe UI", "Noto Sans JP", system-ui, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 16px;
  max-width: 1500px;
}

.topbar h1,
.cart-head h2,
.summary-panel h2,
.signature-panel h2,
.reception-head h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 3vw, 44px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.top-actions,
.workflow-tabs,
.category-row,
.adjust-box,
.signature-head,
.reception-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented,
.workflow-tabs {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.lang-btn,
.step-tab,
.ghost-btn,
.primary-btn,
.send-btn {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.lang-btn,
.step-tab {
  color: var(--muted);
  background: transparent;
}

.lang-btn.active,
.step-tab.active {
  color: #fff;
  background: var(--accent);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.ghost-btn.small {
  min-height: 38px;
  padding: 0 12px;
}

.primary-btn,
.send-btn {
  width: 100%;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 22px rgba(20, 122, 115, 0.22);
}

.primary-btn:disabled,
.send-btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto;
}

.left-pane,
.cart-pane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.left-pane {
  min-height: calc(100vh - 118px);
  padding: 16px;
}

.cart-pane {
  position: sticky;
  top: 18px;
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 36px);
  padding: 16px;
}

.workflow-tabs {
  margin-bottom: 16px;
}

.step-tab {
  flex: 1;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.customer-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

label span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 122, 115, 0.14);
}

.category-row {
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.category-btn {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 0 16px;
  font-weight: 900;
}

.category-btn.active {
  border-color: var(--accent);
  background: #e2f3f0;
  color: var(--accent-dark);
}

.category-detail {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.55fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.category-detail[hidden] {
  display: none;
}

.category-detail img {
  width: 100%;
  height: 280px;
  object-fit: cover;
  background: var(--soft);
}

.category-detail-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
}

.category-detail-body h2 {
  margin: 0 0 10px;
  font-size: 28px;
}

.category-detail-body p:last-child {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

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

.item-card {
  display: grid;
  grid-template-rows: 132px auto auto auto;
  gap: 9px;
  min-height: 316px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 16px;
  text-align: left;
  overflow: hidden;
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}

.item-photo {
  width: calc(100% + 32px);
  height: 132px;
  margin: -16px -16px 2px;
  object-fit: cover;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.item-card:hover {
  border-color: var(--accent);
  box-shadow: 0 12px 24px rgba(22, 35, 44, 0.12);
  transform: translateY(-2px);
}

.item-name {
  overflow-wrap: anywhere;
  font-size: 19px;
  font-weight: 900;
}

.item-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.item-price {
  align-self: end;
  color: var(--accent-dark);
  font-size: 22px;
  font-weight: 900;
}

.item-card.needs-price {
  border-color: var(--gold);
  background: #fffaf0;
}

.cart-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  min-width: 44px;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  padding: 8px 10px;
  text-align: center;
  font-weight: 900;
}

.cart-list {
  flex: 1;
  overflow: auto;
  margin: 14px 0;
  padding-right: 4px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 210px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.cart-row strong {
  display: block;
  margin-bottom: 4px;
}

.cart-row small {
  color: var(--muted);
  font-weight: 700;
}

.custom-price {
  display: block;
  margin-top: 10px;
}

.custom-price input {
  min-height: 42px;
}

.qty-control {
  display: grid;
  grid-template-columns: 42px 58px 42px;
  align-items: center;
  gap: 4px;
}

.qty-control button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 22px;
  font-weight: 900;
}

.qty-control input {
  min-height: 42px;
  padding: 0 4px;
  text-align: center;
}

.remove-btn {
  grid-column: 2;
  border: 0;
  background: transparent;
  color: var(--warn);
  font-weight: 900;
}

.adjust-box {
  align-items: end;
  margin-bottom: 14px;
}

.total-box {
  display: grid;
  gap: 9px;
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.total-box div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 800;
}

.total-box .grand {
  color: var(--ink);
  font-size: 24px;
}

.confirm-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.85fr);
  gap: 16px;
}

.summary-panel,
.signature-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--soft);
}

.customer-summary {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
  font-weight: 800;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 18px;
  font-size: 25px;
  font-weight: 900;
}

.notice {
  margin-top: 18px;
  border-left: 5px solid var(--blue);
  background: #fff;
  padding: 14px;
  color: var(--ink);
  font-weight: 800;
}

.signature-head,
.reception-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

canvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.send-btn {
  margin-top: 14px;
}

.queue-list {
  display: grid;
  gap: 12px;
}

.queue-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px;
}

.queue-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.queue-card p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.queue-card .slip-meta {
  margin-bottom: 6px;
  color: var(--ink);
}

.queue-card .reception-alert {
  display: inline-block;
  margin: 0 0 10px;
  border-radius: 8px;
  background: #fff3cd;
  color: #6f4f00;
  padding: 8px 10px;
  font-size: 14px;
}

.queue-total {
  color: var(--accent-dark);
  font-size: 26px;
  font-weight: 900;
}

.queue-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.settle-btn,
.settled-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

.settle-btn {
  border: 0;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.settle-btn:hover {
  background: var(--accent-dark);
}

.settled-pill {
  background: #edf4f6;
  color: var(--muted);
}

.history-panel {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.history-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.history-head h2 {
  margin: 0;
}

.history-tools {
  display: grid;
  grid-template-columns: 160px minmax(180px, 260px) auto;
  gap: 10px;
  align-items: end;
}

.history-tools label span {
  font-size: 12px;
}

.history-card {
  background: #f8fbfb;
}

.manifest-panel {
  grid-column: 1 / -1;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.manifest-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.manifest-head h4 {
  margin: 0;
  font-size: 20px;
}

.manifest-total {
  display: flex;
  align-items: baseline;
  gap: 6px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  font-weight: 900;
}

.manifest-total span,
.manifest-total small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 12px;
}

.manifest-total strong {
  font-size: 24px;
}

.manifest-visual-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.manifest-sheet {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(32, 62, 66, 0.12);
}

.manifest-sheet img {
  display: block;
  width: 100%;
  height: auto;
}

.manifest-code-mark,
.manifest-qty-mark,
.manifest-capacity-mark {
  position: absolute;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.94);
  color: #b32316;
  font-weight: 900;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(160, 35, 20, 0.2);
}

.manifest-code-mark {
  width: 34px;
  height: 24px;
  border: 2px solid #d6422f;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.manifest-qty-mark {
  min-width: 46px;
  height: 24px;
  border: 2px solid #d6422f;
  border-radius: 6px;
  font-size: 15px;
}

.manifest-capacity-mark {
  left: 92.5%;
  top: 84.5%;
  min-width: 100px;
  height: 36px;
  border: 2px solid #d6422f;
  border-radius: 6px;
  font-size: 18px;
}

.manifest-copy-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfb;
  padding: 12px;
}

.manifest-copy-list h5 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 14px;
}

.manifest-copy-list ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.manifest-copy-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  font-weight: 800;
}

.manifest-copy-list li span {
  color: var(--ink);
}

.manifest-copy-list li strong {
  color: var(--accent-dark);
  white-space: nowrap;
}

.manifest-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.manifest-table th,
.manifest-table td {
  border: 1px solid var(--line);
  padding: 8px 10px;
}

.manifest-table th {
  background: #edf4f6;
  color: var(--muted);
  text-align: left;
  font-weight: 900;
}

.manifest-table .manifest-mark,
.manifest-table .manifest-code,
.manifest-table .manifest-qty {
  text-align: center;
  white-space: nowrap;
  font-weight: 900;
}

.manifest-table .manifest-mark {
  width: 44px;
  color: var(--accent-dark);
  font-size: 20px;
}

.manifest-table .manifest-code {
  width: 58px;
}

.manifest-table .manifest-qty {
  width: 98px;
}

.manifest-active {
  background: #effaf7;
}

.manifest-note {
  margin: 10px 0 0;
  color: var(--warn);
  font-weight: 800;
}

@media (max-width: 1120px) {
  .main-grid,
  .confirm-layout {
    grid-template-columns: 1fr;
  }

  .history-head {
    align-items: stretch;
    flex-direction: column;
  }

  .history-tools {
    grid-template-columns: 1fr;
  }

  .manifest-visual-wrap {
    grid-template-columns: 1fr;
  }

  .cart-pane {
    position: static;
    max-height: none;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .customer-strip,
  .item-grid,
  .category-detail {
    grid-template-columns: 1fr;
  }

  .category-detail img {
    height: 210px;
  }

  .workflow-tabs,
  .segmented {
    width: 100%;
  }

  .lang-btn,
  .step-tab {
    flex: 1;
    padding: 0 8px;
  }
}
