/* ============ MotoSOS – Estilos ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --naranja: #f97316;
    --naranja-osc: #ea580c;
    --oscuro: #1e293b;
    --oscuro2: #0f172a;
    --gris: #64748b;
    --fondo: #f1f5f9;
    --borde: #e2e8f0;
    --ok: #22c55e;
    --rojo: #ef4444;
}
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--fondo); color: #1e293b; }

/* ---- Layout ---- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
    width: 230px; background: var(--oscuro2); color: #cbd5e1;
    display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { padding: 18px 16px; font-size: 20px; color: #fff; border-bottom: 1px solid #1e293b; }
.brand b { color: var(--naranja); }
.sidebar nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sidebar nav a {
    display: flex; align-items: center; gap: 10px; padding: 11px 12px; margin: 2px 0;
    color: #cbd5e1; text-decoration: none; border-radius: 8px; font-size: 14.5px;
}
.sidebar nav a:hover { background: #1e293b; color: #fff; }
.sidebar nav a.active { background: var(--naranja); color: #fff; font-weight: 600; }
.sidebar .ico { font-size: 17px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid #1e293b; font-size: 13px; }
.user-chip { color: #fff; margin-bottom: 6px; }
.user-chip small { display: block; color: var(--gris); text-transform: capitalize; }
.logout { color: #f87171; text-decoration: none; }
.content { flex: 1; min-width: 0; }
.topbar { background: #fff; padding: 16px 26px; border-bottom: 1px solid var(--borde); }
.topbar h1 { font-size: 20px; }
.page { padding: 24px 26px; }

/* ---- Tarjetas / KPIs ---- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.card { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 16px 18px; }
.card .kpi { font-size: 27px; font-weight: 700; }
.card .kpi-label { color: var(--gris); font-size: 13px; margin-top: 3px; }
.panel { background: #fff; border: 1px solid var(--borde); border-radius: 12px; padding: 18px 20px; margin-bottom: 20px; }
.panel h2 { font-size: 16px; margin-bottom: 12px; }

/* ---- Tablas ---- */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
th { background: #f8fafc; text-align: left; font-size: 12.5px; text-transform: uppercase; color: var(--gris); letter-spacing: .4px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--borde); font-size: 14px; }
tr:hover td { background: #fafafa; }
.table-wrap { overflow-x: auto; }

/* ---- Formularios ---- */
label { display: block; font-size: 13px; color: var(--gris); margin: 10px 0 4px; font-weight: 600; }
input, select, textarea {
    width: 100%; padding: 9px 11px; border: 1px solid #cbd5e1; border-radius: 8px;
    font-size: 14px; font-family: inherit; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--naranja); border-color: transparent; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 16px; }
.btn {
    display: inline-block; padding: 9px 18px; border: none; border-radius: 8px; cursor: pointer;
    font-size: 14px; font-weight: 600; text-decoration: none; background: var(--naranja); color: #fff; margin-top: 12px;
}
.btn:hover { background: var(--naranja-osc); }
.btn-sec { background: #e2e8f0; color: #334155; }
.btn-sec:hover { background: #cbd5e1; }
.btn-danger { background: var(--rojo); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; margin: 0; }

/* ---- Badges y avisos ---- */
.badge { color: #fff; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.alert { padding: 12px 15px; border-radius: 8px; margin-bottom: 15px; font-size: 14px; }
.alert-ok { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.muted { color: var(--gris); font-size: 13px; }

/* ---- Modal ---- */
.modal-bg {
    display: none; position: fixed; inset: 0; background: rgba(15,23,42,.55);
    z-index: 50; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto;
}
.modal-bg.open { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 22px 24px; width: 100%; max-width: 640px; }
.modal h3 { margin-bottom: 6px; }
.modal-close { float: right; cursor: pointer; font-size: 20px; color: var(--gris); background: none; border: none; }

/* ---- Login ---- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--oscuro2); }
.login-box { background: #fff; padding: 34px 32px; border-radius: 16px; width: 100%; max-width: 380px; }
.login-box .brand { font-size: 26px; text-align: center; color: var(--oscuro2); border: none; padding: 0 0 6px; }
.login-box .brand b { color: var(--naranja); }
.login-sub { text-align: center; color: var(--gris); font-size: 14px; margin-bottom: 14px; }

/* ---- Timeline bitácora ---- */
.timeline { list-style: none; }
.timeline li { padding: 7px 0 7px 18px; border-left: 2px solid var(--borde); position: relative; font-size: 13.5px; }
.timeline li::before {
    content: ''; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px;
    border-radius: 50%; background: var(--naranja);
}
.timeline small { color: var(--gris); display: block; }

@media (max-width: 800px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; }
}
