:root {
  --color-bg: #0f1720;
  --color-surface: #1b2534;
  --color-surface-2: #263146;
  --color-text: #f3f6fa;
  --color-muted: #9fb0c3;
  --color-primary: #2f81f7;
  --color-primary-text: #ffffff;
  --color-success: #1f9d55;
  --color-danger: #e5484d;
  --color-warning: #d9a441;
  --color-border: #334155;
  --radius: 10px;
  --touch: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
}

#app { min-height: 100vh; display: flex; flex-direction: column; }

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  min-height: var(--touch);
  padding: 0 18px;
  border-radius: var(--radius);
  border: none;
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 600;
  cursor: pointer;
}

button:active { transform: scale(0.98); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary { background: var(--color-primary); color: var(--color-primary-text); }
button.success { background: var(--color-success); color: white; }
button.danger { background: var(--color-danger); color: white; }
button.ghost { background: transparent; border: 1px solid var(--color-border); }
button.block { width: 100%; }

input[type="text"], input[type="number"], input[type="password"], select {
  min-height: var(--touch);
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  width: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar .status { display: flex; gap: 10px; align-items: center; font-size: 14px; color: var(--color-muted); flex-wrap: wrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--color-success); }
.dot.offline { background: var(--color-danger); }

.container { padding: 14px; max-width: 760px; margin: 0 auto; width: 100%; flex: 1; }

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
}

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.space-between { justify-content: space-between; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; }

.nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 14px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}
.nav a {
  color: var(--color-muted);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius);
  white-space: nowrap;
  font-weight: 600;
}
.nav a.active { color: var(--color-text); background: var(--color-surface-2); }

.cart-item {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
}
.cart-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 8px; background: var(--color-surface-2); }
.cart-item .info { flex: 1; min-width: 0; }
.cart-item .info .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cart-item .info .meta { color: var(--color-muted); font-size: 14px; }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-control button { min-width: 44px; min-height: 44px; padding: 0; font-size: 20px; }
.qty-control input { width: 54px; text-align: center; min-height: 44px; padding: 0; }

.totals { font-size: 22px; font-weight: 700; display: flex; justify-content: space-between; margin: 10px 0; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.badge.open { background: var(--color-primary); color: white; }
.badge.completed { background: var(--color-success); color: white; }
.badge.voided { background: var(--color-danger); color: white; }
.badge.cancelled { background: var(--color-muted); color: black; }

.muted { color: var(--color-muted); }
.error { color: var(--color-danger); font-weight: 600; }
.success-text { color: var(--color-success); font-weight: 600; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal {
  background: var(--color-surface);
  border-radius: 16px 16px 0 0;
  padding: 16px;
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  overflow-y: auto;
}
@media (min-width: 600px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 16px; }
}

#qr-reader { width: 100%; border-radius: var(--radius); overflow: hidden; }

table.admin-table { width: 100%; border-collapse: collapse; font-size: 15px; }
table.admin-table th, table.admin-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--color-border); }
table.admin-table th { color: var(--color-muted); font-weight: 600; }

.table-scroll { overflow-x: auto; }

.receipt {
  text-align: center;
  padding: 24px 14px;
}
.receipt .stamp {
  display: inline-block;
  border: 2px solid var(--color-warning);
  color: var(--color-warning);
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  margin-bottom: 14px;
}
