/* ============================================================
   Boreal Delivery — Panel de administración
   CSS propio (sin dependencias externas)
   ============================================================ */

:root {
    --brand: #0f766e;
    --brand-dark: #115e59;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --card: #ffffff;
    --line: #e2e8f0;
    --ok: #16a34a;
    --warn: #d97706;
    --danger: #dc2626;
    --info: #2563eb;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
    --topbar-h: 56px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 232px; background: #0b1220; color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
    flex-shrink: 0;
}
.sidebar .brand {
    padding: 20px 18px; font-weight: 700; font-size: 17px; color: #fff;
    display: flex; align-items: center; gap: 8px; border-bottom: 1px solid #1e293b;
}
.sidebar .brand .dot {
    width: 10px; height: 10px; border-radius: 50%; background: #2dd4bf;
    box-shadow: 0 0 0 3px rgba(45, 212, 191, .25);
}
.sidebar nav { padding: 12px 8px; flex: 1; overflow-y: auto; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0;
    border-radius: 8px; color: #94a3b8; font-weight: 500;
}
.sidebar nav a:hover { background: #16233b; color: #e2e8f0; text-decoration: none; }
.sidebar nav a.active { background: var(--brand); color: #fff; }
.sidebar .foot { padding: 14px; font-size: 12px; color: #475569; border-top: 1px solid #1e293b; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    background: var(--card); border-bottom: 1px solid var(--line);
    padding: 0 24px; height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar .user { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.content { padding: 24px; max-width: 1240px; width: 100%; margin: 0 auto; }

/* ---------- Alertas ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; border: 1px solid transparent; }
.alert.success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.alert.error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert.info { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }

/* ---------- Tarjetas ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card .card-h {
    padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600;
    display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}
.card .card-b { padding: 18px; }

.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
    .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid.cols-2 { grid-template-columns: 1fr; }
}

/* ---------- Tarjetas de estadísticas ---------- */
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.stat .label { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat .value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.stat.ok .value { color: var(--ok); }
.stat.info .value { color: var(--info); }
.stat.warn .value { color: var(--warn); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #f8fafc; }

/* ---------- Badges / estados ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.green { background: #dcfce7; color: #166534; }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.purple { background: #ede9fe; color: #5b21b6; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
    border: 1px solid transparent; border-radius: 9px; padding: 8px 14px;
    font-size: 13px; font-weight: 600; background: #e2e8f0; color: var(--ink);
    transition: filter .12s ease, background .12s ease; text-decoration: none;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.success { background: var(--ok); color: #fff; }
.btn.info { background: var(--info); color: #fff; }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; }

/* ---------- Formularios ---------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.form-group .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.input, .select, .textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 9px;
    font-size: 14px; font-family: inherit; background: #fff; color: var(--ink);
}
.input:focus, .select:focus, .textarea:focus { outline: 2px solid rgba(15, 118, 110, .35); border-color: var(--brand); }
.textarea { min-height: 140px; font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; line-height: 1.55; }
.textarea.lg { min-height: 380px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 700px) { .row-2 { grid-template-columns: 1fr; } }

/* ---------- Barras de progreso ---------- */
.progress { background: #e2e8f0; border-radius: 999px; height: 8px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.progress.green > span { background: var(--ok); }
.progress.warn > span { background: var(--warn); }

/* ---------- Paginación ---------- */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span.page {
    padding: 6px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
}
.pagination a.current { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination a:hover { border-color: var(--brand); text-decoration: none; }

/* ---------- Login / guest ---------- */
.guest-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0b1220, #134e4a); padding: 24px; }
.guest-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 20px 40px rgba(0,0,0,.3); }
.guest-card .brand { font-size: 20px; font-weight: 800; text-align: center; color: var(--brand-dark); margin-bottom: 4px; }
.guest-card .tagline { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 13px; }

/* ---------- Páginas públicas ---------- */
.public-body { margin: 0; background: #f8fafc; min-height: 100vh; font-family: inherit; display: flex; align-items: center; justify-content: center; padding: 24px; }
.public-card { max-width: 520px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 28px; text-align: center; }
.public-card h1 { margin-top: 0; }

/* ---------- Utilidades ---------- */
.mt-0 { margin-top: 0; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .flex { display: flex; gap: 8px; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.right { text-align: right; } .center { text-align: center; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; }
.monospace { font-family: ui-monospace, Consolas, monospace; }
kbd { background: #f1f5f9; padding: 1px 5px; border-radius: 5px; font-size: 12px; border: 1px solid #cbd5e1; }

/* Editor de contenido */
.merge-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 12px; }
.merge-tags span { background: #e6fffa; color: #115e59; border: 1px solid #99f6e4; padding: 2px 8px; border-radius: 6px; font-size: 12px; }

/* ============================================================
   Móvil y uso táctil
   Panel lateral off-canvas (#nav-toggle + .sidebar.open, movidos
   por js/app.js), objetivos táctiles cómodos y tablas legibles.
   ============================================================ */

/* Botón del menú y capa oscura del cajón */
.nav-toggle { display: none; }
.nav-backdrop {
    position: fixed; inset: 0; z-index: 4;
    background: rgba(7, 15, 29, .52);
    opacity: 0; visibility: hidden;
    transition: opacity .22s ease, visibility .22s ease;
}
body.nav-open .nav-backdrop { opacity: 1; visibility: visible; }
body.nav-open { overflow: hidden; }

.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar h1 { min-width: 0; }

/* Alto real del viewport (barras del navegador móvil) */
@supports (height: 100dvh) {
    .sidebar { height: 100dvh; }
    .guest-wrap, .public-body { min-height: 100dvh; }
}

/* Tabla clave/valor que se apila en pantallas pequeñas */
.col-key { width: 240px; }

@media (max-width: 640px) {
    .table.stack thead { display: none; }
    .table.stack tbody tr { display: block; padding: 10px 0; border-bottom: 1px solid var(--line); }
    .table.stack tbody tr:last-child { border-bottom: 0; padding-bottom: 0; }
    .table.stack tbody td { display: block; border: 0; padding: 2px 0; }
    .table.stack tbody td:first-child { font-weight: 600; color: var(--ink-2); }
    .table.stack .col-key { width: auto; }
}

/* El contenedor de tablas se desliza en horizontal sin rebotar la página */
.table-wrap { -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }

