:root {
  color-scheme: dark;
  --bg: #111414;
  --surface: #191d1d;
  --surface-2: #222727;
  --line: #343b3b;
  --text: #f4f4ed;
  --muted: #9ba5a4;
  --accent: #c9e96c;
  --accent-ink: #17200b;
  --danger: #ff8c77;
  --radius: 18px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% -10%, #31412d 0, transparent 32rem),
    var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

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

button {
  cursor: pointer;
}

.customer-header,
.staff-header {
  width: min(1120px, calc(100% - 32px));
  min-height: 76px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.customer-header > p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 900;
}

.customer-main,
.staff-main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 130px;
}

.hero {
  max-width: 680px;
  margin-bottom: 40px;
}

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

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(42px, 8vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 22px;
  font-size: 28px;
  letter-spacing: -0.035em;
}

.hero > h1 + p {
  max-width: 560px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.last-order-link {
  display: inline-flex;
  margin-top: 8px;
  color: var(--accent);
  font-weight: 750;
  text-decoration: none;
}

.last-order-link[hidden] {
  display: none;
}

.flyer-wallet {
  margin: -12px 0 36px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.flyer-wallet[hidden],
.flyer-session-error[hidden] {
  display: none;
}

.flyer-wallet-copy {
  display: grid;
  gap: 4px;
}

.flyer-wallet-copy p,
.flyer-wallet-copy strong,
.flyer-wallet-copy small {
  margin: 0;
}

.flyer-wallet-copy p {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.flyer-wallet-copy strong {
  font-size: 21px;
}

.flyer-wallet-copy small {
  color: var(--muted);
  line-height: 1.4;
}

.flyer-toggle {
  position: relative;
  min-height: 48px;
  padding: 8px 12px;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-2);
  font-size: 14px;
  font-weight: 750;
  cursor: pointer;
}

.flyer-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.flyer-toggle-control {
  width: 38px;
  height: 22px;
  padding: 3px;
  display: flex;
  align-items: center;
  border-radius: 999px;
  background: #4a5251;
  transition: background-color 120ms ease;
}

.flyer-toggle-control::after {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--text);
  content: "";
  transition: transform 120ms ease;
}

.flyer-toggle input:checked + .flyer-toggle-control {
  background: var(--accent);
}

.flyer-toggle input:disabled ~ span {
  opacity: 0.55;
}

.flyer-toggle input:checked + .flyer-toggle-control::after {
  transform: translateX(16px);
  background: var(--accent-ink);
}

.flyer-toggle input:focus-visible + .flyer-toggle-control {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.flyer-retry {
  width: fit-content;
  margin-top: 5px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 750;
}

.flyer-retry[hidden] {
  display: none;
}

.flyer-session-error {
  margin: -12px 0 28px;
  color: var(--muted);
  font-size: 13px;
}

.catalog {
  display: grid;
  gap: 32px;
}

.customer-footer {
  margin-top: 52px;
  padding: 24px 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.customer-footer a,
.legal-details a {
  color: var(--accent);
}

.legal-main {
  padding-bottom: 72px;
}

.legal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.legal-grid .settings-card {
  line-height: 1.55;
}

.legal-grid .settings-card:first-child,
.legal-grid .settings-card:last-child {
  grid-column: 1 / -1;
}

.legal-details {
  margin: 0;
  display: grid;
  gap: 12px;
}

.legal-details div {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) 1fr;
  gap: 16px;
}

.legal-details dt {
  color: var(--muted);
}

.legal-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.category-group h2 {
  margin-bottom: 16px;
  font-size: 20px;
}

.drink-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}

.drink-card {
  min-height: 176px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--drink) 16%, transparent), transparent 60%),
    var(--surface);
  cursor: pointer;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background-color 120ms ease;
}

.drink-card:hover,
.drink-card:focus-visible {
  border-color: color-mix(in srgb, var(--drink) 72%, var(--line));
  outline: none;
}

.drink-card:active {
  transform: scale(0.985);
}

.drink-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.drink-card h3 {
  margin: 0 0 6px;
  font-size: 22px;
  letter-spacing: -0.035em;
}

.drink-card p {
  margin: 0;
  color: var(--muted);
}

.drink-card .drink-description {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.4;
}

.drink-bottom,
.quantity-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drink-bottom strong {
  font-size: 20px;
}

.quantity-control button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 24px;
}

.quantity-control span {
  min-width: 24px;
  text-align: center;
  font-weight: 800;
}

.cart {
  position: fixed;
  z-index: 10;
  left: 50%;
  bottom: 18px;
  width: min(720px, calc(100% - 28px));
  min-height: 76px;
  padding: 12px 12px 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgb(25 29 29 / 94%);
  box-shadow: 0 18px 60px rgb(0 0 0 / 42%);
  backdrop-filter: blur(18px);
}

.cart-summary {
  min-width: 210px;
  display: grid;
  gap: 3px;
}

.cart span {
  color: var(--muted);
  font-size: 13px;
}

.cart strong {
  font-size: 22px;
}

.cart-prices {
  display: flex;
  align-items: flex-end;
  gap: 14px;
}

.cart-price-row {
  display: grid;
  gap: 1px;
}

.cart-price-row small {
  color: var(--muted);
  font-size: 10px;
}

.cart-price-row strong {
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}

.cart-flyer-row[hidden] {
  display: none;
}

.cart-flyer-row strong {
  color: var(--accent);
}

.cart-total-row strong {
  font-size: 22px;
}

.cart-error {
  display: block;
  max-width: 430px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.3;
}

.cart-error:empty {
  display: none;
}

.receipt-contact {
  min-width: min(280px, 34vw);
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 11px;
}

.receipt-contact[hidden] {
  display: none;
}

.receipt-contact input {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #101313;
  color: var(--text);
}

.receipt-contact input:focus {
  border-color: var(--accent);
  outline: none;
}

.cart button,
.primary,
.order-action {
  min-height: 50px;
  padding: 0 22px;
  border: 0;
  border-radius: 13px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 850;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

dialog {
  width: min(520px, calc(100% - 24px));
  max-height: calc(100vh - 24px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  color: var(--text);
}

dialog::backdrop {
  background: rgb(0 0 0 / 72%);
  backdrop-filter: blur(6px);
}

dialog form {
  position: relative;
  padding: 28px;
}

.dialog-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--text);
  font-size: 24px;
}

.order-lines {
  display: grid;
  gap: 10px;
  margin-bottom: 22px;
}

.order-line,
.order-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.order-line {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

dialog label {
  display: grid;
  gap: 8px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 14px;
}

dialog input {
  min-height: 48px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #101313;
  color: var(--text);
}

.order-total {
  margin: 20px 0;
  font-size: 20px;
}

.primary {
  width: 100%;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-size: 14px;
}

.loading,
.empty-state {
  color: var(--muted);
}

.status-main {
  width: min(680px, calc(100% - 28px));
  margin: 0 auto;
  padding: 60px 0;
}

.status-card {
  padding: clamp(24px, 6vw, 48px);
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 30px 100px rgb(0 0 0 / 32%);
}

.status-symbol {
  width: 64px;
  height: 64px;
  margin-bottom: 24px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 30px;
  font-weight: 900;
}

.status-card h1 {
  font-size: clamp(34px, 8vw, 58px);
}

.status-message {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.5;
}

.status-meta,
.status-items,
.status-history {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.status-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.status-meta span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.status-items ul,
.status-history ol {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.status-items li,
.status-history li {
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}

.status-history li {
  justify-content: flex-start;
  color: var(--muted);
}

.status-history li.current {
  color: var(--accent);
  font-weight: 800;
}

.demo-pay {
  width: 100%;
  margin-top: 24px;
}

.payment-link {
  margin-top: 24px;
  display: grid;
  place-items: center;
  text-decoration: none;
}

.payment-error {
  margin: 20px 0 0;
  color: var(--danger);
  line-height: 1.45;
}

.quiet-link {
  color: var(--muted);
  text-decoration: none;
}

.staff-header {
  width: min(1400px, calc(100% - 32px));
}

.staff-main {
  width: min(1400px, calc(100% - 32px));
  padding-top: 32px;
}

.staff-title,
.staff-actions,
.filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.staff-title h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 62px);
}

.staff-actions {
  color: var(--muted);
  font-size: 13px;
}

.filter {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
}

.filter.active {
  background: var(--surface-2);
  color: var(--text);
}

.staff-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.staff-order {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.order-code {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.order-time {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.staff-order h2 {
  margin: 5px 0 0;
  font-size: 22px;
}

.status-pill {
  padding: 7px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.staff-order ul {
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.staff-order li {
  padding: 8px 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 55%, transparent);
}

.staff-order-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.order-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-cancel {
  min-height: 50px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.order-cancel:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.staff-order-foot strong {
  font-size: 20px;
}

.pair-required {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.staff-action-error {
  grid-column: 1 / -1;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid color-mix(in srgb, var(--danger) 45%, var(--line));
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 10%, var(--surface));
  color: var(--danger);
}

.report-controls {
  margin-top: 24px;
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.report-controls label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.report-controls input {
  min-height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.report-controls button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.report-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-card,
.report-section {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

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

.report-card strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(22px, 4vw, 34px);
  letter-spacing: -0.04em;
}

.report-card small {
  display: block;
  margin-top: 7px;
  color: var(--muted);
}

.report-sections {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 12px;
}

.report-section h2 {
  font-size: 18px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
}

.report-table th,
.report-table td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.reconciliation-ok {
  color: var(--accent);
}

.reconciliation-bad {
  color: var(--danger);
}

.settings-grid {
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.settings-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.settings-card h2 {
  margin-bottom: 10px;
  font-size: 22px;
}

.merchant-profile-card,
.tbank-config-card {
  grid-column: 1 / -1;
}

.settings-muted {
  color: var(--muted);
  line-height: 1.5;
}

.settings-status {
  padding: 12px 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.status-ok {
  color: var(--accent);
}

.status-warn {
  color: #f1c77f;
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 160px;
  gap: 12px;
}

.settings-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.settings-form input,
.settings-form select,
.settings-form textarea,
.ticket-url {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101313;
  color: var(--text);
  font: inherit;
}

.settings-form textarea {
  padding-block: 10px;
  resize: vertical;
}

.settings-field-wide {
  grid-column: 1 / -1;
}

.settings-secret-warning {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #725d34;
  border-radius: 10px;
  background: #2a2419;
  color: #f1d89d;
  line-height: 1.5;
}

.settings-form .settings-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  line-height: 1.45;
}

.settings-form .settings-confirm input {
  width: 20px;
  min-height: 20px;
  margin: 1px 0 0;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}

.settings-form button,
.settings-button {
  min-height: 44px;
  padding: 0 14px;
  align-self: end;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 800;
}

.settings-form button {
  grid-column: 1 / -1;
}

.settings-button.secondary {
  background: var(--surface-2);
  color: var(--text);
}

.ticket-result {
  margin-top: 16px;
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101313;
}

.ticket-result[hidden] {
  display: none;
}

.ticket-result small,
.backup-list {
  color: var(--muted);
}

.catalog-preview {
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #101313;
  color: var(--muted);
}

.catalog-preview p {
  margin-bottom: 8px;
}

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

.catalog-preview li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.catalog-preview strong {
  color: var(--text);
}

.backup-list {
  margin: 16px 0 0;
  padding-left: 20px;
  line-height: 1.7;
}

.settings-error {
  color: var(--danger);
}

@media (max-width: 640px) {
  .customer-header > p {
    display: none;
  }

  .staff-header {
    padding: 14px 0;
    flex-wrap: wrap;
  }

  .staff-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .staff-actions::-webkit-scrollbar {
    display: none;
  }

  .staff-actions .quiet-link {
    flex: 0 0 auto;
    min-height: 38px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
  }

  .customer-main {
    padding-top: 28px;
    padding-bottom: 210px;
  }

  .flyer-wallet {
    margin-top: -8px;
    align-items: stretch;
    flex-direction: column;
  }

  .flyer-toggle {
    justify-content: center;
  }

  .cart {
    align-items: center;
    flex-wrap: wrap;
  }

  .cart-summary {
    flex: 1;
  }

  .cart-prices {
    gap: 10px;
  }

  .receipt-contact {
    width: 100%;
    min-width: 0;
    order: 3;
  }

  .drink-grid {
    grid-template-columns: 1fr;
  }

  .drink-card {
    min-height: 150px;
  }

  .staff-title {
    align-items: flex-end;
  }

  .staff-grid {
    grid-template-columns: 1fr;
  }

  .status-meta {
    grid-template-columns: 1fr;
  }

  .report-grid,
  .report-sections,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 641px) and (max-width: 980px) {
  .report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
