/* ==========================================================================
   Little Kalypso'o — Design System
   ========================================================================== */

@font-face {
  font-family: 'Playfair Display';
  src: url('../fonts/playfair-display.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colors — thème clair */
  --color-bg: #FFFFFF;
  --color-surface: #FFFFFF;
  --color-surface-raised: #F7F5F2;
  --color-primary: #c9932e;
  --color-primary-dark: #a67b1f;
  --color-primary-light: #a67b1f;
  --color-primary-bright: #e8b84a;
  --color-accent-teal: #1f6b5f;
  --color-accent-teal-light: #2a8578;
  --color-accent-orange: #e67e22;
  --color-secondary: #EEEAE3;
  --color-text: #0E0E0C;
  --color-text-muted: #6B635A;
  --color-danger: #c0392b;
  --color-danger-bg: #fdecea;
  --color-success: #27ae60;
  --color-warning: #e67e22;
  --color-border: #E5E0D8;
  --color-border-gold: rgba(201, 147, 46, 0.35);
  --color-receipt-bg: #faf8f5;
  --color-receipt-text: #0E0E0C;

  /* Spacing (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* Typography */
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;

  /* Touch & radius */
  --touch-min: 48px;
  --touch-lg: 56px;
  --touch-xl: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-full: 999px;

  /* Effects */
  --shadow: 0 2px 12px rgba(14, 14, 12, 0.08);
  --shadow-glow: 0 0 16px rgba(201, 147, 46, 0.2);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --nav-height: 72px;
  --cart-width: 380px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html, body {
  height: 100%;
  font-family: var(--font);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(31, 107, 95, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(201, 147, 46, 0.04) 0%, transparent 40%);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

h1, h2, h3, .text-heading {
  font-family: var(--font-display);
  color: var(--color-primary-light);
  letter-spacing: 0.02em;
}

.text-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.text-price {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--color-primary-light);
}

.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

:focus-visible {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 2px;
}

#app {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.screen {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity var(--duration-normal) var(--ease-out);
}

.screen[hidden] {
  display: none !important;
}

.screen.screen-fade-out {
  opacity: 0;
}

/* ==========================================================================
   Brand logo
   ========================================================================== */

.brand-logo {
  display: block;
  object-fit: cover;
  border-radius: 50%;
  aspect-ratio: 1;
}

.brand-logo-lg {
  width: min(96px, 16vh);
  height: min(96px, 16vh);
  max-width: min(96px, 16vh);
  margin: 0 auto var(--space-3);
  filter: drop-shadow(0 4px 12px rgba(201, 147, 46, 0.2));
}

.brand-logo-sm {
  width: 48px;
  height: 48px;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border: none;
  border-radius: var(--radius);
  font-size: var(--text-base);
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast), opacity var(--duration-fast);
}

.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.btn-lg {
  flex: 1;
  padding: var(--space-4) var(--space-6);
  font-size: var(--text-lg);
  min-height: var(--touch-xl);
}

.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 40px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--color-primary-bright) 0%, var(--color-primary) 100%);
  color: #0E0E0C;
  font-weight: 700;
  border: 1px solid var(--color-primary-dark);
}

.btn-primary:active:not(:disabled) {
  background: var(--color-primary-dark);
  color: #FFFFFF;
}

.btn-primary.btn-pulse:not(:disabled) {
  animation: btnPulse 2s ease-in-out infinite;
  box-shadow: var(--shadow-glow);
}

.btn-secondary {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border: 2px solid var(--color-border);
}

.btn-secondary:active:not(:disabled) {
  background: var(--color-secondary);
  border-color: var(--color-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border: 2px solid var(--color-border);
}

.btn-ghost:active:not(:disabled) {
  background: var(--color-surface-raised);
  color: var(--color-text);
  border-color: var(--color-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: #fff;
}

.btn-danger:active:not(:disabled) {
  background: #a93226;
}

.btn-checkout-action {
  flex: 2;
}

.btn-quick {
  flex: 1;
  min-height: 44px;
  font-size: var(--text-sm);
  padding: var(--space-2);
}

/* ==========================================================================
   Navigation
   ========================================================================== */

.nav-bar {
  display: flex;
  align-items: stretch;
  height: var(--nav-height);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  position: relative;
  z-index: 100;
  box-shadow: 0 1px 4px rgba(14, 14, 12, 0.06);
}

.nav-brand {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: var(--space-2) var(--space-4);
  background: none;
  border: none;
  border-right: 1px solid var(--color-border);
  cursor: pointer;
  transition: background var(--duration-fast);
}

.nav-brand:active {
  background: rgba(201, 147, 46, 0.1);
}

.nav-buttons {
  display: flex;
  flex: 1;
  align-items: stretch;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background var(--duration-fast), color var(--duration-fast), border-color var(--duration-fast);
  padding: var(--space-1) var(--space-2);
  position: relative;
}

.nav-btn:active,
.nav-btn.active {
  background: rgba(201, 147, 46, 0.12);
  color: var(--color-primary-dark);
  border-bottom-color: var(--color-primary);
}

.nav-more {
  flex: 1;
  position: relative;
}

.nav-more-menu {
  position: absolute;
  top: 100%;
  right: var(--space-2);
  min-width: 200px;
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  z-index: 200;
}

.nav-more-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-4);
  background: none;
  border: none;
  color: var(--color-text);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  text-align: left;
  transition: background var(--duration-fast);
}

.nav-more-item:active {
  background: var(--color-secondary);
}

.nav-more-item-danger {
  color: #e74c3c;
  border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   Login
   ========================================================================== */

.screen-login {
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
  min-height: 100vh;
  min-height: 100dvh;
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  text-align: center;
  box-shadow: 0 4px 24px rgba(14, 14, 12, 0.1);
  width: min(320px, 100%);
  max-width: 100%;
  flex-shrink: 0;
  margin: auto;
  transition: transform var(--duration-normal);
}

.login-card.login-card--error {
  animation: shake 0.4s var(--ease-out);
  border-color: var(--color-danger);
}

.login-subtitle {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pin-dots-sm {
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--color-border);
  background: transparent;
  transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast);
}

.pin-dot.filled {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  transform: scale(1.15);
}

.pin-dots-sm .pin-dot {
  width: 12px;
  height: 12px;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  max-width: 280px;
  margin: 0 auto;
}

.pin-pad button {
  min-height: 56px;
  font-size: var(--text-xl);
  font-weight: 700;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface-raised);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--duration-fast), transform var(--duration-fast), border-color var(--duration-fast);
}

.pin-pad button:active {
  background: var(--color-secondary);
  border-color: var(--color-primary);
  transform: scale(0.96);
}

.pin-action {
  font-size: var(--text-sm) !important;
  font-weight: 600 !important;
}

.pin-submit-sm {
  background: var(--color-primary) !important;
  color: #0E0E0C !important;
  border-color: var(--color-primary) !important;
}

.pin-spacer {
  display: block;
}

.pin-pad-sm {
  gap: 10px;
  max-width: 280px;
}

.pin-pad-sm button {
  min-height: 52px;
  font-size: var(--text-xl);
}

.pin-label {
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
}

.error-msg {
  color: var(--color-danger);
  font-weight: 600;
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.pin-pad--disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* Login — compact on short viewports (tablette paysage) */
@media (max-height: 720px) {
  .brand-logo-lg {
    width: min(72px, 13vh);
    height: min(72px, 13vh);
    max-width: min(72px, 13vh);
    margin-bottom: var(--space-2);
  }

  .login-card {
    padding: var(--space-4) var(--space-5);
  }

  .login-subtitle {
    margin-bottom: var(--space-2);
  }

  .pin-dots {
    margin-bottom: var(--space-2);
  }

  .pin-pad {
    gap: 8px;
    max-width: 260px;
  }

  .pin-pad button {
    min-height: 50px;
    font-size: var(--text-lg);
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .login-card {
    display: grid;
    grid-template-columns: auto 1fr;
    column-gap: var(--space-6);
    row-gap: var(--space-2);
    width: min(480px, 94vw);
    padding: var(--space-4) var(--space-5);
    align-items: center;
  }

  .brand-logo-lg {
    grid-column: 1;
    grid-row: 1 / span 5;
    align-self: center;
    margin: 0;
    width: min(88px, 28vh);
    height: min(88px, 28vh);
    max-width: min(88px, 28vh);
  }

  .login-subtitle {
    grid-column: 2;
    margin-bottom: 0;
    text-align: center;
  }

  .pin-dots {
    grid-column: 2;
    margin-bottom: var(--space-1);
  }

  #login-error {
    grid-column: 2;
    margin-bottom: var(--space-1);
  }

  .pin-pad {
    grid-column: 2;
    max-width: 240px;
    margin: 0 auto;
  }

  .pin-pad button {
    min-height: 48px;
    font-size: var(--text-base);
  }
}

.field-error {
  display: block;
  color: var(--color-danger);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

.form-group input.field-invalid,
.form-group select.field-invalid {
  border-color: var(--color-danger);
  animation: inputPulse 0.6s ease;
}

/* ==========================================================================
   Order screen
   ========================================================================== */

.screen-order {
  flex: 1;
  overflow: hidden;
}

.order-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--nav-height));
}

.order-products {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-4);
}

.category-tabs {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
  flex-shrink: 0;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: var(--space-1);
}

.category-tabs::-webkit-scrollbar {
  height: 4px;
}

.category-tabs::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}

.category-tab {
  padding: var(--space-3) var(--space-5);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  min-height: var(--touch-min);
  white-space: nowrap;
  scroll-snap-align: start;
  flex-shrink: 0;
  transition: background var(--duration-fast), border-color var(--duration-fast), color var(--duration-fast);
}

.category-tab:active,
.category-tab.active {
  background: var(--color-accent-teal);
  border-color: var(--color-accent-teal-light);
  color: #FFFFFF;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: var(--space-3);
  overflow-y: auto;
  flex: 1;
  align-content: start;
  padding-bottom: var(--space-4);
}

.product-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: var(--space-1);
  min-height: 124px;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  border-left-width: 4px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--color-text);
  box-shadow: 0 1px 4px rgba(14, 14, 12, 0.06);
  transition: background var(--duration-fast), border-color var(--duration-fast), transform var(--duration-fast), box-shadow var(--duration-fast);
}

.product-tile:active {
  transform: scale(0.97);
}

.product-tile--added {
  animation: tileFlash 0.35s var(--ease-out);
}

.product-tile.cat-plats { border-left-color: var(--color-primary); }
.product-tile.cat-boissons { border-left-color: var(--color-accent-teal-light); }
.product-tile.cat-desserts { border-left-color: var(--color-accent-orange); }
.product-tile.cat-autre { border-left-color: var(--color-text-muted); }

.product-tile-badge {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: rgba(31, 107, 95, 0.25);
  color: var(--color-accent-teal-light);
  margin-bottom: var(--space-1);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.product-tile-name {
  flex: 1;
  width: 100%;
  min-width: 0;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: break-word;
  word-break: break-word;
  margin-bottom: var(--space-1);
}

.product-tile-price {
  flex-shrink: 0;
  margin-top: auto;
  width: 100%;
  font-size: var(--text-lg);
  color: var(--color-primary-light);
  font-weight: 700;
  font-family: var(--font-display);
}

/* ==========================================================================
   Cart panel
   ========================================================================== */

.cart-panel {
  width: var(--cart-width);
  flex-shrink: 0;
  background: var(--color-surface-raised);
  border-left: 2px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5) var(--space-2);
  flex-shrink: 0;
}

.cart-header h2 {
  font-size: var(--text-xl);
}

.cart-badge {
  background: var(--color-primary);
  color: #0E0E0C;
  font-size: var(--text-sm);
  font-weight: 700;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  min-width: 28px;
  text-align: center;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) var(--space-4);
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  gap: var(--space-3);
}

.cart-empty-icon {
  font-size: 2.5rem;
  opacity: 0.4;
}

.cart-item {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
}

.cart-item:last-child {
  border-bottom: none;
}

.cart-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-2);
  gap: var(--space-2);
}

.cart-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: break-word;
}

.cart-item-subtotal {
  color: var(--color-primary-light);
  font-weight: 700;
  font-family: var(--font-display);
  white-space: nowrap;
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.btn-qty {
  width: 52px;
  height: 52px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-size: var(--text-2xl);
  font-weight: 700;
  cursor: pointer;
  transition: background var(--duration-fast), border-color var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-qty:active {
  background: var(--color-secondary);
  border-color: var(--color-primary);
}

.cart-item-qty {
  font-size: var(--text-xl);
  font-weight: 700;
  min-width: 32px;
  text-align: center;
}

.btn-remove {
  margin-left: auto;
  width: var(--touch-min);
  height: var(--touch-min);
  border: 2px solid var(--color-danger);
  border-radius: var(--radius-sm);
  background: var(--color-danger-bg);
  color: var(--color-danger);
  cursor: pointer;
  transition: background var(--duration-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:active {
  background: #f5c6c2;
}

.btn-remove .icon {
  width: 20px;
  height: 20px;
}

.cart-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 2px solid var(--color-border);
  flex-shrink: 0;
  background: var(--color-surface);
}

.cart-total-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: var(--space-4);
}

.cart-total {
  font-size: var(--text-4xl);
}

.cart-total.bump {
  animation: totalBump 0.35s var(--ease-out);
}

.cart-actions {
  display: flex;
  gap: var(--space-3);
}

/* ==========================================================================
   Admin
   ========================================================================== */

.screen-admin {
  overflow-y: auto;
}

.admin-layout {
  display: flex;
  gap: var(--space-6);
  padding: var(--space-6);
  height: calc(100vh - var(--nav-height));
  overflow: hidden;
}

.admin-form-panel,
.admin-list-panel {
  flex: 1;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--space-6);
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.admin-list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
  position: sticky;
  top: 0;
  background: var(--color-surface);
  padding-bottom: var(--space-3);
  z-index: 1;
}

.admin-count {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  background: var(--color-surface-raised);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-base);
  min-height: var(--touch-min);
  background: var(--color-surface-raised);
  color: var(--color-text);
  font-family: var(--font);
}

.form-group input::placeholder {
  color: var(--color-text-muted);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(201, 147, 46, 0.2);
}

.form-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4);
  background: var(--color-surface-raised);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  transition: border-color var(--duration-fast);
}

.product-row:active {
  border-color: var(--color-primary);
}

.product-row-info {
  flex: 1;
  min-width: 0;
  margin-right: var(--space-3);
}

.product-row-info strong {
  display: block;
  font-size: var(--text-lg);
  margin-bottom: var(--space-1);
  line-height: 1.35;
  overflow-wrap: break-word;
  word-break: break-word;
}

.product-row-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.product-row-price {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--color-primary-light);
  font-weight: 700;
  margin-right: var(--space-4);
}

.product-row-actions {
  display: flex;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* ==========================================================================
   History
   ========================================================================== */

.screen-history {
  overflow: hidden;
}

.history-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--nav-height));
  padding: var(--space-6);
  gap: var(--space-4);
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-shrink: 0;
  gap: var(--space-4);
}

.history-header-text {
  min-width: 0;
}

.history-day-label {
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  text-transform: capitalize;
}

.closed-days-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex-shrink: 0;
}

.closed-day-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-sm);
}

.closed-day-label {
  font-weight: 600;
  color: var(--color-text-muted);
}

.closed-day-stats {
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.history-close-day {
  flex-shrink: 0;
  width: 100%;
}

.history-list {
  flex: 1;
  overflow-y: auto;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.history-row {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  transition: background var(--duration-fast);
  border-left: 4px solid transparent;
}

.history-row.payment-cash {
  border-left-color: var(--color-success);
}

.history-row.payment-card {
  border-left-color: var(--color-accent-teal-light);
}

.history-row-main {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.history-time {
  font-weight: 700;
  font-size: var(--text-lg);
  min-width: 60px;
}

.history-payment {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.badge-cash {
  background: rgba(46, 204, 113, 0.2);
  color: var(--color-success);
}

.badge-card {
  background: rgba(31, 107, 95, 0.3);
  color: #5dcec0;
}

.history-total {
  margin-left: auto;
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary-light);
  font-family: var(--font-display);
}

.history-details {
  margin-top: var(--space-2);
  padding-left: calc(60px + var(--space-4));
}

.history-detail-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-1) 0;
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.4;
}

.history-item-price {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.history-cash-meta {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.history-totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  flex-shrink: 0;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--space-4);
  box-shadow: var(--shadow);
  text-align: center;
  border: 1px solid var(--color-border);
  border-bottom: 4px solid var(--color-border);
}

.stat-card-primary { border-bottom-color: var(--color-primary); }
.stat-card-cash { border-bottom-color: var(--color-success); }
.stat-card-cb { border-bottom-color: var(--color-accent-teal-light); }

.stat-icon {
  width: 20px;
  height: 20px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.total-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 600;
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.total-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-primary-light);
  font-family: var(--font-display);
}

/* ==========================================================================
   Settings
   ========================================================================== */

.screen-settings {
  overflow-y: auto;
}

.settings-layout {
  padding: var(--space-6);
  max-width: 600px;
}

.settings-section {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.settings-hint {
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.settings-danger {
  border-color: rgba(192, 57, 43, 0.4);
}

/* ==========================================================================
   Checkout modal
   ========================================================================== */

.screen-checkout {
  position: fixed;
  inset: 0;
  z-index: 300;
  align-items: center;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(14, 14, 12, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-card {
  width: min(540px, 95vw);
  max-height: 95vh;
  overflow-y: auto;
}

.checkout-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-gold);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow);
}

.checkout-card h2 {
  text-align: center;
  margin-bottom: var(--space-6);
}

.checkout-total-display {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-6);
  padding: var(--space-5);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}

.checkout-total {
  font-size: var(--text-4xl);
}

.segmented-control {
  display: flex;
  background: var(--color-surface-raised);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-border);
}

.segment-btn {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--text-lg);
  font-weight: 700;
  cursor: pointer;
  min-height: var(--touch-min);
  transition: background var(--duration-fast), color var(--duration-fast), box-shadow var(--duration-fast);
}

.segment-btn.active {
  background: var(--color-accent-teal);
  color: #FFFFFF;
  box-shadow: var(--shadow);
}

.cash-section label {
  display: block;
  font-weight: 600;
  margin-bottom: var(--space-3);
  color: var(--color-text-muted);
}

.cash-quick-amounts {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.cash-input {
  width: 100%;
  padding: var(--space-4);
  font-size: var(--text-3xl);
  font-weight: 700;
  font-family: var(--font-display);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  text-align: center;
  margin-bottom: var(--space-4);
  min-height: var(--touch-xl);
  background: var(--color-surface-raised);
  color: var(--color-text);
}

.cash-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(201, 147, 46, 0.2);
}

.cash-input.input-invalid {
  border-color: var(--color-danger);
  animation: inputPulse 0.6s ease;
}

.change-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5);
  background: rgba(46, 204, 113, 0.1);
  border: 2px solid var(--color-success);
  border-radius: var(--radius);
  margin-bottom: var(--space-3);
}

.change-amount {
  font-size: var(--text-3xl);
  color: var(--color-success);
}

.warning-msg {
  color: var(--color-danger);
  font-weight: 600;
  text-align: center;
  margin-bottom: var(--space-2);
}

.cb-info {
  text-align: center;
  color: var(--color-text-muted);
  padding: var(--space-5);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  line-height: 1.5;
}

.checkout-actions {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

/* ==========================================================================
   Ticket / Receipt
   ========================================================================== */

.screen-ticket {
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.ticket-wrapper {
  width: min(480px, 95vw);
}

.ticket-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.receipt-paper {
  background: var(--color-receipt-bg);
  color: var(--color-receipt-text);
  border-radius: var(--radius-sm);
  padding: var(--space-6) var(--space-5);
  box-shadow: var(--shadow);
  position: relative;
}

.receipt-paper::before,
.receipt-paper::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(135deg, var(--color-receipt-bg) 33.33%, transparent 33.33%) 0 0 / 12px 12px,
              linear-gradient(225deg, var(--color-receipt-bg) 33.33%, transparent 33.33%) 0 0 / 12px 12px;
}

.receipt-paper::before {
  top: -8px;
}

.receipt-paper::after {
  bottom: -8px;
  transform: rotate(180deg);
}

.ticket-content {
  background: transparent;
  border: none;
  padding: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
  color: var(--color-receipt-text);
  max-height: 360px;
  overflow-y: auto;
}

.receipt-header {
  text-align: center;
  margin-bottom: var(--space-4);
}

.receipt-brand {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.5px;
}

.receipt-address {
  margin: var(--space-2) 0 0;
  font-size: var(--text-xs);
  line-height: 1.5;
  color: var(--color-text-muted);
}

.receipt-datetime {
  margin: 0 0 var(--space-3);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary-dark);
  text-transform: capitalize;
  text-align: center;
}

.receipt-divider {
  height: 1px;
  background: repeating-linear-gradient(
    90deg,
    var(--color-border-gold) 0,
    var(--color-border-gold) 4px,
    transparent 4px,
    transparent 8px
  );
  margin: var(--space-3) 0;
}

.receipt-items {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.receipt-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.receipt-line-name {
  flex: 1;
  min-width: 0;
}

.receipt-line-price {
  font-weight: 600;
  white-space: nowrap;
}

.receipt-line-total {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary-dark);
}

.receipt-line-total span:last-child {
  color: var(--color-primary);
}

.receipt-line-payment {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
}

.receipt-line-muted {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.receipt-thanks {
  margin: var(--space-5) 0 0;
  text-align: center;
  font-style: italic;
  font-size: var(--text-sm);
  color: var(--color-primary-dark);
}

.ticket-email-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ticket-email-form label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
}

.ticket-email-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--text-lg);
  min-height: var(--touch-min);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font);
}

.ticket-email-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(201, 147, 46, 0.2);
}

.ticket-actions {
  display: flex;
  gap: var(--space-3);
}

/* ==========================================================================
   Update banner
   ========================================================================== */

.update-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  background: var(--color-primary-dark);
  color: var(--color-primary);
  border-bottom: 2px solid var(--color-gold);
  box-shadow: var(--shadow);
}

.update-banner[hidden] {
  display: none !important;
}

.update-banner-text {
  font-size: var(--text-sm);
  font-weight: 600;
}

.update-banner .btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  min-height: 36px;
  flex-shrink: 0;
}

body.has-update-banner #app {
  padding-top: 52px;
}

/* ==========================================================================
   Toast
   ========================================================================== */

.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-surface);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-border-gold);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: var(--text-sm);
  z-index: 9999;
  opacity: 0;
  transition: opacity 300ms var(--ease-out), transform 300ms var(--ease-out);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

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

.empty-msg {
  color: var(--color-text-muted);
  text-align: center;
  padding: var(--space-8);
  font-style: italic;
}

/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes tileFlash {
  0% { box-shadow: 0 0 0 4px var(--color-primary-light); }
  100% { box-shadow: var(--shadow); }
}

@keyframes totalBump {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes btnPulse {
  0%, 100% { box-shadow: var(--shadow-glow); }
  50% { box-shadow: 0 0 30px rgba(201, 147, 46, 0.45); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@keyframes inputPulse {
  0%, 100% { box-shadow: none; }
  50% { box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.3); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .nav-label {
    display: none;
  }

  .nav-btn {
    padding: var(--space-2);
  }
}

@media (max-width: 768px) {
  :root {
    --cart-width: 100%;
  }

  .order-layout {
    flex-direction: column;
    height: auto;
  }

  .cart-panel {
    border-left: none;
    border-top: 2px solid var(--color-border-gold);
    max-height: 42vh;
  }

  .admin-layout {
    flex-direction: column;
    height: auto;
  }

  .history-totals {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .product-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
}
