:root {
  --primary: #D45C1A;
  --primary-dark: #B34A12;
  --primary-soft: #FBE8DA;
  --bg: #FFF8F0;
  --surface: #FFFFFF;
  --text: #3E2A1E;
  --text-muted: #8A6B55;
  --border: #EFE0D0;
  --danger: #C0392B;
  --danger-soft: #FBEAE7;
  --shadow-sm: 0 1px 3px rgba(62, 42, 30, 0.08);
  --shadow-md: 0 6px 18px rgba(62, 42, 30, 0.12);
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  min-height: 100dvh;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

input {
  font: inherit;
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.app-ui {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: 96px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-logo {
  font-size: 26px;
}

.topbar-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.1;
}

.topbar-title span {
  color: var(--primary);
}

.topbar-sub {
  font-size: 12px;
  color: var(--text-muted);
}

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

.order-badge {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border: 1px solid #F2CDB2;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.order-badge:active {
  transform: scale(0.95);
  background: #F6D9C4;
}

.icon-btn {
  font-size: 20px;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  transition: transform 0.15s ease, background 0.15s ease;
}

.icon-btn:active {
  transform: scale(0.92);
  background: #F6D9C4;
}

/* ---------- Views ---------- */
.content {
  padding: 16px 16px 8px;
}

.view {
  display: none;
  animation: fadeIn 0.18s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.view-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
}

.view-sub {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 14px;
}

/* ---------- Campo cliente ---------- */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: #C3A995;
}

.input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 92, 26, 0.15);
  outline: none;
}

/* ---------- Pratos do pedido ---------- */
.order-pratos {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 6px;
}

.order-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s ease;
}

.order-card:active {
  transform: scale(0.99);
}

.order-card-name {
  font-weight: 600;
  font-size: 15px;
  display: block;
}

.order-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.order-card-x {
  flex: none;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 15px;
  color: var(--danger);
  background: var(--danger-soft);
}

/* ---------- Cardápio ---------- */
.menu-head {
  margin: 14px 0 10px;
}

.menu-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
}

.menu-hint {
  font-size: 12.5px;
  color: var(--text-muted);
}

.cats {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px 12px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.cats::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex: none;
  padding: 9px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s ease;
  white-space: nowrap;
}

.cat-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.dish-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 12px;
}

.dish-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  text-align: left;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  font-size: 15.5px;
  font-weight: 600;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

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

.dish-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
}

.dish-plus {
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--primary);
  background: var(--primary-soft);
}

/* ---------- Extras ---------- */
.extras-groups {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 12px;
}

.extra-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.extra-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}

.extra-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}

.extra-row:last-child {
  border-bottom: none;
}

.extra-name {
  font-size: 14.5px;
  font-weight: 500;
}

.extra-sub {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}

.stepper button {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 18px;
  font-weight: 700;
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: var(--shadow-sm);
  display: grid;
  place-items: center;
  line-height: 1;
}

.stepper button:active {
  transform: scale(0.9);
}

.stepper-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

/* ---------- Bottom bar ---------- */
.bottombar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 4px;
  width: 100%;
  max-width: 520px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 16px rgba(62, 42, 30, 0.06);
}

.bottombar.hidden {
  display: none;
}

.bb-btn {
  flex: 1;
  min-height: 48px;
  font-size: 18px;
  line-height: 1.1;
  border-radius: 12px;
  padding: 4px;
  color: var(--text-muted);
}

.bb-btn span {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  margin-top: 2px;
}

.bb-btn.active {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.bb-primary {
  color: #fff;
  background: var(--primary);
}

.bb-primary span {
  font-weight: 700;
}

.bb-count {
  flex: 1.4;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* ---------- Botões ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 46px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 14.5px;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(212, 92, 26, 0.3);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: transparent;
}

.btn-sm {
  min-height: 36px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
}

.print-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.print-actions .btn {
  flex: 1;
}

/* ---------- Bottom sheet ---------- */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 15, 5, 0.5);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.sheet-backdrop.open {
  opacity: 1;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  max-width: 520px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(30, 15, 5, 0.25);
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  flex: none;
  width: 44px;
  height: 5px;
  border-radius: 999px;
  background: #E2CDBA;
  margin: 10px auto 4px;
}

.sheet-body {
  overflow-y: auto;
  padding: 4px 18px 18px;
}

.sheet-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 21px;
  line-height: 1.2;
  padding-right: 8px;
}

.sheet-nota {
  font-size: 13px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 7px 10px;
  margin: 8px 0 12px;
}

.sheet-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 12px 0 14px;
}

.sheet-check,
.sheet-radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px dashed var(--border);
  cursor: pointer;
  font-size: 15.5px;
}

.sheet-check input,
.sheet-radio input {
  width: 22px;
  height: 22px;
  accent-color: var(--primary);
  cursor: pointer;
  flex: none;
}

.sheet-choice {
  margin: 8px 0;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 12px;
}

.sheet-choice-label {
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
  margin-bottom: 6px;
}

.sheet-radio {
  padding: 8px 4px;
}

.sheet-qty {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0 4px;
}

.sheet-qty button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 22px;
  font-weight: 700;
  background: var(--primary-soft);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
  line-height: 1;
}

.sheet-qty button:active {
  transform: scale(0.92);
}

.sheet-qty-value {
  min-width: 36px;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
}

.sheet-qty-label {
  font-size: 13px;
  color: var(--text-muted);
}

.sheet-obs-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 6px;
}

.sheet-obs {
  width: 100%;
  padding: 12px 14px;
  font-size: 15px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
}

.sheet-obs:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(212, 92, 26, 0.15);
}

.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.sheet-actions .btn {
  flex: 1;
}

/* ---------- Checklist (pré-visualização no app) ---------- */
#checklistPaper {
  padding-bottom: 16px;
}

.ck {
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  padding: 22px 20px;
  color: #1F1F1F;
}

.ck-empty {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.ck-header {
  border-bottom: 3px double #444;
  padding-bottom: 12px;
  margin-bottom: 14px;
}

.ck-brand {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 20px;
  font-weight: 700;
}

.ck-sub {
  font-size: 12px;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 2px 0 8px;
}

.ck-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12.5px;
  color: #333;
  margin-bottom: 6px;
}

.ck-cliente {
  font-size: 15px;
  font-weight: 700;
  margin-top: 4px;
}

.ck-item {
  margin-bottom: 14px;
  border: 1px solid #DDD;
  border-radius: 10px;
  padding: 12px 14px;
}

.ck-dish {
  font-size: 15.5px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ck-qty {
  color: var(--primary-dark);
  font-size: 13px;
}

.ck-items {
  list-style: none;
}

.ck-line {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  font-size: 14px;
}

.ck-box {
  flex: none;
  width: 16px;
  height: 16px;
  border: 2px solid #333;
  border-radius: 4px;
}

.ck-circle {
  flex: none;
  width: 15px;
  height: 15px;
  border: 2px solid #333;
  border-radius: 50%;
}

.ck-choice {
  flex-wrap: wrap;
}

.ck-opt {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.ck-or {
  font-size: 11px;
  color: #777;
  font-style: italic;
}

.ck-hint {
  font-size: 11px;
  color: #777;
  font-style: italic;
  display: block;
  width: 100%;
  margin-left: 25px;
}

.ck-none {
  font-size: 12.5px;
  color: #777;
  font-style: italic;
}

.ck-obs {
  font-size: 12.5px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #CCC;
}

.ck-section {
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid #DDD;
  border-radius: 10px;
}

.ck-sec-title {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

/* ---------- Histórico ---------- */
.hist-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 10px;
}

.hist-main {
  min-width: 0;
}

.hist-numero {
  font-weight: 700;
  color: var(--primary-dark);
  font-size: 15px;
}

.hist-cliente {
  font-weight: 600;
  font-size: 14.5px;
  display: block;
}

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

.hist-actions {
  display: flex;
  gap: 6px;
  flex: none;
}

.empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px 0;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  transform: translate(-50%, 12px);
  z-index: 60;
  background: #2A1A10;
  color: #FFF;
  font-size: 14px;
  font-weight: 600;
  padding: 11px 18px;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 86vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Impressão ---------- */
@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: #fff !important;
  }

  .topbar,
  .bottombar,
  .sheet,
  .sheet-backdrop,
  .toast {
    display: none !important;
  }

  .app-ui {
    max-width: none;
    margin: 0;
    min-height: 0;
    padding-bottom: 0;
  }

  .content {
    padding: 0;
  }

  .view {
    display: none !important;
  }

  #view-checklist {
    display: block !important;
  }

  .print-actions {
    display: none !important;
  }

  #checklistPaper {
    padding: 0;
  }

  .ck {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
  }

  .ck-item,
  .ck-section {
    break-inside: avoid;
  }
}
