:root {
  --primary: #05a070;
  --primary-dark: #047857;
  --primary-soft: #ecfdf5;
  --success-bg: #d1fae5;
  --success-text: #065f46;
  --warning-bg: #fef9c3;
  --warning-text: #854d0e;
  --error-bg: #fee2e2;
  --error-text: #b91c1c;
  --text: #1a1c3c;
  --text-secondary: #4d4f67;
  --muted: #71717a;
  --disabled: #b3b3be;
  --bg: #fafafb;
  --surface: #ffffff;
  --border: #e4e4e7;
  --border-light: #f4f4f5;
  --navy: #1a1c3c;
  --violet-soft: #f3e8ff;
  --violet-text: #6b21a8;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", Inter, ui-sans-serif, system-ui, sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 20px 16px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 12px;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(5, 160, 112, 0.28);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.1;
}

.brand-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-button {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.nav-button:hover {
  background: var(--border-light);
}

.nav-button.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.nav-button i,
.icon-button i,
.btn i,
.mini-action i {
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
}

.sidebar-footer label {
  display: block;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.api-input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
  color: var(--text);
  background: #fff;
  font-size: 12px;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 72px;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: rgba(250, 250, 251, 0.96);
  border-bottom: 1px solid var(--border);
}

.page-title {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.page-kicker {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

.content > .notice {
  margin-bottom: 16px;
}

.content-stack {
  margin-top: 16px;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 56px;
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.panel-body {
  padding: 16px;
}

.metric {
  padding: 16px;
}

.metric-label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 800;
}

.metric-note {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 13px;
}

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

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

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.form-actions {
  align-self: end;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.api-input:focus {
  outline: 0;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 160, 112, 0.15);
}

.btn {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-size: 14px;
  font-weight: 800;
}

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

.btn.secondary {
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
}

.btn.secondary:hover {
  background: var(--border-light);
}

.btn.dark {
  background: var(--navy);
}

.btn.danger {
  background: var(--error-text);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: var(--text-secondary);
  background: #fff;
  border: 1px solid var(--border);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.pill.live,
.pill.success {
  color: var(--success-text);
  background: var(--success-bg);
}

.pill.warning {
  color: var(--warning-text);
  background: var(--warning-bg);
}

.pill.error {
  color: var(--error-text);
  background: var(--error-bg);
}

.pill.dark {
  color: #fff;
  background: var(--navy);
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

.order-list,
.menu-list,
.table-list {
  display: grid;
  gap: 10px;
}

.order-row,
.menu-row,
.runner-row {
  width: 100%;
  min-height: 64px;
  padding: 12px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.order-row {
  grid-template-columns: 1fr auto;
  align-items: center;
  text-align: left;
}

.order-row.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(5, 160, 112, 0.1);
}

.row-title {
  font-size: 16px;
  font-weight: 800;
}

.row-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.menu-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.menu-price {
  font-weight: 800;
  color: var(--text);
}

.tag-row {
  min-height: 28px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-action {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
}

.item-line {
  min-height: 58px;
  padding: 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.item-line.pending {
  border-left: 4px solid #facc15;
}

.item-line.delivered {
  border-left: 4px solid var(--primary);
}

.sticky-footer {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px -16px -16px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: var(--navy);
  color: #fff;
  border-radius: 0 0 8px 8px;
}

.footer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.qr-box {
  width: min(100%, 220px);
  aspect-ratio: 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    linear-gradient(90deg, #1a1c3c 10px, transparent 10px) 0 0 / 28px 28px,
    linear-gradient(#1a1c3c 10px, transparent 10px) 0 0 / 28px 28px,
    #fff;
}

.qr-inner {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-weight: 900;
}

.notice {
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.notice.success {
  border-color: var(--success-bg);
  background: var(--primary-soft);
  color: var(--success-text);
}

.notice.error {
  border-color: var(--error-bg);
  background: #fff7f7;
  color: var(--error-text);
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-row {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  font-weight: 800;
}

.check-row.ok {
  color: var(--success-text);
  background: var(--primary-soft);
  border-color: var(--success-bg);
}

.check-row i {
  width: 20px;
  height: 20px;
}

.empty {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 24px;
  border: 1px dashed var(--disabled);
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
}

.customer-frame {
  max-width: 430px;
  margin: 0 auto;
}

.customer-summary {
  min-height: 64px;
  margin: 16px 0;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.browser-bar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-radius: 8px 8px 0 0;
  background: var(--border-light);
  color: var(--muted);
  font-size: 11px;
}

.mobile-bottom-nav {
  display: none;
}

@media (max-width: 920px) {
  .app-shell {
    display: block;
    padding-bottom: 70px;
  }

  .sidebar {
    display: none;
  }

  .topbar {
    padding: 14px 16px;
    align-items: flex-start;
  }

  .content {
    padding: 16px;
  }

  .grid.cols-2,
  .grid.cols-3,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .page-title {
    font-size: 20px;
  }

  .mobile-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    height: 64px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: #fff;
    border-top: 1px solid var(--border);
  }

  .mobile-bottom-nav button {
    display: grid;
    place-items: center;
    gap: 2px;
    color: var(--disabled);
    background: transparent;
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-bottom-nav button.active {
    color: var(--primary);
  }

  .mobile-bottom-nav i {
    width: 20px;
    height: 20px;
  }
}
