:root {
  --primary: #f59e0b;
  --primary-hover: #d97706;
  --primary-dark: #b45309;
  --bg-main: #0b1120;
  --card-bg: #1e293b;
  --card-border: #334155;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-green: #10b981;
  --accent-red: #ef4444;
  --accent-blue: #38bdf8;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", Monaco, Inconsolata, "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  padding-bottom: 85px; /* Espacio para barra de navegación inferior en celular */
  overflow-x: hidden;
}

/* Header */
.app-header {
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
  border-bottom: 2px solid var(--primary);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.header-content {
  max-width: 650px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.header-logo {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--primary);
  background: #fff;
  object-fit: cover;
}
.header-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}
.header-subtitle {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.header-badge {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 4px 8px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Main Container */
.container {
  max-width: 650px;
  margin: 0 auto;
  padding: 16px;
}

/* Tab Screens */
.screen-tab {
  display: none;
  animation: fadeIn 0.2s ease-in;
}
.screen-tab.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Cards */
.card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Termómetro / Progress Bar */
.kpi-gauge {
  background: #0f172a;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid #334155;
  margin-bottom: 14px;
}
.gauge-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}
.gauge-target {
  color: var(--primary);
}
.progress-bar-bg {
  width: 100%;
  height: 18px;
  background: #1e293b;
  border-radius: 10px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b 0%, #10b981 100%);
  border-radius: 10px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}
.gauge-footer {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Grid de Métricas */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.kpi-box {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fff;
}
.kpi-value.green { color: var(--accent-green); }
.kpi-value.amber { color: var(--primary); }
.kpi-value.blue { color: var(--accent-blue); }
.kpi-desc {
  font-size: 0.68rem;
  color: #64748b;
  margin-top: 4px;
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 14px;
}
.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-control {
  width: 100%;
  padding: 12px 14px;
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 10px;
  color: #fff;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2);
}
select.form-control {
  cursor: pointer;
}

/* Botones Rápidos (Tiras) */
.quick-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.chip-btn {
  flex: 1;
  min-width: 90px;
  background: #0f172a;
  border: 1px solid #334155;
  color: var(--text-main);
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s;
}
.chip-btn.active, .chip-btn:hover {
  background: var(--primary);
  color: #000;
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(245, 158, 11, 0.3);
}

/* Buttons Generales */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all 0.2s;
}
.btn-primary {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #000;
  box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}
.btn-primary:active {
  transform: scale(0.98);
}
.btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #fff;
}
.btn-secondary {
  background: #334155;
  color: #fff;
}
.btn-sm {
  padding: 8px 12px;
  font-size: 0.8rem;
  border-radius: 8px;
  width: auto;
}

/* Lista de Tiendas / Directorio */
.search-bar {
  margin-bottom: 14px;
  position: relative;
}
.store-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.store-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
}
.store-card:hover {
  border-color: var(--primary);
  background: #253349;
}
.store-info h4 {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.store-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.store-tag {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  background: #334155;
  color: var(--primary);
  margin-top: 4px;
}
.store-status {
  text-align: right;
}
.traffic-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 4px;
}
.light-green { background: var(--accent-green); box-shadow: 0 0 6px var(--accent-green); }
.light-amber { background: var(--primary); box-shadow: 0 0 6px var(--primary); }
.light-red { background: var(--accent-red); box-shadow: 0 0 6px var(--accent-red); }

/* Bottom Nav Bar (Estilo App Móvil) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #0f172a;
  border-top: 1px solid #334155;
  display: flex;
  justify-content: space-around;
  padding: 8px 6px;
  z-index: 99;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.4);
}
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 700;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 12px;
  transition: all 0.2s;
  cursor: pointer;
}
.nav-item.active {
  color: var(--primary);
  background: rgba(245, 158, 11, 0.12);
}
.nav-icon {
  font-size: 1.25rem;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-overlay.active {
  display: flex;
}
.modal-box {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 18px;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

/* Ticket Térmico 58mm (Estilo Papel) */
.ticket-paper {
  background: #fff;
  color: #000;
  font-family: var(--mono);
  padding: 16px 14px;
  border-radius: 4px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  font-size: 12px;
  line-height: 1.35;
  max-width: 320px;
  margin: 0 auto 16px auto;
  border-bottom: 4px dashed #94a3b8;
}
.ticket-header {
  text-align: center;
  border-bottom: 1px dashed #000;
  padding-bottom: 10px;
  margin-bottom: 10px;
}
.ticket-logo {
  max-width: 120px;
  height: auto;
  margin-bottom: 4px;
  filter: grayscale(100%) contrast(150%);
}
.ticket-h1 {
  font-size: 15px;
  font-weight: 900;
  text-transform: uppercase;
}
.ticket-h2 {
  font-size: 11px;
  font-weight: bold;
}
.ticket-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}
.ticket-row.bold {
  font-weight: bold;
}
.ticket-divider {
  border-bottom: 1px dashed #000;
  margin: 8px 0;
}
.ticket-footer {
  text-align: center;
  font-size: 10px;
  margin-top: 10px;
  border-top: 1px dashed #000;
  padding-top: 8px;
}

/* Impresión Térmica ESC/POS (58mm) */
@media print {
  body * {
    visibility: hidden;
  }
  #printable-ticket, #printable-ticket * {
    visibility: visible;
  }
  #printable-ticket {
    position: absolute;
    left: 0;
    top: 0;
    width: 58mm !important;
    margin: 0 !important;
    padding: 2mm !important;
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    border: none !important;
  }
  @page {
    size: 58mm auto;
    margin: 0mm;
  }
}

/* Nuevos Estilos: Selector de Precios Promo/Normal y Stepper de Sabores */
.price-mode-chips, .package-chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}
.price-btn, .pkg-btn {
  background: #0f172a;
  border: 2px solid #334155;
  color: var(--text-main);
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  transition: all 0.2s ease;
}
.price-btn.active, .pkg-btn.active {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.15);
  color: #fff;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.25);
}
.price-btn .promo-tag {
  display: block;
  font-size: 0.7rem;
  color: var(--accent-green);
  font-weight: 600;
  margin-top: 2px;
}
.flavor-card {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 14px;
}
.flavor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.flavor-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.flavor-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1e293b;
  padding: 8px 12px;
  border-radius: 8px;
}
.flavor-name {
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.flavor-stepper {
  display: flex;
  align-items: center;
  gap: 10px;
}
.stepper-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #475569;
  background: #334155;
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
}
.stepper-btn:active {
  background: var(--primary);
  transform: scale(0.95);
}
.flavor-count {
  min-width: 24px;
  text-align: center;
  font-weight: 700;
  font-size: 0.95rem;
  color: #fff;
}
