:root {
  color-scheme: light;
  --forest: #0d4a3c;
  --forest-deep: #08372d;
  --action: #0a8f70;
  --action-soft: #e4f4ef;
  --orange: #ef7b45;
  --orange-soft: #fff0e8;
  --yellow: #e9ad28;
  --yellow-soft: #fff7dd;
  --red: #c83d4d;
  --red-soft: #fdecef;
  --blue: #2878c7;
  --blue-soft: #eaf3fb;
  --purple: #7a55b3;
  --purple-soft: #f2edfa;
  --ink: #15221e;
  --muted: #68746f;
  --line: #dce4e1;
  --surface: #ffffff;
  --surface-muted: #f3f7f5;
  --page: #eaf0ed;
  --sidebar: 246px;
  --radius: 8px;
  --shadow: 0 16px 48px rgba(8, 55, 45, 0.10);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  min-width: 320px;
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  letter-spacing: 0;
}

button, input, select, textarea { min-width: 0; font: inherit; letter-spacing: 0; }
button {
  cursor: pointer;
  touch-action: manipulation;
  overflow-wrap: anywhere;
}
button:disabled { cursor: not-allowed; opacity: 0.5; }
.hidden { display: none !important; }

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 48%, transparent);
  outline-offset: 2px;
}

.offline-banner {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  padding: max(9px, env(safe-area-inset-top)) 16px 9px;
  background: var(--red);
  color: white;
  text-align: center;
  font-size: 13px;
  font-weight: 750;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--action);
  object-fit: cover;
}

.brand-mark.large {
  width: 48px;
  height: 48px;
  font-size: 25px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--action);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.development-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  width: min(100% - 32px, 430px);
  height: max-content;
  margin: auto;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  background: var(--forest-deep);
  box-shadow: 0 0 0 100vmax var(--forest);
  color: white;
}

.development-gate .gate-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 34px;
}

.development-gate h1 { margin: 2px 0 8px; font-size: 31px; }
.development-gate p { color: rgba(255, 255, 255, 0.72); line-height: 1.5; }
.development-gate .eyebrow { color: #7bd8bd; }
.development-gate .field span { color: rgba(255, 255, 255, 0.82); }
.development-gate input { border-color: rgba(255, 255, 255, 0.24); background: rgba(255, 255, 255, 0.09); color: white; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
}

.auth-brand {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  padding: clamp(30px, 5vw, 68px);
  background:
    linear-gradient(rgba(8, 55, 45, 0.94), rgba(13, 74, 60, 0.94)),
    url("../assets/restaurant-workspace.png") center/cover;
  color: white;
}

.brand-lockup { display: flex; align-items: center; gap: 12px; font-size: 22px; font-weight: 800; }
.auth-brand .eyebrow { color: #80d5bd; }
.auth-brand h1 {
  max-width: 620px;
  margin: 6px 0 14px;
  font-size: clamp(38px, 4vw, 54px);
  line-height: 1.05;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
}
.auth-brand p:not(.eyebrow) { max-width: 570px; color: rgba(255,255,255,0.74); font-size: 16px; line-height: 1.55; }
.auth-points { display: grid; gap: 7px; }
.auth-points span { display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 700; }
.auth-points span::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #80d5bd; content: ""; }

.auth-panel {
  width: min(100% - 40px, 560px);
  min-width: 0;
  margin: auto;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 36px rgba(8, 55, 45, 0.08);
}

.auth-heading h2 { margin: 0; font-size: 32px; }
.auth-heading > p:last-child { margin: 8px 0 24px; color: var(--muted); }

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 24px;
  padding: 3px;
  border-radius: 7px;
  background: var(--surface-muted);
}

.segmented button {
  min-height: 38px;
  min-width: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  white-space: normal;
}

.segmented button.selected { background: white; color: var(--ink); box-shadow: 0 2px 8px rgba(8,55,45,0.08); }

.field { display: grid; gap: 7px; margin-bottom: 16px; }
.field > span { color: var(--ink); font-size: 13px; font-weight: 750; }
.field small { color: var(--muted); font-weight: 500; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cdd8d4;
  border-radius: 6px;
  background: white;
  color: var(--ink);
  outline: none;
  padding: 10px 12px;
}

textarea { resize: vertical; }
input[readonly] { background: var(--surface-muted); color: var(--muted); cursor: default; }
input:focus, select:focus, textarea:focus { border-color: var(--action); box-shadow: 0 0 0 3px rgba(10,143,112,0.13); }

.check {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  margin: 16px 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.check input { width: 19px; height: 19px; min-height: 0; margin: 1px 0 0; accent-color: var(--action); }
.field-hint { margin: -5px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.form-error { padding: 10px 12px; border: 1px solid #efbdc4; border-radius: 6px; background: var(--red-soft); color: var(--red); font-size: 13px; }

.primary, .secondary, .quiet, .danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 42px;
  border-radius: 6px;
  padding: 9px 14px;
  font-weight: 780;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
}
.primary { border: 1px solid var(--action); background: var(--action); color: white; }
.primary:hover { background: #08795f; }
.secondary { border: 1px solid var(--line); background: white; color: var(--ink); }
.secondary:hover { border-color: var(--action); color: var(--action); }
.quiet { border: 0; background: transparent; color: var(--muted); }
.danger { border: 1px solid #efbdc4; background: var(--red-soft); color: var(--red); }
.full { width: 100%; }

.app-shell { min-height: 100vh; padding-left: var(--sidebar); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  background: var(--forest-deep);
  color: white;
}

.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 7px 20px; }
.sidebar-brand div { display: grid; }
.sidebar-brand strong { font-size: 18px; }
.sidebar-brand small { color: rgba(255,255,255,0.55); font-size: 11px; }

.sidebar nav { display: grid; gap: 3px; overflow-y: auto; }
.nav-button {
  display: grid;
  grid-template-columns: 25px 1fr auto;
  align-items: center;
  min-height: 44px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: rgba(255,255,255,0.68);
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
}
.nav-button:hover { background: rgba(255,255,255,0.07); color: white; }
.nav-button.selected { background: var(--action); color: white; }
.nav-symbol { width: 22px; text-align: center; font-size: 17px; }
.nav-count { min-width: 22px; padding: 2px 6px; border-radius: 10px; background: rgba(255,255,255,0.14); text-align: center; font-size: 11px; }

.sidebar-user { margin-top: auto; display: grid; gap: 3px; padding: 14px 9px 2px; border-top: 1px solid rgba(255,255,255,0.12); }
.sidebar-user span { color: rgba(255,255,255,0.58); font-size: 12px; }
.sidebar-user .quiet { justify-self: start; min-height: 34px; padding: 6px 0; color: #85d8c1; }

.workspace { min-width: 0; }
.workspace-header {
  position: sticky;
  inset: 0 0 auto;
  z-index: 10;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 13px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(18px);
}

.workspace-header h1 { margin: 0; font-size: 25px; }
.header-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}
.sync-state { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.sync-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--action); }
.sync-state.saving i { animation: pulse 900ms infinite; background: var(--yellow); }
.sync-state.error i { background: var(--red); }
@keyframes pulse { 50% { opacity: 0.3; } }

.icon-button {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  color: var(--ink);
  font-size: 22px;
}
.restaurant-switch { display: grid; min-width: 160px; border: 0; border-left: 1px solid var(--line); background: transparent; padding: 3px 0 3px 13px; text-align: left; }
.restaurant-switch span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.restaurant-switch small { color: var(--muted); }

.view { width: min(100%, 1500px); min-width: 0; margin: 0 auto; padding: clamp(18px, 3vw, 36px); }
.page-tools {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}
.page-tools > :first-child { min-width: 0; }
.page-tools h2 { margin: 0; font-size: 20px; }
.page-tools p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.tool-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}
.tool-actions > button { flex: 0 1 auto; }
.tool-actions > input, .tool-actions > select { width: auto; max-width: 100%; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.metric {
  min-height: 118px;
  display: grid;
  align-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric .metric-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 700; }
.metric strong { font-size: 29px; }
.metric small { color: var(--muted); }
.metric-symbol { color: var(--action); font-size: 19px; }

.split-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.65fr); gap: 16px; }
.section {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.section-header {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}
.section-header > * { min-width: 0; }
.section-header h2, .section-header h3 { margin: 0; font-size: 17px; }
.section-header span { color: var(--muted); font-size: 12px; }
.section-body { padding: 18px; }

.review-block {
  margin-bottom: 14px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
}
.review-block h3 { margin: 0 0 12px; font-size: 16px; }
.review-block p { margin: 6px 0 14px; color: var(--muted); }

.activity-list, .compact-list { display: grid; }
.activity-row, .compact-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  border-bottom: 1px solid var(--line);
}
.activity-row:last-child, .compact-row:last-child { border-bottom: 0; }
.activity-icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; background: var(--action-soft); color: var(--action); font-weight: 850; }
.activity-copy { min-width: 0; display: grid; gap: 2px; }
.activity-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.activity-copy span, .activity-row time { color: var(--muted); font-size: 12px; }

.table-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.table-tile {
  position: relative;
  min-height: 150px;
  display: grid;
  align-content: space-between;
  border: 2px solid var(--table-color, var(--action));
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--table-color, var(--action)) 10%, white);
  padding: 15px;
  text-align: left;
}
.table-tile:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(8,55,45,0.09); }
.table-tile h3 { margin: 0; font-size: 17px; }
.table-tile p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.table-tile strong { font-size: 14px; }
.status-dot { position: absolute; inset: 11px 11px auto auto; width: 10px; height: 10px; border-radius: 50%; background: var(--status-color); }
.table-meta { display: flex; align-items: end; justify-content: space-between; gap: 10px; }
.table-total { color: var(--action); font-weight: 850; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.filter-button { min-height: 34px; padding: 6px 11px; border: 1px solid var(--line); border-radius: 16px; background: white; color: var(--muted); font-size: 12px; font-weight: 750; }
.filter-button.selected { border-color: var(--action); background: var(--action-soft); color: var(--action); }

.ticket-board { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 12px; overflow-x: auto; }
.ticket-lane { min-width: 250px; }
.ticket-lane-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding: 0 3px; }
.ticket-lane-header h3 { margin: 0; font-size: 15px; }
.ticket-lane-header span { padding: 3px 7px; border-radius: 10px; background: var(--surface); color: var(--muted); font-size: 11px; }
.ticket-stack { display: grid; gap: 10px; }
.ticket-card { border: 1px solid var(--line); border-top: 4px solid var(--ticket-color); border-radius: var(--radius); background: white; padding: 14px; }
.ticket-card header { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.ticket-card h4 { margin: 0; font-size: 16px; }
.ticket-card time { color: var(--muted); font-size: 12px; }
.ticket-items { margin: 13px 0; padding: 0; list-style: none; }
.ticket-items li { padding: 4px 0; font-size: 13px; }
.ticket-actions { min-width: 0; display: flex; flex-wrap: wrap; gap: 7px; }
.ticket-actions button { flex: 1 1 110px; min-height: 35px; padding: 6px 8px; font-size: 12px; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.data-table td { font-size: 13px; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--surface-muted); }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 18px 20px 10px; }
.section-heading h3, .section-heading p { margin: 0; }
.section-heading .eyebrow { margin-bottom: 4px; }
.muted { color: var(--muted); font-size: 0.84rem; }
.empty-inline { display: grid; gap: 4px; padding: 22px 20px; color: var(--muted); }
.empty-inline strong { color: var(--ink); }
.row-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.row-button { min-height: 32px; max-width: 100%; border: 1px solid var(--line); border-radius: 5px; background: white; padding: 5px 9px; font-size: 12px; font-weight: 700; line-height: 1.2; }

.badge { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border-radius: 12px; padding: 4px 8px; background: var(--surface-muted); color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.badge.green { background: var(--action-soft); color: var(--action); }
.badge.orange { background: var(--orange-soft); color: #b55429; }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--blue-soft); color: var(--blue); }
.badge.purple { background: var(--purple-soft); color: var(--purple); }

.routing-warning {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  color: #b54708;
  font-size: 0.78rem;
  font-weight: 750;
}

.data-table tr.is-disabled {
  opacity: 0.52;
}

.data-table tr.is-disabled strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.inline-settings {
  display: grid;
  grid-template-columns: minmax(0, 320px) auto;
  align-items: center;
  justify-content: start;
  gap: 10px;
}

.setting-stack {
  display: grid;
  gap: 12px;
}

.setting-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.setting-choice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.permission-list {
  display: grid;
  gap: 0;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.permission-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 54px;
  padding: 10px 13px;
  background: white;
}

.permission-row + .permission-row { border-top: 1px solid var(--line); }
.permission-row strong { font-size: 13px; }
.permission-row small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  line-height: 1.35;
}

.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 13px;
  background: #cbd5d1;
  transition: background 160ms ease;
}

.switch span::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
  content: "";
  transition: transform 160ms ease;
}

.switch input:checked + span { background: var(--action); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--blue) 48%, transparent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .inline-settings {
    grid-template-columns: 1fr;
  }
}

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.product-card { border: 1px solid var(--line); border-left: 5px solid var(--product-color); border-radius: var(--radius); background: white; padding: 16px; }
.product-card header { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 10px; }
.product-card header > div { min-width: 0; }
.product-card h3 { margin: 0; font-size: 16px; }
.product-card p { margin: 5px 0 15px; color: var(--muted); font-size: 12px; }
.product-card strong { font-size: 18px; }
.product-card footer { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.empty-state { min-height: 280px; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-mark { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; }
.empty-state h2 { margin: 14px 0 5px; font-size: 19px; }
.empty-state p { max-width: 430px; margin: 0; color: var(--muted); line-height: 1.5; }

dialog { width: min(100% - 28px, 650px); max-height: min(90vh, 820px); border: 0; border-radius: var(--radius); padding: 0; box-shadow: 0 30px 90px rgba(8,55,45,0.26); }
dialog::backdrop { background: rgba(7,28,23,0.52); backdrop-filter: blur(3px); }
.modal-shell { margin: 0; }
.modal-shell > header { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-shell h2 { margin: 0; font-size: 21px; }
.modal-body { max-height: calc(90vh - 150px); overflow-y: auto; padding: 20px; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}
.modal-footer > button { flex: 0 1 auto; }
.detail-list { display: grid; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.detail-list > div { min-width: 0; display: flex; justify-content: space-between; gap: 20px; padding: 13px 14px; }
.detail-list > div > * { min-width: 0; overflow-wrap: anywhere; }
.detail-list > div + div { border-top: 1px solid var(--line); }
.detail-list span, .modal-note { color: var(--muted); }
.modal-note { margin: 16px 0 0; line-height: 1.5; }
.modal-account-actions { display: grid; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }

.toast-region { position: fixed; z-index: 120; inset: auto 18px 18px auto; display: grid; gap: 8px; }
.toast { max-width: min(390px, calc(100vw - 36px)); display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: white; box-shadow: var(--shadow); padding: 12px 14px; }
.toast strong { display: block; font-size: 13px; }
.toast span { color: var(--muted); font-size: 12px; }
.toast button { border: 0; background: transparent; color: var(--muted); }

.mobile-navigation { display: none; }

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  :root { --mobile-nav: 70px; }
  .auth-shell { display: block; padding-bottom: env(safe-area-inset-bottom); background: var(--forest); }
  .auth-brand { min-height: 218px; width: 100%; padding: 24px 20px 30px; justify-content: space-between; }
  .auth-brand > div:nth-child(2) { margin-top: 30px; }
  .auth-brand h1 { margin: 3px 0 8px; font-size: 33px; }
  .auth-brand p:not(.eyebrow) { margin: 0; font-size: 14px; }
  .auth-points { display: none; }
  .auth-panel { width: 100%; margin-top: -10px; padding: 25px 20px calc(35px + env(safe-area-inset-bottom)); border: 0; border-radius: 8px 8px 0 0; box-shadow: none; }
  .auth-heading h2 { font-size: 29px; }
  .segmented button { padding-inline: 6px; font-size: 13px; }
  .field-grid { grid-template-columns: 1fr; gap: 0; }

  .app-shell { padding: 0 0 calc(var(--mobile-nav) + env(safe-area-inset-bottom)); }
  .sidebar { display: none; }
  .workspace-header {
    height: 74px;
    padding: max(11px, env(safe-area-inset-top)) 15px 10px;
  }
  .workspace-header > div:first-child { min-width: 0; }
  .workspace-header h1 { font-size: 21px; }
  .workspace-header .eyebrow { display: none; }
  .sync-state span, .restaurant-switch { display: none; }
  .view { padding: 16px 13px 24px; }
  .page-tools { align-items: stretch; flex-direction: column; }
  .page-tools > button { align-self: flex-start; }
  .tool-actions, .page-tools > .row-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }
  .tool-actions > input { flex: 1 1 170px; }
  .tool-actions > button, .page-tools > .row-actions > button {
    width: 100%;
    min-width: 0;
  }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 105px; padding: 13px; }
  .metric strong { font-size: 23px; }
  .table-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .table-tile { min-height: 135px; padding: 12px; }
  .ticket-board { grid-template-columns: repeat(3, minmax(85vw, 1fr)); margin-inline: -13px; padding-inline: 13px; }
  .data-table { min-width: 650px; }
  .section.table-section {
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }
  .product-grid { grid-template-columns: 1fr; }

  .mobile-navigation {
    position: fixed;
    inset: auto 0 0;
    z-index: 30;
    height: calc(var(--mobile-nav) + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    padding: 6px 5px env(safe-area-inset-bottom);
    border-top: 1px solid var(--line);
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
  }
  .mobile-navigation .nav-button { min-width: 0; min-height: 54px; display: grid; grid-template-columns: 1fr; justify-items: center; gap: 1px; padding: 4px 1px; color: var(--muted); text-align: center; font-size: 10px; }
  .mobile-navigation .nav-symbol { font-size: 20px; }
  .mobile-navigation .nav-button > span:not(.nav-symbol):not(.nav-count) { display: block; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .mobile-navigation .nav-count { display: none; }
  .mobile-navigation .nav-button.selected { background: var(--action-soft); color: var(--action); }

  dialog { width: 100%; max-height: 94vh; margin: auto 0 0; border-radius: 8px 8px 0 0; }
  .modal-body { max-height: calc(94vh - 150px); }
  .modal-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-footer > button {
    width: 100%;
    min-width: 0;
  }
  .modal-footer > .danger:first-child:last-of-type { grid-column: 1 / -1; }
  .detail-list > div { align-items: flex-start; flex-direction: column; gap: 4px; }
  .toast-region { inset: auto 10px calc(var(--mobile-nav) + env(safe-area-inset-bottom) + 10px); }
}

@media (max-width: 390px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-head { font-size: 11px !important; }
  .table-grid { grid-template-columns: 1fr; }
  .tool-actions, .page-tools > .row-actions,
  .modal-footer { grid-template-columns: 1fr; }
  .setting-choice { grid-template-columns: 1fr; }
}
.inline-alert {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, #e05d44 35%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, #e05d44 9%, white);
  color: #7d2f20;
}

.inline-alert span {
  font-size: 0.88rem;
}

.option-group {
  display: grid;
  gap: 8px;
  margin: 0 0 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.option-group legend {
  padding: 0 6px;
  font-weight: 750;
}

.option-group legend span {
  margin-left: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.option-group .check {
  grid-template-columns: auto 1fr auto;
}

.option-group-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
}

.option-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px auto;
  gap: 8px;
  margin-top: 8px;
}

.option-editor input {
  min-width: 0;
}

.danger-text {
  color: #b42318;
}

.category-manager-list {
  margin-top: 18px;
}

.category-row {
  grid-template-columns: 28px minmax(0, 1fr) auto;
}

.category-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.category-actions .row-button {
  width: 34px;
  padding-inline: 0;
}

.category-swatch {
  width: 18px;
  height: 18px;
  border-radius: 4px;
}

@media (max-width: 640px) {
  .option-editor {
    grid-template-columns: minmax(0, 1fr) 90px;
  }

  .option-editor > .row-button {
    grid-column: 1 / -1;
    justify-self: end;
  }

  .category-row {
    grid-template-columns: 24px minmax(0, 1fr);
    padding-block: 10px;
  }

  .category-actions {
    grid-column: 2;
    justify-content: flex-start;
  }
}
