:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f7;
  --text: #17202a;
  --muted: #667085;
  --line: #dce4ec;
  --accent: #0f8b8d;
  --accent-2: #e4572e;
  --ok: #198754;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.16);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, #f8fafc 0%, #eef3f7 48%, #f6f8fb 100%);
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(96px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 2px 2px 12px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 18px;
  line-height: 1.2;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 7px 20px rgba(31, 41, 55, 0.08);
}

.icon-button span {
  font-size: 22px;
  line-height: 1;
}

.hamburger-button {
  gap: 4px;
  align-content: center;
}

.hamburger-button span {
  width: 20px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  font-size: 0;
}

.sales-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 24px rgba(31, 41, 55, 0.07);
}

.muted,
.order-time,
.section-heading span,
.item-line,
.sales-item span,
.history-meta {
  color: var(--muted);
  font-size: 12px;
}

.list-section {
  margin-bottom: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 0 2px;
}

.completed-section {
  margin-top: 8px;
  padding-top: 4px;
}

.order-list,
.history-list {
  display: grid;
  gap: 8px;
}

.order-card,
.history-card {
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 8px 22px rgba(31, 41, 55, 0.07);
}

.order-card {
  padding: 12px;
}

.order-card.is-completed {
  border-left-color: var(--ok);
  opacity: 0.82;
}

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

.order-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.order-title strong {
  font-size: 17px;
}

.ticket-badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  color: #ffffff;
  background: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
}

.order-total {
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.order-items {
  display: grid;
  gap: 3px;
  margin: 10px 0 12px;
}

.item-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.item-line span:first-child {
  color: var(--text);
  font-weight: 700;
}

.complete-button,
.primary-button,
.secondary-button,
.text-button {
  border: 0;
  border-radius: var(--radius);
  font-weight: 900;
}

.complete-button,
.primary-button {
  color: #ffffff;
  background: var(--accent);
}

.complete-button {
  width: 100%;
  min-height: 44px;
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent);
  background: transparent;
}

.text-button.danger {
  color: #c93524;
}

.secondary-button {
  min-height: 42px;
  margin-bottom: 10px;
  color: var(--accent);
  background: #e8f5f5;
}

.undo-button {
  width: 100%;
  margin: 0;
}

.fab {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent-2);
  box-shadow: var(--shadow);
}

.fab span {
  transform: translateY(-1px);
  font-size: 42px;
  line-height: 1;
}

.sheet {
  width: min(100%, 520px);
  max-width: 520px;
  max-height: 92vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 18px 18px 0 0;
  background: transparent;
}

.drawer {
  width: min(100%, 520px);
  max-width: 520px;
  height: 100vh;
  max-height: 100vh;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
}

.drawer::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.drawer-panel {
  width: min(86%, 360px);
  height: 100%;
  margin-left: auto;
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom));
  border-left: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.drawer-actions {
  display: grid;
  gap: 8px;
}

.menu-action {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  background: #fbfdff;
  text-align: left;
}

.menu-action strong {
  font-size: 16px;
}

.menu-action span {
  color: var(--muted);
  font-size: 12px;
}

.menu-action.danger strong {
  color: #c93524;
}

.sheet::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.sheet-content {
  display: flex;
  max-height: 92vh;
  flex-direction: column;
  padding: 9px 14px calc(14px + env(safe-area-inset-bottom));
  border-radius: 18px 18px 0 0;
  background: var(--surface);
}

.sheet-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: #cbd5e1;
}

.sheet-header,
.sheet-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.sheet-header {
  padding-bottom: 12px;
}

.sheet-footer {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sheet-footer.single {
  display: block;
}

.sheet-footer.single .primary-button {
  width: 100%;
}

.sheet-footer strong {
  display: block;
  font-size: 22px;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.setting-row input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--text);
  background: #f8fafc;
  font-size: 16px;
}

.picker-list,
.settings-list {
  overflow: auto;
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
}

.picker-row,
.setting-row {
  display: grid;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfdff;
}

.picker-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.setting-row {
  grid-template-columns: minmax(84px, 1fr) 94px 76px;
}

.setting-row .field {
  margin-bottom: 0;
}

.product-name {
  font-weight: 900;
}

.product-price {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.stepper {
  display: grid;
  grid-template-columns: 46px 44px 46px;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.stepper button {
  width: 46px;
  height: 46px;
  border: 0;
  color: var(--accent);
  background: #ffffff;
  font-size: 24px;
  font-weight: 900;
}

.stepper button:disabled {
  color: #9aa6b2;
  background: #f1f5f9;
}

.stepper output {
  min-width: 44px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
}

.ticket-edit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 64px;
  gap: 8px;
  margin: 10px 0;
}

.ticket-edit input {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 7px 9px;
  background: #f8fafc;
  font-size: 16px;
}

.ticket-edit button {
  min-height: 40px;
  border: 0;
  border-radius: var(--radius);
  color: var(--accent);
  background: #e8f5f5;
  font-weight: 900;
}

.primary-button {
  min-width: 116px;
  min-height: 48px;
  padding: 0 16px;
  font-size: 16px;
}

.primary-button:disabled {
  opacity: 0.45;
}

.sales-card {
  padding: 12px;
}

.sales-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.sales-total span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.sales-total strong {
  font-size: 28px;
}

.sales-grid {
  display: grid;
  gap: 8px;
  padding-top: 12px;
}

.sales-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.sales-item strong {
  font-size: 15px;
}

.history-list {
  margin-top: 10px;
}

.history-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-left-color: #7c3aed;
}

.history-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 18px 12px;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--text);
}

@media (min-width: 760px) {
  .fab {
    right: calc((100vw - 520px) / 2 + 18px);
  }
}
