:root {
    --bp-navy: #14263f;
    --bp-navy-2: #1f3a5f;
    --bp-amber: #f4b400;
    --bp-bg: #f4f6f9;
    --bp-border: #e3e7ee;
}

body { background: var(--bp-bg); font-size: .925rem; color: #1d2733; }
.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 236px; flex-shrink: 0; background: var(--bp-navy); color: #c9d4e3;
    position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: 1rem .75rem;
}
.brand { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem 1.25rem; }
.brand-mark { color: var(--bp-amber); font-size: 1.7rem; line-height: 1; }
.brand-name { color: #fff; font-weight: 700; letter-spacing: .02em; }
.brand-sub { font-size: .75rem; color: #8ea2bd; }
.sidebar .nav-link { color: #c9d4e3; border-radius: .45rem; padding: .5rem .65rem; display: flex; gap: .6rem; align-items: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active { background: var(--bp-navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--bp-amber); }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #6f86a5; margin: 1.1rem .65rem .35rem; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    display: flex; align-items: center; gap: .75rem; background: #fff; border-bottom: 1px solid var(--bp-border);
    padding: .55rem 1.25rem; position: sticky; top: 0; z-index: 10;
}
.topbar-search { position: relative; width: min(360px, 60vw); }
.topbar-search i { position: absolute; left: .6rem; top: 50%; transform: translateY(-50%); color: #8a96a8; }
.topbar-search input { padding-left: 1.9rem; }
.content { padding: 1.25rem 1.5rem 3rem; }

.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }
.page-head h1 { font-size: 1.35rem; margin: 0; font-weight: 650; }
.page-head .acciones { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }

.card { border: 1px solid var(--bp-border); border-radius: .6rem; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; font-weight: 600; border-bottom: 1px solid var(--bp-border); }
.table { margin-bottom: 0; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #5d6b7e; background: #f8fafc; white-space: nowrap; }
.table td { vertical-align: middle; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* KPIs */
.kpi { padding: 1rem 1.1rem; }
.kpi .v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.kpi .l { font-size: .78rem; color: #6b7a8d; text-transform: uppercase; letter-spacing: .05em; }
.kpi-bar { height: 6px; border-radius: 3px; background: #edf0f4; overflow: hidden; display: flex; }
.kpi-bar span { display: block; height: 100%; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1.6rem; border-left: 2px solid var(--bp-border); margin-left: .45rem; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: .2rem; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--bp-navy-2); }
.timeline .t-fecha { font-size: .78rem; color: #6b7a8d; }

/* Escáner */
.scan-box { border: 2px dashed #b8c4d4; border-radius: .75rem; padding: 1rem; background: #fff; transition: border-color .15s, background .15s; }
.scan-box.ok { border-color: #198754; background: #f1fbf5; }
.scan-box.warn { border-color: #f4b400; background: #fffaeb; }
.scan-box.error { border-color: #dc3545; background: #fff4f4; }
.scan-input { font-size: 1.6rem; font-family: ui-monospace, Consolas, monospace; letter-spacing: .06em; text-align: center; }
.scan-ultimo { font-size: 1.05rem; min-height: 1.6rem; text-align: center; margin-top: .5rem; }
.scan-lista { max-height: 52vh; overflow-y: auto; }
.scan-contador { font-size: 2.2rem; font-weight: 700; line-height: 1; }
.fila-error { background: #fff0f0 !important; }
.fila-warn { background: #fffbea !important; }

.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1rem; }
.auth .card { width: min(420px, 100%); }

@media (max-width: 991.98px) {
    .sidebar { position: fixed; left: -260px; z-index: 30; transition: left .2s; }
    .sidebar.open { left: 0; }
    .content { padding: 1rem; }
}
