:root {
  /* FoodDash color system */
  --primary: #DC2626;
  --primary-hover: #B91C1C;
  --primary-soft: #FEF2F2;
  --secondary: #EA580C;
  --secondary-soft: #FFF7ED;
  --success: #16A34A;
  --success-soft: #DCFCE7;
  --warning: #D97706;
  --warning-soft: #FEF3C7;
  --error: #EF4444;
  --error-soft: #FEE2E2;
  --info: #2563EB;
  --info-soft: #DBEAFE;

  --background: #FFFFFF;
  --surface: #FFFFFF;
  --surface-subtle: #FAFAFA;
  --surface-muted: #F5F5F5;
  --text-primary: #171717;
  --text-secondary: #525252;
  --text-tertiary: #737373;
  --line: #E5E5E5;
  --line-soft: #F5F5F5;

  /* FoodDash typography */
  --font-headline: "Poppins", ui-sans-serif, system-ui, sans-serif;
  --font-body: "DM Sans", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, SFMono-Regular, monospace;

  /* FoodDash spacing: 6px base */
  --space-xs: 3px;
  --space-sm: 6px;
  --space-md: 12px;
  --space-lg: 18px;
  --space-xl: 24px;
  --space-2xl: 36px;
  --space-3xl: 48px;

  /* FoodDash radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  /* FoodDash elevation */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, .12);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .16);
  --shadow-xl: 0 12px 32px rgba(0, 0, 0, .20);
  --focus-ring: 0 0 0 3px rgba(220, 38, 38, .25);
}

* { box-sizing: border-box; }
html { background: var(--background); }
body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 22px;
  background: var(--background);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; }

h1, h2, h3, h4 { font-family: var(--font-headline); color: var(--text-primary); }
h1 { font-size: 28px; line-height: 34px; font-weight: 700; }
h2 { font-size: 22px; line-height: 28px; font-weight: 600; }
h3 { font-size: 18px; line-height: 24px; font-weight: 600; }
h4 { font-size: 15px; line-height: 20px; font-weight: 600; }

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

/* Mobile bottom navigation */
.sidebar {
  position: fixed;
  z-index: 30;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 7px max(8px, env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(0,0,0,.06);
  backdrop-filter: blur(14px);
}
.brand, .sidebar-note { display: none; }
.nav-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xs); }
.nav-item {
  min-height: 54px;
  border: 0;
  border-radius: var(--radius-md);
  padding: 7px 5px;
  background: transparent;
  color: var(--text-secondary);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  transition: background .16s ease, color .16s ease, transform .12s ease;
}
.nav-item span { font-size: 18px; line-height: 18px; }
.nav-item:hover { background: var(--surface-muted); }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-item:active { transform: scale(.98); }

.main-content { min-width: 0; padding: var(--space-lg) var(--space-md) 96px; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: var(--space-md); margin-bottom: var(--space-xl); }
.topbar h1 { margin: var(--space-xs) 0 0; }
.topbar .primary-btn { display: none; }
.eyebrow {
  margin: 0;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: .12em;
}
.view { display: none; }
.view.is-active { display: block; }

/* Cards */
.panel, .stat-card {
  background: var(--surface);
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.welcome-card {
  overflow: hidden;
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  display: grid;
  gap: var(--space-lg);
  box-shadow: var(--shadow-md);
}
.welcome-card::after {
  content: "";
  position: absolute;
  right: -52px;
  top: -62px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: var(--secondary-soft);
  pointer-events: none;
}
.welcome-card > * { position: relative; z-index: 1; }
.welcome-card h2 { max-width: 640px; margin: var(--space-md) 0 var(--space-sm); }
.welcome-card p { margin: 0; max-width: 650px; color: var(--text-secondary); }
.pill {
  display: inline-flex;
  width: max-content;
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--secondary-soft);
  color: var(--secondary);
  font-size: 12px;
  line-height: 18px;
  font-weight: 700;
}

/* Buttons */
.primary-btn, .secondary-btn, .ghost-btn {
  min-height: 42px;
  border: 0;
  padding: 8px 20px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  transition: background .16s ease, border-color .16s ease, color .16s ease, box-shadow .12s ease, transform .12s ease;
}
.primary-btn {
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: #FFFFFF;
  box-shadow: 0 2px 4px rgba(220, 38, 38, .18);
}
.primary-btn:hover { background: var(--primary-hover); }
.primary-btn:focus-visible { box-shadow: var(--focus-ring); }
.primary-btn:active { transform: translateY(1px); box-shadow: var(--shadow-md); }
.secondary-btn {
  border: 1.5px solid var(--primary);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--primary);
}
.secondary-btn:hover { background: var(--primary-soft); }
.secondary-btn:focus-visible { box-shadow: var(--focus-ring); }
.ghost-btn {
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
}
.ghost-btn:hover { background: var(--surface-muted); }
.compact { min-height: 36px; padding: 6px 14px; font-size: 12px; }
.full { width: 100%; margin-top: var(--space-md); }
.text-btn { border: 0; background: none; color: var(--primary); font-weight: 700; padding: 6px; border-radius: var(--radius-sm); }
.text-btn:hover { background: var(--primary-soft); }

.stats-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-md); margin: var(--space-lg) 0; }
.stat-card { position: relative; padding: var(--space-lg); overflow: hidden; }
.stat-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--line); }
.stat-card:nth-child(1)::before { background: var(--info); }
.stat-card:nth-child(2)::before { background: var(--success); }
.stat-card:nth-child(3)::before { background: var(--warning); }
.stat-card span, .stat-card small { display: block; color: var(--text-tertiary); }
.stat-card strong { display: block; margin: var(--space-sm) 0 var(--space-xs); font-family: var(--font-headline); font-size: 24px; line-height: 30px; }
.stat-card small { font-size: 12px; line-height: 18px; }

.panel-heading { padding: var(--space-lg); display: flex; justify-content: space-between; gap: var(--space-lg); align-items: center; }
.panel-heading h3 { margin: var(--space-xs) 0 0; }
.order-list { border-top: 1px solid var(--line-soft); }
.order-row {
  min-height: 64px;
  padding: var(--space-md) var(--space-lg);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm) var(--space-md);
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  transition: background .15s ease;
}
.order-row:hover { background: var(--surface-subtle); }
.order-row:last-child { border-bottom: 0; }
.order-row strong, .order-row span, .order-row small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-row > strong:first-child { font-family: var(--font-mono); font-size: 13px; }
.order-row small { color: var(--text-tertiary); font-size: 12px; }
.order-row .order-customer, .order-row .order-date { grid-column: 1; }
.order-row .order-total, .order-row .status-chip, .order-row .text-btn { grid-column: 2; }

/* Status chips */
.status-chip, .database-badge {
  display: inline-flex;
  width: max-content;
  align-items: center;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 12px;
  line-height: 18px;
  font-weight: 600;
}
.status-chip { background: var(--warning-soft); color: var(--warning); }
.status-chip.LUNAS { background: var(--success-soft); color: var(--success); }
.status-chip.DP { background: var(--info-soft); color: var(--info); }
.status-chip.BELUM_LUNAS { background: var(--warning-soft); color: var(--warning); }
.empty-state { color: var(--text-tertiary); padding: var(--space-xl) var(--space-lg); text-align: center; }

.order-layout { display: grid; grid-template-columns: 1fr; gap: var(--space-lg); align-items: start; }
.order-main { display: grid; gap: var(--space-lg); }
.form-panel { padding: var(--space-lg); }
.invoice-strip {
  display: grid;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-xl);
}
.invoice-strip span { display: block; color: var(--text-tertiary); font-size: 12px; line-height: 18px; margin-bottom: var(--space-xs); }
.invoice-strip strong { font-family: var(--font-mono); font-size: 13px; }
.section-title { display: flex; gap: var(--space-md); align-items: flex-start; margin-bottom: var(--space-lg); }
.section-title > span {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
}
.section-title h3 { margin: 0; }
.section-title p { margin: var(--space-xs) 0 0; font-size: 12px; line-height: 18px; color: var(--text-tertiary); }
.form-grid { display: grid; gap: var(--space-md); }
.form-grid.two { grid-template-columns: 1fr; }
label { display: grid; gap: var(--space-sm); color: var(--text-primary); font-size: 14px; line-height: 20px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  color: var(--text-primary);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { min-height: 84px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #A3A3A3; }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
input:disabled, select:disabled, textarea:disabled { border-color: var(--line); background: var(--surface-subtle); box-shadow: none; }
.search-input { max-width: none; border-radius: var(--radius-pill); }

.menu-picker { display: grid; grid-template-columns: 1fr auto; gap: var(--space-sm); }
.menu-picker .ghost-btn { grid-column: 1 / -1; }
.manual-item { margin-top: var(--space-md); display: grid; grid-template-columns: 1fr; gap: var(--space-sm); padding: var(--space-md); background: var(--surface-subtle); border-radius: var(--radius-md); }
.item-list { margin-top: var(--space-md); border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; padding: 0; }
.item-row { min-height: 64px; display: grid; grid-template-columns: minmax(0,1fr) 100px 34px; gap: var(--space-md); align-items: center; padding: var(--space-md); border-bottom: 1px solid var(--line-soft); }
.item-row:last-child { border-bottom: 0; }
.item-name strong { display: block; font-family: var(--font-headline); font-size: 15px; line-height: 20px; }
.item-name small { color: var(--text-tertiary); font-size: 12px; line-height: 18px; }
.item-row > .item-price { grid-column: 1 / 3; grid-row: 2; font-size: 14px; }
.qty-control { display: flex; height: 36px; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.qty-control button { width: 32px; border: 0; background: var(--surface-muted); color: var(--text-primary); font-size: 18px; }
.qty-control button:hover { background: var(--primary-soft); color: var(--primary); }
.qty-control span { min-width: 34px; display: grid; place-items: center; font-weight: 700; }
.remove-item { width: 32px; height: 32px; border: 0; border-radius: var(--radius-sm); background: #171717; color: #FFFFFF; font-size: 18px; }
.remove-item:hover { background: #404040; color: #FFFFFF; }

.order-summary { padding: var(--space-lg); box-shadow: var(--shadow-md); }
.order-summary h3 { margin: var(--space-xs) 0 var(--space-lg); }
.summary-lines { display: grid; gap: var(--space-md); }
.summary-lines > div { display: flex; justify-content: space-between; gap: var(--space-md); color: var(--text-secondary); }
.summary-lines strong { color: var(--text-primary); }
.summary-lines .total-line { border-top: 1px solid var(--line); padding-top: var(--space-md); margin-top: var(--space-xs); font-size: 18px; color: var(--text-primary); }
.summary-lines .total-line strong { font-family: var(--font-headline); color: var(--primary); }
.helper, .muted { color: var(--text-tertiary); font-size: 12px; line-height: 18px; }

.settings-grid { display: grid; grid-template-columns: 1fr; gap: var(--space-lg); align-items: start; }
.stack-form { display: grid; gap: var(--space-md); }
.menu-form { display: grid; grid-template-columns: 1fr; gap: var(--space-sm); }
.settings-menu-list { margin-top: var(--space-md); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); overflow: hidden; }
.settings-menu-row { display: grid; grid-template-columns: 1fr 34px; gap: var(--space-sm); padding: var(--space-md); align-items: center; border-bottom: 1px solid var(--line-soft); }
.settings-menu-row:last-child { border-bottom: 0; }
.settings-menu-row > span { color: var(--text-secondary); font-size: 12px; }
.database-badge { background: var(--surface-muted); color: var(--text-secondary); }
.database-badge.connecting { background: var(--info-soft); color: var(--info); }
.database-badge.connected { background: var(--success-soft); color: var(--success); }
.database-badge.error { background: var(--error-soft); color: var(--error); }
.database-status-card {
  display: grid;
  gap: var(--space-xs);
  padding: var(--space-md);
  margin: var(--space-md) 0;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--line-soft);
}
.database-status-card span { color: var(--text-tertiary); font-size: 12px; line-height: 18px; }
.database-status-card strong { font-size: 14px; overflow-wrap: anywhere; }
.database-panel .secondary-btn { width: 100%; }

/* Modal + receipt */
.modal[hidden] { display: none; }
.modal { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; padding: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23,23,23,.56); backdrop-filter: blur(3px); }
.modal-card { position: relative; width: 100%; max-height: 96vh; overflow: auto; background: var(--surface); border-radius: var(--radius-lg) var(--radius-lg) 0 0; box-shadow: var(--shadow-xl); }
.modal-head { padding: var(--space-lg); display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: var(--space-xs) 0 0; }
.icon-btn { width: 36px; height: 36px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); color: var(--text-primary); font-size: 22px; }
.icon-btn:hover { background: var(--surface-muted); }
.receipt-wrap { padding: var(--space-lg); background: #F7F4F1; display: grid; place-items: center; }
.receipt {
  width: 380px;
  max-width: 100%;
  overflow: hidden;
  background: #fff;
  color: #171717;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(67, 31, 18, .13);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 18px;
}
.receipt-brand-banner {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  padding: 22px 20px 20px;
  color: #FFFFFF;
  background: linear-gradient(135deg, #DC2626 0%, #EA580C 100%);
  isolation: isolate;
}
.receipt-brand-banner::after {
  content: '';
  position: absolute;
  width: 112px;
  height: 112px;
  right: -42px;
  top: -48px;
  border: 18px solid rgba(255,255,255,.10);
  border-radius: 50%;
  z-index: -1;
}
.receipt-food-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(255,255,255,.94);
  color: #DC2626;
  box-shadow: 0 6px 14px rgba(109, 25, 13, .18);
}
.receipt-food-mark svg { width: 43px; height: 43px; display: block; }
.receipt-brand-copy { min-width: 0; }
.receipt-kicker { display: block; margin-bottom: 3px; font-size: 9px; line-height: 13px; font-weight: 800; letter-spacing: .12em; opacity: .9; }
.receipt-brand-copy h2 { margin: 0; color: #fff; font-family: var(--font-headline); font-size: 22px; line-height: 27px; font-weight: 700; }
.receipt-brand-copy p { margin: 4px 0 0; max-width: 230px; font-size: 10px; line-height: 14px; opacity: .9; }
.receipt-contact { display: inline-flex; margin-top: 7px; padding: 3px 8px; border-radius: var(--radius-pill); background: rgba(255,255,255,.16); font-family: var(--font-mono); font-size: 9px; line-height: 13px; }
.receipt-info-card { margin: 16px 16px 0; padding: 14px; border: 1px solid #F1E8E3; border-radius: 14px; background: #FFFDFC; }
.receipt-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-bottom: 12px; border-bottom: 1px dashed #E7D7CE; }
.receipt-info-grid div { min-width: 0; }
.receipt-info-grid span, .receipt-customer-row span, .receipt-payment-row span:not(.receipt-status-chip) { display: block; color: #78716C; font-size: 9px; line-height: 13px; text-transform: uppercase; letter-spacing: .05em; }
.receipt-info-grid strong { display: block; margin-top: 2px; font-family: var(--font-mono); font-size: 10px; line-height: 15px; overflow-wrap: anywhere; }
.receipt-customer-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: center; padding-top: 12px; }
.receipt-customer-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: #FEF2F2; color: #DC2626; font-family: var(--font-headline); font-size: 16px; font-weight: 700; }
.receipt-customer-row strong { display: block; font-size: 12px; line-height: 17px; }
.receipt-customer-row small { display: block; margin-top: 1px; color: #78716C; font-family: var(--font-mono); font-size: 9px; line-height: 13px; }
.receipt-order-section { padding: 18px 16px 6px; }
.receipt-section-title { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 11px; }
.receipt-section-title strong { font-family: var(--font-headline); font-size: 14px; line-height: 19px; }
.receipt-section-title span { padding: 3px 8px; border-radius: var(--radius-pill); background: #FFF7ED; color: #C2410C; font-size: 9px; line-height: 13px; font-weight: 700; }
.receipt-items { display: grid; gap: 0; }
.receipt-item { padding: 10px 0; border-bottom: 1px solid #F5F0ED; }
.receipt-item:last-child { border-bottom: 0; }
.receipt-item-main { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.receipt-item-main span { min-width: 0; font-size: 12px; line-height: 17px; font-weight: 700; }
.receipt-item-main strong { white-space: nowrap; font-size: 11px; line-height: 16px; }
.receipt-item-sub { margin-top: 2px; color: #78716C; font-family: var(--font-mono); font-size: 9px; line-height: 13px; }
.receipt-summary-card { margin: 10px 16px 0; padding: 14px; border-radius: 14px; background: #FFF7ED; border: 1px solid #FED7AA; }
.receipt-summary-lines { display: grid; gap: 5px; }
.receipt-summary-lines > div, .receipt-balance-row { display: flex; justify-content: space-between; gap: 12px; color: #57534E; font-size: 10px; line-height: 15px; }
.receipt-discount { color: #16A34A !important; }
.receipt-grand { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin: 11px 0; padding: 11px 0; border-top: 1px dashed #FDBA74; border-bottom: 1px dashed #FDBA74; }
.receipt-grand span { max-width: 120px; font-family: var(--font-headline); font-size: 12px; line-height: 16px; font-weight: 600; }
.receipt-grand strong { color: #DC2626; font-family: var(--font-headline); font-size: 20px; line-height: 25px; white-space: nowrap; }
.receipt-payment-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.receipt-payment-row > div strong { display: block; margin-top: 1px; font-size: 10px; line-height: 15px; }
.receipt-status-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 4px 9px; border-radius: var(--radius-pill); font-size: 9px; line-height: 13px; font-weight: 800; white-space: nowrap; }
.receipt-status-chip.LUNAS { background: #DCFCE7; color: #15803D; }
.receipt-status-chip.DP { background: #DBEAFE; color: #1D4ED8; }
.receipt-status-chip.BELUM_LUNAS { background: #FEF3C7; color: #B45309; }
.receipt-balance-row { margin-top: 8px; padding-top: 8px; border-top: 1px solid rgba(234,88,12,.13); }
.receipt-balance-row.is-remaining { color: #B91C1C; font-weight: 700; }
.receipt-thankyou { padding: 20px 20px 22px; text-align: center; }
.receipt-thankyou strong { display: block; margin-bottom: 3px; font-family: var(--font-headline); font-size: 12px; line-height: 17px; }
.receipt-thankyou span, .receipt-thankyou small { display: block; color: #78716C; font-size: 9px; line-height: 14px; }
.receipt-thankyou small { margin-top: 4px; }
.receipt-spice-dots { display: flex; justify-content: center; gap: 4px; margin-bottom: 8px; }
.receipt-spice-dots i { width: 5px; height: 5px; border-radius: 50%; background: #DC2626; }
.receipt-spice-dots i:nth-child(2) { background: #EA580C; transform: scale(1.35); }
.receipt-spice-dots i:nth-child(3) { background: #D97706; }
.modal-actions { padding: var(--space-md) var(--space-lg) calc(var(--space-md) + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); background: var(--surface); position: sticky; bottom: 0; border-top: 1px solid var(--line); }
.modal-actions .primary-btn { grid-column: 1 / -1; }
.toast { position: fixed; right: var(--space-md); left: var(--space-md); bottom: 88px; z-index: 100; background: #171717; color: #fff; border-radius: var(--radius-md); padding: 12px 16px; box-shadow: var(--shadow-md); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; font-size: 12px; line-height: 18px; }
.toast.show { transform: none; opacity: 1; }

@media (min-width: 681px) {
  .main-content { padding: var(--space-xl) var(--space-xl) 104px; }
  .topbar .primary-btn { display: inline-flex; align-items: center; }
  .welcome-card { grid-template-columns: minmax(0, 1fr) auto; align-items: end; padding: var(--space-2xl); }
  .welcome-card h2 { font-size: 28px; line-height: 34px; }
  .stats-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid.two { grid-template-columns: 1fr 1fr; }
  .invoice-strip { grid-template-columns: 1fr 1fr; }
  .menu-picker { grid-template-columns: minmax(0,1fr) auto auto; }
  .menu-picker .ghost-btn { grid-column: auto; }
  .manual-item { grid-template-columns: minmax(0,1fr) 150px auto; }
  .item-row { grid-template-columns: minmax(0,1fr) 110px 115px 34px; }
  .item-row > .item-price { grid-column: auto; grid-row: auto; }
  .settings-grid { grid-template-columns: 1fr 1fr; }
  .settings-grid .database-panel { grid-column: 1 / -1; }
  .menu-form { grid-template-columns: 1fr 120px 120px auto; }
  .settings-menu-row { grid-template-columns: 1fr 120px 100px 34px; }
  .search-input { max-width: 360px; }
  .history-head { align-items: center; }
  .modal { place-items: center; padding: var(--space-lg); }
  .modal-card { width: min(720px, 100%); max-height: 94vh; border-radius: var(--radius-lg); }
  .modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; }
  .modal-actions .primary-btn { grid-column: auto; }
  .toast { left: auto; width: max-content; max-width: 360px; right: var(--space-xl); bottom: var(--space-xl); }
}

@media (min-width: 981px) {
  .app-shell { grid-template-columns: 252px 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: var(--space-xl) var(--space-lg);
    border-top: 0;
    border-right: 1px solid var(--line);
    box-shadow: none;
    display: flex;
    flex-direction: column;
  }
  .brand { display: flex; gap: var(--space-md); align-items: center; padding: 0 var(--space-sm) var(--space-xl); }
  .brand-mark { width: 42px; height: 42px; border-radius: var(--radius-md); display: grid; place-items: center; background: #171717; color: #fff; font-family: var(--font-headline); font-weight: 700; font-size: 15px; box-shadow: var(--shadow-sm); }
  .brand strong { display: block; font-family: var(--font-headline); font-size: 16px; line-height: 21px; }
  .brand span { display: block; margin-top: 2px; color: var(--text-tertiary); font-size: 11px; line-height: 16px; }
  .nav-list { grid-template-columns: 1fr; gap: var(--space-sm); }
  .nav-item { min-height: 44px; justify-content: flex-start; flex-direction: row; text-align: left; padding: 10px 12px; font-size: 14px; line-height: 20px; gap: var(--space-md); }
  .nav-item span { font-size: 17px; }
  .nav-item.is-active { background: var(--primary); color: #fff; box-shadow: 0 3px 8px rgba(220,38,38,.18); }
  .sidebar-note { margin-top: auto; display: flex; gap: var(--space-sm); align-items: center; color: var(--text-tertiary); font-size: 12px; padding: var(--space-md) var(--space-sm); }
  .status-dot { width: 8px; height: 8px; background: var(--success); border-radius: 50%; box-shadow: 0 0 0 4px var(--success-soft); }
  .main-content { padding: var(--space-xl) var(--space-2xl) var(--space-3xl); }
  .order-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .order-summary { position: sticky; top: var(--space-xl); }
  .order-row { grid-template-columns: minmax(150px,1.1fr) minmax(120px,1fr) 150px 120px auto; }
  .order-row .order-customer, .order-row .order-date, .order-row .order-total, .order-row .status-chip, .order-row .text-btn { grid-column: auto; }
}

@media print {
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  body * { visibility: hidden !important; }
  #receipt-preview, #receipt-preview * { visibility: visible !important; }
  #receipt-preview { position: absolute; left: 0; top: 0; width: 80mm; box-shadow: none; border-radius: 0; }
}

.customer-lookup-hint {
  display: block;
  min-height: 18px;
  margin-top: 4px;
  color: #737373;
  font-size: 12px;
  line-height: 18px;
}
.customer-lookup-hint.is-returning { color: var(--tertiary, #16A34A); font-weight: 600; }
.customer-lookup-hint.is-new { color: var(--text-tertiary, #737373); }
.customer-lookup-hint.is-error { color: var(--warning, #D97706); }
