/**
 * Stitch "Warm Operational Utility" visual layer.
 * Loaded after styles.css — overrides presentation only.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0&display=swap');

:root {
  --stitch-bg: #ede0d4;
  --stitch-surface: #f5ede4;
  --stitch-surface-container: #f2edeb;
  --stitch-surface-container-high: #ece7e5;
  --stitch-surface-container-low: #f8f2f1;
  --stitch-on-surface: #1d1b1a;
  --stitch-on-surface-variant: #4c463f;
  --stitch-outline-variant: #cfc5bc;
  --stitch-primary: #665d54;
  --stitch-primary-container: #ede0d4;
  --stitch-tertiary-container: #cbe9d6;
  --stitch-on-tertiary-container: #4f6a5a;
  --stitch-warning: #d97706;
  --stitch-action: #2a2a2a;
  --stitch-success: #2d4739;
  --stitch-radius-card: 12px;
  --stitch-radius-chip: 999px;
  --z-bottom-nav: 45;
  --z-fab: 44;
  --z-toast: 55;
  --bottom-nav-h: 64px;
}

body {
  font-family: Inter, Arial, sans-serif;
  background: var(--stitch-bg);
  color: var(--stitch-on-surface);
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-weight: normal;
  font-style: normal;
  font-size: 24px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
}

.material-symbols-outlined.filled {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.label-caps {
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
}

.display-table-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--stitch-on-surface);
  font-variant-numeric: tabular-nums;
}

.phone-shell {
  padding-left: 16px;
  padding-right: 16px;
}

body.has-bottom-nav .phone-shell {
  padding-bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom, 0px));
}

/* —— App chrome —— */
.stitch-app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 8px 0 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.stitch-app-header-main {
  flex: 1;
  min-width: 0;
}

.stitch-app-header-title {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--stitch-on-surface);
}

.stitch-app-header-sub {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stitch-on-surface-variant);
  margin-top: 2px;
}

.stitch-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--stitch-primary);
  flex-shrink: 0;
}

.stitch-icon-btn:active {
  background: var(--stitch-surface-container-high);
  transform: scale(0.95);
}

.stitch-screen-title {
  margin: 0 0 4px;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.stitch-screen-sub {
  margin: 0 0 16px;
}

.stitch-screen-body {
  padding-bottom: 8px;
}

/* Hide legacy duplicate nav when stitch header is used */
.stitch-screen .topbar .ghost-btn.back-tap {
  display: none;
}

#active-orders-screen .section-head .primary-btn#new-order-btn {
  display: none;
}

/* —— Bottom navigation —— */
.app-bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: 560px;
  z-index: var(--z-bottom-nav);
  display: flex;
  justify-content: space-around;
  align-items: center;
  gap: 4px;
  min-height: var(--bottom-nav-h);
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom, 0px));
  background: rgba(248, 242, 241, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--stitch-outline-variant);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.06);
}

.app-bottom-nav[hidden] {
  display: none !important;
}

.app-bottom-nav-item {
  flex: 1;
  max-width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: 48px;
  padding: 6px 10px;
  border: none;
  border-radius: var(--stitch-radius-chip);
  background: transparent;
  color: var(--stitch-on-surface-variant);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.app-bottom-nav-item .material-symbols-outlined {
  font-size: 22px;
}

.app-bottom-nav-item.is-active {
  background: var(--stitch-primary-container);
  color: var(--stitch-primary);
}

.app-bottom-nav-item.is-active .material-symbols-outlined {
  font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* —— FAB (new order) —— */
.app-fab {
  position: fixed;
  right: 20px;
  bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom, 0px));
  z-index: var(--z-fab);
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 999px;
  background: var(--stitch-action);
  color: #fdf8f6;
  box-shadow: 0 8px 24px rgba(42, 42, 42, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.app-fab[hidden] {
  display: none !important;
}

.app-fab:active {
  transform: scale(0.92);
}

body:not(.has-bottom-nav) .app-fab {
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

/* —— Toast —— */
.app-toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  bottom: calc(var(--bottom-nav-h) + 72px + env(safe-area-inset-bottom, 0px));
  width: calc(100% - 32px);
  max-width: 528px;
  z-index: var(--z-toast);
  padding: 12px 16px;
  border-radius: var(--stitch-radius-card);
  background: var(--stitch-action);
  color: #fdf8f6;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
  transition: transform 0.28s ease, opacity 0.28s ease;
  opacity: 0;
  pointer-events: none;
}

.app-toast.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.app-toast[hidden] {
  display: block !important;
}

.app-toast--success {
  background: var(--stitch-success);
}

.app-toast--error {
  background: #ba1a1a;
}

/* —— Login —— */
#login-screen.active .hero-card {
  background: var(--stitch-surface);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
}

#login-screen .brand-pill {
  background: var(--stitch-primary-container);
  color: var(--stitch-primary);
}

#login-screen .panel {
  background: var(--stitch-surface);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--stitch-radius-card);
  box-shadow: none;
}

.primary-btn,
.send-main-btn {
  background: var(--stitch-action) !important;
  color: #fdf8f6 !important;
  border-radius: 8px !important;
  box-shadow: none;
}

/* —— Cards / panels —— */
.hero-card,
.panel,
.stat-card {
  background: var(--stitch-surface);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: none;
  border-radius: var(--stitch-radius-card);
}

.compact-panel.topbar {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

/* —— Active order cards (Stitch bento) —— */
.stitch-order-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--stitch-radius-card);
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--stitch-surface);
  text-align: left;
}

.stitch-order-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.stitch-order-table-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stitch-order-card-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.stitch-order-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stitch-order-meta-title {
  font-size: 16px;
  font-weight: 600;
}

.stitch-order-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--stitch-outline-variant);
}

.stitch-order-total {
  font-size: 18px;
  font-weight: 700;
}

.active-orders-list {
  gap: 12px;
}

/* —— Table grid —— */
.tables-grid {
  gap: 12px;
}

.table-cell {
  min-height: 148px;
  padding: 20px;
  border-radius: var(--stitch-radius-card);
  border: 1px solid rgba(0, 0, 0, 0.05);
  background: var(--stitch-surface);
  justify-content: space-between;
}

.table-cell-top {
  display: flex;
  width: 100%;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.table-cell .table-cell-label {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.tfloor-free {
  background: var(--stitch-surface-container-low);
}

.tfloor-draft {
  background: var(--stitch-primary-container);
  border-color: rgba(102, 93, 84, 0.2);
}

.tfloor-active {
  background: var(--stitch-surface);
}

.table-status-badge {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  padding: 4px 10px;
  border-radius: var(--stitch-radius-chip);
}

.badge-floor-free {
  background: var(--stitch-tertiary-container);
  color: var(--stitch-on-tertiary-container);
}

.badge-floor-draft {
  background: rgba(217, 119, 6, 0.18);
  color: var(--stitch-warning);
}

.order-status-chip,
.kitchen-order-status {
  font-size: 14px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  padding: 6px 12px;
  border-radius: var(--stitch-radius-chip);
}

.chip-active,
.order-state-chip--ready {
  background: var(--stitch-tertiary-container);
  color: var(--stitch-on-tertiary-container);
}

.chip-draft {
  background: rgba(217, 119, 6, 0.15);
  color: var(--stitch-warning);
}

/* —— Zone tabs —— */
.tables-section-tabs {
  background: var(--stitch-surface-container);
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: var(--stitch-radius-chip);
  padding: 4px;
}

.floor-section-tab-active {
  background: var(--stitch-primary);
  color: #fff;
  box-shadow: none;
}

/* —— Order screen —— */
.order-head-panel h2#order-table-title {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.fixed-send-bar {
  background: rgba(237, 224, 212, 0.94);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--stitch-outline-variant);
}

.floating-ticket-bar {
  z-index: var(--z-float-ticket);
}

.floating-ticket-btn {
  border-radius: var(--stitch-radius-card) var(--stitch-radius-card) 0 0;
  background: var(--stitch-surface-container-high);
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
}

.menu-search-input,
input,
select,
textarea {
  border-radius: var(--stitch-radius-card);
  border-color: var(--stitch-outline-variant);
}

.menu-tile,
.menu-group {
  border-radius: var(--stitch-radius-card);
}

.ticket-details {
  border-radius: var(--stitch-radius-card);
}

.connectivity-banner {
  font-size: 12px;
  letter-spacing: 0.03em;
}

.push-enable-btn {
  width: 100%;
  min-height: 48px;
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}

.push-enable-btn.is-enabled {
  background: var(--stitch-tertiary-container);
  color: var(--stitch-on-tertiary-container);
  border-color: transparent;
}
