/* ============================================
   VARIABLES Y RESET
   ============================================ */
:root {
  --bg: #0f0f0f;
  --bg-card: #1a1a2e;
  --bg-card-hover: #1f1f3a;
  --bg-input: #16213e;
  --text: #e0e0e0;
  --text-muted: #8888aa;
  --primary: #6c63ff;
  --primary-hover: #5a52d5;
  --success: #00c853;
  --warning: #ffd600;
  --danger: #ff5252;
  --border: #2a2a4a;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --nav-height: 72px;
  --header-height: 56px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: calc(var(--nav-height) + 16px);
}

[hidden] { display: none !important; }

/* ============================================
   CARGA INICIAL
   ============================================ */
.app-loading-screen {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 42%, rgba(108, 99, 255, .15), transparent 34%),
    linear-gradient(135deg, #0f0f0f 0%, #17172a 100%);
}

.oven-loader {
  display: flex;
  align-items: center;
  flex-direction: column;
  color: var(--text);
  text-align: center;
}

.oven-loader-pizza {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin-bottom: 18px;
  border: 1px solid rgba(129, 122, 255, .32);
  border-radius: 50%;
  background: rgba(26, 26, 46, .86);
  box-shadow: 0 0 32px rgba(108, 99, 255, .2);
  font-size: 43px;
  line-height: 1;
  animation: ovenPizzaTurn 1.2s ease-in-out infinite;
}

.oven-loader strong {
  font-size: 20px;
  letter-spacing: -.01em;
}

.oven-loader small {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 13px;
}

@keyframes ovenPizzaTurn {
  0% { transform: rotate(-12deg) scale(.96); }
  50% { transform: rotate(168deg) scale(1.04); }
  100% { transform: rotate(348deg) scale(.96); }
}

@media (prefers-reduced-motion: reduce) {
  .oven-loader-pizza,
  #delivery-day-summary-shell.is-refreshing::after { animation: none; }
}

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 16px;
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a2e 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 64px;
  margin-bottom: 8px;
}

.login-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 4px;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.login-error {
  color: var(--danger);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 16px;
}

/* ============================================
   APP HEADER
   ============================================ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 1001;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-logo { font-size: 24px; }

.header-title {
  font-size: 16px;
  font-weight: 700;
  display: none;
}

.header-center {
  display: flex;
  flex: 1;
  justify-content: center;
  min-width: 0;
  overflow: hidden;
  padding: 0 14px;
}

.restaurant-select {
  padding: 6px 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  max-width: 250px;
  width: 100%;
}

.restaurant-select-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.restaurant-quick-selector {
  display: flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  overflow-x: auto;
  border-radius: 10px;
  background: rgba(255, 255, 255, .025);
  scrollbar-width: none;
}

.restaurant-quick-selector::-webkit-scrollbar {
  display: none;
}

.restaurant-quick-option {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  white-space: nowrap;
  transition: background .15s, color .15s, box-shadow .15s;
}

.restaurant-quick-option:hover {
  background: rgba(255, 255, 255, .055);
  color: var(--text);
}

.restaurant-quick-option.is-scope {
  color: #b7b8cf;
  font-weight: 750;
}

.restaurant-quick-option.is-active {
  background: rgba(108, 99, 255, .2);
  color: #fff;
  box-shadow: inset 0 -2px 0 #817aff;
}

.restaurant-quick-divider {
  flex: 0 0 auto;
  width: 1px;
  height: 18px;
  margin: 0 5px;
  background: var(--border);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.header-user {
  font-size: 13px;
  color: var(--text-muted);
  display: none;
}

/* ============================================
   NAVEGACIÓN INFERIOR
   ============================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: auto;
}

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-btn.active { color: var(--primary); }
.nav-btn:hover { color: var(--primary); background: rgba(108,99,255,0.1); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 600; }

/* ============================================
   LAYOUT
   ============================================ */
#app-container {
  padding-top: var(--header-height);
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-title {
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 16px;
}

.section-header .section-title { margin-bottom: 0; }

/* ============================================
   CARDS
   ============================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  transition: opacity 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.interactive-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 12px rgba(108, 99, 255, 0.12);
}

.action-card {
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chart-card { padding: 16px; }
.chart-card h3 { margin-bottom: 12px; font-size: 16px; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* ============================================
   SUMMARY CARD
   ============================================ */
.summary-stats {
  display: flex;
  justify-content: space-around;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.stat { text-align: center; }

.stat-number {
  display: block;
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ============================================
   BOTONES
   ============================================ */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--border); color: var(--text); }
.btn-secondary:hover { background: #3a3a5a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #cc4444; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}
.btn-icon:hover { background: rgba(255,255,255,0.1); }

/* ============================================
   FORMULARIOS
   ============================================ */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

.input-with-btn {
  display: flex;
  gap: 8px;
}

.input-with-btn select { flex: 1; }

/* Checkbox group */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

/* ============================================
   MODALES
   ============================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 2000;
  justify-content: center;
  align-items: flex-end;
  padding: 0;
}

.modal.open {
  display: flex;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 24px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  animation: slideUp 0.3s ease;
}

.modal-sm { max-width: 400px; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-header h2 { font-size: 20px; }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0 4px;
}

/* ============================================
   FILTROS Y TABS
   ============================================ */
.filters {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filters select {
  padding: 8px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-card);
  padding: 4px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

.tab {
  flex: 1;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
  min-width: fit-content;
}

.tab.active {
  background: var(--primary);
  color: #fff;
}

.inventory-tabs {
  flex-wrap: nowrap;
  overflow-x: auto;
}

.inventory-delivery-view > .section-header { display: none; }

.inventory-delivery-view .inventory-tabs {
  margin-bottom: 24px;
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.inventory-delivery-view .inventory-tabs .tab {
  padding: 11px 14px;
  border-radius: 0;
}

.inventory-delivery-view .inventory-tabs .tab.active {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 -2px 0 #817aff;
}

.delivery-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.delivery-page-head h2 {
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.05;
}

.delivery-page-head p {
  margin-top: 5px;
  color: var(--text-muted);
  font-size: 14px;
}

.delivery-new-button { min-height: 42px; }

.delivery-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.delivery-kpi {
  display: flex;
  min-height: 80px;
  padding: 14px 16px;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(26, 26, 46, .72);
}

.delivery-kpi span {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 12px;
}

.delivery-kpi strong {
  overflow: hidden;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delivery-kpi.is-warning strong { color: #fbbf24; }

.delivery-filter-row {
  display: flex;
  gap: 7px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.delivery-filter-row::-webkit-scrollbar { display: none; }

.delivery-filter-row button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.delivery-filter-row button:hover,
.delivery-filter-row button.is-active {
  border-color: #817aff;
  color: #fff;
}

.delivery-filter-row button.is-active { background: rgba(108, 99, 255, .12); }

.delivery-filter-row i,
.delivery-db-state i,
.delivery-correct-row i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #64748b;
}

.delivery-filter-row i.is-amber { background: #fbbf24; }
.delivery-filter-row i.is-green,
.delivery-db-state i,
.delivery-correct-row i { background: #4ade80; }

.delivery-date-layout {
  display: grid;
  grid-template-columns: minmax(300px, .85fr) minmax(420px, 1.15fr);
  gap: 14px;
  align-items: stretch;
  margin-bottom: 14px;
}

#delivery-calendar-shell,
#delivery-day-summary-shell {
  min-width: 0;
  max-width: 100%;
}

#delivery-day-summary-shell,
#delivery-records-shell { transition: opacity .12s ease; }

#delivery-day-summary-shell { position: relative; }

#delivery-day-summary-shell.is-refreshing {
  pointer-events: none;
}

#delivery-day-summary-shell.is-refreshing > * {
  opacity: .7;
  transition: opacity .12s ease;
}

#delivery-day-summary-shell.is-refreshing::after {
  position: absolute;
  top: 12px;
  right: 14px;
  content: '🍕';
  font-size: 21px;
  filter: drop-shadow(0 0 7px rgba(108, 99, 255, .5));
  animation: ovenPizzaTurn 1.2s ease-in-out infinite;
}

#delivery-records-shell.is-refreshing {
  opacity: .72;
  pointer-events: none;
}

.delivery-calendar-card,
.delivery-day-summary {
  min-width: 0;
  max-width: 100%;
  height: 100%;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(26, 26, 46, .72);
}

.delivery-calendar-heading,
.delivery-calendar-nav,
.delivery-day-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.delivery-calendar-heading { margin-bottom: 10px; }
.delivery-calendar-heading .task-meta { font-size: 11px; }
.delivery-calendar-heading strong { font-size: 16px; }

.delivery-calendar-today,
.delivery-calendar-nav button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.delivery-calendar-today {
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.delivery-calendar-nav { margin-bottom: 8px; }

.delivery-calendar-nav button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 21px;
  line-height: 1;
}

.delivery-calendar-today:hover,
.delivery-calendar-nav button:hover {
  border-color: var(--primary);
  background: rgba(99, 102, 241, .1);
}

.delivery-calendar-weekdays,
.delivery-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.delivery-calendar-weekdays { margin-bottom: 3px; }

.delivery-calendar-weekdays span {
  padding: 3px 0;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.delivery-calendar-day,
.delivery-calendar-empty {
  aspect-ratio: 1;
  min-width: 0;
}

.delivery-calendar-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
}

.delivery-calendar-day:hover {
  border-color: var(--border);
  background: var(--bg-card-hover);
}

.delivery-calendar-day.is-today { border-color: rgba(129, 122, 255, .65); }

.delivery-calendar-day.is-selected {
  border-color: var(--primary);
  background: rgba(108, 99, 255, .22);
  color: #fff;
  font-weight: 800;
}

.delivery-calendar-status-dot {
  position: absolute;
  bottom: 3px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 7px rgba(74, 222, 128, .8);
}

.delivery-calendar-legend {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 10px;
}

.delivery-calendar-legend i {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px rgba(74, 222, 128, .6);
}

.delivery-day-heading {
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border);
}

.delivery-day-heading > div > span {
  color: var(--text-muted);
  font-size: 11px;
}

.delivery-day-heading h3 {
  margin-top: 3px;
  font-size: clamp(20px, 2.2vw, 27px);
}

.delivery-db-state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #86efac;
  font-size: 11px;
}

.delivery-day-facts {
  display: grid;
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 4px 16px;
  padding: 15px 0 12px;
}

.delivery-day-facts strong { font-size: 18px; }
.delivery-day-facts > span { font-size: 18px; font-weight: 750; text-align: right; }
.delivery-day-facts small { grid-column: 1 / -1; color: var(--text-muted); }

.delivery-restaurant-list {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 9px;
}

.delivery-restaurant-row,
.delivery-breakdown-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) auto;
  gap: 12px;
  padding: 9px 11px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}

.delivery-restaurant-row:last-child,
.delivery-breakdown-row:last-child { border-bottom: 0; }

.delivery-restaurant-empty { padding: 20px 12px; color: var(--text-muted); text-align: center; }

.delivery-attention-row,
.delivery-correct-row {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, .28);
  border-radius: 9px;
  background: rgba(120, 72, 8, .16);
  color: #fbbf24;
  font: inherit;
  font-size: 12px;
  text-align: left;
}

button.delivery-attention-row { cursor: pointer; justify-content: space-between; }

.delivery-correct-row {
  border-color: rgba(74, 222, 128, .2);
  background: rgba(22, 101, 52, .1);
  color: #86efac;
}

.delivery-disclosure-stack { display: grid; gap: 7px; }

.delivery-disclosure {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(26, 26, 46, .58);
}

.delivery-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  list-style: none;
}

.delivery-disclosure summary::-webkit-details-marker { display: none; }
.delivery-disclosure summary > span:first-child { display: flex; align-items: center; gap: 10px; }

.delivery-disclosure-arrow {
  color: var(--text-muted);
  font-size: 22px;
  transition: transform .15s;
}

.delivery-disclosure[open] .delivery-disclosure-arrow { transform: rotate(90deg); }

.delivery-disclosure-icon {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #817aff;
}

.delivery-disclosure-icon.is-chart { border-radius: 50%; }
.delivery-disclosure-icon.is-alert { background: #fbbf24; transform: rotate(45deg); }

.delivery-disclosure-content {
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

.delivery-disclosure-content #delivery-notes-list { padding-top: 12px; }

.delivery-list-limit {
  margin-top: 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(129, 122, 255, .08);
  color: var(--text-muted);
  font-size: 11px;
}

.delivery-breakdown-row {
  grid-template-columns: minmax(150px, 1fr) auto auto;
  padding: 10px 2px;
}

.delivery-alert-item {
  display: flex;
  width: 100%;
  padding: 11px 2px;
  flex-direction: column;
  gap: 3px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.delivery-alert-item span { color: #fbbf24; font-size: 12px; }
.delivery-alert-item:last-child { border-bottom: 0; }

.delivery-loading-shell {
  display: grid;
  place-items: center;
  min-height: min(55vh, 460px);
  padding: 32px 16px;
}

.delivery-loading-shell .oven-loader-pizza {
  width: 64px;
  height: 64px;
  font-size: 36px;
}

@media (max-width: 900px) {
  .delivery-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .delivery-date-layout { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .inventory-delivery-view,
  .inventory-delivery-view #inventory-content {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
  }
  .delivery-page-head { align-items: stretch; flex-direction: column; }
  .delivery-new-button { width: 100%; }
  .delivery-kpi { min-height: 68px; padding: 12px; }
  .delivery-kpi strong { font-size: 20px; }
  .delivery-calendar-card,
  .delivery-day-summary { padding: 14px; }
  .delivery-calendar-heading { flex-wrap: wrap; }
  .delivery-day-heading { align-items: flex-start; flex-direction: column; }
  .delivery-day-facts { grid-template-columns: 1fr; }
  .delivery-day-facts > span { text-align: left; }
  .delivery-breakdown-row { grid-template-columns: 1fr auto; }
  .delivery-breakdown-row strong { grid-column: 1 / -1; }
}

/* ============================================
   LISTAS DE ITEMS
   ============================================ */
.task-group { margin-bottom: 20px; }

.task-group-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
  padding-left: 4px;
}

.task-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: all 0.2s;
  cursor: pointer;
}

.task-item:hover { background: var(--bg-card-hover); }

.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
  transition: all 0.2s;
}

.task-check:hover { border-color: var(--success); }
.task-check.checked { background: var(--success); border-color: var(--success); }
.task-check.checked::after { content: '\2713'; color: #fff; font-size: 12px; font-weight: 700; }

.task-info { flex: 1; min-width: 0; }

.task-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
  word-break: break-word;
}

.task-item.completed .task-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-alta { background: rgba(255,82,82,0.2); color: var(--danger); }
.badge-media { background: rgba(255,214,0,0.2); color: var(--warning); }
.badge-baja { background: rgba(0,200,83,0.2); color: var(--success); }
.badge-laboral { background: rgba(108,99,255,0.2); color: var(--primary); }
.badge-personal { background: rgba(0,200,83,0.2); color: var(--success); }
.badge-overdue { background: rgba(255,82,82,0.3); color: var(--danger); }

.task-actions {
  display: flex;
  gap: 2px;
  flex-shrink: 0;
}

/* ============================================
   HÁBITOS
   ============================================ */
.habit-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all 0.2s;
}

.habit-toggle {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: none;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s;
}

.habit-toggle.done {
  border-color: var(--success);
  background: rgba(0,200,83,0.15);
  transform: scale(1.05);
}

.habit-info { flex: 1; }
.habit-name { font-weight: 600; font-size: 16px; }
.habit-streak { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.habit-actions {
  display: flex;
  gap: 4px;
}

/* Calendar grid */
.calendar-grid {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.calendar-grid h4 {
  font-size: 15px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-day-label {
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-input);
}

.calendar-day.done { background: var(--success); color: #fff; font-weight: 600; }
.calendar-day.has-tasks { background: var(--warning); color: #1a1a2e; font-weight: 600; }
.calendar-day.today { border: 2px solid var(--primary); }
.calendar-day.selected { border: 2px solid #fff; }
.calendar-day.empty { background: transparent; }
.calendar-day.clickable { cursor: pointer; position: relative; }
.calendar-day.clickable:hover { opacity: 0.8; }
.day-count {
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 9px;
  background: rgba(0,0,0,0.4);
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.calendar-legend {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.legend-dot.done { background: var(--success); }
.legend-dot.has-tasks { background: var(--warning); }

/* ============================================
   FITNESS
   ============================================ */
.fitness-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.fitness-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.fitness-stat-icon { font-size: 24px; margin-bottom: 4px; }
.fitness-stat-value { font-size: 20px; font-weight: 800; color: var(--primary); }
.fitness-stat-label { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.chart-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
}

.chart-tab {
  padding: 6px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.chart-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.fitness-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.fitness-item-icon { font-size: 24px; }
.fitness-item-info { flex: 1; }
.fitness-item-value { font-weight: 700; font-size: 15px; }
.fitness-item-date { font-size: 12px; color: var(--text-muted); }

/* ============================================
   COMPACT LIST (Dashboard)
   ============================================ */
.list-compact { font-size: 14px; }

.list-compact-item {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.empty-state {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ============================================
   ALERTAS
   ============================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.alert-warning {
  background: rgba(255,214,0,0.15);
  border: 1px solid rgba(255,214,0,0.3);
  color: var(--warning);
}

.alert-danger {
  background: rgba(255,82,82,0.15);
  border: 1px solid rgba(255,82,82,0.3);
  color: var(--danger);
}

/* ============================================
   ICON PICKER
   ============================================ */
.icon-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.icon-option {
  width: 40px;
  height: 40px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.icon-option.selected { border-color: var(--primary); background: rgba(108,99,255,0.2); }

/* ============================================
   UTILIDADES
   ============================================ */
.mt-1 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* Toast notifications */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 3000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
  max-width: 320px;
}

@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toastOut { from { opacity: 1; } to { opacity: 0; } }

/* Table styles */
table {
  font-size: 14px;
}

table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 599px) {
  .fitness-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-row {
    grid-template-columns: 1fr;
  }
  .summary-stats {
    flex-direction: column;
    gap: 8px;
  }
}

@media (min-width: 600px) {
  .container { padding: 24px; }
  .dashboard-grid { grid-template-columns: repeat(2, 1fr); }
  .summary-card { grid-column: 1 / -1; }
  .chart-card { grid-column: 1 / -1; }
  .modal { align-items: center; padding: 16px; }
  .modal-content { border-radius: var(--radius); }
  .header-title { display: block; }
  .header-user { display: block; }
}

@media (min-width: 768px) {
  .bottom-nav {
    top: var(--header-height);
    bottom: auto;
    border-top: none;
    border-bottom: 1px solid var(--border);
    height: 48px;
  }
  #app-container {
    padding-top: calc(var(--header-height) + 48px);
  }
  body {
    padding-bottom: 0;
  }
  .nav-btn { flex-direction: row; gap: 6px; }
  .nav-label { font-size: 13px; }
  .nav-icon { font-size: 16px; }
}

/* ============================================
   AREAS GRID
   ============================================ */

/* Rompé el max-width de .container sólo cuando entrás a áreas,
   para que el grid pueda centrarse en viewports anchos sin quedar pegado a la izquierda. */
@media (min-width: 961px) {
  #areas.section {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    padding-top: 8px;
  }
}

/* Flexbox + wrap: cada fila se centra sola, así la fila huérfana queda
   perfectamente centrada sin hacks de :nth-child. */
.areas-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: flex-start;
  gap: 14px;
  /* 5 cards × 160px + 4 gaps × 14px + padding 48 = 904px → fija 5 por fila;
     la última fila incompleta queda centrada automáticamente por justify-content. */
  max-width: 904px;
  margin: 0 auto;
  padding: 16px 24px 24px;
}

.area-card {
  flex: 0 0 160px;
  width: 160px;
  aspect-ratio: 4 / 3;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.area-card:hover {
  transform: translateY(-4px);
  border-color: #d4a853;
  box-shadow: 0 10px 28px rgba(212, 168, 83, 0.22);
}

.area-icon {
  font-size: 32px;
  line-height: 1;
  margin-bottom: 8px;
}

.area-label {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: center;
  line-height: 1.2;
}

.area-desc {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.35;
}

/* Tablets: cards un poco más chicas para que entren 3-4 por fila */
@media (max-width: 1023px) {
  .area-card { flex: 0 0 150px; width: 150px; }
}

/* Mobile: 2 por fila, cards fluidas */
@media (max-width: 600px) {
  .areas-grid { gap: 12px; padding: 12px 16px 20px; }
  .area-card {
    flex: 0 0 calc(50% - 6px);
    width: calc(50% - 6px);
    padding: 12px;
  }
  .area-icon { font-size: 28px; }
}

/* ============================================
   MEETINGS MODALS
   ============================================ */
.modal-meetings {
  min-width: 500px;
  max-width: 560px;
}

.meeting-form .form-group {
  margin-bottom: 20px;
}

.meeting-form .form-group label {
  font-size: 14px;
  margin-bottom: 8px;
  display: block;
  color: var(--text);
}

.meeting-form input[type="date"],
.meeting-form input[type="text"],
.meeting-form select,
.meeting-form textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 16px;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}

.meeting-form input:focus,
.meeting-form select:focus,
.meeting-form textarea:focus {
  border-color: var(--primary);
  outline: none;
}

.meeting-form textarea {
  min-height: 100px;
  resize: vertical;
}

.meeting-form .form-actions {
  margin-top: 24px;
  gap: 12px;
}

.meeting-form .form-actions .btn {
  padding: 12px 32px;
  font-size: 16px;
}

.participants-list {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
}

.participant-check {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  flex-shrink: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  user-select: none;
}

.participant-check:has(input:checked) {
  background: #6C5CE7;
  border-color: #6C5CE7;
}

.participant-check:has(input:checked) span {
  color: #fff;
}

.participant-check input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

.participant-check span {
  font-size: 13px;
  color: var(--text-muted);
  transition: color 0.2s;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .modal-meetings {
    min-width: unset;
    max-width: 100%;
    width: 100%;
    margin: 8px;
  }
}

/* ============================================
   LOADING / DISABLED STATES
   ============================================ */
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.spinner-inline {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

select {
  transition: border-color 0.15s ease;
}

/* ============================================
   MARKETING CALENDAR — Adapted from original
   ============================================ */
:root {
  --mk-fuego: #E8775A;
  --mk-voz: #6EA8D8;
  --mk-saber: #76B887;
  --mk-mesa: #D8A460;
  --mk-story: #A882CC;
  --mk-accion: #E8C84A;
  --mk-gold: #D8A460;
  --mk-header: #1a1520;
  --mk-radius: 14px;
  --mk-radius-sm: 8px;
}

/* Container */
.marketing-section { overflow: hidden; }

/* ─── HEADER ─────────────────────────── */
.mk-header {
  background: var(--mk-header);
  border-radius: var(--mk-radius);
  margin-bottom: 12px;
  overflow: hidden;
}
.mk-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 8px;
}
.mk-brand-label {
  font-size: 9px;
  letter-spacing: 3px;
  color: rgba(255,255,255,0.3);
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}
.mk-header-title {
  font-size: 22px;
  font-weight: 600;
  color: #FFF;
  line-height: 1.1;
}
.mk-header-title em {
  color: var(--mk-gold);
  font-style: italic;
}
.mk-header-stats {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mk-stat-pill {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.08);
  padding: 4px 10px;
  border-radius: 20px;
  white-space: nowrap;
}
.mk-sync-dot {
  color: var(--mk-saber);
  animation: mk-pulse 2s infinite;
}
@keyframes mk-pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }

/* Nav row */
.mk-header-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px 12px;
  gap: 12px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(255,255,255,0.06);
}

/* Tabs */
.mk-view-tabs {
  display: flex;
  background: rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 3px;
}
.mk-view-tab {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.5);
  background: none;
  border: none;
  padding: 5px 14px;
  border-radius: var(--mk-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}
.mk-view-tab:hover { color: rgba(255,255,255,0.8); }
.mk-view-tab.active {
  background: var(--mk-gold);
  color: #FFF;
}

/* Nav center */
.mk-nav-center {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mk-nav-arrow {
  width: 30px; height: 30px;
  border-radius: var(--mk-radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: none;
  color: #FFF;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.mk-nav-arrow:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--mk-gold);
}
.mk-nav-label {
  font-size: 18px;
  font-weight: 600;
  color: #FFF;
  min-width: 160px;
  text-align: center;
}
.mk-nav-today {
  font-size: 11px;
  color: var(--mk-gold);
  background: none;
  border: 1px solid rgba(216,164,96,0.3);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.mk-nav-today:hover { background: rgba(216,164,96,0.15); }

/* City filter */
.mk-city-filter {
  display: flex;
  gap: 4px;
}
.mk-filter-btn {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  background: none;
  border: 1px solid rgba(255,255,255,0.1);
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.mk-filter-btn:hover { color: #FFF; border-color: rgba(255,255,255,0.3); }
.mk-filter-btn.active {
  color: var(--mk-gold);
  border-color: var(--mk-gold);
  background: rgba(216,164,96,0.12);
}

/* Toolbar buttons */
.mk-toolbar-buttons {
  display: flex;
  gap: 6px;
}
.mk-tool-btn {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 5px 12px;
  border-radius: var(--mk-radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.mk-tool-btn:hover { color: #FFF; background: rgba(255,255,255,0.12); }
.mk-tool-btn.mk-primary { background: var(--mk-gold); color: #FFF; border-color: var(--mk-gold); }
.mk-tool-btn.mk-primary:hover { filter: brightness(1.1); }
.mk-tool-badge {
  position: absolute;
  top: -5px; right: -5px;
  background: var(--mk-fuego);
  color: #FFF;
  font-size: 9px;
  font-weight: 600;
  min-width: 16px; height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}

/* ─── STATS BAR ──────────────────────── */
.mk-stats-bar {
  display: flex;
  gap: 14px;
  padding: 6px 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.mk-progress-group {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mk-progress-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.mk-progress-label strong { color: var(--text); }
.mk-progress-track {
  width: 100px;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
}
.mk-progress-fill {
  height: 100%;
  background: var(--mk-saber);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 0%;
}
.mk-stats-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mk-stats-title {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.mk-stats-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.mk-type-pill {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
  transition: all 0.2s;
}
.mk-type-pill:hover { border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.9); }
.mk-type-pill .mk-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mk-stats-chip.mk-chip-fuego { background: rgba(232,119,90,0.15); color: var(--mk-fuego); }
.mk-stats-chip.mk-chip-voz { background: rgba(110,168,216,0.15); color: var(--mk-voz); }
.mk-stats-chip.mk-chip-saber { background: rgba(118,184,135,0.15); color: var(--mk-saber); }
.mk-stats-chip.mk-chip-mesa { background: rgba(216,164,96,0.15); color: var(--mk-mesa); }
.mk-stats-chip.mk-chip-story { background: rgba(168,130,204,0.15); color: var(--mk-story); }
.mk-stats-chip.mk-chip-accion { background: rgba(232,200,74,0.15); color: #b09520; }

/* ─── MONTH GRID ─────────────────────── */
.mk-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  width: 100%;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.06);
}
.mk-month-header-cell {
  padding: 8px 4px;
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  background: rgba(255,255,255,0.02);
}
.mk-month-day {
  background: var(--bg-card);
  min-height: 115px;
  padding: 8px 10px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.mk-month-day:hover {
  background: rgba(255,255,255,0.04);
}
.mk-month-day.mk-has-content {
  background: rgba(255,255,255,0.025);
}
.mk-month-day.mk-other-month {
  opacity: 0.3;
  background: rgba(0,0,0,0.1);
}
.mk-month-day.mk-today {
  background: rgba(216,164,96,0.06);
  box-shadow: inset 0 0 0 2px var(--mk-gold);
}

/* Day number */
.mk-day-number {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin-bottom: 6px;
}
.mk-day-number > span:first-child {
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}
.mk-month-day.mk-other-month .mk-day-number > span:first-child { color: var(--text-muted); }
.mk-month-day.mk-today .mk-day-number > span:first-child { color: var(--mk-gold); }
.mk-day-dow {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: lowercase;
  letter-spacing: 0.3px;
}
.mk-today-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mk-gold);
  margin-left: auto;
}

/* Efemeride */
.mk-day-efemeride {
  font-size: 8px;
  color: var(--mk-gold);
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 100%;
  line-height: 1.3;
  opacity: 0.8;
}

/* Chips container */
.mk-day-chips {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 0;
}

/* Overflow indicator */
.mk-day-overflow {
  font-size: 9px;
  color: var(--text-muted);
  padding: 1px 0;
  cursor: pointer;
}
.mk-day-overflow:hover { color: var(--text); }

/* Status indicators row */
.mk-day-indicators {
  display: flex;
  gap: 3px;
  margin-top: auto;
  padding-top: 4px;
}
.mk-day-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.mk-day-indicator.mk-ind-pub { background: var(--mk-saber); }
.mk-day-indicator.mk-ind-pending { background: rgba(255,255,255,0.2); }

/* Quick-add */
.mk-day-add {
  position: absolute;
  bottom: 6px;
  right: 6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.05);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s ease;
  z-index: 2;
}
.mk-month-day:hover .mk-day-add { opacity: 1; }
.mk-day-add:hover {
  background: var(--mk-gold);
  border-color: var(--mk-gold);
  color: #FFF;
  transform: scale(1.1);
}

/* ─── ENTRY CHIPS ────────────────────── */
.mk-entry-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 2px 4px;
  border-radius: 3px;
  font-size: 10.5px;
  line-height: 1.3;
  cursor: grab;
  transition: all 0.15s;
  overflow: hidden;
  max-width: 100%;
  background: none;
  color: rgba(255,255,255,0.75);
}
.mk-entry-chip:active { cursor: grabbing; }
.mk-entry-chip:hover { background: rgba(255,255,255,0.05); color: #FFF; }
.mk-entry-chip.mk-dragging { opacity: 0.4; }

.mk-chip-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.mk-chip-dot.mk-dot-fuego { background: var(--mk-fuego); }
.mk-chip-dot.mk-dot-voz { background: var(--mk-voz); }
.mk-chip-dot.mk-dot-saber { background: var(--mk-saber); }
.mk-chip-dot.mk-dot-mesa { background: var(--mk-mesa); }
.mk-chip-dot.mk-dot-story { background: var(--mk-story); }
.mk-chip-dot.mk-dot-accion { background: var(--mk-accion); }
.mk-chip-dot.mk-dot-reunion { background: var(--mk-accion); border: 1px dashed rgba(232,200,74,0.6); width: 6px; height: 6px; }

.mk-chip-icon { font-size: 10px; flex-shrink: 0; display: none; }
.mk-chip-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
  font-size: 10.5px;
  min-width: 0;
}
.mk-chip-status {
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Chip type colors - minimal, just text color hint */
.mk-chip-fuego { color: rgba(255,255,255,0.75); }
.mk-chip-voz { color: rgba(255,255,255,0.75); }
.mk-chip-saber { color: rgba(255,255,255,0.75); }
.mk-chip-mesa { color: rgba(255,255,255,0.75); }
.mk-chip-story { color: rgba(255,255,255,0.75); }
.mk-chip-accion { color: rgba(255,255,255,0.75); }
.mk-chip-reunion {
  color: rgba(232,200,74,0.7);
  font-style: italic;
}

/* Status dot colors */
.mk-status-idea { background: #555; }
.mk-status-prod { background: var(--mk-voz); }
.mk-status-ready { background: var(--mk-saber); }
.mk-status-pub { background: var(--mk-gold); }

/* Drag over */
.mk-drag-over {
  border-color: var(--mk-gold) !important;
  box-shadow: 0 0 0 2px rgba(216,164,96,0.3) !important;
}

/* ─── WEEK GRID ──────────────────────── */
.mk-week-grid {
  display: grid;
  grid-template-columns: 90px repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border-radius: var(--mk-radius);
  overflow: hidden;
  width: 100%;
}
.mk-week-header-cell {
  background: rgba(255,255,255,0.03);
  padding: 10px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}
.mk-week-type-label {
  background: rgba(255,255,255,0.03);
  padding: 8px;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-muted);
}
.mk-week-cell {
  background: var(--bg-card);
  padding: 5px;
  min-height: 55px;
  cursor: pointer;
  transition: background 0.15s;
}
.mk-week-cell:hover { background: var(--bg-input); }
.mk-today-col { box-shadow: inset 0 0 0 1px var(--mk-gold); }

/* ─── LIST VIEW ──────────────────────── */
.mk-list-group {
  background: var(--bg-card);
  border-radius: var(--mk-radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 8px;
}
.mk-list-date-header {
  padding: 8px 14px;
  background: rgba(255,255,255,0.03);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.mk-list-entry {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
}
.mk-list-entry:hover { background: var(--bg-input); }
.mk-list-entry-icon {
  width: 32px; height: 32px;
  border-radius: var(--mk-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.mk-list-entry-icon.mk-type-fuego { background: rgba(232,119,90,0.15); }
.mk-list-entry-icon.mk-type-voz { background: rgba(110,168,216,0.15); }
.mk-list-entry-icon.mk-type-saber { background: rgba(118,184,135,0.15); }
.mk-list-entry-icon.mk-type-mesa { background: rgba(216,164,96,0.15); }
.mk-list-entry-icon.mk-type-story { background: rgba(168,130,204,0.15); }
.mk-list-entry-icon.mk-type-accion { background: rgba(232,200,74,0.15); }
.mk-list-entry-icon.mk-type-reunion { background: rgba(232,200,74,0.08); border: 1px dashed rgba(232,200,74,0.3); }

/* ─── MODALS ─────────────────────────── */
.mk-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  z-index: 999;
}
.mk-modal-overlay.active { display: block; }
.mk-modal {
  display: none;
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, calc(-50% + 10px)) scale(0.97);
  background: var(--bg-card);
  border-radius: var(--mk-radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  z-index: 1000;
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.mk-modal.active {
  display: block;
  transform: translate(-50%, -50%) scale(1);
}
.mk-modal-large { max-width: 700px; }

.mk-modal .modal-header {
  background: var(--mk-header);
  color: #FFF;
  padding: 16px 20px;
  border-radius: var(--mk-radius) var(--mk-radius) 0 0;
}
.mk-modal .modal-header h2 {
  font-size: 20px;
  font-weight: 600;
}
.mk-modal .modal-close {
  width: 30px; height: 30px;
  border-radius: var(--mk-radius-sm);
  border: 1px solid rgba(255,255,255,0.15);
  background: none;
  color: rgba(255,255,255,0.6);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mk-modal .modal-close:hover { color: #FFF; background: rgba(255,255,255,0.1); }

/* Type/status card active state in modal */
.mk-type-card.active, .mk-status-card.active, .mk-arc-card.active, .mk-format-card.active {
  background: rgba(216,164,96,0.15) !important;
  color: var(--mk-gold) !important;
  border-color: var(--mk-gold) !important;
}

/* ============================================
   AUDITS
   ============================================ */
.audit-items-open { display: block !important; }

/* ============================================
   AUDITORÍAS — checklist propio
   ============================================ */
.aud-topbar {
  position: sticky;
  top: calc(var(--header-height) + 8px);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.aud-topbar-info { display: flex; flex-direction: column; min-width: 0; }
.aud-topbar-score { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.aud-topbar-score strong { font-size: 20px; }
.aud-item { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.aud-item:last-child { border-bottom: 0; }
.aud-item-desc { font-size: 14px; margin-bottom: 10px; line-height: 1.4; }
.aud-item-num { color: var(--text-muted); font-size: 12px; font-weight: 700; margin-right: 4px; }
.aud-res-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.aud-res-btn {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  min-height: 42px;
  padding: 6px 4px;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.aud-res-btn.aud-c.sel { background: rgba(0, 200, 83, .16); border-color: var(--success); color: var(--success); }
.aud-res-btn.aud-m.sel { background: rgba(255, 214, 0, .14); border-color: var(--warning); color: var(--warning); }
.aud-res-btn.aud-nc.sel { background: rgba(255, 82, 82, .14); border-color: var(--danger); color: var(--danger); }
.aud-res-btn.aud-na.sel { background: rgba(136, 136, 170, .18); border-color: var(--text-muted); color: var(--text); }
.aud-extra { display: flex; gap: 8px; align-items: flex-start; }
.aud-extra textarea {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  resize: vertical;
  min-height: 38px;
}
.aud-foto-btn {
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  font-size: 17px;
  height: 38px;
  justify-content: center;
  width: 46px;
}
.aud-foto-btn:hover { border-color: var(--primary); }
/* Cabecera editable al corregir una auditoría ya cerrada */
.aud-edit-campos { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.aud-edit-campos label {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 4px;
  min-width: 140px;
}
/* Sin esto el navegador los pinta blancos con fuente de máquina de escribir */
.aud-edit-campos input,
.aud-edit-general textarea {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 10px;
  width: 100%;
}
.aud-edit-campos input:focus,
.aud-edit-general textarea:focus { border-color: var(--primary); outline: none; }
.aud-fotos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.aud-thumb { position: relative; display: inline-block; }
.aud-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--border); display: block; }
.aud-thumb-open { padding: 0; border: 0; background: none; cursor: zoom-in; display: block; }
.aud-thumb-del {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
}

/* Auditorías — miniaturas del detalle + visor de fotos a pantalla completa */
.aud-detalle-fotos { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.aud-detalle-thumb { padding: 0; border: 0; background: none; cursor: zoom-in; line-height: 0; }
.aud-detalle-thumb img {
  width: 64px; height: 64px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--border);
  transition: transform .12s ease, border-color .12s ease;
}
.aud-detalle-thumb:hover img { transform: scale(1.05); border-color: var(--primary); }

.aud-visor {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(3px);
  padding: 24px 68px 64px;
}
.aud-visor.open { display: flex; }
/* width/height 100% + contain: la foto llena la caja disponible sin poder
   desbordarla nunca (con max-width se escapaba a lo ancho en móvil). */
.aud-visor img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}
.aud-visor-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(20, 20, 30, .72);
  color: #fff;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.aud-visor-nav:hover { background: rgba(60, 60, 90, .9); }
.aud-visor-nav.prev { left: 10px; }
.aud-visor-nav.next { right: 10px; }
.aud-visor-cerrar {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .22);
  background: rgba(20, 20, 30, .72);
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
.aud-visor-cerrar:hover { background: rgba(255, 82, 82, .85); }
.aud-visor-pie {
  position: absolute;
  bottom: 18px;
  left: 0;
  right: 0;
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, .8);
  font-size: 13px;
}
.aud-visor-pie a { color: rgba(255, 255, 255, .65); text-decoration: none; }
.aud-visor-pie a:hover { color: #fff; text-decoration: underline; }

/* Auditorías — filtro por local, KPIs y gráfico */
.aud-filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.aud-filtro-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}
.aud-filtro-chip:hover { border-color: var(--primary); color: var(--text); }
.aud-filtro-chip.sel { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }

.aud-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.aud-kpi {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.aud-kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.aud-kpi-valor { font-size: 26px; font-weight: 700; margin: 2px 0; line-height: 1.15; }
.aud-kpi-extra { font-size: 11px; color: var(--text-muted); }

.aud-chart-card { padding: 16px; margin-bottom: 20px; }
.aud-chart-wrap { position: relative; height: 260px; }
.aud-chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.aud-periodos { display: flex; gap: 6px; flex-wrap: wrap; }
.aud-periodo-chip {
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
}
.aud-periodo-chip:hover { color: var(--text); border-color: var(--primary); }
.aud-periodo-chip.sel { background: var(--bg-input); color: var(--text); border-color: var(--primary); font-weight: 600; }

/* Auditorías — resumen en palabras */
.aud-resumen {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  margin-bottom: 16px;
  font-size: 15px;
  line-height: 1.45;
}
.aud-resumen.ok { border-left: 4px solid var(--success); }
.aud-resumen.alerta { border-left: 4px solid var(--warning); }
.aud-resumen-icono { font-size: 20px; line-height: 1.2; }

/* Auditorías — tarjetas de local (clickeables) */
.aud-locales { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 20px; }
.aud-local-card {
  text-align: left;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  transition: transform .12s ease, border-color .12s ease;
}
.aud-local-card:hover { transform: translateY(-2px); border-color: var(--primary); }
.aud-local-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* Auditorías — qué pasó con lo de la auditoría anterior */
.aud-arrastre { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin: 12px 0 6px; }
.aud-arr { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.aud-arr-n { font-size: 30px; font-weight: 700; line-height: 1.1; }
.aud-arr-l { font-size: 12px; color: var(--text-muted); }
.aud-arr.ok { border-left: 4px solid var(--success); }
.aud-arr.pend { border-left: 4px solid var(--warning); }
.aud-arr.mal { border-left: 4px solid var(--danger); }
.aud-arr.nuevo { border-left: 4px solid #5B8DEF; }

/* Auditorías — matriz punto por punto */
.aud-matriz-wrap { overflow-x: auto; margin-bottom: 20px; }
.aud-matriz { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 13px; min-width: 520px; }
.aud-matriz th { text-align: left; color: var(--text-muted); font-weight: 500; font-size: 12px; padding: 0 8px 6px; }
.aud-matriz th.f { text-align: center; width: 96px; }
.aud-matriz td { padding: 7px 8px; background: var(--bg-card); }
.aud-matriz td:first-child { border-radius: 8px 0 0 8px; }
.aud-matriz td:last-child { border-radius: 0 8px 8px 0; }
.aud-celda { display: block; text-align: center; border-radius: 6px; padding: 5px 0; font-weight: 600; font-size: 12px; cursor: pointer; }
.aud-celda.c-ok { background: rgba(0, 200, 83, .16); color: #39d98a; }
.aud-celda.c-m { background: rgba(255, 179, 0, .18); color: #ffc44d; }
.aud-celda.c-nc { background: rgba(255, 82, 82, .18); color: #ff7b7b; }
.aud-celda.c-na { background: rgba(136, 136, 170, .12); color: var(--text-muted); }

/* Auditorías — puntos a corregir */
.aud-falla {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-card);
}
.aud-falla.grave { border-left: 4px solid var(--danger); }
.aud-falla.media { border-left: 4px solid var(--warning); }
.aud-falla-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.aud-falla-nota { margin-top: 6px; padding: 6px 10px; background: var(--bg-input); border-radius: 6px; font-size: 13px; color: var(--text-muted); }
@media (max-width: 600px) {
  .aud-visor { padding: 16px 8px 58px; }
  .aud-visor-nav { width: 44px; height: 44px; font-size: 26px; }
  .aud-kpi-valor { font-size: 22px; }
  .aud-chart-wrap { height: 220px; }
}
@media (max-width: 600px) {
  .aud-topbar { top: 0; }
  .aud-res-btn { font-size: 11px; min-height: 46px; }
}

/* En móvil el header de sección no puede imponer su ancho de una sola línea
   (min-width: fit-content estiraba todo el panel y generaba scroll lateral). */
@media (max-width: 600px) {
  .section-header { min-width: 0; }
}

/* Auditorías — formulario Nueva auditoría */
.aud-nueva-card { max-width: 480px; margin: 0 auto; padding: 20px; }
.aud-nueva-card h3 { margin-bottom: 4px; }
.aud-form-label {
  color: var(--text-muted);
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  margin: 16px 0 6px;
  text-transform: uppercase;
}
.aud-form-field {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-sizing: border-box;
  color: var(--text);
  display: block;
  font-family: inherit;
  font-size: 15px;
  min-height: 48px;
  min-width: 0;
  padding: 12px;
  width: 100%;
}
input[type="date"].aud-form-field {
  -webkit-appearance: none;
  appearance: none;
  text-align: left;
}
input[type="date"].aud-form-field::-webkit-date-and-time-value { text-align: left; }
.aud-resp-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
.aud-resp-chip {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  min-height: 44px;
  padding: 8px 6px;
  transition: border-color .12s ease, color .12s ease, background .12s ease;
}
.aud-resp-chip.sel {
  background: rgba(108, 99, 255, .16);
  border-color: var(--primary);
  color: #b9b5ff;
}
.aud-nueva-actions { display: flex; gap: 10px; margin-top: 22px; }

/* ============================================
   ESQUELETOS DE CARGA
   Mientras una seccion trae sus datos se dibuja su forma en gris en vez
   de la palabra "Cargando": se ve que esta trabajando y no salta el layout.
   ============================================ */
.esqueleto { padding: 4px 0; }
.esq-linea,
.esq-titulo,
.esq-tarjeta,
.esq-bloque {
  background: linear-gradient(90deg, rgba(255,255,255,.06) 25%, rgba(255,255,255,.13) 37%, rgba(255,255,255,.06) 63%);
  background-size: 400% 100%;
  animation: esq-brillo 1.4s ease-in-out infinite;
  border-radius: 10px;
}
.esq-linea { height: 14px; margin-bottom: 10px; }
.esq-linea.corta { width: 38%; }
.esq-linea.media { width: 62%; }
.esq-titulo { height: 26px; width: 32%; margin-bottom: 18px; border-radius: 8px; }
.esq-fila {
  display: grid;
  /* 150px para que en el celular entren tres y no quede un hueco suelto. */
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.esq-tarjeta { height: 108px; }
.esq-bloque { height: 220px; margin-bottom: 16px; }
.esq-bloque.bajo { height: 130px; }

@keyframes esq-brillo {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@media (max-width: 760px) {
  /* En el celular, dos por fila: evita que quede una tarjeta huérfana. */
  .esq-fila { grid-template-columns: repeat(2, 1fr); }
  .esq-tarjeta { height: 86px; }
  .esq-bloque { height: 180px; }
}

@media (prefers-reduced-motion: reduce) {
  .esq-linea, .esq-titulo, .esq-tarjeta, .esq-bloque { animation: none; }
}

/* ============================================
   VENTAS TPV AGORA
   ============================================ */
.vts-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.vts-filtros select {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  min-width: 180px;
}
.vts-presets { display: flex; gap: 6px; flex-wrap: wrap; }
.vts-preset {
  background: var(--bg-card);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
}
.vts-preset.active {
  background: #d4a853;
  border-color: #d4a853;
  color: #1a1a2e;
  font-weight: 700;
}
.vts-fechas { display: flex; gap: 6px; align-items: center; color: var(--text-muted); }
.vts-fechas input {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 8px;
  font-size: 13px;
}
.vts-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.vts-kpi { padding: 14px 12px; text-align: center; }
.vts-kpi-valor { font-size: 22px; font-weight: 700; color: var(--text); }
.vts-kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.vts-card { padding: 16px; margin-bottom: 14px; }
.vts-card-titulo { font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px; }
.vts-chart { position: relative; height: 240px; }
.vts-dos-columnas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.vts-dos-columnas .vts-card { margin-bottom: 14px; }
.vts-tabla-wrap { overflow-x: auto; }
.vts-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.vts-tabla th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.vts-tabla td { padding: 7px 8px; border-bottom: 1px solid rgba(42,42,74,0.5); }
.vts-tabla tbody tr:last-child td { border-bottom: none; }
.vts-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.vts-tabla th:nth-child(n+2) { text-align: right; }
.vts-tabla th:first-child { text-align: left; }
.vts-muted { color: var(--text-muted); }
.vts-pie { font-size: 12px; color: var(--text-muted); margin: 4px 0 12px; }

@media (max-width: 900px) {
  .vts-kpis { grid-template-columns: repeat(3, 1fr); }
  .vts-dos-columnas { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .vts-kpis { grid-template-columns: repeat(2, 1fr); }
  .vts-kpi-valor { font-size: 18px; }
  .vts-chart { height: 200px; }
}

/* ============================================
   CONTROL DE LECTURA DE ALBARANES
   ============================================ */
.delivery-head-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.rc-screen { min-width: 0; }
.rc-back {
  margin-bottom: 14px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
}
.rc-back:hover { color: #fff; }

.rc-progress {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(26, 26, 46, .72);
}
.rc-progress-text { margin-bottom: 8px; color: var(--text-muted); font-size: 14px; }
.rc-progress-text strong { color: #fff; font-size: 18px; }
.rc-progress-bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--border); }
.rc-progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--success); }

.rc-group { margin-bottom: 14px; }
.rc-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.rc-group-head strong { font-size: 16px; }
.rc-group-head span { color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.rc-group-items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rc-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.rc-item:hover { border-color: #817aff; }
.rc-item-icon { flex: 0 0 auto; font-size: 18px; color: var(--text-muted); }
.rc-item-main { display: flex; flex: 1 1 auto; min-width: 0; flex-direction: column; }
.rc-item-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rc-item-main small { color: var(--text-muted); font-size: 12px; }
.rc-item-state { flex: 0 0 auto; color: var(--text-muted); font-size: 12px; }
.rc-item.is-ok { border-color: rgba(0, 200, 83, .45); }
.rc-item.is-wrong { border-color: rgba(251, 191, 36, .55); }
.rc-item.is-resend { border-color: rgba(129, 122, 255, .55); }

.rc-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.rc-topbar .rc-back { margin-bottom: 0; }
.rc-topbar > span { color: var(--text-muted); font-size: 14px; text-align: right; }

.rc-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
/* En escritorio el control usa todo el ancho del panel (con o sin barra lateral): la foto tiene que leerse.
   Solo mientras la sección visible es la del control. */
@media (min-width: 901px) {
  #app-container .container:has(> .section.active .rc-screen.is-check),
  #app-container .container > .section.active:has(.rc-screen.is-check) { max-width: 1680px; }
}
.rc-doc {
  position: sticky;
  top: calc(var(--header-height) + 12px);
  max-height: calc(100vh - var(--header-height) - 24px);
  overflow-y: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}
.rc-page + .rc-page { margin-top: 14px; }
.rc-page-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
  color: #444;
  font-size: 12px;
}
.rc-page-head a { color: #3b35c9; font-weight: 600; }
.rc-zoom { overflow: auto; border-radius: 4px; }
.rc-img { display: block; width: 100%; height: auto; cursor: zoom-in; }
.rc-zoom.is-zoomed { max-height: calc(100vh - 90px); }
.rc-zoom.is-zoomed .rc-img { width: 220%; max-width: none; cursor: zoom-out; }
.rc-pdf { display: block; width: 100%; height: calc(100vh - var(--header-height) - 80px); min-height: 480px; border: 0; }
.rc-pdf-open {
  display: none;
  padding: 18px;
  border-radius: var(--radius-sm);
  background: #f1f0ff;
  color: #3b35c9;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.rc-data { min-width: 0; }
.rc-meta { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.rc-meta strong { font-size: 18px; }
.rc-meta span { color: var(--text-muted); font-size: 13px; }
.rc-title { margin: 16px 0 8px; color: var(--text-muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }

.rc-doubts {
  margin-bottom: 4px;
  padding: 10px 12px;
  border: 1px solid rgba(251, 191, 36, .45);
  border-radius: var(--radius-sm);
  background: rgba(251, 191, 36, .08);
  font-size: 13px;
}
.rc-doubts summary { cursor: pointer; color: #fbbf24; font-weight: 600; }
.rc-doubts ul { margin: 8px 0 0 18px; }
.rc-doubts li { margin-bottom: 6px; color: var(--text); }

.rc-verdict {
  margin-bottom: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.rc-verdict > span { display: block; margin-top: 2px; color: var(--text-muted); font-size: 12px; }
.rc-verdict ul { margin: 8px 0 0 18px; }
.rc-verdict li { margin-bottom: 4px; }
.rc-verdict s { color: var(--text-muted); }
.rc-verdict p { margin-top: 8px; color: var(--text); white-space: pre-line; }
.rc-verdict.is-ok { border-color: rgba(0, 200, 83, .5); background: rgba(0, 200, 83, .08); }
.rc-verdict.is-wrong { border-color: rgba(251, 191, 36, .55); background: rgba(251, 191, 36, .08); }
.rc-verdict.is-resend { border-color: rgba(129, 122, 255, .55); background: rgba(129, 122, 255, .1); }

.rc-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rc-field {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
}
.rc-field.is-proveedor { grid-column: 1 / -1; }
.rc-field span { color: var(--text-muted); font-size: 12px; }
.rc-field strong { overflow-wrap: anywhere; font-size: 15px; }

.rc-lines { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.rc-line {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(48px, .6fr) minmax(78px, .8fr) minmax(0, .9fr) minmax(0, .9fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  font-size: 14px;
}
.rc-line:first-child { border-top: 0; }
.rc-line > span { min-width: 0; overflow-wrap: anywhere; }
.rc-line > span:nth-child(n+2) { text-align: right; font-variant-numeric: tabular-nums; }
.rc-line > span:nth-child(3) { overflow-wrap: normal; white-space: nowrap; }
/* Al corregir, cada producto va en dos renglones: nombre entero y abajo los números. */
.rc-line.is-editing { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
.rc-line.is-editing .rc-l-name { grid-column: 1 / -1; }
.rc-line.is-editing > span[data-label] { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.rc-line.is-editing > span[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; }
.rc-line-head { background: rgba(255, 255, 255, .03); color: var(--text-muted); font-size: 12px; }
.rc-line.is-doubt { box-shadow: inset 3px 0 0 #fbbf24; background: rgba(251, 191, 36, .06); }
.rc-l-name em { color: #fbbf24; font-size: 11px; font-style: normal; white-space: nowrap; }
.rc-line.is-editing .rc-l-remove { grid-column: 1 / -1; justify-self: start; }
.rc-line.is-removed > span { opacity: .4; text-decoration: line-through; }
.rc-line.is-new { background: rgba(0, 200, 83, .06); }

.rc-line input,
.rc-line select,
.rc-field input {
  width: 100%;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 14px;
}
.rc-line input[inputmode="decimal"] { text-align: right; }
.rc-line input.is-changed,
.rc-line select.is-changed,
.rc-field input.is-changed { border-color: #fbbf24; background: rgba(251, 191, 36, .12); }

.rc-l-remove,
.rc-add-line {
  padding: 4px 0;
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.rc-l-remove:hover,
.rc-add-line:hover { color: #fff; }
.rc-add-line { margin-top: 8px; color: #a5a0ff; font-size: 13px; }

.rc-sum { margin-top: 8px; color: var(--text-muted); font-size: 13px; }
.rc-sum b { color: var(--text); }
.rc-ok { color: var(--success); font-weight: 600; }
.rc-warn { color: #fbbf24; font-weight: 600; }

.rc-verdict-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 18px; }
.rc-verdict-btn {
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
}
.rc-verdict-btn.is-ok { border-color: rgba(0, 200, 83, .6); background: rgba(0, 200, 83, .14); }
.rc-verdict-btn.is-wrong { border-color: rgba(251, 191, 36, .6); background: rgba(251, 191, 36, .12); }
.rc-verdict-btn:hover { filter: brightness(1.2); }
.rc-screen button:disabled { cursor: wait; opacity: .6; }

.rc-form { margin-top: 18px; }
.rc-form label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
.rc-form textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  resize: vertical;
}
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.rc-chips button {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}
.rc-hint { margin-top: 8px; color: var(--text-muted); font-size: 12px; }
.rc-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .rc-layout { grid-template-columns: 1fr; }
  .rc-doc { position: static; max-height: none; }
  .rc-pdf { height: 70vh; min-height: 360px; }
  .rc-group-items { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .delivery-head-actions { flex-direction: column; }
  .rc-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rc-line { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; }
  .rc-line.is-editing { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Los navegadores del celular no muestran un PDF dentro de la página: se abre aparte. */
  .rc-pdf,
  .rc-pdf-link { display: none; }
  .rc-pdf-open { display: block; }
  .rc-line .rc-l-name { grid-column: 1 / -1; font-weight: 600; }
  .rc-line-head { display: none; }
  .rc-line > span[data-label] { display: flex; flex-direction: column; gap: 2px; text-align: left; }
  .rc-line > span[data-label]::before { content: attr(data-label); color: var(--text-muted); font-size: 11px; font-weight: 400; }
  .rc-verdict-buttons { grid-template-columns: 1fr; }
  .rc-actions .btn { flex: 1 1 auto; }
}

/* ============================================
   CONTROL DE COCINA (fotos de las fichas de Google)
   ============================================ */
.coc-cabecera { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.coc-semana { display: flex; align-items: center; gap: 10px; min-width: 0; }
.coc-semana-txt { display: flex; flex-direction: column; min-width: 0; }
.coc-semana-txt strong { font-size: 17px; color: var(--text); }
.coc-semana-txt span { font-size: 12px; color: var(--text-muted); }
.coc-flecha {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
  font-size: 22px; line-height: 1; cursor: pointer;
}
.coc-flecha:disabled { opacity: 0.3; cursor: default; }
.coc-filtros { display: flex; gap: 6px; }
.coc-filtro {
  background: var(--bg-card); color: var(--text-muted); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 14px; font-size: 13px; cursor: pointer;
}
.coc-filtro.activo { background: #d4a853; border-color: #d4a853; color: #1a1a2e; font-weight: 700; }

.coc-locales { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 14px; }
.coc-local { display: flex; flex-direction: column; justify-content: flex-start; text-align: left; margin: 0; padding: 12px 14px; cursor: pointer; color: var(--text); font: inherit; }
.coc-local.activo { border-color: #d4a853; box-shadow: 0 0 0 1px #d4a853; }
.coc-local-nombre { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.coc-local-nums { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; color: var(--text-muted); }
.coc-n-ok { color: var(--success); font-weight: 700; }
.coc-n-fallo { color: var(--danger); font-weight: 700; }
.coc-n-pend { color: #d4a853; font-weight: 700; }
.coc-local-informe { font-size: 12px; color: var(--text-muted); margin-top: 6px; line-height: 1.35; }
.coc-local-informe.ok { color: var(--success); }
.coc-local-informe.alerta { color: #d4a853; }
.coc-local-informe.error { color: var(--danger); }
.coc-local-informe.aviso { color: #d4a853; }
.coc-aviso { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.coc-vacio { padding: 40px 16px; }

.coc-grilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.coc-foto { padding: 0; margin: 0; overflow: hidden; display: flex; flex-direction: column; }
.coc-foto.ok { border-color: rgba(0, 200, 83, 0.45); }
.coc-foto.fallo { border-color: rgba(255, 82, 82, 0.6); }
/* La foto entra completa (sin recorte): el fallo puede estar en un borde. */
.coc-img {
  position: relative; display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1 / 1; width: 100%; padding: 0; border: 0; background: #0b0b12; cursor: zoom-in;
}
.coc-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.coc-sin-foto { color: var(--text-muted); font-size: 13px; padding: 16px; text-align: center; }
.coc-info { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.coc-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--text); }
.coc-local-tag { background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px; padding: 1px 7px; font-size: 12px; font-weight: 700; }
.coc-autor { font-size: 12px; color: var(--text-muted); }
.coc-botones { display: flex; gap: 8px; margin-top: 4px; }
.coc-botones .btn { flex: 1; padding: 11px 10px; font-weight: 700; }
.coc-btn-ok { background: rgba(0, 200, 83, 0.14); color: var(--success); border: 1px solid rgba(0, 200, 83, 0.5); }
.coc-btn-ok:hover { background: rgba(0, 200, 83, 0.24); }
.coc-btn-fallo { background: rgba(255, 82, 82, 0.12); color: var(--danger); border: 1px solid rgba(255, 82, 82, 0.5); }
.coc-btn-fallo:hover { background: rgba(255, 82, 82, 0.22); }
/* Tercera opción, más discreta: la foto no sirve para el control (no es de la cocina). */
.coc-btn-nc { width: 100%; padding: 8px 10px; font-size: 13px; background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.coc-btn-nc:hover { color: var(--text); border-color: var(--text-muted); }
.coc-obs {
  width: 100%; margin-top: 4px; resize: vertical; font: inherit; font-size: 16px;
  background: var(--bg-input); color: var(--text); border: 1px solid var(--danger); border-radius: var(--radius-sm); padding: 8px 10px;
}
.coc-resultado { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; margin-top: 2px; }
.coc-pill {
  align-self: flex-start;
  display: inline-block; font-size: 12px; font-weight: 700; border-radius: 12px; padding: 3px 10px;
  background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border);
}
.coc-pill.ok { background: rgba(0, 200, 83, 0.14); color: var(--success); border-color: rgba(0, 200, 83, 0.5); }
.coc-pill.fallo { background: rgba(255, 82, 82, 0.14); color: var(--danger); border-color: rgba(255, 82, 82, 0.5); }
.coc-obs-txt { margin: 2px 0 0; font-size: 14px; font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.coc-obs.ok { border-color: var(--success); }
.coc-com-txt { margin: 2px 0 0; font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.coc-links { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.coc-quien { font-size: 12px; color: var(--text-muted); }
.coc-link { background: none; border: 0; padding: 2px 0; color: #d4a853; font-size: 13px; cursor: pointer; text-decoration: underline; }

.coc-visor {
  position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 16px; cursor: zoom-out;
}
.coc-visor img { max-width: 100%; max-height: calc(100vh - 70px); object-fit: contain; border-radius: 6px; }
.coc-visor-pie { color: #ccc; font-size: 13px; text-align: center; }

@media (max-width: 599px) {
  .coc-cabecera { flex-direction: column; align-items: stretch; }
  .coc-semana { justify-content: space-between; }
  .coc-semana-txt { align-items: center; text-align: center; }
  .coc-filtros .coc-filtro { flex: 1; }
  .coc-grilla { grid-template-columns: 1fr; }
  .coc-locales { grid-template-columns: 1fr 1fr; gap: 8px; }
  .coc-local { padding: 10px 12px; }
  .coc-local-nombre { font-size: 14px; }
  .coc-local-nums { font-size: 12px; }
}

/* ============================================
   CONTROL DE ALBARANES (lo que leyó Popi; mismas piezas .coc-* que Control de cocina)
   ============================================ */
/* La miniatura muestra la parte de arriba de la hoja (proveedor, número, fecha): el albarán entero se ve en grande. */
.alb-card .coc-img { aspect-ratio: 4 / 3; cursor: pointer; }
.alb-card .coc-img img { object-fit: cover; object-position: top center; }
.alb-mini { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.alb-ver {
  position: absolute; right: 8px; bottom: 8px; pointer-events: none;
  background: rgba(0, 0, 0, 0.75); color: #fff; font-size: 12px; font-weight: 600; border-radius: 12px; padding: 4px 10px;
}
.alb-lectura {
  display: flex; flex-direction: column; gap: 3px; margin-top: 2px; padding: 8px 10px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.alb-prov { font-weight: 700; font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.alb-tipo {
  display: inline-block; margin-right: 6px; padding: 0 6px; vertical-align: 1px;
  font-size: 11px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); border-radius: 6px;
}
.alb-fila { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text-muted); }
.alb-fila > span { min-width: 0; overflow-wrap: anywhere; }
.alb-total { font-size: 16px; color: var(--text); white-space: nowrap; }
.alb-total.vacio { font-size: 13px; color: var(--text-muted); }
.alb-productos { font-size: 12px; color: var(--text-muted); }
.alb-avisos { margin: 4px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; font-size: 12px; line-height: 1.35; color: #d4a853; }
.alb-avisos li::before { content: '⚠️ '; }
.alb-avisos.todos li:not(.grave) { color: var(--text-muted); }
.alb-avisos.todos li:not(.grave)::before { content: 'ℹ️ '; }
.alb-incidencia { margin: 2px 0 0; font-size: 12px; color: var(--text); overflow-wrap: anywhere; }

/* El albarán en grande: original a la izquierda, lo que leyó Popi a la derecha. */
.alb-visor { position: fixed; inset: 0; z-index: 3000; background: var(--bg); display: flex; flex-direction: column; }
.alb-visor-barra {
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
}
.alb-visor-titulo { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.alb-visor-titulo strong { font-size: 16px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alb-visor-titulo span { font-size: 12px; color: var(--text-muted); }
.alb-visor-abrir { flex: none; }
.alb-visor-cerrar {
  width: 38px; height: 38px; flex: none; border-radius: 50%; cursor: pointer;
  background: var(--bg-input); border: 1px solid var(--border); color: var(--text); font-size: 17px;
}
.alb-visor-cuerpo { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(340px, 1fr); }
.alb-visor-doc { overflow: auto; padding: 12px; background: #0b0b12; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.alb-visor-doc canvas,
.alb-visor-doc img { display: block; width: 100%; height: auto; background: #fff; border-radius: 4px; }
.alb-visor-datos { overflow: auto; padding: 16px 16px 0; display: flex; flex-direction: column; gap: 12px; border-left: 1px solid var(--border); }
.alb-visor-datos h3 { margin: 0; font-size: 15px; color: var(--text); }
.alb-campos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.alb-campo {
  display: flex; flex-direction: column; min-width: 0; padding: 6px 8px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.alb-campo span { font-size: 11px; color: var(--text-muted); }
.alb-campo strong { font-size: 14px; color: var(--text); overflow-wrap: anywhere; }
.alb-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.alb-tabla th { padding: 4px 6px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.alb-tabla td { padding: 6px; vertical-align: top; color: var(--text); border-bottom: 1px solid var(--border); }
.alb-tabla :is(td, th):not(:first-child) { text-align: right; white-space: nowrap; }
.alb-tabla small { color: var(--text-muted); }
/* Los botones quedan siempre a mano, abajo de lo leído. */
.alb-visor-acciones { position: sticky; bottom: 0; margin-top: auto; padding: 10px 0 16px; background: var(--bg); border-top: 1px solid var(--border); }

@media (max-width: 899px) {
  .alb-visor-cuerpo { display: block; overflow: auto; padding-bottom: 170px; }
  .alb-visor-doc { overflow: visible; padding: 8px; }
  .alb-visor-datos { overflow: visible; padding: 14px 16px; border-left: 0; border-top: 1px solid var(--border); }
  .alb-campos { grid-template-columns: 1fr 1fr; }
  .alb-visor-acciones {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1; margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg-card);
  }
}
.alb-visor-girar { flex: none; padding: 7px 12px; font-size: 13px; }
@media (max-width: 599px) {
  .alb-visor-barra { flex-wrap: wrap; }
  .alb-visor-titulo { flex-basis: calc(100% - 50px); }
  .alb-visor-cerrar { order: 1; }
  .alb-visor-girar, .alb-visor-abrir { order: 2; }
}

/* Control de albaranes: corrección, reenvío y «Para cargar en Ágora» */
.alb-cambios { margin: 2px 0 0; padding: 0 0 0 16px; font-size: 12px; color: var(--text); display: flex; flex-direction: column; gap: 2px; }
.alb-cambios s { color: var(--text-muted); }
.alb-agora { font-size: 12px; font-weight: 600; color: #d4a853; }
.alb-agora.hecho { color: var(--success); }
.alb-aviso-mal { font-size: 12px; color: var(--danger); }
.alb-revision { font-size: 12px; color: var(--text-muted); overflow-wrap: anywhere; }
.alb-ver-original { align-self: flex-start; }
.alb-btn-cargado { width: 100%; padding: 11px 10px; font-weight: 700; margin-top: 2px; }
.alb-card-agora .alb-tabla { font-size: 12px; }
.alb-card-agora .alb-tabla td { padding: 4px 6px; }
.alb-grilla-agora { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.alb-visor-datos-cuerpo { display: flex; flex-direction: column; gap: 12px; }
.alb-visor-datos-cuerpo h3 { margin: 0; font-size: 15px; color: var(--text); }
.alb-visor .rc-hint { margin: -6px 0 0; font-size: 12px; color: var(--text-muted); }
.alb-visor .rc-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.alb-suma { font-size: 13px; color: var(--text-muted); }
.alb-suma .rc-ok { color: var(--success); font-weight: 700; }
.alb-suma .rc-warn { color: #d4a853; font-weight: 700; }
.alb-visor .rc-form { display: flex; flex-direction: column; gap: 6px; }
.alb-visor .rc-form label { font-size: 13px; font-weight: 600; color: var(--text); }
.alb-visor .rc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.alb-visor .rc-chips button {
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 14px;
  padding: 4px 10px; font-size: 12px; cursor: pointer;
}
@media (max-width: 899px) {
  .alb-visor.corrigiendo .alb-visor-cuerpo { padding-bottom: 240px; }
  .alb-visor .rc-fields { grid-template-columns: 1fr 1fr; }
  .alb-grilla-agora { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  .alb-agora-cabecera .coc-semana-txt { align-items: flex-start; text-align: left; }
}
@media (max-width: 899px) {
  /* 16 px: con menos, el iPhone hace zoom al tocar el campo dentro del visor fijo */
  .alb-visor .rc-field input,
  .alb-visor .rc-line input,
  .alb-visor .rc-line select,
  .alb-visor textarea { font-size: 16px; }
  /* el pie fijo nunca ocupa más de media pantalla: si crece, se desplaza adentro */
  .alb-visor-acciones { max-height: 55vh; overflow-y: auto; }
}
/* cantidad e importe van sin teclado numérico (para poder escribir «-»), pero alineados como los números */
.alb-visor .rc-line input[aria-label="Cantidad"],
.alb-visor .rc-line input[aria-label="Importe"] { text-align: right; }

/* ============================================
   PARA CARGAR EN ÁGORA: vista previa y envío (albaranes-agora.js)
   ============================================ */
/* Con la vista previa abierta, la tarjeta ocupa todo el ancho: a la izquierda el albarán, a la derecha cómo quedaría en Ágora. */
.alb-card-agora.abierta { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); scroll-margin-top: 72px; }
.alb-btn-ver { width: 100%; justify-content: center; padding: 10px; font-weight: 700; background: transparent; color: #d4a853; border: 1px solid rgba(212, 168, 83, 0.6); }
.alb-btn-ver:hover { background: rgba(212, 168, 83, 0.12); }
.alb-envio-fallo { font-size: 12px; color: #d4a853; }
.alb-pill-envio { line-height: 1.4; }

.alb-envio { min-width: 0; padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; border-left: 1px solid var(--border); }
.alb-envio.actualizando { opacity: 0.55; pointer-events: none; }
.alb-envio-esq { height: 220px; margin: 0; }
.alb-envio-titulo { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.alb-envio-titulo h3 { margin: 0; font-size: 15px; color: var(--text); }
.alb-envio-num { font-size: 12px; font-weight: 700; color: var(--text-muted); border: 1px solid var(--border); border-radius: 12px; padding: 2px 9px; }
.alb-envio-motivo { margin: 0; font-size: 14px; color: var(--text); }
.alb-envio-campos { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.alb-envio-falta { color: #d4a853; }
.alb-envio-gris { margin: 0; font-size: 12px; color: var(--text-muted); }
.alb-envio-nota { margin: 0; font-size: 12px; line-height: 1.4; }
.alb-envio-bloqueos { margin: 0; }

.alb-envio-lineas { display: flex; flex-direction: column; }
.alb-envio-linea {
  display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 0.9fr) minmax(0, 0.5fr) minmax(0, 0.9fr);
  gap: 4px 10px; align-items: baseline; padding: 8px 6px; font-size: 13px; color: var(--text); border-bottom: 1px solid var(--border);
}
.alb-envio-linea.cabeza { padding-top: 0; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.alb-envio-linea.bloqueada { background: rgba(212, 168, 83, 0.08); box-shadow: inset 3px 0 0 #d4a853; }
.alb-envio-linea.fuera { color: var(--text-muted); }
.ael-prod { min-width: 0; overflow-wrap: anywhere; }
.ael-prod small { display: block; margin-top: 1px; font-size: 12px; color: var(--text-muted); }
.ael-prod .coc-link { margin-left: 8px; font-size: 12px; color: var(--text-muted); }
.ael-prod .coc-link:hover { color: #d4a853; }
/* Sin producto de Ágora (falta elegirlo, o no va): lo leído ocupa todo el ancho. */
.alb-envio-linea.sin-numeros .ael-prod { grid-column: 1 / -1; }
.alb-envio-linea.sin-numeros .ael-n { display: none; }
.ael-n { text-align: right; white-space: nowrap; }
.ael-u { white-space: normal; overflow-wrap: anywhere; }
.ael-motivos, .alb-envio-linea > .alb-envio-acciones, .alb-envio-linea > .alb-elegir { grid-column: 1 / -1; }
.ael-motivos { margin: 0; }
.alb-envio-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.alb-envio-acciones .btn { padding: 8px 12px; font-size: 13px; }
.alb-btn-elegir { align-self: flex-start; padding: 8px 12px; font-size: 13px; background: rgba(212, 168, 83, 0.14); color: #d4a853; border: 1px solid rgba(212, 168, 83, 0.6); }
.alb-btn-elegir:hover { background: rgba(212, 168, 83, 0.24); }

.alb-envio-totales { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 4px 16px; font-size: 13px; color: var(--text-muted); }
.alb-envio-totales strong { font-size: 15px; color: var(--text); }
.alb-envio-difiere { color: #d4a853; }
.alb-envio-ok { margin: 0; font-size: 13px; font-weight: 600; color: var(--success); }
.alb-btn-mandar { width: 100%; justify-content: center; padding: 12px 10px; font-weight: 700; background: #d4a853; color: #1a1a2e; border: 1px solid #d4a853; }
.alb-btn-mandar:hover { background: #e0b765; }
/* Apagado: el botón dice qué falta, así que se tiene que leer bien. */
.alb-btn-mandar:disabled { opacity: 1; white-space: normal; text-align: center; background: transparent; color: var(--text-muted); border: 1px dashed var(--border); }

.alb-envio-dup, .alb-envio-confirma {
  display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; font-size: 13px; color: var(--text);
  background: rgba(212, 168, 83, 0.08); border: 1px solid rgba(212, 168, 83, 0.6); border-radius: var(--radius-sm);
}
.alb-envio-dup > strong { color: #d4a853; }
.alb-envio-dup-fila { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 10px; }
.alb-envio-dup-fila .btn, .alb-envio-dup > .btn { padding: 8px 12px; font-size: 13px; }
.alb-envio-dup > .btn { align-self: flex-start; }
.alb-envio-confirma p { margin: 0; line-height: 1.45; font-size: 14px; }
.alb-envio-confirma .btn { justify-content: center; text-align: center; }
.alb-envio-confirma .alb-btn-mandar { flex: 2; }

/* Elegir una equivalencia: buscador sobre los maestros de Ágora. */
.alb-elegir { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; padding: 10px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.alb-elegir-titulo { font-size: 12px; font-weight: 600; color: var(--text-muted); overflow-wrap: anywhere; }
.alb-elegir-campo { width: 100%; font: inherit; font-size: 14px; padding: 8px 10px; color: var(--text); background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.alb-elegir-campo:focus { outline: none; border-color: #d4a853; }
.alb-elegir-res { display: flex; flex-direction: column; max-height: 240px; overflow-y: auto; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.alb-elegir-op { padding: 8px 10px; text-align: left; font: inherit; font-size: 13px; color: var(--text); background: none; border: 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.alb-elegir-op:last-child { border-bottom: 0; }
.alb-elegir-op:hover, .alb-elegir-op:focus-visible { background: var(--bg-card-hover); }
.alb-elegir-op small { display: block; font-size: 11px; color: var(--text-muted); }
.alb-elegir-nada { margin: 0; padding: 8px 10px; font-size: 12px; color: var(--text-muted); }
.alb-elegir-elegido { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; font-size: 14px; color: var(--text); }
.alb-elegir-fila { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 8px; }
.alb-elegir-fila label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.alb-elegir-ayuda, .alb-elegir-calc { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }
.alb-elegir-calc { color: var(--text); }
.alb-elegir-calc .rc-ok { color: var(--success); font-weight: 700; }
.alb-elegir-calc .rc-warn { color: #d4a853; font-weight: 700; }

@media (max-width: 899px) {
  .alb-card-agora.abierta { display: flex; }
  .alb-envio { padding: 14px; border-left: 0; border-top: 1px solid var(--border); }
  .alb-envio-campos { grid-template-columns: 1fr 1fr; }
  /* Cada línea en bloque: el producto arriba y los números debajo, con su nombre. */
  .alb-envio-linea.cabeza { display: none; }
  .alb-envio-linea { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 10px 6px; }
  .ael-prod, .ael-motivos, .alb-envio-linea > .alb-envio-acciones, .alb-envio-linea > .alb-elegir { flex-basis: 100%; }
  .ael-n { text-align: left; }
  .ael-n:empty { display: none; }
  .ael-n::before { content: attr(data-label) ' '; font-size: 11px; color: var(--text-muted); }
  .alb-envio-totales { justify-content: flex-start; }
  .alb-elegir-fila { grid-template-columns: 1fr; }
  .alb-envio-dup-fila { grid-template-columns: 1fr; justify-items: start; }
  /* 16 px: con menos, el iPhone hace zoom al tocar el campo */
  .alb-elegir-campo { font-size: 16px; }
}
