:root {
    --azul:        #004a80;
    --azul-osc:    #00385f;
    --azul-claro:  #e8f1f8;
    --tinta:       #1b2733;
    --gris-txt:    #5b6b7a;
    --linea:       #e2e8ee;
    --fondo:       #f4f6f9;
    --blanco:      #ffffff;
    --radio:       10px;
    --sombra:      0 1px 2px rgba(16,38,60,.06), 0 4px 16px rgba(16,38,60,.06);

    /* estados */
    --c-disponible: #1a8f4c;  --b-disponible: #e3f6ea;
    --c-enuso:      #1c6fb8;  --b-enuso:      #e6f0fa;
    --c-transito:   #b5780a;  --b-transito:   #fdf2da;
    --c-reparacion: #c0492b;  --b-reparacion: #fbe7e1;
    --c-calint:     #0f7d7d;  --b-calint:     #e0f4f4;
    --c-calext:     #6b46c1;  --b-calext:     #efe9fb;
    --c-fuera:      #6b7785;  --b-fuera:      #eceff2;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    color: var(--tinta);
    background: var(--fondo);
    line-height: 1.5;
}

a { color: var(--azul); }

/* ---------- Barra superior ---------- */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 24px;
    background: var(--blanco);
    border-bottom: 1px solid var(--linea);
    position: sticky;
    top: 0;
    z-index: 20;
}
.brand { display: inline-flex; align-items: center; }
.brand-logo { height: 42px; width: auto; display: block; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.user-badge { display: flex; flex-direction: column; line-height: 1.15; text-align: right; }
.user-name { font-weight: 600; font-size: 14px; }
.user-rol  { font-size: 12px; color: var(--gris-txt); }
.btn-link {
    font-size: 13px; text-decoration: none; color: var(--azul);
    border: 1px solid var(--linea); padding: 7px 12px; border-radius: 8px;
    transition: background .15s;
}
.btn-link:hover { background: var(--azul-claro); }

/* ---------- Estructura de página ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 60px; }
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.muted { color: var(--gris-txt); font-size: 13px; }

.foot {
    text-align: center; color: var(--gris-txt); font-size: 12px;
    padding: 24px; border-top: 1px solid var(--linea); margin-top: 40px;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    font: inherit; font-size: 13px; font-weight: 600;
    padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
    cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .15s, border-color .15s, opacity .15s;
}
.btn-primary { background: var(--azul); color: #fff; }
.btn-primary:hover { background: var(--azul-osc); }
.btn-ghost { background: var(--blanco); color: var(--azul); border-color: var(--linea); }
.btn-ghost:hover { background: var(--azul-claro); }
.btn-soft { background: var(--azul-claro); color: var(--azul); }
.btn-soft:hover { background: #d8e8f5; }
.btn-danger { background: #fff; color: var(--c-reparacion); border-color: #f0cdc3; }
.btn-danger:hover { background: var(--b-reparacion); }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }

/* ---------- Tarjeta / panel ---------- */
.card {
    background: var(--blanco);
    border: 1px solid var(--linea);
    border-radius: var(--radio);
    box-shadow: var(--sombra);
    overflow: hidden;
}

/* ---------- Tabla ---------- */
.tabla-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
    text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
    color: var(--gris-txt); font-weight: 600;
    padding: 12px 14px; background: #fafbfc; border-bottom: 1px solid var(--linea);
    position: sticky; top: 0;
}
table.data tbody td { padding: 11px 14px; border-bottom: 1px solid var(--linea); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fbfcfe; }
.col-codigo { font-weight: 600; white-space: nowrap; }
.col-fecha  { white-space: nowrap; color: var(--gris-txt); font-size: 13px; }

/* inputs dentro de la tabla (admin) */
table.data input[type=text],
table.data select {
    width: 100%; min-width: 110px;
    padding: 7px 9px; border: 1px solid var(--linea); border-radius: 7px;
    font: inherit; font-size: 13px; background: #fff; color: var(--tinta);
}
table.data input[type=text]:focus,
table.data select:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-claro); }

/* ---------- Pills de estado ---------- */
.pill {
    display: inline-block; font-size: 12px; font-weight: 600;
    padding: 4px 10px; border-radius: 999px; white-space: nowrap;
}
.est-disponible { color: var(--c-disponible); background: var(--b-disponible); }
.est-enuso      { color: var(--c-enuso);      background: var(--b-enuso); }
.est-transito   { color: var(--c-transito);   background: var(--b-transito); }
.est-reparacion { color: var(--c-reparacion); background: var(--b-reparacion); }
.est-calint     { color: var(--c-calint);     background: var(--b-calint); }
.est-calext     { color: var(--c-calext);     background: var(--b-calext); }
.est-fuera      { color: var(--c-fuera);      background: var(--b-fuera); }
.est-otro       { color: var(--gris-txt);     background: var(--b-fuera); }

/* ---------- Acciones por fila (usuario) ---------- */
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.acciones form { display: contents; }
.acciones-inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.acciones-inline select {
    padding: 6px 8px; border: 1px solid var(--linea); border-radius: 7px; font: inherit; font-size: 13px;
}

/* ---------- Filtros ---------- */
.filtros {
    display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end;
    padding: 16px; margin-bottom: 18px;
}
.filtro { display: flex; flex-direction: column; gap: 5px; }
.filtro label { font-size: 12px; font-weight: 600; color: var(--gris-txt); }
.filtro select, .filtro input[type=date] {
    padding: 8px 10px; border: 1px solid var(--linea); border-radius: 8px; font: inherit; font-size: 14px; background: #fff;
}

/* ---------- Login ---------- */
.login-screen {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: linear-gradient(160deg, var(--azul-claro), var(--fondo));
    padding: 24px;
}
.login-card {
    background: #fff; border: 1px solid var(--linea); border-radius: 16px;
    box-shadow: 0 10px 40px rgba(16,38,60,.10);
    width: 100%; max-width: 380px; padding: 36px 32px; text-align: center;
}
.login-card img { height: 54px; margin-bottom: 18px; }
.login-card h1 { font-size: 19px; margin: 0 0 4px; }
.login-card p.sub { margin: 0 0 24px; color: var(--gris-txt); font-size: 14px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--gris-txt); }
.login-card input {
    width: 100%; padding: 11px 13px; border: 1px solid var(--linea); border-radius: 9px; font-size: 15px;
}
.login-card input:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px var(--azul-claro); }
.login-card .btn { width: 100%; justify-content: center; padding: 12px; font-size: 15px; margin-top: 6px; }
.alert {
    background: var(--b-reparacion); color: var(--c-reparacion);
    border-radius: 9px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; text-align: left;
}

/* ---------- Toast ---------- */
.toast {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
    background: var(--tinta); color: #fff; padding: 12px 18px; border-radius: 10px;
    font-size: 14px; box-shadow: var(--sombra); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--c-reparacion); }

/* ---------- Histórico (impresión) ---------- */
.hist-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; font-size: 14px; }
.hist-meta b { color: var(--gris-txt); font-weight: 600; margin-right: 6px; }

@media (max-width: 640px) {
    .page { padding: 18px 14px 48px; }
    .topbar { padding: 10px 14px; }
    table.data { font-size: 13px; }
}
