/* =========================================================================
   Laban Oman — Preorder Manager styles
   Mobile-first. Operate surface. Restrained dairy-cream / deep-forest palette.
   ========================================================================= */

/* ---- Design tokens ---- */
:root {
  /* Palette */
  --cream: #f7f6ed;
  --cream-deep: #efedd9;
  --forest: #173e35;
  --forest-soft: #1f5246;
  --forest-ink: #0d2a23;
  --pistachio: #e3edbd;
  --pistachio-deep: #cddfa0;
  --border: #ddd9c6;
  --border-warm: #d4cfb8;
  --ink: #1a1a16;
  --ink-soft: #555047;
  --ink-mute: #8a8475;
  --surface: #ffffff;
  --surface-alt: #faf9f2;
  --danger: #b33a2e;
  --danger-soft: #f4e3e0;
  --success: #3a7d5e;
  --success-soft: #e0ede4;
  --warn: #b8862e;
  --warn-soft: #f0e8d0;
  --focus: #2d6a5a;

  /* Typography */
  --font-sans: 'Plus Jakarta Sans', 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-serif: 'Georgia', 'Times New Roman', serif;

  /* Spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(23,62,53,0.06);
  --shadow-md: 0 2px 8px rgba(23,62,53,0.08);
  --shadow-lg: 0 4px 20px rgba(23,62,53,0.12);
  --shadow-fab: 0 4px 16px rgba(23,62,53,0.18);

  /* Layout */
  --header-h: 52px;
  --toolbar-py: 10px;
  --bottom-tabs-h: 60px;
  --touch: 44px;

  /* Safe areas */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  min-height: 100vh;
  min-height: 100dvh;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button { cursor: pointer; border: none; background: none; }

a { color: var(--forest); text-decoration: none; }

/* ---- Visually hidden ---- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* ---- Wordmark ---- */
.wordmark {
  font-family: var(--font-serif);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--forest);
}

/* ===================== LOGIN SCREEN ===================== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--sp-6) var(--sp-4);
  padding-top: calc(var(--sp-6) + var(--safe-top));
  background: linear-gradient(160deg, var(--forest) 0%, var(--forest-ink) 100%);
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--cream);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-6);
  box-shadow: var(--shadow-lg);
}

.login-card .wordmark {
  font-size: 1.75rem;
  text-align: center;
  display: block;
  margin-bottom: var(--sp-1);
}

.login-subtitle {
  text-align: center;
  color: var(--ink-mute);
  font-size: 0.875rem;
  margin-bottom: var(--sp-6);
}

.login-field { margin-bottom: var(--sp-4); }

.login-field input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.login-field input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(45,106,90,0.12);
}

.login-error {
  color: var(--danger);
  font-size: 0.8125rem;
  min-height: 1.2em;
  margin-bottom: var(--sp-3);
}

/* ===================== APP SHELL ===================== */
.app-shell { display: none; }

body.view-app .app-shell {
  display: block;
}

body.view-app .login-screen { display: none; }

/* ---- Header ---- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding-left: calc(var(--sp-4) + var(--safe-left));
  padding-right: calc(var(--sp-4) + var(--safe-right));
  padding-top: var(--safe-top);
  background: var(--forest);
  color: var(--cream);
}

.wordmark-sm {
  font-size: 1.0625rem;
  color: var(--cream);
}

.header-action {
  color: var(--pistachio);
  font-size: 0.8125rem;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  transition: background 0.15s;
}

.header-action:hover, .header-action:focus-visible {
  background: rgba(255,255,255,0.08);
  outline: none;
}

/* ---- Toolbar (search + filters) ---- */
.toolbar {
  position: sticky;
  top: calc(var(--header-h) + var(--safe-top));
  z-index: 49;
  background: var(--cream);
  border-bottom: 1px solid var(--border-warm);
  padding: var(--sp-3) var(--sp-4);
  padding-left: calc(var(--sp-4) + var(--safe-left));
  padding-right: calc(var(--sp-4) + var(--safe-right));
}

.search-wrap input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(45,106,90,0.12);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-top: var(--sp-2);
  align-items: flex-end;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 90px;
  min-width: 0;
}

.filter-label {
  font-size: 0.6875rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

.filter-field select,
.filter-field input {
  min-height: 38px;
  padding: var(--sp-1) var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: 0.8125rem;
  transition: border-color 0.15s;
}

.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 2px rgba(45,106,90,0.12);
}

/* ---- App main ---- */
.app-main {
  padding: var(--sp-4);
  padding-left: calc(var(--sp-4) + var(--safe-left));
  padding-right: calc(var(--sp-4) + var(--safe-right));
  padding-bottom: calc(var(--bottom-tabs-h) + var(--sp-6) + var(--safe-bottom));
  max-width: 720px;
  margin: 0 auto;
}

/* ---- Tab panels ---- */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===================== ORDERS LIST ===================== */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.empty-state {
  text-align: center;
  color: var(--ink-mute);
  padding: var(--sp-8) var(--sp-4);
  font-size: 0.9375rem;
}

.order-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s;
}

.order-card:active { box-shadow: var(--shadow-md); }

.order-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

.order-name {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
  word-break: break-word;
}

.order-chips {
  display: flex;
  gap: var(--sp-1);
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* ---- Chips: text-based status, not colour-only ---- */
.chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 3px var(--sp-2);
  border-radius: var(--r-full);
  border: 1px solid transparent;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.chip-status { border-color: var(--border); background: var(--surface-alt); color: var(--ink-soft); }
.chip-status-baru { border-color: var(--pistachio-deep); background: var(--pistachio); color: var(--forest-ink); }
.chip-status-disahkan { border-color: var(--pistachio-deep); background: var(--pistachio); color: var(--forest-ink); }
.chip-status-disediakan { border-color: var(--warn); background: var(--warn-soft); color: var(--forest-ink); }
.chip-status-selesai { border-color: var(--success); background: var(--success-soft); color: var(--forest-ink); }
.chip-status-batal { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }

.chip-pay { border-color: var(--border); background: var(--surface-alt); color: var(--ink-soft); }
.chip-pay-deposit { border-color: var(--warn); background: var(--warn-soft); color: var(--forest-ink); }
.chip-pay-lunas { border-color: var(--success); background: var(--success-soft); color: var(--forest-ink); }

/* ---- Order meta ---- */
.order-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--sp-1) var(--sp-3);
  font-size: 0.8125rem;
  margin-bottom: var(--sp-3);
}

.order-meta dt {
  color: var(--ink-mute);
  font-weight: 500;
  white-space: nowrap;
}

.order-meta dd {
  color: var(--ink);
  word-break: break-word;
}

/* ---- Order actions ---- */
.order-actions {
  display: flex;
  gap: var(--sp-2);
}

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

/* ===================== PENYEDIAAN ===================== */
.penyediaan-content {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.penyediaan-explain {
  font-size: 0.8125rem;
  color: var(--ink-mute);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-3);
}

.prep-table {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.prep-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-sm);
}

.prep-group-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--forest);
  margin-bottom: var(--sp-3);
  padding-bottom: var(--sp-2);
  border-bottom: 1px solid var(--border-warm);
}

.prep-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-2);
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--cream-deep);
}

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

.prep-desc {
  font-size: 0.875rem;
  color: var(--ink);
  text-transform: capitalize;
  flex: 1;
}

.prep-qty {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-align: right;
  min-width: 60px;
}

.prep-vol {
  font-size: 0.8125rem;
  color: var(--ink-mute);
  text-align: right;
  min-width: 56px;
  font-variant-numeric: tabular-nums;
}

.prep-grand {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--forest);
  color: var(--cream);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  font-weight: 700;
  font-size: 0.9375rem;
}

.prep-grand span { font-variant-numeric: tabular-nums; }

/* ===================== SETTINGS ===================== */
.settings-content {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--sp-6);
}

.settings-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--forest);
}

.settings-user {
  display: flex;
  gap: var(--sp-3);
  font-size: 0.875rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
}

.settings-user dt { color: var(--ink-mute); font-weight: 500; }
.settings-user dd { color: var(--ink); font-weight: 600; }

.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.settings-section h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--forest);
}

.pw-form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

/* ===================== FORM FIELDS ===================== */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.form-field-label {
  font-size: 0.75rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.req { color: var(--danger); }

.form-field input,
.form-field select,
.form-field textarea {
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}

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

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(45,106,90,0.12);
}

.form-error {
  color: var(--danger);
  font-size: 0.8125rem;
  min-height: 1.2em;
}

.form-success {
  color: var(--success);
  font-size: 0.8125rem;
  min-height: 1.2em;
}

/* ===================== BUTTONS ===================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-1);
  min-height: var(--touch);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-md);
  font-weight: 600;
  font-size: 0.875rem;
  transition: background 0.15s, opacity 0.15s, border-color 0.15s;
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn:disabled { opacity: 0.5; pointer-events: none; }

.btn-block { display: flex; width: 100%; }
.btn-sm { min-height: 36px; padding: var(--sp-1) var(--sp-3); font-size: 0.8125rem; }

.btn-primary {
  background: var(--forest);
  color: var(--cream);
}
.btn-primary:hover, .btn-primary:focus-visible {
  background: var(--forest-soft);
  outline: none;
}

.btn-secondary {
  background: var(--surface);
  color: var(--forest);
  border-color: var(--border);
}
.btn-secondary:hover, .btn-secondary:focus-visible {
  background: var(--cream-deep);
  outline: none;
}

.btn-ghost {
  background: transparent;
  color: var(--forest);
  border-color: var(--border-warm);
}
.btn-ghost:hover, .btn-ghost:focus-visible {
  background: var(--cream-deep);
  outline: none;
}

.btn-wa {
  background: var(--success);
  color: var(--cream);
}
.btn-wa:hover, .btn-wa:focus-visible {
  background: #2d6a52;
  outline: none;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover, .btn-danger:focus-visible {
  background: #9c2f25;
  outline: none;
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger-ghost:hover, .btn-danger-ghost:focus-visible {
  background: var(--danger-soft);
  outline: none;
}

.btn-icon-remove {
  min-height: 36px;
  padding: var(--sp-1) var(--sp-3);
  font-size: 0.75rem;
  color: var(--danger);
  border: 1px solid var(--danger-soft);
  border-radius: var(--r-sm);
  align-self: flex-end;
}
.btn-icon-remove:hover { background: var(--danger-soft); }

/* ===================== FAB ===================== */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-tabs-h) + var(--sp-4) + var(--safe-bottom));
  right: var(--sp-4);
  z-index: 48;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-height: 52px;
  padding: 0 var(--sp-5);
  background: var(--forest);
  color: var(--cream);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-fab);
  font-weight: 700;
  font-size: 0.875rem;
  transition: transform 0.15s, background 0.15s;
}

.fab:active { transform: scale(0.96); }

.fab-icon {
  font-size: 1.25rem;
  line-height: 1;
  font-weight: 300;
}

/* ===================== BOTTOM TABS ===================== */
.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 47;
  display: flex;
  height: var(--bottom-tabs-h);
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  box-shadow: 0 -1px 8px rgba(23,62,53,0.06);
}

.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--touch);
  color: var(--ink-mute);
  font-size: 0.6875rem;
  font-weight: 500;
  transition: color 0.15s;
}

.tab-btn.active { color: var(--forest); }

.tab-icon {
  font-size: 1.25rem;
  line-height: 1;
}

/* ===================== DIALOGS ===================== */
dialog {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
}

dialog::backdrop {
  background: rgba(13,42,35,0.45);
  backdrop-filter: blur(2px);
}

.dialog-content {
  background: var(--cream);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  max-height: 100dvh;
  overflow: hidden;
}

/* Form dialog: full-screen mobile, centered desktop */
.dialog-form .dialog-content {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4);
  padding-top: calc(var(--sp-4) + var(--safe-top));
  background: var(--forest);
  color: var(--cream);
  flex-shrink: 0;
}

.dialog-title {
  font-size: 1.0625rem;
  font-weight: 700;
  color: var(--cream);
}

.dialog-close {
  min-width: var(--touch);
  min-height: var(--touch);
  font-size: 1.5rem;
  line-height: 1;
  color: var(--cream);
  border-radius: var(--r-sm);
  transition: background 0.15s;
}

.dialog-close:hover, .dialog-close:focus-visible {
  background: rgba(255,255,255,0.12);
  outline: none;
}

/* Order form */
.order-form {
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-6) + var(--safe-bottom));
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}

.form-row-two {
  display: flex;
  gap: var(--sp-3);
}

.form-row-two .form-field { flex: 1; }

.form-items-section {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.form-items-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.form-section-title {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--forest);
}

.form-item-count {
  font-size: 0.8125rem;
  color: var(--ink-mute);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.form-items {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.form-item-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-3);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-2) var(--sp-3);
}

.form-field-flavour { grid-column: 1; }
.form-field-pack { grid-column: 2; }
.form-field-size { grid-column: 1; }
.form-field-qty { grid-column: 2; }
.btn-icon-remove { grid-column: 1 / -1; }

/* Quantity stepper */
.qty-stepper {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  min-height: var(--touch);
}

.qty-btn {
  min-width: var(--touch);
  min-height: var(--touch);
  background: var(--surface-alt);
  font-size: 1.25rem;
  font-weight: 300;
  color: var(--forest);
  transition: background 0.15s;
  border: none;
}

.qty-btn:hover { background: var(--cream-deep); }
.qty-btn:active { background: var(--border-warm); }

.qty-input {
  width: 100%;
  min-width: 0;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  background: var(--surface);
  font-weight: 600;
  font-size: 0.9375rem;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.form-actions {
  flex-shrink: 0;
  padding-top: var(--sp-2);
}

/* Detail dialog */
.dialog-detail .dialog-content {
  width: 100vw;
  max-width: 100vw;
  height: auto;
  max-height: 100dvh;
  border-radius: 0;
}

#detail-content {
  padding: var(--sp-4);
  padding-bottom: calc(var(--sp-6) + var(--safe-bottom));
  overflow-y: auto;
  flex: 1;
}

.detail-head {
  margin-bottom: var(--sp-4);
}

.detail-head h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--sp-2);
  word-break: break-word;
}

.detail-items-title {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--forest);
  margin-top: var(--sp-4);
  margin-bottom: var(--sp-2);
}

.detail-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

.detail-items li {
  font-size: 0.875rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: var(--sp-2) var(--sp-3);
}

.detail-actions {
  display: flex;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
  flex-wrap: wrap;
}

.detail-actions .btn { flex: 1; min-width: 100px; }

/* Confirm dialog */
.dialog-confirm .dialog-content {
  width: calc(100vw - var(--sp-8));
  max-width: 360px;
  border-radius: var(--r-lg);
  padding: var(--sp-5);
}

.confirm-message {
  font-size: 0.9375rem;
  color: var(--ink);
  margin-bottom: var(--sp-4);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: var(--sp-2);
  justify-content: flex-end;
}

/* ===================== FOCUS STATES ===================== */
*:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

dialog:focus-visible { outline: none; }

/* ===================== REDUCED MOTION ===================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===================== DESKTOP / TABLET ===================== */
@media (min-width: 768px) {
  .app-shell {
    display: none;
  }
  body.view-app .app-shell {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: var(--header-h) 1fr;
    grid-template-areas:
      "header header"
      "sidebar main";
    min-height: 100vh;
    min-height: 100dvh;
  }

  .app-header {
    grid-area: header;
    position: static;
    padding-left: var(--sp-4);
    padding-right: var(--sp-4);
  }

  /* Sidebar replaces bottom tabs on desktop */
  .bottom-tabs {
    position: static;
    grid-area: sidebar;
    flex-direction: column;
    height: auto;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: var(--sp-4) var(--sp-2);
    padding-top: var(--sp-4);
    background: var(--cream);
    box-shadow: none;
    gap: var(--sp-1);
  }

  .tab-btn {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--r-md);
    font-size: 0.875rem;
    min-height: var(--touch);
  }

  .tab-btn:hover:not(.active) {
    background: var(--cream-deep);
  }

  .tab-icon { font-size: 1rem; }

  .toolbar {
    position: static;
    grid-area: main;
    align-self: start;
  }

  /* Re-flow: toolbar and main share the main area */
  body.view-app .app-shell {
    grid-template-areas:
      "header header"
      "sidebar toolbar"
      "sidebar main";
  }

  .app-main {
    grid-area: main;
    padding: var(--sp-4) var(--sp-6);
    padding-bottom: var(--sp-8);
    max-width: none;
  }

  .orders-list {
    max-width: 640px;
  }

  /* FAB becomes inline add button on desktop */
  .fab {
    position: static;
    align-self: flex-start;
    margin-bottom: var(--sp-4);
  }

  /* Dialogs: centered, not full-screen */
  .dialog-form .dialog-content {
    width: 560px;
    max-width: calc(100vw - var(--sp-8));
    height: auto;
    max-height: calc(100dvh - var(--sp-8));
    border-radius: var(--r-lg);
  }

  .dialog-detail .dialog-content {
    width: 480px;
    max-width: calc(100vw - var(--sp-8));
    max-height: calc(100dvh - var(--sp-8));
    border-radius: var(--r-lg);
  }

  .form-item-row {
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    align-items: end;
  }

  .form-field-flavour { grid-column: 1; }
  .form-field-pack { grid-column: 2; }
  .form-field-size { grid-column: 3; }
  .form-field-qty { grid-column: 4; }
  .btn-icon-remove { grid-column: 5; align-self: end; }
}

@media (min-width: 1024px) {
  .app-main { padding: var(--sp-6) var(--sp-8); }
  .orders-list { max-width: 720px; }
}

/* ===================== NO HORIZONTAL OVERFLOW ===================== */
html, body { overflow-x: hidden; }

.order-meta dd,
.detail-head h2,
.order-name { overflow-wrap: break-word; word-break: break-word; }

/* Prevent zoom on input focus iOS */
@media (max-width: 767px) {
  .form-field input,
  .form-field select,
  .form-field textarea,
  .login-field input,
  .search-wrap input,
  .filter-field select,
  .filter-field input {
    font-size: 16px;
  }
}
