:root {
  --brand-primary: #F2B705;
  --brand-hover: #D9A204;
  --brand-soft: #FEF8E1;

  --bg-app: #F8F8F6;
  --bg-card: #FFFFFF;
  --border-subtle: #EAEAE6;
  --text-main: #18181B;
  --text-muted: #71717A;

  --urgent-bg: #FEE2E2;   --urgent-text: #B91C1C;
  --soon-bg: #FFEDD5;     --soon-text: #C2410C;
  --fresh-bg: #DCFCE7;    --fresh-text: #15803D;
  --freezer-bg: #E0F2FE;  --freezer-text: #0369A1;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Plus Jakarta Sans', sans-serif;
}

html {
  background: var(--bg-app);
  border-radius: 0;
}

body {
  background: var(--bg-app);
  color: var(--text-main);
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
  border-radius: 0;
}

#app-shell,
.screen,
.app-header,
.bottom-nav {
  border-radius: 0;
}

.hidden { display: none !important; }

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 20px;
  background: var(--bg-app);
  position: sticky;
  top: 0;
  z-index: 10;
  border-radius: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand-primary);
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
}

/* Contenedores */
.screen { padding: 16px 20px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

/* Botones unificados (minimalista: borde fino, texto e icono) */
.btn,
.btn-dark,
.btn-brand,
.btn-outline {
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid #D4D4D0;
  color: var(--text-main);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn:hover,
.btn-dark:hover,
.btn-brand:hover,
.btn-outline:hover {
  background: var(--brand-soft);
  border-color: var(--brand-primary);
}

.btn:active,
.btn-dark:active,
.btn-brand:active,
.btn-outline:active {
  transform: scale(0.99);
}

.btn svg,
.btn-dark svg,
.btn-brand svg,
.btn-outline svg {
  color: currentColor !important;
}

/* Inputs y etiquetas */
input[type="text"],
input[type="email"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  background: #FFF;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 12px;
}

input[readonly] {
  background: var(--bg-app);
  color: var(--text-muted);
  cursor: not-allowed;
}

.field-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Desplegables (Añadir manualmente, Historial y Datos del cliente) */
.accordion-header {
  width: 100%;
  padding: 16px;
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  text-align: left;
}

.accordion-header svg {
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.accordion-header.open svg {
  transform: rotate(180deg);
  color: var(--text-main);
}

/* Selector Nevera / Congelador */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: var(--border-subtle);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.segmented button {
  padding: 9px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segmented button.active {
  background: #FFF;
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Tarjeta de producto */
.product-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
}

.product-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.product-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
}

.product-name { font-weight: 600; font-size: 0.95rem; }
.product-sub { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Badges de semáforo */
.badge { padding: 4px 10px; border-radius: 99px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-urgent { background: var(--urgent-bg); color: var(--urgent-text); }
.badge-soon { background: var(--soon-bg); color: var(--soon-text); }
.badge-fresh { background: var(--fresh-bg); color: var(--fresh-text); }
.badge-freezer { background: var(--freezer-bg); color: var(--freezer-text); }

/* Ticket cámara y previsualización */
.ticket-actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.preview-frame {
  width: 100%;
  max-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-frame img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  display: block;
}

.preview-frame video {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
}

/* Listas con checkbox */
.check-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.check-row:last-child { border-bottom: none; }

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--text-main);
  cursor: pointer;
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Métricas en Perfil */
.metric-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: var(--brand-soft);
  border: 1px solid #F7E396;
  margin-bottom: 10px;
}

.metric-icon-pill {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #FFF;
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  flex-shrink: 0;
}

.metric-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.metric-value-lg {
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
}

.metrics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.metric-box {
  background: var(--bg-app);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
}

.metric-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.metric-footnote {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Historial en Perfil */
.history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-subtle);
}

.history-row:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.history-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.history-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--bg-app);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-main);
  flex-shrink: 0;
}

/* Navegación inferior */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #FFF;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 10px 0 14px;
  z-index: 20;
}

.nav-item {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.nav-item.active { color: var(--text-main); }
.nav-item.active svg { color: var(--brand-primary); }

/* Modal detalle producto */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(24, 24, 27, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal-sheet {
  background: #FFF;
  width: 100%;
  max-width: 480px;
  border-radius: 20px 20px 0 0;
  padding: 20px;
  max-height: 90vh;
  overflow-y: auto;
}

.quick-dates {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

/* Selector Nevera / Congelador / Despensa */
.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: var(--border-subtle);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 16px;
}

.segmented button {
  padding: 9px 4px;
  border: none;
  border-radius: 9px;
  background: transparent;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}