/* ============================================================
   Panel administrativo global de OmniDate
   Identidad visual propia, claramente distinta del panel del comercio.
   Responsive (escritorio / tablet / móvil) y accesible.
   ============================================================ */

:root {
    --adm-bg: #0f1729;
    --adm-bg-soft: #172136;
    --adm-panel: #ffffff;
    --adm-ink: #1b2436;
    --adm-muted: #64748b;
    --adm-border: #e2e8f0;
    --adm-primary: #4f46e5;
    --adm-primary-ink: #ffffff;
    --adm-accent: #0ea5e9;
    --adm-ok: #16a34a;
    --adm-warn: #d97706;
    --adm-danger: #dc2626;
    --adm-sidebar-w: 250px;
}

.adm-shell {
    display: flex;
    min-height: 100vh;
    background: #f1f5f9;
    color: var(--adm-ink);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* ── Barra lateral ─────────────────────────────────────────── */
.adm-sidebar {
    width: var(--adm-sidebar-w);
    background: linear-gradient(180deg, var(--adm-bg), var(--adm-bg-soft));
    color: #cbd5e1;
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    transform: translateX(0);
    transition: transform .2s ease;
}

.adm-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: 1.1rem 1.2rem;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.adm-brand .adm-brand-badge {
    background: var(--adm-primary);
    color: #fff;
    border-radius: 8px;
    padding: .25rem .5rem;
    font-size: .7rem;
    letter-spacing: .05em;
}

.adm-nav { padding: .75rem .5rem; overflow-y: auto; flex: 1; }
.adm-nav a {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: .6rem .8rem;
    margin: .1rem 0;
    color: #cbd5e1;
    text-decoration: none;
    border-radius: 8px;
    font-size: .92rem;
}
.adm-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.adm-nav a.active { background: var(--adm-primary); color: #fff; }
.adm-nav a i { width: 1.1rem; text-align: center; }

.adm-sidebar-foot {
    padding: .8rem 1rem;
    border-top: 1px solid rgba(255,255,255,.08);
    font-size: .8rem;
    color: #94a3b8;
}
.adm-sidebar-foot button {
    background: transparent;
    border: 1px solid rgba(255,255,255,.2);
    color: #e2e8f0;
    border-radius: 6px;
    padding: .4rem .6rem;
    cursor: pointer;
    width: 100%;
    margin-top: .4rem;
}
.adm-sidebar-foot button:hover { background: rgba(255,255,255,.08); }

/* ── Contenido ─────────────────────────────────────────────── */
.adm-main {
    flex: 1;
    margin-left: var(--adm-sidebar-w);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.adm-topbar {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .8rem 1.2rem;
    background: #fff;
    border-bottom: 1px solid var(--adm-border);
    position: sticky;
    top: 0;
    z-index: 30;
}
.adm-topbar h1 { font-size: 1.15rem; margin: 0; font-weight: 650; }
.adm-topbar .adm-spacer { flex: 1; }
.adm-hamburger {
    display: none;
    background: transparent;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: .4rem .6rem;
    cursor: pointer;
}
.adm-content { padding: 1.2rem; }

/* ── Tarjetas / KPIs ───────────────────────────────────────── */
.adm-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .9rem;
}
.adm-kpi {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 1rem;
}
.adm-kpi .adm-kpi-label { color: var(--adm-muted); font-size: .8rem; }
.adm-kpi .adm-kpi-value { font-size: 1.7rem; font-weight: 700; margin-top: .2rem; }
.adm-kpi .adm-kpi-sub { color: var(--adm-muted); font-size: .78rem; margin-top: .2rem; }

.adm-card {
    background: #fff;
    border: 1px solid var(--adm-border);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
}
.adm-card h2 { font-size: 1rem; margin: 0 0 .8rem; }

/* ── Filtros ───────────────────────────────────────────────── */
.adm-filters { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: .8rem; }
.adm-field { display: flex; flex-direction: column; gap: .2rem; }
.adm-field label { font-size: .75rem; color: var(--adm-muted); }
.adm-field input, .adm-field select {
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    padding: .45rem .6rem;
    font-size: .9rem;
    min-width: 150px;
    background: #fff;
}

/* ── Botones ───────────────────────────────────────────────── */
.adm-btn {
    border: 1px solid var(--adm-border);
    background: #fff;
    border-radius: 8px;
    padding: .45rem .8rem;
    cursor: pointer;
    font-size: .86rem;
    color: var(--adm-ink);
}
.adm-btn:hover { background: #f8fafc; }
.adm-btn.primary { background: var(--adm-primary); border-color: var(--adm-primary); color: #fff; }
.adm-btn.primary:hover { filter: brightness(1.05); }
.adm-btn.danger { border-color: var(--adm-danger); color: var(--adm-danger); }
.adm-btn.danger:hover { background: #fef2f2; }
.adm-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Tablas ────────────────────────────────────────────────── */
.adm-table-wrap { overflow-x: auto; }
table.adm-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.adm-table th, table.adm-table td {
    text-align: left;
    padding: .6rem .7rem;
    border-bottom: 1px solid var(--adm-border);
    white-space: nowrap;
}
table.adm-table th { color: var(--adm-muted); font-weight: 600; font-size: .78rem; text-transform: uppercase; }
table.adm-table tbody tr:hover, table.adm-table tr:hover { background: #f8fafc; }

.adm-badge {
    display: inline-block;
    padding: .15rem .55rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
}
.adm-badge.ok { background: #dcfce7; color: #166534; }
.adm-badge.warn { background: #fef3c7; color: #92400e; }
.adm-badge.danger { background: #fee2e2; color: #991b1b; }
.adm-badge.muted { background: #e2e8f0; color: #475569; }

/* ── Paginación ────────────────────────────────────────────── */
.adm-pager { display: flex; align-items: center; gap: .6rem; margin-top: .8rem; justify-content: flex-end; }
.adm-pager span { color: var(--adm-muted); font-size: .85rem; }

/* ── Estados (carga / vacío / error) ───────────────────────── */
.adm-state { text-align: center; padding: 2rem 1rem; color: var(--adm-muted); }
.adm-state i { font-size: 1.6rem; display: block; margin-bottom: .5rem; }
.adm-error { color: var(--adm-danger); }

/* ── Modal ─────────────────────────────────────────────────── */
.adm-modal-backdrop {
    position: fixed; inset: 0; background: rgba(15,23,41,.55);
    display: flex; align-items: center; justify-content: center; z-index: 60; padding: 1rem;
}
.adm-modal {
    background: #fff; border-radius: 14px; width: 100%; max-width: 460px; padding: 1.3rem;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.adm-modal h3 { margin: 0 0 .3rem; font-size: 1.05rem; }
.adm-modal p { color: var(--adm-muted); font-size: .9rem; margin: 0 0 .8rem; }
.adm-modal textarea, .adm-modal input, .adm-modal select {
    width: 100%; border: 1px solid var(--adm-border); border-radius: 8px; padding: .55rem .7rem; font-size: .92rem;
}
.adm-modal .adm-modal-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1rem; }
.adm-inline-msg { font-size: .85rem; margin-top: .4rem; }
.adm-inline-msg.error { color: var(--adm-danger); }
.adm-inline-msg.ok { color: var(--adm-ok); }

/* ── Acceso denegado ───────────────────────────────────────── */
.adm-gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #f1f5f9; padding: 1rem; }
.adm-gate .adm-gate-card { background: #fff; border-radius: 14px; padding: 2rem; max-width: 420px; text-align: center; border: 1px solid var(--adm-border); }
.adm-gate i { font-size: 2rem; color: var(--adm-warn); }

/* ── Gráfico de barras simple (sin dependencias, accesible) ── */
.adm-bars { display: flex; align-items: flex-end; gap: .4rem; height: 160px; padding-top: .5rem; overflow-x: auto; }
.adm-bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 34px; }
.adm-bar { width: 100%; background: var(--adm-primary); border-radius: 4px 4px 0 0; min-height: 2px; }
.adm-bar-val { font-size: .7rem; color: var(--adm-ink); margin-bottom: .15rem; }
.adm-bar-lbl { font-size: .65rem; color: var(--adm-muted); margin-top: .25rem; white-space: nowrap; transform: rotate(-35deg); transform-origin: top left; }

/* ── Impresión: solo el contenido del informe ──────────────── */
@media print {
    .adm-sidebar, .adm-topbar, .adm-filters, .adm-pager, .adm-scrim { display: none !important; }
    .adm-main { margin-left: 0 !important; }
    .adm-content { padding: 0 !important; }
    .adm-card { border: none !important; }
    body { background: #fff !important; }
}

/* ── Responsive ────────────────────────────────────────────── */
.adm-scrim { display: none; }
@media (max-width: 900px) {
    .adm-sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,.4); }
    .adm-sidebar.open { transform: translateX(0); }
    .adm-main { margin-left: 0; }
    .adm-hamburger { display: inline-flex; }
    .adm-scrim.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
}
