/* ===================================================================
   Bitacora de Ambulancias - Sermisalud
   Dashboard del Administrador (con menu lateral izquierdo)
   =================================================================== */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --accent: #e63946;
    --bg-dark: #0f172a;
    --bg-dark-2: #164e63;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --body-bg: #eef2f7;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --radius: 14px;
    --shadow: 0 6px 24px rgba(2, 6, 23, .07);
    --sidebar-w: 268px;
    --sidebar-collapsed: 80px;
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: "Segoe UI", Tahoma, sans-serif; }

body {
    display: flex;
    min-height: 100vh;
    background: var(--body-bg);
    color: #1e293b;
}

/* ==================== SIDEBAR IZQUIERDO ==================== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--bg-dark) 0%, var(--bg-dark-2) 100%);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    transition: width .25s ease;
}

.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-brand-text,
.sidebar.collapsed .menu-item span,
.sidebar.collapsed .menu-section,
.sidebar.collapsed .sidebar-user-text,
.sidebar.collapsed .sidebar-collapse i { display: none; }

/* --- Marca superior --- */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    padding: 5px;
    background: #fff;
    border-radius: 13px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .25);
}
.sidebar-logo img { max-width: 100%; max-height: 100%; display: block; }

.sidebar-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sidebar-brand-text strong { font-size: 1.05rem; }
.sidebar-brand-text span { font-size: .78rem; color: #216382; letter-spacing: .5px; }

.sidebar-collapse {
    margin-left: auto;
    border: none;
    background: rgba(255, 255, 255, .08);
    color: var(--text-muted);
    width: 28px;
    height: 28px;
    border-radius: 8px;
    cursor: pointer;
    font-size: .8rem;
    transition: background .2s, color .2s;
}

.sidebar-collapse:hover { background: rgba(255, 255, 255, .15); color: #fff; }

/* --- Menu --- */
.sidebar-menu { flex: 1; overflow-y: auto; padding: 16px 12px; }

.menu-section {
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 18px 10px 8px;
}

.sidebar-menu > .menu-section:first-child { margin-top: 4px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 12px 14px;
    margin-bottom: 3px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .93rem;
    border-radius: 11px;
    transition: background .18s, color .18s, padding-left .18s;
}

.menu-item i {
    width: 22px;
    text-align: center;
    font-size: 1.02rem;
    flex-shrink: 0;
}

.menu-item:hover { background: rgba(255, 255, 255, .07); color: #fff; padding-left: 18px; }

.menu-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 6px 18px rgba(13, 110, 253, .35);
}

/* --- Tarjeta usuario conectado --- */
.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255, 255, 255, .08); }

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 11px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .10);
    border-radius: 13px;
    padding: 10px 12px;
}

.sidebar-user-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: .9rem;
    background: linear-gradient(135deg, #38bdf8, #0369a1);
}

.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-text strong { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-text span { font-size: .68rem; color: #4ade80; letter-spacing: .3px; }
.sidebar-user-text span i { font-size: .5rem; margin-right: 4px; }

.sidebar-logout { margin-left: auto; color: #fca5a5; font-size: 1rem; transition: color .2s, transform .2s; }
.sidebar-logout:hover { color: #f87171; transform: scale(1.15); }

/* ==================== AREA PRINCIPAL ==================== */
.main-area {
    flex: 1;
    min-width: 0;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left .25s ease;
}

body.collapsed-sidebar .main-area { margin-left: var(--sidebar-collapsed); }

/* --- Barra superior --- */
.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    background: var(--card-bg);
    padding: 14px 28px;
    box-shadow: 0 2px 10px rgba(2, 6, 23, .06);
    position: sticky;
    top: 0;
    z-index: 40;
}

.btn-menu-mobile {
    display: none;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: #475569;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
}

.topbar-title h1 { font-size: 1.15rem; color: var(--bg-dark); display: flex; align-items: center; gap: 10px; }
.topbar-title h1 i { color: var(--primary); }
.topbar-title p { font-size: .76rem; color: var(--text-muted); }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    border: 1px solid var(--border);
    background: #f8fafc;
    color: #475569;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    font-size: .98rem;
    transition: background .2s, color .2s;
}

.icon-btn:hover { background: #eff6ff; color: var(--primary); }

.badge-dot {
    position: absolute;
    top: 9px;
    right: 10px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px #fff;
}

.topbar-user { display: flex; align-items: center; gap: 9px; margin-left: 6px; }

.topbar-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    font-size: .82rem;
    font-weight: 700;
    background: linear-gradient(135deg, #38bdf8, #0369a1);
}

.topbar-user-name { font-size: .85rem; font-weight: 600; color: #334155; }

/* --- Area de contenido --- */
.content { flex: 1; padding: 26px 28px; min-width: 0; }

/* --- Alertas (flash) --- */
.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 11px;
    font-size: .9rem;
    margin-bottom: 16px;
    animation: slide-in .25s ease;
}

@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fef3c7; color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #bfdbfe; }

.alert-close { margin-left: auto; border: none; background: transparent; color: inherit; cursor: pointer; font-size: .9rem; opacity: .7; }
.alert-close:hover { opacity: 1; }

/* --- Banner de bienvenida --- */
.welcome-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 26px 30px;
    border-radius: 18px;
    color: var(--text-light);
    background: linear-gradient(115deg, #0b3a6f 0%, #115e59 55%, #14532d 100%);
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.welcome-banner::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(640px 220px at 85% 50%, rgba(255, 255, 255, .10), transparent 70%);
}

.welcome-text { position: relative; z-index: 1; max-width: 620px; }
.welcome-text h2 { font-size: 1.5rem; margin-bottom: 8px; display: flex; align-items: center; gap: 10px; }
.welcome-text h2 i { color: #fbbf24; }
.welcome-text p { color: #cbd5e1; font-size: .92rem; line-height: 1.6; }
.welcome-text p strong { color: #7dd3fc; }

.welcome-icon {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    padding: 14px 18px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 28px rgba(0, 0, 0, .3);
    animation: pulse-soft 3s ease-in-out infinite;
}
.welcome-icon img { max-width: 150px; max-height: 68px; display: block; }

@keyframes pulse-soft { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.07); } }

/* --- Tarjetas de estadisticas --- */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
    margin-bottom: 24px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    border-top: 4px solid transparent;
    transition: transform .18s, box-shadow .18s;
    text-decoration: none;
    color: inherit;
}

.stat-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(2, 6, 23, .12); }

.stat-icon {
    flex-shrink: 0;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    font-size: 1.35rem;
    color: #fff;
}

.stat-card h3 { font-size: 1.7rem; line-height: 1.15; }
.stat-card p { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

.stat-blue  { border-top-color: #3b82f6; } .stat-blue .stat-icon  { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-red   { border-top-color: #ef4444; } .stat-red .stat-icon   { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.stat-green { border-top-color: #22c55e; } .stat-green .stat-icon { background: linear-gradient(135deg, #22c55e, #15803d); }
.stat-amber { border-top-color: #f59e0b; } .stat-amber .stat-icon { background: linear-gradient(135deg, #f59e0b, #b45309); }

/* --- Panel de datos --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 18px;
}

.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 { font-size: .98rem; color: var(--bg-dark); display: flex; align-items: center; gap: 9px; }
.panel-header h3 i { color: var(--primary); }
.panel-body { padding: 20px; }

/* --- Accesos rapidos --- */
.quick-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.quick-action {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    color: #334155;
    text-decoration: none;
    font-size: .88rem;
    font-weight: 600;
    transition: border-color .2s, background .2s, transform .18s, box-shadow .18s;
}

.quick-action i {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    font-size: .95rem;
    flex-shrink: 0;
}

.quick-action:hover { border-color: var(--primary); background: #eff6ff; transform: translateY(-3px); box-shadow: 0 8px 18px rgba(13, 110, 253, .18); }

/* --- Tabla --- */
.table { width: 100%; border-collapse: collapse; font-size: .86rem; }

.table thead th {
    text-align: left;
    padding: 10px 12px;
    color: #64748b;
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .8px;
    border-bottom: 2px solid var(--border);
    background: #f8fafc;
}

.table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); color: #334155; }
.table tbody tr:hover td { background: #f1f5f9; }
.table tbody td i { color: var(--primary); margin-right: 4px; font-size: .8rem; }

.empty-row { text-align: center; color: var(--text-muted); padding: 26px !important; font-style: italic; }

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 600;
}

.badge-green { background: #dcfce7; color: #15803d; }

/* --- Modulo en construccion --- */
.proximo-card {
    max-width: 560px;
    margin: 40px auto 0;
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: var(--shadow);
    padding: 46px 40px;
    text-align: center;
}

.proximo-icon-box {
    width: 92px;
    height: 92px;
    margin: 0 auto 22px;
    display: grid;
    place-items: center;
    font-size: 2.1rem;
    color: #7dd3fc;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--bg-dark), var(--bg-dark-2));
    box-shadow: 0 12px 30px rgba(15, 23, 42, .3);
    animation: pulse-soft 3s ease-in-out infinite;
}

.proximo-card h2 { color: var(--bg-dark); margin-bottom: 10px; }
.proximo-card p { color: var(--text-muted); line-height: 1.6; margin-bottom: 26px; }

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 22px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(13, 110, 253, .3);
    transition: transform .15s, filter .15s;
}

.btn-back:hover { transform: translateY(-2px); filter: brightness(1.05); }

/* --- Pie --- */
.dashboard-footer {
    padding: 16px 28px;
    text-align: center;
    font-size: .76rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--card-bg);
}

/* ==================== MODULO: GESTION DE USUARIOS ==================== */

/* Cabecera del modulo (titulo + accion principal) */
.module-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.module-header-text h2 { font-size: 1.25rem; color: var(--bg-dark); display: flex; align-items: center; gap: 10px; }
.module-header-text h2 i { color: var(--primary); }
.module-header-text p { color: var(--text-muted); font-size: .88rem; margin-top: 3px; }

.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 12px 22px;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff !important;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(13, 110, 253, .3);
    transition: transform .15s, filter .15s;
}

.btn-primary-action:hover { transform: translateY(-2px); filter: brightness(1.06); }

/* Filtros */
.filter-panel { padding: 18px 20px; margin-bottom: 18px; }

.filters-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }

.filter-field { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.filter-field.grow { flex: 1; min-width: 240px; }

.filter-field label { font-size: .78rem; font-weight: 600; color: #475569; display: flex; gap: 6px; align-items: center; }
.filter-field label i { color: var(--primary); }

.filter-field input,
.filter-field select {
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .9rem;
    background: #f8fafc;
    width: 100%;
}

.filter-field input:focus, .filter-field select:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.filter-actions { display: flex; gap: 9px; }

.btn-filter, .btn-clear {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 11px 16px;
    border-radius: 10px;
    font-size: .86rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    border: 1.5px solid transparent;
    transition: filter .15s, background .15s;
}

.btn-filter { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.btn-filter:hover { filter: brightness(1.08); }

.btn-clear { background: #f1f5f9; color: #475569; border-color: var(--border); }
.btn-clear:hover { background: #e2e8f0; }

/* Boton volver inline (formulario) */
.btn-back-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #f1f5f9;
    color: #475569 !important;
    text-decoration: none;
    font-size: .86rem;
    font-weight: 600;
    border: 1px solid var(--border);
}

.btn-back-inline:hover { background: #e2e8f0; color: var(--primary) !important; }

/* Contador de registros */
.count-badge {
    background: #eff6ff;
    color: var(--primary);
    border-radius: 20px;
    font-size: .72rem;
    padding: 3px 10px;
    font-weight: 700;
}

/* Tabla de usuarios */
.users-table .doc-type {
    display: inline-block;
    background: #eff6ff;
    color: var(--primary-dark);
    font-size: .68rem;
    font-weight: 700;
    border-radius: 6px;
    padding: 2px 7px;
    margin-right: 4px;
}

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: .72rem;
    font-weight: 700;
    color: #0c4a6e;
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
    flex-shrink: 0;
}

.cell-strong { font-weight: 600; color: #0f172a; }

.cell-contact { display: flex; flex-direction: column; gap: 2px; font-size: .8rem; }
.cell-contact i { color: var(--primary); width: 15px; }

.badge-gray { background: #e2e8f0; color: #64748b; }
.badge-green i, .badge-gray i { font-size: .45rem; }

/* Botones de accion por fila (icono + texto, mas intuitivos) */
.row-actions { display: flex; gap: 8px; align-items: center; }

.inline-form { display: inline; }

.pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border: 1.5px solid transparent;
    border-radius: 10px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    white-space: nowrap;
    transition: transform .15s, box-shadow .15s;
    font-family: "Segoe UI", Tahoma, sans-serif;
}

.pill-btn i { font-size: .85rem; }
.pill-btn:hover { transform: translateY(-2px); }

.pill-edit {
    color: #1d4ed8 !important;
    background: #eff6ff;
    border-color: #bfdbfe;
}

.pill-edit:hover { box-shadow: 0 6px 16px rgba(29, 78, 216, .25); filter: brightness(1.03); }

.pill-deactivate {
    color: #b91c1c !important;
    background: #fef2f2;
    border-color: #fecaca;
}

.pill-deactivate:hover { box-shadow: 0 6px 16px rgba(185, 28, 28, .22); filter: brightness(1.03); }

.pill-activate {
    color: #15803d !important;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.pill-activate:hover { box-shadow: 0 6px 16px rgba(21, 128, 61, .22); filter: brightness(1.03); }

@media (max-width: 640px) {
    .row-actions { flex-direction: column; gap: 6px; }
    .pill-btn { width: 100%; justify-content: center; }
    .users-table th:last-child, .users-table td:last-child { width: auto; }
}

/* ==================== FORMULARIO DE USUARIO ==================== */
.form-panel-wide { max-width: 980px; }

.form-section-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: .85rem;
    font-weight: 700;
    color: var(--primary-dark);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin: 22px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px dashed var(--border);
}

.form-section-title:first-child { margin-top: 0; }
.form-section-title i { font-size: .9rem; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 20px;
}

.user-form .form-group { margin-bottom: 14px; }

.user-form label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .82rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.req { color: var(--accent); }
.optional { color: var(--text-muted); font-weight: 400; font-size: .72rem; }

.user-form .input-icon select {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .92rem;
    background: #f8fafc;
    appearance: none;
    cursor: pointer;
}

.user-form .input-icon select:focus {
    outline: none;
    background: #fff;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
}

.user-form .input-icon input { padding: 12px 44px 12px 40px; border-radius: 10px; }

/* Botones del formulario */
.form-buttons {
    display: flex;
    gap: 12px;
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-submit { border: none; cursor: pointer; }

.btn-cancel { margin-left: 0; padding: 12px 22px; }

.user-form .toggle-pass {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-size: .9rem;
    transition: color .2s;
}

.user-form .toggle-pass:hover { color: var(--primary); }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-buttons { flex-direction: column; }
    .form-buttons .btn-submit, .form-buttons .btn-cancel { width: 100%; justify-content: center; }
    .filter-actions { width: 100%; }
    .filter-actions .btn-filter, .filter-actions .btn-clear { flex: 1; justify-content: center; }
}

/* --- Tabla con acciones siempre visibles (columna fija a la derecha) --- */
.table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.users-table { min-width: 900px; }

.users-table th:last-child,
.users-table td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 14px rgba(2, 6, 23, .06);
}

.users-table thead th:last-child { background: #f8fafc; }
.users-table tbody tr:hover td:last-child { background: #f8fafc; }

.users-table th:last-child, .users-table td:last-child { white-space: nowrap; width: 130px; }


/* ==================== FORMULARIO DINAMICO DE USUARIO ==================== */

/* Banner superior simple con avatar en vivo y estado */
.form-hero {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    margin-bottom: 22px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
}

.form-hero > * { position: static; }

.form-avatar {
    flex-shrink: 0;
    width: 64px;
    height: 64px;
    display: grid;
    place-items: center;
    border-radius: 18px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #0c4a6e;
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
    box-shadow: 0 8px 20px rgba(56, 189, 248, .3);
    transition: transform .2s;
}

.form-avatar:active { transform: scale(.94); }

.form-hero-text h3 { font-size: 1.08rem; color: var(--bg-dark); margin-bottom: 4px; }
.form-hero-text p { font-size: .8rem; color: var(--text-muted); }
.form-hero .badge { margin-left: auto; }

/* Secciones del formulario en tarjetas de colores */
.form-section {
    display: block;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 16px;
    transition: border-color .2s, box-shadow .2s;
}

.form-section:hover { box-shadow: 0 8px 22px rgba(2, 6, 23, .06); }

.form-section-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--border);
}

.form-section-head .sec-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    font-size: 1.05rem;
    color: #fff;
}

.sec-blue  .sec-icon { background: linear-gradient(135deg, #60a5fa, #1d4ed8); }
.sec-cyan  .sec-icon { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.sec-amber .sec-icon { background: linear-gradient(135deg, #fbbf24, #b45309); }

.form-section-head h4 { font-size: .95rem; color: var(--bg-dark); }
.form-section-head p { font-size: .74rem; color: var(--text-muted); }

/* Etiquetas e insumos dentro de secciones */
.form-section .user-form, .form-section .form-group { margin-bottom: 12px; }
.form-section .form-grid { gap: 6px 22px; }

.form-section label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8rem;
    font-weight: 600;
    color: #334155;
    margin-bottom: 6px;
}

.form-section label i { color: #64748b; font-size: .78rem; }

.form-section .input-icon select,
.form-section .input-icon input {
    width: 100%;
    padding: 12px 44px 12px 40px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .92rem;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.form-section .input-icon select { appearance: none; cursor: pointer; }

.form-section .input-icon select:focus,
.form-section .input-icon input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
}

/* Pista de ayuda bajo cada campo */
.hint { font-size: .72rem; color: var(--text-muted); margin-top: 5px; }

/* ================= Sombreado suave de campos que faltan por diligenciar
   (Bitacora, FURTRAN y FURIPS: campos vacios se pintan en amarillo claro) ================= */
.hint-legend { display: flex; align-items: center; gap: 7px; font-size: .78rem; color: #8a6d3b; background: #fffdf4; border: 1px solid #efe3c3; border-radius: 9px; padding: 8px 12px; margin-bottom: 12px; }

.form-group input.field-needs-fill,
.form-group select.field-needs-fill,
.form-group textarea.field-needs-fill,
.form-group.group-needs-fill input,
.form-group.group-needs-fill select,
.form-group.group-needs-fill textarea {
    background: #fffaf0 !important;
    border: 1.5px solid #eadfae !important;
    box-shadow: 0 0 0 2px rgba(233, 216, 166, .18);
}
.form-group input.field-needs-fill::placeholder { color: #a89468; font-style: italic; }

.row-needs-fill td {
    background: #fffcf2;
}
.row-needs-fill td:first-child { border-left: 3px solid #e9d8a6; }

.resumen-pendientes { display: flex; flex-wrap: wrap; gap: 6px; }
.pend-tag {
    display: inline-flex; padding: 4px 10px; border-radius: 999px;
    background: #fff8e8; border: 1px solid #eadfae; color: #8a6d3b;
    font-size: .7rem; font-weight: 600; text-transform: capitalize;
}



/* ===== Roles multiples del usuario (checkboxes de pill) ===== */
.roles-checks { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.role-check {
    display: inline-flex; align-items: center; gap: 8px;
    border: 1.5px solid #e2e8f0; border-radius: 10px;
    padding: 8px 14px; cursor: pointer; user-select: none;
    background: #fff; transition: border-color .15s, background .15s;
}
.role-check input { position: absolute; opacity: 0; pointer-events: none; }
.role-check-box {
    width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #cbd5e1;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .65rem; transition: all .15s;
}
.role-check-box i { opacity: 0; }
.role-check input:checked + .role-check-box {
    background: var(--primary, #2563eb); border-color: var(--primary, #2563eb); color: #fff;
}
.role-check input:checked + .role-check-box i { opacity: 1; }
.role-check input:checked ~ .role-check-txt { color: var(--text-strong, #0f172a); font-weight: 700; }
.role-check-txt { font-size: .82rem; color: var(--text, #334155); }
.role-check:hover { border-color: #94a3b8; }

/* Tarjeta de la unidad del momento (mi ambulancia) */
.plate-big { font-size: 1.1rem; padding: 12px 18px; border-radius: 12px; }
.mio-item { margin-bottom: 10px; }
.fleet-item.mio-item { background: #f8fafc; border: 1.5px solid #e2e8f0; border-radius: 14px; padding: 14px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* Medidor de seguridad de la contrasena */
.pass-meter {
    height: 6px;
    border-radius: 6px;
    background: #e2e8f0;
    margin-top: 10px;
    overflow: hidden;
}

.pass-meter i {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 6px;
    background: transparent;
    transition: width .25s ease, background .25s ease;
}

.pass-weak   { color: #ef4444 !important; }
.pass-mid    { color: #f59e0b !important; }
.pass-strong { color: #16a34a !important; }

/* Botones finales del formulario */
.form-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.btn-submit-form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px 30px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 26px rgba(13, 110, 253, .35);
    transition: transform .15s, filter .15s, box-shadow .15s;
}

.btn-submit-form:hover { transform: translateY(-2px); filter: brightness(1.06); box-shadow: 0 14px 32px rgba(13, 110, 253, .4); }

.btn-cancel-form {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 22px;
    border-radius: 12px;
    background: #f1f5f9;
    color: #475569 !important;
    text-decoration: none;
    font-size: .9rem;
    font-weight: 600;
    border: 1.5px solid var(--border);
    transition: background .15s, color .15s;
}

.btn-cancel-form:hover { background: #e2e8f0; color: var(--primary) !important; }

.user-form .toggle-pass {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    font-size: .9rem;
    transition: color .2s;
}

.user-form .toggle-pass:hover { color: var(--primary); }

/* Pestañas Activos / Inactivos */
.tabs-nav {
    display: flex;
    gap: 8px;
    margin-bottom: 18px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 13px;
    padding: 7px;
    width: fit-content;
    box-shadow: var(--shadow);
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 11px 20px;
    border-radius: 9px;
    text-decoration: none !important;
    font-size: .88rem;
    font-weight: 600;
    color: #64748b;
    transition: background .18s, color .18s, box-shadow .18s;
}

.tab:hover { background: #f1f5f9; color: #334155; }

.tab-count {
    background: #e2e8f0;
    color: #475569;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
    padding: 2px 9px;
}

.tab.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 6px 16px rgba(13, 110, 253, .3);
}

.tab.active .tab-count { background: rgba(255, 255, 255, .22); color: #fff; }

.tab-inactive.active {
    background: linear-gradient(135deg, #f87171, #dc2626);
    box-shadow: 0 6px 16px rgba(220, 38, 38, .3);
}

.list-note {
    font-size: .78rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.list-note i { color: var(--primary); }

/* ==================== MODULO DE AMBULANCIAS ==================== */

/* Cinco tarjetas de resumen de la flota */
.fleet-stats { grid-template-columns: repeat(5, 1fr); }

.stat-cyan { border-top-color: #06b6d4; }
.stat-cyan .stat-icon { background: linear-gradient(135deg, #22d3ee, #0e7490); }
.stat-gray { border-top-color: #94a3b8; }
.stat-gray .stat-icon { background: linear-gradient(135deg, #94a3b8, #475569); }

/* Tablero de la flota agrupado por estado */
.fleet-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.fleet-panel { overflow: hidden; border-top: 4px solid transparent; }
.fleet-green { border-top-color: #22c55e; }
.fleet-blue  { border-top-color: #0ea5e9; }
.fleet-amber { border-top-color: #f59e0b; }
.fleet-gray  { border-top-color: #94a3b8; }

.fleet-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.fleet-green .fleet-panel-head h3 i { color: #16a34a; }
.fleet-blue  .fleet-panel-head h3 i { color: #0284c7; }
.fleet-amber .fleet-panel-head h3 i { color: #d97706; }
.fleet-gray  .fleet-panel-head h3 i { color: #64748b; }

.fleet-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 16px 18px;
}

.fleet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    transition: transform .15s, box-shadow .15s, background .15s;
}

.fleet-item:hover {
    transform: translateY(-2px);
    background: #fff;
    box-shadow: 0 8px 20px rgba(2, 6, 23, .08);
}

.fleet-plate {
    flex-shrink: 0;
    padding: 7px 10px;
    border-radius: 8px;
    background: linear-gradient(135deg, #1e293b, #0f172a);
    color: #f8fafc;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .6px;
}

.fleet-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.fleet-info strong {
    font-size: .84rem;
    color: var(--bg-dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fleet-meta {
    font-size: .72rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.fleet-meta i { color: var(--primary); font-size: .68rem; }

.fleet-edit {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eff6ff;
    border: 1.5px solid #bfdbfe;
    color: #1d4ed8 !important;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s;
}

.fleet-edit:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(29, 78, 216, .25); }

.fleet-empty {
    font-size: .8rem;
    color: var(--text-muted);
    text-align: center;
    padding: 18px 8px;
    font-style: italic;
}

.fleet-empty i { margin-right: 6px; color: var(--primary); }

/* Estado cuando la flota esta vacia */
.fleet-empty-state { text-align: center; padding: 46px 20px; }
.fleet-empty-state > i { font-size: 2.6rem; color: #cbd5e1; margin-bottom: 14px; }
.fleet-empty-state h3 { font-size: 1.05rem; color: var(--bg-dark); margin-bottom: 6px; }
.fleet-empty-state p { font-size: .85rem; color: var(--text-muted); margin-bottom: 18px; }

/* Avatar con la placa en el formulario */
.vehicle-avatar {
    font-size: 1rem !important;
    letter-spacing: .8px;
    padding: 0 8px;
    text-align: center;
}

/* Campo a todo el ancho dentro del formulario */
.form-group-full { grid-column: 1 / -1; }

/* Textarea del formulario */
.form-section textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .92rem;
    font-family: inherit;
    color: #334155;
    background: #fff;
    resize: vertical;
    min-height: 86px;
    transition: border-color .2s, box-shadow .2s;
}

.form-section textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(13, 110, 253, .12);
}

/* Badges de estado de la ambulancia */
.badge-blue  { background: #e0f2fe; color: #0369a1; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-blue i, .badge-amber i { font-size: .45rem; }

/* Responsive del modulo de ambulancias */
@media (max-width: 1100px) {
    .fleet-stats { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .fleet-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .fleet-stats { grid-template-columns: 1fr 1fr; }
    .fleet-item { flex-wrap: wrap; }
}

/* ==================== MODULO DE PERSONAL ==================== */

.personal-table { min-width: 1080px; }

.personal-table th:last-child,
.personal-table td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 14px rgba(2, 6, 23, .06);
    white-space: nowrap;
}

.personal-table thead th:last-child { background: #f8fafc; }
.personal-table tbody tr:hover td:last-child { background: #f8fafc; }

/* Foto circular en la tabla */
.cell-photo {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e2e8f0;
    box-shadow: 0 4px 10px rgba(2, 6, 23, .08);
}

.cell-sub {
    display: block;
    font-size: .72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Etiquetas de cargo */
.cargo-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 20px;
    font-size: .7rem;
    font-weight: 700;
    white-space: nowrap;
    border: 1px solid transparent;
}

.cargo-medico    { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.cargo-auxiliar  { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.cargo-tem       { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.cargo-conductor { background: #f5f3ff; color: #6d28d9; border-color: #ddd6fe; }
.cargo-otro      { background: #f1f5f9; color: #475569; border-color: #e2e8f0; }

/* Licencia de conduccion */
.license-cell { display: flex; flex-direction: column; gap: 4px; }
.license-num { font-size: .76rem; font-weight: 700; color: #334155; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-red i { font-size: .45rem; }

/* Foto en el encabezado del formulario */
.personal-photo {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    overflow: hidden;
    font-size: 1.4rem;
    font-weight: 700;
    color: #0c4a6e;
    background: linear-gradient(135deg, #7dd3fc, #38bdf8);
    box-shadow: 0 8px 20px rgba(56, 189, 248, .3);
    border: 3px solid #fff;
}

.personal-photo img { width: 100%; height: 100%; object-fit: cover; }

/* Input de archivo (foto) */
.file-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    background: #fff;
    font-size: .85rem;
    color: #475569;
    cursor: pointer;
    transition: border-color .2s, background .2s;
}

.file-input:hover { border-color: var(--primary); background: #f8fafc; }

.file-input::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: .78rem;
    cursor: pointer;
}

/* Seccion de licencia */
.sec-purple .sec-icon { background: linear-gradient(135deg, #a78bfa, #6d28d9); }

/* Texto tenue */
.muted { color: var(--text-muted); }

/* Ajustes responsivos del modulo */
.tabs-nav { flex-wrap: wrap; }

@media (max-width: 640px) {
    .personal-photo { width: 58px; height: 58px; }
}

/* ==================== SUBMENU LATERAL ==================== */

.menu-subitem {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-left: 16px;
    padding: 9px 12px;
    color: #cbd5e1;
    text-decoration: none;
    font-size: .8rem;
    line-height: 1.25;
    border-left: 2px solid rgba(148, 163, 184, .25);
    border-radius: 0 10px 10px 0;
    transition: background .18s, color .18s, padding-left .18s;
}

.menu-subitem:hover { background: rgba(255, 255, 255, .07); color: #fff; padding-left: 14px; }

.menu-subitem.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border-left-color: transparent;
    box-shadow: 0 4px 14px rgba(13, 110, 253, .3);
}

.menu-subitem i { font-size: .82rem; width: 18px; }
.menu-subitem span { white-space: normal; }
.menu-subitem:hover { padding-left: 12px; }
.menu-subitem.active { border-left-color: transparent; box-shadow: 0 4px 14px rgba(13, 110, 253, .3); }

.sidebar.collapsed .menu-subitem {
    margin-left: 0;
    padding: 12px 14px;
    border-left: none;
    border-radius: 11px;
}

/* ==================== TABLA DE ASIGNACION DE TURNOS ==================== */

.turnos-table { min-width: 1080px; }

.turnos-table th:last-child,
.turnos-table td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 14px rgba(2, 6, 23, .06);
    white-space: nowrap;
}

.turnos-table thead th:last-child { background: #f8fafc; }
.turnos-table tbody tr:hover td:last-child { background: #f8fafc; }

.turno-date { display: flex; flex-direction: column; }
.turno-date strong { font-size: .84rem; color: var(--bg-dark); }
.turno-date span { font-size: .72rem; color: var(--text-muted); }

.turno-time { display: flex; flex-direction: column; gap: 2px; }
.turno-time span { font-size: .8rem; font-weight: 600; color: #334155; }
.turno-time i { color: var(--primary); font-size: .72rem; width: 14px; }
.turno-time small { font-size: .7rem; color: var(--text-muted); margin-top: 2px; }

.turno-amb { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.turno-amb-name { font-size: .72rem; color: var(--text-muted); max-width: 180px; }

.aux-avatar { background: linear-gradient(135deg, #a78bfa, #6d28d9) !important; color: #fff !important; }

.row-cancelado td:not(:last-child) { opacity: .6; }
.row-cancelado .turno-date strong { text-decoration: line-through; }

/* Aviso del formulario de turno */
.turno-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.turno-note i { color: #d97706; margin-top: 2px; }
.turno-note p { font-size: .78rem; line-height: 1.35; }

/* Avatar con el dia del turno */
.turno-avatar { font-size: 1.35rem !important; letter-spacing: 0; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1100px) {
    .stat-cards { grid-template-columns: repeat(2, 1fr); }
    .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-w) !important;
        transition: transform .25s ease;
    }

    .sidebar.mobile-open { transform: translateX(0); box-shadow: 30px 0 60px rgba(2, 6, 23, .4); }

    .main-area { margin-left: 0 !important; }
    .btn-menu-mobile { display: grid; place-items: center; }
    .topbar { padding: 12px 16px; flex-wrap: wrap; }
    .topbar-user-name { display: none; }
    .content { padding: 18px 16px; }
    .stat-cards { grid-template-columns: 1fr; }
    .quick-actions { grid-template-columns: 1fr; }
    .welcome-banner { flex-direction: column; align-items: stretch; padding: 20px; gap: 14px; }
    .welcome-icon { align-self: center; padding: 10px 12px; border-radius: 12px; }
    .welcome-icon img { max-width: 96px; max-height: 44px; }
}

/* ==================== BITACORA DE SERVICIOS ==================== */

.bitacora-table { min-width: 1150px; }

.bitacora-table th:last-child,
.bitacora-table td:last-child {
    position: sticky;
    right: 0;
    background: #fff;
    box-shadow: -8px 0 14px rgba(2, 6, 23, .06);
    white-space: nowrap;
    width: 150px;
}

.bitacora-table thead th:last-child { background: #f8fafc; }
.bitacora-table tbody tr:hover td:last-child { background: #f8fafc; }

.bitacora-servicio {
    display: inline-block;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    font-weight: 600;
    color: #334155;
}

.bitacora-destino {
    display: inline-block;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
    color: var(--text-muted);
}

.triage-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .74rem;
    font-weight: 800;
}

.triage-1 { background: #fee2e2; color: #b91c1c; }
.triage-2 { background: #fef3c7; color: #b45309; }
.triage-3 { background: #dcfce7; color: #15803d; }

.triage-badge i { font-size: .65rem; }

/* ---- Wizard del formulario de bitacora ---- */
.wizard-layout { display: grid; grid-template-columns: 250px 1fr; gap: 18px; }

.wizard-steps { display: flex; flex-direction: column; gap: 8px; }

.wizard-step-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1.5px solid var(--border);
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    transition: all .15s;
    font-family: inherit;
}

.wizard-step-btn:hover { border-color: #93c5fd; background: #f8fafc; }

.wizard-step-btn.active {
    border-color: var(--primary);
    background: linear-gradient(135deg, #eff6ff, #f8fafc);
    box-shadow: 0 6px 16px rgba(13, 110, 253, .12);
}

.wizard-step-num {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #e2e8f0;
    color: #475569;
    font-weight: 800;
    font-size: .85rem;
}

.wizard-step-btn.active .wizard-step-num { background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; }

.wizard-step-text { display: flex; flex-direction: column; }
.wizard-step-text strong { font-size: .84rem; color: #0f172a; }
.wizard-step-text small { font-size: .7rem; color: var(--text-muted); }

.wizard-body { min-width: 0; }

.wizard-step-panel { display: none; }
.wizard-step-panel.active { display: block; }

.progress-hero { margin-bottom: 18px; }
.progress-info p { font-size: .85rem; font-weight: 700; color: var(--primary-dark); margin-bottom: 8px; }
.progress-track { height: 8px; background: #e2e8f0; border-radius: 8px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, #38bdf8, #2563eb); border-radius: 8px; transition: width .3s ease; }

.wizard-footer { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.wizard-progress-label { font-size: .8rem; color: var(--text-muted); font-weight: 600; }
.wizard-footer .btn-submit-form, .wizard-footer .btn-cancel-form { margin: 0; }

.campo-error input, .campo-error select, .campo-error textarea {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
}

/* Remarque rojo directo sobre el control y todo su grupo (label + campo) */
input.campo-error, select.campo-error, textarea.campo-error {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .15);
}
.form-group.campo-error > label { color: #dc2626; }

/* Tarjeta resumen de errores al guardar y finalizar */
.tarjeta-errores {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin: 0 0 18px;
    padding: 18px 20px;
    border: 1.5px solid #fecaca;
    border-left: 5px solid #ef4444;
    background: #fef2f2;
    border-radius: 14px;
    box-shadow: 0 4px 14px rgba(239, 68, 68, .08);
}
.tarjeta-errores-icono {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    font-size: 17px;
}
.tarjeta-errores-cuerpo h3 { font-size: .95rem; color: #b91c1c; margin: 0 0 4px; }
.tarjeta-errores-cuerpo p { font-size: .82rem; color: #7f1d1d; margin: 0 0 10px; }
#listaErrores {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 6px;
}
.error-item {
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid #fecaca;
    background: #fff;
    color: #b91c1c;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease;
}
.error-item:hover { background: #fff1f1; border-color: #ef4444; }
.error-item i { color: #ef4444; }
.error-item-paso {
    margin-left: auto;
    font-weight: 700;
    color: #ef4444;
    font-size: .68rem;
    background: #fee2e2;
    padding: 2px 8px;
    border-radius: 999px;
}

.otro-input {
    margin-top: 8px;
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: .92rem;
}

.module-header-actions { display: flex; gap: 10px; align-items: center; }

.btn-print {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 12px;
    background: #f1f5f9;
    border: 1.5px solid var(--border);
    color: #334155;
    font-weight: 700;
    font-size: .9rem;
    cursor: pointer;
    text-decoration: none;
}

/* ---- Resumen del detalle ---- */
.bitacora-resumen { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.bitacora-resumen-item { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; min-width: 0; }
.bitacora-resumen-item strong { font-size: .95rem; color: #0f172a; word-break: break-word; }
.bitacora-resumen-label { font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; display: inline-flex; align-items: center; gap: 6px; }

.bitacora-detalle-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 20px; }
.bitacora-detalle-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border: 1px solid #eef2f7; border-radius: 10px; background: #fff; }
.bitacora-detalle-item.full { grid-column: 1 / -1; }
.bitacora-detalle-label { font-size: .7rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.bitacora-detalle-value { font-size: .9rem; color: #0f172a; word-break: break-word; }

/* ---- Colores de secciones adicionales ---- */
.sec-green .sec-icon { background: linear-gradient(135deg, #34d399, #047857); }
.sec-indigo .sec-icon { background: linear-gradient(135deg, #818cf8, #4338ca); }
.sec-red .sec-icon { background: linear-gradient(135deg, #f87171, #b91c1c); }
.sec-slate .sec-icon { background: linear-gradient(135deg, #e67b29, #475569); }

.stat-slate { border-top-color: #64748b; }
.stat-slate .stat-icon { background: linear-gradient(135deg, #94a3b8, #475569); }

/* ---- Boton Imprimir ---- */
.btn-print { display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px; background: #f1f5f9; border: 1.5px solid var(--border); color: #334155; font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: none; }

/* ---- Responsivo wizard / bitacora ---- */
@media (max-width: 1100px) {
    .wizard-layout { grid-template-columns: 1fr; }
    .wizard-steps { flex-direction: row; overflow-x: auto; padding-bottom: 6px; }
    .wizard-step-btn { min-width: 220px; }
    .bitacora-resumen { grid-template-columns: 1fr; }
    .bitacora-detalle-grid { grid-template-columns: 1fr; }
}

/* ---- Impresion ---- */
@media print {
    .sidebar, .topbar, .dashboard-footer, .btn-back-inline, .module-header-actions, .wizard-footer, .wizard-steps { display: none !important; }
    .main-area { margin-left: 0 !important; }
    .content { padding: 0 !important; }
    body { background: #fff !important; }
    .panel { box-shadow: none !important; border: 1px solid #ddd !important; }
    .bitacora-detalle-grid { grid-template-columns: 1fr; }
    .bitacora-table { min-width: 0; }
}

/* ==================== CELULARES: logos centrados y ajustes generales ==================== */
@media (max-width: 640px) {
    /* Logo del sidebar centrado en el menu movil */
    .sidebar-brand { flex-wrap: wrap; justify-content: center; gap: 8px; padding: 18px 12px; text-align: center; }
    .sidebar-brand-text { align-items: center; }
    .sidebar-collapse { display: none; }

    /* Encabezados de modulo apilados y botones a ancho completo */
    .module-header { flex-direction: column; align-items: stretch; gap: 12px; }
    .module-header-actions { width: 100%; }
    .module-header-actions .btn-print,
    .module-header-actions .btn-primary-action { flex: 1; justify-content: center; }

    .welcome-banner { padding: 18px; }
    .welcome-text { max-width: 100%; }

    /* Wizard de bitacora a ancho completo en celular */
    .wizard-footer { flex-direction: column; }
    .wizard-footer .btn-submit-form,
    .wizard-footer .btn-cancel-form { width: 100%; justify-content: center; }
    .wizard-step-btn { min-width: 150px; padding: 10px 12px; }

    .topbar { gap: 8px; min-width: 0; }
    .topbar-title { min-width: 0; }
    .topbar-title h1 { font-size: 1.05rem; overflow-wrap: anywhere; white-space: normal; }
    .topbar-title p { overflow-wrap: anywhere; }

    /* Evitar desbordamiento horizontal en celulares */
    .main-area, .content, .panel, .badge { min-width: 0; }
    .main-area { max-width: 100%; }
    .content { width: 100%; }
    .wizard-layout, .wizard-body, .wizard-steps, .wizard-step-panel { min-width: 0; }
    .module-header, .module-header-text, .panel-header, .panel-body { min-width: 0; }
    .bitacora-resumen, .bitacora-detalle-grid, .stat-cards, .quick-actions { min-width: 0; }
    .stat-card { min-width: 0; }
    .module-header-text h2 { overflow-wrap: anywhere; font-size: 1.1rem; }
}


@media (max-width: 640px) {
    .fleet-item.mio-item { flex-direction: column; align-items: flex-start; gap: 10px; }
    .plate-big { padding: 10px 14px; }
}

/* ===== Cambio de contrasena propio (perfil) ===== */
.pass-change { margin-top: 14px; border: 1.5px dashed #e2c58a; background: #fffbeb; border-radius: 14px; padding: 14px 16px; }
.pass-change-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.pass-change-head > i { width: 38px; height: 38px; border-radius: 10px; background: #fef3c7; color: #b45309; display: inline-flex; align-items: center; justify-content: center; font-size: .95rem; flex: 0 0 38px; }
.pass-change-head h4 { margin: 0; font-size: .95rem; color: var(--text-strong, #0f172a); }
.pass-change-head p { margin: 2px 0 0; font-size: .72rem; color: var(--text-muted, #64748b); }
.pass-change .form-buttons { margin-top: 6px; justify-content: flex-start; }
.btn-change-pass { width: auto; padding: 10px 22px; }

@media (max-width: 640px) {
    .pass-change { padding: 12px; }
    .pass-change .form-buttons .btn-change-pass { width: 100%; }
}

/* ===== Reportes generales (graficas en barras CSS) ===== */
.chart-bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 240px) 1fr auto; align-items: center; gap: 10px; }
.bar-label { font-size: .74rem; color: var(--text, #334155); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 14px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, #2563eb, #38bdf8); min-width: 4px; transition: width .35s ease; }
.bar-value { font-size: .74rem; font-weight: 700; color: var(--text-muted, #475569); white-space: nowrap; }
.quick-periods { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.period-chip { font-size: .74rem; font-weight: 700; padding: 6px 14px; border-radius: 999px; border: 1.5px solid #dbe4f0; color: #2563eb; background: #fff; text-decoration: none; }
.period-chip:hover { background: #eef4ff; border-color: #2563eb; }
.reportes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.reportes-grid .empty-row { padding: 14px 8px; text-align: center; color: var(--text-muted); font-size: .8rem; }

@media (max-width: 640px) {
    .bar-row { grid-template-columns: 96px 1fr auto; gap: 7px; }
    .bar-value { font-size: .68rem; }
}

/* ===== Resumen mensual del auxiliar (completados / borradores / cancelados) ===== */
.bar-fill.bar-verde { background: linear-gradient(90deg, #16a34a, #4ade80); }
.bar-fill.bar-ambar { background: linear-gradient(90deg, #d97706, #fbbf24); }
.bar-fill.bar-rojo  { background: linear-gradient(90deg, #dc2626, #f87171); }
.mes-row .bar-label { min-width: 30px; text-align: center; }
.mes-cancel-box { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; padding: 10px 14px; border-radius: 12px; background: #fef2f2; border: 1.5px solid #fecaca; color: #b91c1c; }
.mes-cancel-box i { margin-top: 2px; }
.mes-cancel-box strong { font-size: .82rem; }
.mes-cancel-box p { margin: 2px 0 0; font-size: .72rem; color: #991b1b; }
.mes-cancel-box .hint { margin-top: 10px; }
.pill-danger { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.pill-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.pill-undo { background: #eff6ff; color: #2563eb; border: 1px solid #c7dbff; }
.pill-undo:hover { background: #2563eb; color: #fff; border-color: #2563eb; }
.row-actions form { margin: 0; }
.btn-cancel-service { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.btn-cancel-service:hover { background: #dc2626; color: #fff; border-color: #dc2626; }

@media (max-width: 640px) {
    .mes-cancel-box { flex-direction: column; }
    .reportes-grid .panel .chart-bars .bar-row .bar-label { max-width: 120px; }
}\

.panel-sub-hint { font-size: .74rem; font-weight: 700; color: var(--text-muted, #64748b); margin: 14px 0 8px; display: flex; align-items: center; gap: 6px; }

/* ===== FURTRAN ===== */
.pill-final { background: #eff6ff; color: #1d4ed8; border: 1px solid #c7dbff; }
.pill-final:hover { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.btn-draft { background: #e2e8f0 !important; color: #334155 !important; }
.btn-draft:hover { background: #cbd5e1 !important; }

/* ===== Firmas digitales (pad tactil celular / tablet) ===== */
.firmas-digital { margin-top: 16px; }
.firmas-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (max-width: 720px) { .firmas-grid { grid-template-columns: 1fr; } }
/* Un solo slot ancho (FURTRAN / FURIPS: representante legal) */
.firma-grid-uno { grid-template-columns: 1fr; max-width: 520px; }

/* Nombre + documento de quien firma, con la linea donde se traza la firma */
.firma-quien {
    margin-top: 8px; padding-top: 6px;
    border-top: 1.5px solid #334155;      /* linea sobre la que va la firma */
    display: flex; flex-direction: column; gap: 1px;
}
.firma-quien-nombre { font-size: .82rem; font-weight: 700; color: #0f172a; min-height: 1.05em; }
.firma-quien-doc, .firma-quien-tipo { font-size: .76rem; color: #475569; min-height: 1em; }
.firma-quien .firma-quien-vacio { color: #94a3b8; font-style: italic; }

.firma-slot { border: 1.5px dashed #c9d6ec; background: #fff; border-radius: 14px; padding: 12px 14px; }
.firma-slot > label { display: flex; align-items: center; gap: 7px; font-size: .78rem; font-weight: 700; color: var(--text, #334155); margin-bottom: 8px; }
.firma-slot > label i { color: #1d4ed8; }
.firma-slot-caja {
    position: relative; height: 96px; border-radius: 10px;
    background: #f8fafc; border: 1px solid #e2e8f0;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.firma-slot-preview { max-width: 100%; max-height: 90px; object-fit: contain; }
.firma-slot-vacio { display: flex; align-items: center; gap: 7px; font-size: .74rem; color: #94a3b8; font-style: italic; }
.firma-slot-tinta { display: none; }
.firma-slot-botones { display: flex; gap: 8px; margin-top: 9px; flex-wrap: wrap; }
.firma-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 9px; border: none; cursor: pointer;
    font: 600 .76rem/1 Arial, sans-serif;
}
.firma-btn-firmar { background: #1d4ed8; color: #fff; }
.firma-btn-firmar:hover { background: #1e40af; }
.firma-btn-borrar { background: #e2e8f0; color: #334155; }
.firma-btn-borrar:hover { background: #cbd5e1; }

/* Modal del pad de firma */
.firma-modal { position: fixed; inset: 0; z-index: 3000; display: none; }
.firma-modal.open { display: block; }
.firma-modal-fondo { position: absolute; inset: 0; background: rgba(15, 23, 42, .62); }
.firma-modal-caja {
    position: relative; z-index: 1;
    width: min(640px, 96vw); max-height: 96vh; overflow: auto;
    margin: 3vh auto; background: #fff; border-radius: 18px; padding: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}
.firma-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.firma-modal-head h3 { margin: 0; font-size: .98rem; color: #0f172a; }
.firma-modal-head p { margin: 2px 0 0; font-size: .72rem; color: #64748b; }
.firma-cerrar { border: none; background: #eef2f7; color: #334155; width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 1rem; }
.firma-canvas-envio {
    position: relative;
    border: 1.5px dashed #c9d6ec; border-radius: 12px; background: #f8fafc;
    overflow: hidden; touch-action: none;
}
.firma-canvas-envio canvas { display: block; width: 100%; position: relative; z-index: 1; touch-action: none; cursor: crosshair; background: transparent; }
/* Linea guia de firma: SOLO en pantalla, nunca se guarda en la imagen */
.firma-canvas-envio::after {
    content: ''; position: absolute; left: 16px; right: 16px; bottom: 20px;
    border-bottom: 1.5px dashed #c9d6ec; pointer-events: none;
}
.firma-modal-botones { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }
.firma-modal-botones .firma-btn { padding: 10px 16px; font-size: .8rem; }
.firma-modal-hint { font-size: .7rem; color: #94a3b8; text-align: center; margin-top: 8px; }

/* ==================== CELULARES: la columna Acciones se desliza con la tabla ====================
   EnCelulares no se deja NINGUNA columna pegada (sticky) a la derecha:
   la tabla completa (incluidos los botones Ver / Completar / Cancelar)
   se desplaza lateralmente para que se vea toda la informacion. */
@media (max-width: 640px) {
    .bitacora-table th:last-child, .bitacora-table td:last-child,
    .users-table th:last-child, .users-table td:last-child,
    .personal-table th:last-child, .personal-table td:last-child,
    .turnos-table th:last-child, .turnos-table td:last-child {
        position: static;
        right: auto;
        background: transparent;
        box-shadow: none;
    }
    .bitacora-table thead th:last-child,
    .personal-table thead th:last-child,
    .turnos-table thead th:last-child { background: #f8fafc; }

    /* Botones de acciones siempre en una linea (mantienen el ancho real de la columna) */
    .row-actions { flex-direction: row !important; flex-wrap: nowrap; }

    /* Deslize lateral suave y sin rebotes raros en pantalla tactil */
    .table-responsive { overscroll-behavior-x: contain; }
}

/* ==================== FIRMA PREDEFINIDA (pegar imagen) ====================
   Botones del modal solo visibles en la firma del representante legal:
   "Pegar firma (imagen)" toma la foto/archivo de la firma en papel y el
   sistema le quita el fondo blanco; "Firma predefinida" reutiliza la firma
   ya guardada en el dispositivo con un solo toque. */
.firma-modal-botones-import {
    justify-content: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px dashed #dbe4f0;
}
.firma-btn-imagen {
    background: #f0f6ff;
    border: 1.5px dashed #7c9bd4;
    color: #2f5aa8;
}
.firma-btn-imagen:active { background: #dbe9fb; }
.firma-btn-predefinida {
    background: #eefaf2;
    border: 1.5px solid #79cf9b;
    color: #1d7a46;
}
.firma-btn-predefinida:active { background: #d9f3e3; }
.firma-modal-hint-import { color: #4a6285; }
