/* ============================================================
   CSS CUSTOM PROPERTIES — light mode defaults
   ============================================================ */
:root {
  color-scheme: light dark;
  --bg:              #F5F0E8;
  --surface:         #FFFFFF;
  --surface-warm:    #FAF7F2;
  --surface-tint:    #F0EBE3;
  --surface-accent:  #F5E8D8;
  --text:            #1A0A00;
  --text-muted:      #6B6059;
  --text-2:          #4A3426;
  --text-heading:    #3D1C02;
  --border:          #D4C5B0;
  --border-lt:       #F0EBE3;
  --border-footer:   #E8E0D5;
  --interactive:     #5C3317;
  --interactive-act: #7A4520;
  --btn-primary-bg:  #5C3317;
  --btn-primary-act: #7A4520;
  --toggle-off:      #D4C5B0;
  --cancel-bg:       #FEF6F6;
  --cancel-bg-2:     #FEF2F2;
  --cancel-badge-bg: #FEE2E2;
  --cancel-badge-fg: #B91C1C;
  --done-badge-bg:   #D1FAE5;
  --done-badge-fg:   #065F46;
  --unavail-bg:      #F5F5F5;
  --unavail-border:  #E0E0E0;
  --unavail-text:    #BBB;
  --unavail-label:   #AAA;
  --muted-line:      #999;
  --accent-border:   #C17B3E;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:              #0F0A06;
    --surface:         #2A1C10;
    --surface-warm:    #231610;
    --surface-tint:    #382415;
    --surface-accent:  #442C18;
    --text:            #F4EAD8;
    --text-muted:      #B89878;
    --text-2:          #D0A878;
    --text-heading:    #E0B870;
    --border:          #6A4228;
    --border-lt:       #44291A;
    --border-footer:   #543420;
    --interactive:     #D08848;
    --interactive-act: #E09A58;
    --btn-primary-bg:  #9A6035;
    --btn-primary-act: #B07040;
    --toggle-off:      #4A3020;
    --cancel-bg:       #2C0E0E;
    --cancel-bg-2:     #2C0E0E;
    --cancel-badge-bg: #421212;
    --cancel-badge-fg: #FF8888;
    --done-badge-bg:   #0C2418;
    --done-badge-fg:   #55E898;
    --unavail-bg:      #1E140C;
    --unavail-border:  #322010;
    --unavail-text:    #7A6050;
    --unavail-label:   #6A5040;
    --muted-line:      #7A6050;
    --accent-border:   #8A5428;
    --card-outline:    1px solid #6A4228;
    --card-shadow:     0 2px 8px rgba(0,0,0,0.6), 0 0 0 1px #6A4228;
  }
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   HEADER & TABS
   ============================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #5C3317;
  color: white;
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.app-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tab-bar {
  display: flex;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.75);
  font-size: 16px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  min-height: 44px;
}

.tab-btn.active {
  background: white;
  color: #5C3317;
  font-weight: 700;
}

/* ============================================================
   MAIN LAYOUT
   ============================================================ */
#main {
  padding: 16px;
  padding-bottom: 16px;
  max-width: 600px;
  margin: 0 auto;
}

.orders-view-pad { padding-bottom: 90px; }

/* ============================================================
   FIXED FOOTER
   ============================================================ */
#order-footer {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  background: var(--surface);
  border-top: 1px solid var(--border-footer);
  box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
}

.footer-bar {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  max-width: 600px;
  margin: 0 auto;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  width: 100%;
  padding: 16px;
  background: var(--btn-primary-bg);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  min-height: 56px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-primary:active { background: var(--btn-primary-act); }

.btn-ghost {
  padding: 14px 24px;
  background: transparent;
  color: var(--interactive);
  border: 2px solid var(--interactive);
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}
.btn-ghost:active { background: var(--surface-accent); }

.btn-danger {
  padding: 14px 24px;
  background: #C0392B;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 52px;
}
.btn-danger:active { background: #A93226; }

.btn-success {
  padding: 14px 28px;
  background: #2D7A4F;
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  min-height: 52px;
}
.btn-success:active { background: #25663F; }

.btn-danger-sm {
  padding: 10px 16px;
  background: #C0392B;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.btn-ghost-sm {
  padding: 10px 16px;
  background: transparent;
  color: var(--interactive);
  border: 2px solid var(--interactive);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

/* ============================================================
   ORDERS VIEW
   ============================================================ */
.order-list { display: flex; flex-direction: column; gap: 0; }

.order-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 15px 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border-left: 4px solid var(--accent-border);
  transition: transform 0.1s;
}

.order-card.order-pending {
  cursor: pointer;
  border-left-color: var(--interactive);
}
.order-card.order-pending:active { transform: scale(0.98); }

.order-card.order-done {
  opacity: 0.45;
  border-left-color: #2D7A4F;
}

.order-card.order-cancelled {
  opacity: 0.55;
  border-left-color: #C0392B;
  background: var(--cancel-bg);
}
.order-card.order-cancelled .order-name,
.order-card.order-cancelled .order-drink { text-decoration: line-through; }

.order-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
}

.order-name { font-size: 17px; font-weight: 700; flex: 1; }
.order-card-right {
  flex-shrink: 0;
  text-align: right;
}
.order-time {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.3;
  display: block;
  margin-bottom: 5px;
}
.order-drink { font-size: 15px; color: var(--text-2); }

.order-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* ============================================================
   BADGES
   ============================================================ */
.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.badge-cancelled { background: var(--cancel-badge-bg); color: var(--cancel-badge-fg); }
.badge-done { background: var(--done-badge-bg); color: var(--done-badge-fg); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 56px 24px;
  font-size: 16px;
  line-height: 1.5;
}
.empty-state-icon { font-size: 40px; display: block; margin-bottom: 12px; }

/* ============================================================
   KITCHEN VIEW
   ============================================================ */
.kitchen-first-visit-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-accent);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.4;
}
.kitchen-first-visit-banner span { flex: 1; }
.banner-dismiss {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
}

.kitchen-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  gap: 12px;
}

.pending-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--interactive);
  background: var(--surface-accent);
  padding: 5px 12px;
  border-radius: 20px;
  flex-shrink: 0;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.toggle-label input[type="checkbox"] { display: none; }

/* Toggle switch */
.toggle-switch {
  display: inline-block;
  width: 48px;
  height: 28px;
  background: var(--toggle-off);
  border-radius: 14px;
  position: relative;
  transition: background 0.2s;
  flex-shrink: 0;
}
.toggle-switch::after {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  top: 3px;
  left: 3px;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}
input:checked ~ .toggle-switch,
input:checked + .toggle-switch { background: var(--btn-primary-bg); }
input:checked ~ .toggle-switch::after,
input:checked + .toggle-switch::after { transform: translateX(20px); }

/* Kitchen cards */
.kitchen-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.1);
  border-left: 4px solid var(--accent-border);
}
.kitchen-card-pending { cursor: pointer; transition: transform 0.1s; }
.kitchen-card-pending:active { transform: scale(0.98); }

.kitchen-card-cancelled {
  border-left-color: #C0392B;
  background: var(--cancel-bg-2);
  opacity: 0.7;
}
.kitchen-card-cancelled .kitchen-name,
.kitchen-card-cancelled .kitchen-card-drink { text-decoration: line-through; color: var(--muted-line); }

.kitchen-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
}
.kitchen-name { font-size: 20px; font-weight: 700; flex: 1; }
.kitchen-time { font-size: 13px; color: var(--text-muted); flex-shrink: 0; line-height: 1.7; }
.kitchen-card-drink { font-size: 17px; color: var(--text-2); font-weight: 500; }

.kitchen-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.btn-done-quick {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #2D7A4F;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
  cursor: pointer;
  min-height: 36px;
}
.btn-done-quick:active { background: #25663F; transform: scale(0.97); }

/* Cancelled orders note */
.cancelled-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 10px 16px 4px;
  opacity: 0.7;
}

/* Compact done list */
.done-section {
  margin-top: 16px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.done-heading {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border-lt);
}

.done-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-lt);
  font-size: 14px;
}
.done-row:last-child { border-bottom: none; }
.done-name { font-weight: 700; color: var(--text); flex-shrink: 0; }
.done-sep { color: var(--border); }
.done-drink { color: var(--text-muted); flex: 1; font-size: 13px; }

/* Quick complete modal */
.modal-quick .modal-body { padding-bottom: 4px; }
.quick-order-summary {
  font-size: 17px;
  color: var(--text);
  line-height: 1.5;
  margin: 0;
}

.kitchen-notes {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 7px;
  font-style: italic;
  padding: 6px 10px;
  background: var(--surface-warm);
  border-radius: 6px;
}

.milk-group-header {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 20px 0 8px 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.milk-group-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================================================
   SETTINGS SECTION
   ============================================================ */
.settings-section {
  margin-top: 28px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.settings-toggle {
  width: 100%;
  padding: 16px;
  background: var(--surface);
  border: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--interactive);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
}
.settings-toggle:active { background: var(--surface-warm); }

.settings-body { padding: 0 16px 20px; }

.settings-group-heading {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-heading);
  margin: 24px 0 4px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.settings-group-heading:first-of-type { margin-top: 8px; }

.settings-empty {
  font-size: 14px;
  color: var(--text-muted);
  padding: 10px 0;
}

.menu-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-lt);
  min-height: 52px;
}
.menu-item-row:last-of-type { border-bottom: none; }

.menu-item-name { font-size: 16px; }
.toggle-switch-wrap { display: flex; align-items: center; }

.settings-danger {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-lt);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.confirm-inline-text {
  font-size: 15px;
  font-weight: 600;
  color: #C0392B;
  flex: 1;
  min-width: 140px;
}

.settings-explainer {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 4px;
  padding: 10px 12px;
  background: var(--surface-warm);
  border-radius: 8px;
}

/* ============================================================
   MODAL
   ============================================================ */
@keyframes overlayFadeIn {
  from { background: rgba(0,0,0,0); }
  to   { background: rgba(0,0,0,0.55); }
}
@keyframes overlayFadeOut {
  from { background: rgba(0,0,0,0.55); }
  to   { background: rgba(0,0,0,0); }
}
@keyframes modalSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@keyframes modalSlideDown {
  from { transform: translateY(0); }
  to   { transform: translateY(100%); }
}

#modal-overlay {
  position: fixed;
  inset: 0;
  height: 100dvh;
  background: rgba(0,0,0,0.55);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
#modal-overlay.modal-opening {
  animation: overlayFadeIn 0.28s ease forwards;
}
#modal-overlay.modal-opening .modal {
  animation: modalSlideUp 0.32s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}
#modal-overlay.modal-closing {
  animation: overlayFadeOut 0.24s ease forwards;
}
#modal-overlay.modal-closing .modal {
  animation: modalSlideDown 0.28s cubic-bezier(0.32, 0.72, 0, 1) forwards;
}

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  width: 100%;
  max-width: 600px;
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-lt);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 20px; font-weight: 700; }

.modal-close {
  background: var(--surface-tint);
  border: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--interactive);
}
.modal-close:active { background: var(--border); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-lt);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ============================================================
   ORDER FORM
   ============================================================ */
.form-group { margin-bottom: 22px; }

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}
.optional { font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--unavail-text); }
.required-note { font-weight: 400; text-transform: none; letter-spacing: 0; color: #e53e3e; }

.form-input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
  color: var(--text);
  background: var(--surface);
  -webkit-appearance: none;
  font-family: inherit;
}
.form-input:focus {
  outline: none;
  border-color: var(--interactive);
  box-shadow: 0 0 0 3px rgba(92,51,23,0.12);
}

/* Hero name input */
.name-hero-input {
  width: 100%;
  padding: 18px 16px 14px;
  border: none;
  border-bottom: 3px solid var(--border);
  border-radius: 0;
  background: transparent;
  -webkit-appearance: none;
  font-family: 'Helvetica Neue', Helvetica, 'Montserrat', sans-serif;
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 700;
  color: var(--text);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  caret-color: var(--interactive);
  caret-width: 3px;
  line-height: 1.1;
  transition: border-color 0.2s;
}
.name-hero-input::placeholder {
  color: #bbb;
  font-weight: 400;
}
@keyframes blink-caret {
  0%, 100% { caret-color: var(--interactive); }
  50% { caret-color: transparent; }
}
.name-hero-input:focus {
  outline: none;
  border-bottom-color: var(--interactive);
  animation: blink-caret 1s step-end infinite;
}
.name-hero-input.has-value {
  font-weight: 800;
}

.form-textarea { min-height: 84px; resize: vertical; line-height: 1.5; }

/* Frequent order suggestion banner */
.suggestion-banner {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  margin-bottom: 0;
  transition: max-height 0.3s ease, opacity 0.25s ease, margin-bottom 0.3s ease;
}
.suggestion-banner.suggestion-visible {
  max-height: 100px;
  opacity: 1;
  margin-bottom: 18px;
}
.suggestion-content {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-accent);
  border: 1.5px solid var(--accent-border);
  border-radius: 12px;
  padding: 11px 14px;
  flex-wrap: wrap;
}
.suggestion-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.suggestion-drink {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-2);
  flex: 1;
  min-width: 0;
}
.suggestion-btn {
  flex-shrink: 0;
  padding: 8px 16px;
  background: var(--btn-primary-bg);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.suggestion-btn:active { background: var(--btn-primary-act); }

/* Picker grid */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.picker-btn {
  padding: 13px 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  text-align: center;
  min-height: 54px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all 0.1s;
  line-height: 1.3;
  font-family: inherit;
}
.picker-btn.picker-selected {
  background: var(--btn-primary-bg);
  border-color: var(--btn-primary-bg);
  color: white;
  font-weight: 700;
}
.picker-btn.picker-unavail {
  background: var(--unavail-bg);
  border-color: var(--unavail-border);
  color: var(--unavail-text);
  text-decoration: line-through;
  cursor: not-allowed;
}
.picker-btn.picker-unavail .unavail-label { text-decoration: none; }
.unavail-label {
  font-size: 11px;
  color: var(--unavail-label);
  font-weight: 400;
  display: block;
}

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

.required-star { color: #C0392B; margin-left: 2px; }

.field-error {
  font-size: 13px;
  color: #C0392B;
  font-weight: 600;
  margin-bottom: 8px;
}

.picker-subsection {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 12px 16px;
  margin-bottom: 10px;
}
.picker-subsection:last-child { margin-bottom: 0; }

.picker-subsection-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.picker-grid-error {
  border: 2px solid #C0392B;
  border-radius: 12px;
  padding: 8px;
}

/* Segmented control */
.segmented {
  display: flex;
  background: var(--surface-tint);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}
.seg-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--interactive);
  min-height: 48px;
  font-family: inherit;
}
.seg-btn.seg-active {
  background: var(--btn-primary-bg);
  color: white;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Sugar counter */
.sugar-counter { display: flex; align-items: center; justify-content: center; gap: 20px; }

.sugar-btn {
  width: 52px;
  height: 52px;
  background: var(--surface-tint);
  border: none;
  border-radius: 50%;
  font-size: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--interactive);
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1;
}
.sugar-btn:active { background: var(--border); }

.sugar-val {
  font-size: 32px;
  font-weight: 700;
  color: var(--interactive);
  min-width: 36px;
  text-align: center;
}

/* ============================================================
   DETAIL VIEW
   ============================================================ */
.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-lt);
  font-size: 16px;
  gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.detail-value { text-align: right; color: var(--text); }

.confirm-danger-text {
  font-size: 16px;
  font-weight: 600;
  color: #C0392B;
  flex: 1;
}

/* ============================================================
   LOADING
   ============================================================ */
.loading-state {
  text-align: center;
  color: var(--text-muted);
  padding: 56px 24px;
  font-size: 16px;
}

/* ============================================================
   MISC FORM ELEMENTS
   ============================================================ */
.settings-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin: 16px 0 8px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 480px) {
  .picker-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (min-width: 600px) {
  .app-header { padding: 14px 24px 12px; }
  #main { padding: 20px 24px 48px; }
}

@media (prefers-color-scheme: dark) {
  .order-card,
  .kitchen-card {
    box-shadow: var(--card-shadow);
    border: var(--card-outline);
    border-left: 4px solid var(--accent-border);
  }
  .order-card.order-pending,
  .kitchen-card.kitchen-card-pending {
    border-left-color: var(--interactive);
  }
  .order-card.order-cancelled,
  .kitchen-card.kitchen-card-cancelled {
    border-left-color: #C0392B;
  }
}

/* ============================================================
   PASSPHRASE GATE
   ============================================================ */
#passphrase-gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 24px;
}

.gate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 32px 32px;
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.gate-heading {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-heading);
  text-align: center;
  margin-bottom: 4px;
}

.gate-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gate-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 1rem;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface-warm);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
.gate-input:focus { border-color: var(--interactive); }

.gate-error {
  min-height: 1.2em;
  font-size: 0.875rem;
  color: var(--cancel-badge-fg);
  font-weight: 600;
}

.gate-btn {
  width: 100%;
  padding: 15px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--btn-primary-bg);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 4px;
}
.gate-btn:active { background: var(--btn-primary-act); }

@keyframes gate-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}
.gate-input--shake { animation: gate-shake 0.35s ease; }

/* Lock button (inside kitchen settings) */
.settings-lock {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-lt);
  display: flex;
  justify-content: flex-end;
}
.btn-lock {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.btn-lock:hover { color: var(--text); border-color: var(--border); }
