/**
 * css/app-dashboard.css — Dashboard adaptativo SaaS
 * Namespace: .dash-*  (reemplaza legacy .appdash__)
 * Tema: claro — fondo blanco/gris, acentos índigo
 */

/* ── Reset / base ─────────────────────────────────────────── */
.dash,
.dash * {
  box-sizing: border-box;
}

.dash .material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  vertical-align: middle;
  line-height: 1;
}

/* ── Root container ───────────────────────────────────────── */
.dash {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  background: #f1f5f9;
  color: #0f172a;
  font-family: 'Inter', system-ui, sans-serif;
  contain: layout style;
}

.dash-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 20px 28px;
  gap: 18px;
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 768px) {
  .dash-inner {
    padding: 28px 32px 36px;
    gap: 22px;
  }
}

/* ── Header row ───────────────────────────────────────────── */
.dash-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-greeting {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dash-h1 {
  margin: 0;
  font-size: clamp(1.35rem, 3.5vw, 2rem);
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.dash-meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #64748b;
  text-transform: capitalize;
}

.dash-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.dash-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
}

.dash-chip--accent {
  color: #4338ca;
  background: #eef2ff;
  border-color: #c7d2fe;
}

.dash-btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(15,23,42,0.06);
  transition: background 0.15s, box-shadow 0.15s;
  flex-shrink: 0;
}

.dash-btn-refresh:hover {
  background: #f8fafc;
  box-shadow: 0 3px 8px rgba(15,23,42,0.1);
}

.dash-btn-refresh:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── KPI row ──────────────────────────────────────────────── */
.dash-kpis {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.dash-kpi {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
  transition: box-shadow 0.2s;
}

.dash-kpi:hover {
  box-shadow: 0 4px 16px rgba(15,23,42,0.08);
}

.dash-kpi--alert {
  background: #fef2f2;
  border-color: #fecaca;
}

.dash-kpi-val {
  font-size: 1.75rem;
  font-weight: 900;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -0.03em;
}

.dash-kpi-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #94a3b8;
}

/* ── Body layout (brand card + sidebar) ───────────────────── */
.dash-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  flex: 1;
  min-height: 0;
  align-items: start;
}

@media (max-width: 1100px) {
  .dash-body {
    grid-template-columns: 1fr 300px;
  }
}

@media (max-width: 860px) {
  .dash-body {
    grid-template-columns: 1fr;
  }
}

/* ── Brand card ───────────────────────────────────────────── */
.dash-brand-card {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 4px 24px rgba(15,23,42,0.08);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (min-width: 861px) {
  .dash-brand-card {
    min-height: 480px;
    position: sticky;
    top: 16px;
  }
}

.dash-brand-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 55% 35%, var(--brand, #6366f1) 0%, transparent 68%);
  opacity: 0.07;
  pointer-events: none;
}

.dash-brand-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px 32px;
  text-align: center;
  width: 100%;
}

.dash-brand-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
}

.dash-brand-logo {
  max-height: 160px;
  max-width: 280px;
  width: auto;
  object-fit: contain;
  border-radius: 12px;
  filter: drop-shadow(0 4px 16px rgba(15,23,42,0.10));
}

.dash-brand-monogram {
  width: 120px;
  height: 120px;
  border-radius: 28px;
  background: var(--brand, #6366f1);
  color: #fff;
  font-size: 52px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 32px rgba(99,102,241,0.25);
  letter-spacing: -0.02em;
}

.dash-brand-title {
  font-size: 1.5rem;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.03em;
  margin: 0;
  line-height: 1.2;
}

.dash-brand-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.dash-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.dash-brand-pill--accent {
  color: #4338ca;
  background: #eef2ff;
  border-color: #c7d2fe;
}

.dash-brand-pill .material-symbols-outlined {
  font-size: 13px !important;
}

.dash-brand-date {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  text-transform: capitalize;
}

/* ── Sidebar column ───────────────────────────────────────── */
.dash-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Widget cards ─────────────────────────────────────────── */
.dash-widget {
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15,23,42,0.05);
}

.dash-widget-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
}

.dash-widget-head .material-symbols-outlined {
  font-size: 16px;
  color: #94a3b8;
  flex-shrink: 0;
}

.dash-widget-head h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  margin: 0;
  flex: 1;
}

.dash-widget-link {
  font-size: 10px;
  font-weight: 600;
  color: #6366f1;
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.12s;
}

.dash-widget-link:hover {
  color: #4338ca;
  text-decoration: underline;
}

.dash-widget-body {
  padding: 12px 14px 14px;
}

.dash-widget-empty {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  text-align: center;
  padding: 8px 0;
}

/* ── Cuadre / estado del patio ────────────────────────────── */
.dash-cs-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}

.dash-cs-stat {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-cs-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dash-cs-label {
  font-size: 12px;
  color: #64748b;
  flex: 1;
}

.dash-cs-val {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}

.dash-cs-bar {
  display: flex;
  height: 5px;
  border-radius: 3px;
  overflow: hidden;
  background: #f1f5f9;
  margin-bottom: 8px;
  gap: 1px;
}

.dash-cs-bar > div {
  height: 100%;
  transition: width 0.5s ease;
}

.dash-cs-avail {
  font-size: 11px;
  color: #64748b;
}

.dash-cs-avail strong {
  color: #16a34a;
}

/* ── Cola de preparación ──────────────────────────────────── */
.dash-cola-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 12px;
}

.dash-cola-row:last-child {
  border-bottom: none;
}

.dash-cola-mva {
  font-weight: 800;
  color: #0f172a;
  min-width: 48px;
  font-size: 12px;
}

.dash-cola-info {
  color: #64748b;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.dash-cola-prog {
  font-size: 11px;
  color: #16a34a;
  font-weight: 700;
  white-space: nowrap;
}

/* ── Turno widget ─────────────────────────────────────────── */
.dash-turno-active {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.dash-turno-ico {
  font-size: 22px !important;
  color: #16a34a;
  flex-shrink: 0;
}

.dash-turno-elapsed {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1.2;
}

.dash-turno-since {
  font-size: 10px;
  color: #64748b;
  margin-top: 2px;
}

.dash-turno-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s, transform 0.1s;
  margin-top: 4px;
}

.dash-turno-btn .material-symbols-outlined {
  font-size: 15px !important;
}

.dash-turno-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

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

.dash-turno-btn--start {
  background: #f0fdf4;
  color: #16a34a;
  border-color: #bbf7d0;
}

.dash-turno-btn--start:hover:not(:disabled) {
  background: #dcfce7;
}

.dash-turno-btn--end {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fecaca;
}

.dash-turno-btn--end:hover:not(:disabled) {
  background: #fee2e2;
}

@keyframes dashPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(16,185,129,0.5); }
  50%       { opacity: 0.7; box-shadow: 0 0 0 5px rgba(16,185,129,0); }
}

/* ── Turno widget enhancements ────────────────────────────── */
.dash-turno-widget {
  border-color: #c7d2fe;
  background: linear-gradient(135deg, #f8f8ff 0%, #fff 100%);
}

.dash-turno-widget .dash-widget-head .material-symbols-outlined {
  color: #6366f1;
}

.dash-turno-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
  animation: dashPulse 2s ease-in-out infinite;
}

.dash-turno-active-info {
  flex: 1;
}

.dash-turno-rest {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #6366f1;
  font-weight: 700;
  margin-top: 2px;
}

.dash-turno-hint {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 10px;
  line-height: 1.4;
}

.dash-turno-schedule {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}

.dash-turno-sch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #475569;
}

.dash-turno-sch-row strong {
  color: #0f172a;
}

/* ── Equipo en turno ──────────────────────────────────────── */
.dash-equipo-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: #6366f1;
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  flex-shrink: 0;
}

.dash-equipo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
}

.dash-equipo-row:last-child {
  border-bottom: none;
}

.dash-equipo-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

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

.dash-equipo-name {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash-equipo-dur {
  font-size: 10px;
  color: #94a3b8;
  margin-top: 1px;
}

.dash-equipo-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  flex-shrink: 0;
}

/* ── Preferred view bar ───────────────────────────────────── */
.dash-pref-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 4px rgba(15,23,42,0.04);
  margin-top: 4px;
}

.dash-pref-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  white-space: nowrap;
}

.dash-pref-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dash-pref-btn {
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.dash-pref-btn:hover {
  background: #f1f5f9;
  color: #475569;
}

.dash-pref-btn--active {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
  font-weight: 700;
}

/* ── Mobile tweaks ────────────────────────────────────────── */
@media (max-width: 600px) {
  .dash-inner {
    padding: 14px 14px 24px;
    gap: 14px;
  }

  .dash-kpi {
    min-width: 100px;
  }

  .dash-kpi-val {
    font-size: 1.4rem;
  }

  .dash-module-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .dash-map-stats {
    gap: 14px;
    padding: 10px 12px;
  }

  .dash-map-stat-val {
    font-size: 1rem;
  }
}
