/* ════════════════════════════════════════════════════════════════
   admin-dashboard.css — Convierte el header superior en BARRA LATERAL
   y da el look "dashboard" (estilo de la referencia aprobada).
   Solo VISUAL. Se apoya en los onclick en línea (las funciones intactas).
   Carga DESPUÉS de admin-simple.css.
   • Escritorio (≥ 900px): barra lateral izquierda.
   • Móvil (< 900px): se mantiene el header/menú original (no se toca).
   Reversible: quitar el <link> de app.html.
   ════════════════════════════════════════════════════════════════ */

@media (min-width: 900px) {

  /* ── El header pasa a ser una columna fija a la izquierda ──
     OJO: NO forzamos display (lo controla el JS al iniciar sesión),
     solo cambiamos su posición y forma. */
  .site-header {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    width: 240px; height: 100vh;
    border-right: 1px solid var(--sm-border) !important;
    border-bottom: none !important;
    box-shadow: 0 0 40px -28px rgba(42,35,64,.4) !important;
    overflow-y: auto;
  }

  /* Interior en columna, a lo alto */
  .site-header .header-inner {
    flex-direction: column;
    align-items: stretch;
    max-width: none !important;
    margin: 0 !important;
    height: 100%;
    padding: 22px 14px !important;
    gap: 6px;
  }

  /* Logo arriba — flex:0 evita que crezca y empuje el menú hacia abajo (fix del hueco) */
  .site-header .logo { padding: 4px 8px 14px; flex: 0 0 auto !important; }

  /* La nav ocupa todo el alto y se apila */
  .site-header .header-nav {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    width: 100%;
    flex: 1;                 /* empuja "Cerrar sesión" al fondo */
  }

  /* Cada botón = ítem de barra lateral */
  .site-header .nav-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    justify-content: flex-start;
    padding: 11px 14px !important;
    border-radius: 12px !important;
    font-size: .9rem !important;
    font-weight: 600 !important;
  }
  .site-header .nav-btn.active {
    background: var(--sm-accent) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px -8px var(--sm-accent) !important;
  }

  /* "Cerrar sesión" abajo del todo, separado */
  .site-header .nav-logout {
    margin-top: auto;
    border-top: 1px solid var(--sm-border);
    border-radius: 12px !important;
    color: #d6536a !important;
    background: transparent !important;
  }
  .site-header .nav-logout:hover { background: #fde6e9 !important; color: #d6536a !important; }

  /* En escritorio no hace falta el botón hamburguesa */
  .site-header .menu-toggle { display: none !important; }

  /* ── El contenido se corre a la derecha SOLO cuando el header
        está visible (logueado). En el login no se corre. ── */
  body:has(.site-header:not([style*="none"])) #app { margin-left: 240px; }
  body:has(.site-header:not([style*="none"])) .page-inner { max-width: 1500px; }
}

/* ── Pestañas del admin movidas a la BARRA LATERAL (ítems de menú) ── */
@media (min-width: 900px) {
  /* Etiqueta de grupo "Secciones" */
  .site-header .side-group {
    font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase;
    color: var(--sm-muted); font-weight: 700; padding: 14px 14px 6px;
  }
  /* Cada pestaña como fila del menú */
  .site-header .admin-tab-btn {
    width: 100% !important;
    display: flex !important;
    align-items: center; gap: 10px;
    justify-content: flex-start !important;
    text-align: left !important;
    padding: 10px 14px !important;
    margin: 0 !important;
    border-radius: 12px !important;
    font-size: .88rem !important;
    font-weight: 600 !important;
    color: #6f6885 !important;
    background: transparent !important;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .site-header .admin-tab-btn:hover {
    background: #efeaf8 !important;
    color: var(--sm-accent-dk) !important;
  }
  .site-header .admin-tab-btn.atb-active {
    background: var(--sm-accent) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px -8px var(--sm-accent) !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   DASHBOARD (pestaña Resumen) — look tipo maqueta
   Las tarjetas KPI usan clases (.rsm-kpi-*) → se restilizan sin tocar JS.
   ════════════════════════════════════════════════════════════════ */
.rsm-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 16px !important;
}
@media (max-width: 1200px) { .rsm-kpi-grid { grid-template-columns: repeat(3, 1fr) !important; } }
@media (max-width: 680px)  { .rsm-kpi-grid { grid-template-columns: repeat(2, 1fr) !important; } }

.rsm-kpi,
.rsm-kpi-rose, .rsm-kpi-navy, .rsm-kpi-pink, .rsm-kpi-blue, .rsm-kpi-teal {
  background: #fff !important;
  border: 1px solid var(--sm-border) !important;
  border-radius: 18px !important;
  box-shadow: 0 1px 3px rgba(42,35,64,.05), 0 12px 28px -20px rgba(42,35,64,.22) !important;
  padding: 20px !important;
  color: var(--sm-text) !important;
  position: relative;
  overflow: hidden;
}
/* Franja de color superior según categoría */
.rsm-kpi::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
}
.rsm-kpi-rose::before { background: #e8526a; }
.rsm-kpi-navy::before { background: #2c3e6b; }
.rsm-kpi-pink::before { background: #e91e8c; }
.rsm-kpi-blue::before { background: #1565c0; }
.rsm-kpi-teal::before { background: #0f9d8f; }

.rsm-kpi-val { font-size: 27px !important; font-weight: 800 !important; letter-spacing: -.02em; }
.rsm-kpi-rose .rsm-kpi-val { color: #e8526a !important; }
.rsm-kpi-navy .rsm-kpi-val { color: #2c3e6b !important; }
.rsm-kpi-pink .rsm-kpi-val { color: #e91e8c !important; }
.rsm-kpi-blue .rsm-kpi-val { color: #1565c0 !important; }
.rsm-kpi-teal .rsm-kpi-val { color: #0f9d8f !important; }
.rsm-kpi-lbl { color: var(--sm-muted) !important; font-weight: 700 !important; font-size: 13px !important; margin-top: 2px !important; }

/* Tarjeta con icono circular (estilo maqueta) */
.rsm-kpi.has-ic { display: flex !important; align-items: center; gap: 14px; }
.rsm-kpi.has-ic::before { display: none !important; }
.rsm-kpi-ic {
  width: 52px; height: 52px; border-radius: 15px;
  display: grid; place-items: center; font-size: 23px; flex-shrink: 0;
}
.rsm-kpi-rose .rsm-kpi-ic { background: #fde6ea; }
.rsm-kpi-navy .rsm-kpi-ic { background: #e5e9f4; }
.rsm-kpi-pink .rsm-kpi-ic { background: #fbe0ef; }
.rsm-kpi-blue .rsm-kpi-ic { background: #e1ecfb; }
.rsm-kpi-teal .rsm-kpi-ic { background: #dcf3ef; }
.rsm-kpi-body { display: flex; flex-direction: column-reverse; align-items: flex-start; gap: 2px; }
.rsm-kpi-body .rsm-kpi-val { font-size: 25px !important; }

/* ── Fila de gráficas del Dashboard (barras + dona), estilo maqueta ── */
.dash-charts {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 16px;
  margin: 18px 0;
}
@media (max-width: 900px) { .dash-charts { grid-template-columns: 1fr; } }
.dash-card {
  background: #fff;
  border: 1px solid var(--sm-border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(42,35,64,.05), 0 12px 28px -20px rgba(42,35,64,.22);
}
.dash-card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.dash-card-h h3 { font-size: 16px; font-weight: 700; color: var(--sm-text); }
.dash-canvas { position: relative; height: 250px; }
.dash-canvas canvas { max-height: 250px; }

/* ── Vista "Consultar pedidos" (nueva sección) ── */
#atab-consultar .cs-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
#atab-consultar .cs-head h2 { font-family: 'Playfair Display', serif; font-size: 1.5rem; color: var(--sm-text); margin: 0; }
.cs-search {
  flex: 1; min-width: 220px; max-width: 440px;
  padding: 12px 16px; border: 1px solid var(--sm-border); border-radius: 12px;
  font-family: inherit; font-size: 14px; background: #fff; color: var(--sm-text);
}
.cs-search:focus { outline: none; border-color: var(--sm-accent); box-shadow: 0 0 0 3px #efeaf8; }
.cs-card {
  background: #fff; border: 1px solid var(--sm-border); border-radius: 18px; padding: 6px;
  box-shadow: 0 1px 3px rgba(42,35,64,.05), 0 12px 28px -20px rgba(42,35,64,.22); overflow-x: auto;
}
.cs-table { width: 100%; border-collapse: collapse; }
.cs-table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; color: #9089a6; font-weight: 700; padding: 13px 14px; white-space: nowrap; }
.cs-table td { padding: 13px 14px; font-size: 13.5px; border-top: 1px solid var(--sm-border); color: #2a2340; white-space: nowrap; }
.cs-table tbody tr:hover { background: #faf9fc; }
.cs-badge { display: inline-block; padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.cs-row { cursor: pointer; transition: background .15s; }
.cs-row:hover { background: #f4f1fb !important; }
.cs-who { display: flex; align-items: center; gap: 10px; }
.cs-ava { width: 32px; height: 32px; border-radius: 50%; background: #efeaf8; color: #5a4a8f; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }

/* Fallback en móvil / si NO se movieron: barra de pestañas con scroll limpio */
.admin-tab-nav {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  max-width: 100%;
  scrollbar-width: thin;
}
.admin-tab-nav::-webkit-scrollbar { height: 5px; }
.admin-tab-nav::-webkit-scrollbar-thumb { background: var(--sm-border); border-radius: 3px; }
.admin-tab-nav .admin-tab-btn { white-space: nowrap; flex-shrink: 0; }
