/* BOME — estilos base. Mobile-first: tablet en taller, escritorio en oficina. */
:root {
    --bome-sidebar: #0f172a;
    --bome-sidebar-text: #cbd5e1;
    --bome-sidebar-muted: #64748b;
    --bome-accent: #f59e0b;
    --bome-accent-dark: #b45309;
    --bome-bg: #f1f5f9;
    --bome-radius: .75rem;
    --bs-primary: #1d4ed8;
    --bs-primary-rgb: 29, 78, 216;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--bome-bg); }

.app { display: flex; min-height: 100vh; }

/* ---------- Sidebar ---------- */
.sidebar {
    width: 250px;
    background: var(--bome-sidebar);
    color: var(--bome-sidebar-text);
    flex-shrink: 0;
}
@media (min-width: 992px) {
    .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
    /* Bootstrap deja offcanvas-lg transparente en pantallas anchas. */
    .sidebar.offcanvas-lg { background-color: var(--bome-sidebar) !important; }
}
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--bome-sidebar); --bs-offcanvas-width: 270px; }

.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 1.1rem 1.25rem .4rem; }
.brand-mark {
    font-weight: 800; font-size: 1.45rem; letter-spacing: .12em; color: #fff; text-decoration: none;
}
.brand-mark::after { content: ""; display: inline-block; width: .45rem; height: .45rem; margin-left: .2rem;
    border-radius: 50%; background: var(--bome-accent); vertical-align: super; }
.sidebar-taller { padding: 0 1.25rem 1rem; font-size: .8rem; color: var(--bome-sidebar-muted);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 1px solid rgba(255,255,255,.06); }

.sidebar-nav { padding: .75rem .6rem 2rem; display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--bome-sidebar-muted);
    padding: 1rem .75rem .35rem; }
.nav-item {
    display: flex; align-items: center; gap: .75rem; padding: .7rem .75rem; min-height: 44px;
    border-radius: .5rem; color: var(--bome-sidebar-text); text-decoration: none; font-size: .95rem;
}
.nav-item i { font-size: 1.1rem; width: 1.25rem; text-align: center; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(245,158,11,.14); color: #fff; box-shadow: inset 3px 0 0 var(--bome-accent); }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem;
    background: #fff; border-bottom: 1px solid #e2e8f0; padding: .6rem 1rem; min-height: 60px;
}
.topbar-title { font-size: 1.15rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-icon { font-size: 1.5rem; line-height: 1; padding: .25rem .5rem; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--bome-sidebar); color: #fff;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 600; }

.content { padding: 1rem; flex: 1; }
@media (min-width: 768px) { .content { padding: 1.5rem; } }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: flex-end; margin-bottom: 1rem; }
.app-footer { padding: .75rem 1.5rem; font-size: .75rem; color: #94a3b8; }

/* ---------- Componentes ---------- */
.card { border: 0; border-radius: var(--bome-radius); box-shadow: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04); }
.card-header { background: transparent; font-weight: 600; border-bottom-color: #eef2f7; }
.table > :not(caption) > * > * { padding: .7rem .75rem; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: #64748b; font-weight: 600; }
.btn { min-height: 40px; }
.btn-touch { min-height: 48px; font-size: 1.05rem; }
.form-control, .form-select { min-height: 42px; }
.form-label { font-weight: 500; font-size: .9rem; }

.kpi { padding: 1.1rem 1.25rem; }
.kpi-label { font-size: .8rem; color: #64748b; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }

.perm-matrix th, .perm-matrix td { text-align: center; vertical-align: middle; }
.perm-matrix td:first-child, .perm-matrix th:first-child { text-align: left; }
.perm-matrix .form-check-input { width: 1.35rem; height: 1.35rem; cursor: pointer; }

.json-diff { font-family: ui-monospace, monospace; font-size: .78rem; white-space: pre-wrap; margin: 0; }

/* ---------- Login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem;
    background: radial-gradient(circle at 20% 20%, #1e293b 0, #0f172a 60%); }
.login-card { width: 100%; max-width: 400px; }
.login-card .brand-mark { font-size: 2rem; color: var(--bome-sidebar); }

/* ---------- Búsqueda global ---------- */
.global-search { position: relative; flex: 0 1 420px; }
.global-search > i { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: #94a3b8; }
.global-search input { padding-left: 2.2rem; background: #f1f5f9; border-color: transparent; }
.global-search input:focus { background: #fff; }
.global-search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 1050; max-height: 70vh; overflow-y: auto; }
.global-search-results .list-group-item { padding: .65rem .9rem; }
.global-search-results .list-group-item.active-item { background: #eff6ff; }
@media (max-width: 575.98px) {
    .topbar { flex-wrap: wrap; }
    .global-search { order: 5; flex: 1 1 100%; }
}

/* ---------- Estados ---------- */
.badge-estado { font-weight: 500; }
.bg-orange { background-color: #ea580c !important; color: #fff; }
.bg-purple { background-color: #7c3aed !important; color: #fff; }
.bg-light.badge-estado { color: #475569; border: 1px solid #cbd5e1; }
.patente { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-weight: 700; letter-spacing: .06em;
    background: #fff; border: 2px solid #0f172a; border-radius: .35rem; padding: .05rem .45rem; white-space: nowrap; }

/* ---------- Asistente de recepción ---------- */
.stepper { display: flex; gap: .25rem; list-style: none; padding: 0; margin: 0; counter-reset: s; overflow-x: auto; }
.stepper li { flex: 1; display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-radius: .6rem;
    background: #fff; color: #64748b; font-size: .85rem; min-width: 0; cursor: default; }
.stepper li span { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: #e2e8f0; color: #475569;
    display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; }
.stepper li em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.active { background: #0f172a; color: #fff; }
.stepper li.active span { background: var(--bome-accent); color: #0f172a; }
.stepper li.done { cursor: pointer; color: #0f172a; }
.stepper li.done span { background: #16a34a; color: #fff; }
@media (max-width: 767.98px) { .stepper li em { display: none; } .stepper li.active em { display: inline; } }

.patente-input { font-family: ui-monospace, Menlo, monospace; font-size: 2rem; font-weight: 800; letter-spacing: .2em;
    text-transform: uppercase; text-align: center; max-width: 320px; border: 3px solid #0f172a; }
.fuel .btn { padding-left: .25rem; padding-right: .25rem; font-size: .95rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chips .btn { min-height: 44px; }
.dano-tipos .btn { font-size: .85rem; padding-left: .3rem; padding-right: .3rem; }
.dano-tipos .dot { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }
.diagrama-wrap { max-width: 280px; margin: 0 auto; }
#diagrama { width: 100%; height: auto; cursor: crosshair; touch-action: manipulation; user-select: none; }
#lista-danos li { cursor: pointer; }
.fotos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: .75rem; }
.fotos-grid .foto { position: relative; aspect-ratio: 4 / 3; border-radius: .5rem; overflow: hidden; background: #e2e8f0; }
.fotos-grid img { width: 100%; height: 100%; object-fit: cover; }
.fotos-grid .foto .btn { position: absolute; top: .35rem; right: .35rem; min-height: 0; }
.firma-canvas { width: 100%; height: 190px; border: 2px dashed #94a3b8; border-radius: .6rem; background: #fff; touch-action: none; }
.condiciones { background: #f8fafc; border-radius: .5rem; padding: .6rem .75rem; color: #475569; max-height: 140px; overflow-y: auto; }
.wizard-nav { position: sticky; bottom: 0; display: flex; gap: .75rem; padding: .75rem 0; margin-top: 1rem;
    background: linear-gradient(to top, var(--bome-bg) 75%, transparent); z-index: 5; }

/* ---------- Página pública ---------- */
.seguimiento { list-style: none; padding: 0; margin: 0; display: flex; justify-content: space-between; position: relative; }
.seguimiento::before { content: ""; position: absolute; top: 9px; left: 8%; right: 8%; height: 3px; background: #e2e8f0; }
.seguimiento li { flex: 1; text-align: center; font-size: .72rem; color: #94a3b8; position: relative; }
.seguimiento li span { display: block; width: 20px; height: 20px; margin: 0 auto .35rem; border-radius: 50%;
    background: #e2e8f0; border: 3px solid #fff; box-shadow: 0 0 0 1px #e2e8f0; position: relative; }
.seguimiento li.done { color: #16a34a; }
.seguimiento li.done span { background: #16a34a; box-shadow: 0 0 0 1px #16a34a; }
.seguimiento li.active { color: #0f172a; font-weight: 700; }
.seguimiento li.active span { background: var(--bome-accent); box-shadow: 0 0 0 3px rgba(245,158,11,.35); }
.items-table td { vertical-align: middle; }
.dano-tipos .btn-check:checked + .btn { background: #0f172a; border-color: #0f172a; color: #fff; }
.chips .btn-check:checked + .btn-outline-primary { background: #1d4ed8; border-color: #1d4ed8; color: #fff; }
.chips .btn-check:checked + .btn-outline-danger { background: #dc2626; border-color: #dc2626; color: #fff; }
@media (min-width: 768px) and (max-width: 1199.98px) { .diagrama-wrap { max-width: 220px; } }

/* ---------- Tablero Kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: .75rem; overflow-x: auto; padding-bottom: .5rem; align-items: start; }
.kanban-col { background: #e2e8f0; border-radius: var(--bome-radius); padding: .6rem; min-height: 200px; }
.kanban-head { display: flex; align-items: center; gap: .4rem; font-weight: 600; font-size: .85rem; padding: .2rem .25rem .6rem; }
.kanban-head .dot { width: .6rem; height: .6rem; border-radius: 50%; }
.kanban-card { display: block; background: #fff; border-radius: .6rem; padding: .7rem; margin-bottom: .5rem; color: inherit;
    text-decoration: none; box-shadow: 0 1px 2px rgba(15,23,42,.08); border-left: 4px solid transparent; }
.kanban-card:hover { box-shadow: 0 3px 8px rgba(15,23,42,.12); }
.kanban-card.atrasada { border-left-color: #dc2626; }
.kanban-vacio { font-size: .8rem; color: #64748b; text-align: center; padding: 1rem 0; }

/* ---------- Mis tareas ---------- */
.tarea { border-left: 5px solid #cbd5e1; }
.tarea-activa { border-left-color: var(--bome-accent); box-shadow: 0 0 0 2px rgba(245,158,11,.25); }
.cronometro { font-variant-numeric: tabular-nums; }

/* ---------- Agenda ---------- */
.semana { display: grid; grid-template-columns: repeat(7, 1fr); gap: .35rem; }
.semana .dia { display: flex; flex-direction: column; align-items: center; gap: .1rem; padding: .4rem .2rem; border-radius: .5rem;
    text-decoration: none; color: inherit; background: #f8fafc; }
.semana .dia.hoy { outline: 2px solid var(--bome-accent); }
.semana .dia.activo { background: #0f172a; color: #fff; }
.semana .dia.cerrado { opacity: .45; }
.agenda-bloque { display: flex; gap: 1rem; align-items: flex-start; }
.agenda-bloque .hora { width: 3.2rem; font-weight: 700; font-variant-numeric: tabular-nums; padding-top: .15rem; }
.agenda-bloque .cita { background: #f8fafc; border-radius: .5rem; padding: .5rem .65rem; margin-bottom: .4rem; }
