:root {
    --rojo-kosmos: #d62022;
    --rojo-kosmos-dark: #b31a1c;
    --azul-marino: #0e2a47;
    --azul-marino-light: #16406e;
    --naranja-acento: #f26522;
    --gris-claro: #f4f6f9;
    --gris-borde: #e2e6ea;
    --texto-oscuro: #212529;
    --texto-gris: #6b7280;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Poppins", "Segoe UI", Arial, sans-serif;
    background: var(--gris-claro);
    color: var(--texto-oscuro);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ---------- Barra superior ---------- */
.topbar {
    background: linear-gradient(135deg, var(--rojo-kosmos), var(--rojo-kosmos-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 30px;
    flex-wrap: wrap;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    position: sticky;
    top: 0;
    z-index: 10;
}

.topbar-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 17px; }
.topbar-brand img { height: 34px; background: #fff; border-radius: 6px; padding: 2px 6px; }

.topbar-nav { display: flex; align-items: center; gap: 22px; }
.topbar-nav a { font-weight: 600; padding: 6px 4px; opacity: .92; transition: opacity .15s; }
.topbar-nav a:hover { opacity: 1; text-decoration: underline; }
.topbar-user { opacity: .9; font-size: 14px; }

.btn-logout {
    background: var(--azul-marino);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    transition: background .15s;
}
.btn-logout:hover { background: var(--azul-marino-light); }

/* ---------- Layout general ---------- */
.container { max-width: 1150px; margin: 0 auto; padding: 30px 22px 60px; }

h1 { color: var(--azul-marino); font-size: 27px; margin-bottom: 6px; font-weight: 700; }
h2 { color: var(--azul-marino); font-size: 18px; font-weight: 600; }

.card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 14px rgba(16,42,67,.07);
    margin-bottom: 24px;
    border: 1px solid var(--gris-borde);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 800px) { .grid-2 { grid-template-columns: 1fr; } }

.dashboard-links { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 24px; }

.dashboard-card {
    flex: 1;
    min-width: 240px;
    background: linear-gradient(135deg, var(--azul-marino), var(--azul-marino-light));
    color: #fff;
    padding: 36px 26px;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
    transition: transform .15s, box-shadow .15s;
    box-shadow: 0 4px 14px rgba(14,42,71,.25);
}
.dashboard-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(14,42,71,.3); }

/* ---------- Formularios ---------- */
form label { display: block; font-weight: 600; margin: 12px 0 5px; font-size: 13.5px; color: var(--azul-marino); }

input[type=text], input[type=password], input[type=date], select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--gris-borde);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--naranja-acento); }

textarea { min-height: 70px; resize: vertical; }

.btn {
    display: inline-block;
    padding: 11px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    text-align: center;
    font-family: inherit;
    transition: transform .1s, box-shadow .15s, background .15s;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--naranja-acento); color: #fff; box-shadow: 0 3px 10px rgba(242,101,34,.3); }
.btn-primary:hover { background: #d9581c; }
.btn-secondary { background: var(--azul-marino); color: #fff; }
.btn-secondary:hover { background: var(--azul-marino-light); }
.btn-danger { background: var(--rojo-kosmos); color: #fff; }
.btn-danger:hover { background: var(--rojo-kosmos-dark); }
.btn-outline { background: #fff; color: var(--azul-marino); border: 1.5px solid var(--azul-marino); }
.btn-outline:hover { background: var(--azul-marino); color: #fff; }
.btn-block { width: 100%; padding: 13px; font-size: 15px; }

.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* ---------- Tablas ---------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--gris-borde); }
th { background: var(--gris-claro); color: var(--azul-marino); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: #fafbfd; }

.badge { display: inline-block; padding: 3px 11px; border-radius: 20px; font-size: 12px; font-weight: 700; color: #fff; }
.badge-activo, .badge-programado { background: #2e7d32; }
.badge-baja, .badge-vencido { background: var(--rojo-kosmos); }
.badge-reparacion { background: var(--naranja-acento); }
.badge-realizado { background: var(--azul-marino); }
.badge-cancelado { background: #888; }

.alert { padding: 13px 18px; border-radius: 10px; margin-bottom: 20px; font-weight: 600; }
.alert-success { background: #e5f6e8; color: #205c2c; border: 1px solid #b9e3c1; }
.alert-error { background: #fdecea; color: #8a1c1c; border: 1px solid #f3b8b4; }

.top-actions { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.search-box { max-width: 420px; margin-bottom: 18px; }

/* ---------- Login split screen ---------- */
.login-page-body { margin: 0; background: #fff; }

.login-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 100vh;
}
@media (max-width: 850px) { .login-split { grid-template-columns: 1fr; } }

.login-form-side { display: flex; align-items: center; justify-content: center; padding: 40px 20px; }
.login-form-inner { width: 100%; max-width: 360px; }
.login-form-inner h1 { font-size: 28px; margin-bottom: 4px; }
.login-subtitle { color: var(--texto-gris); margin: 0 0 22px; font-size: 14px; }

.password-field { position: relative; }
.toggle-password { position: absolute; right: 12px; top: 10px; cursor: pointer; user-select: none; opacity: .6; }
.toggle-password:hover { opacity: 1; }

.login-brand-side {
    background: linear-gradient(160deg, var(--azul-marino) 0%, var(--rojo-kosmos-dark) 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}
.login-logo { width: 220px; max-width: 70%; background: #fff; border-radius: 14px; padding: 18px 24px; margin-bottom: 26px; box-shadow: 0 6px 24px rgba(0,0,0,.25); }
.login-brand-side h2 { color: #fff; font-size: 22px; margin: 0 0 10px; }
.login-brand-side p { opacity: .85; max-width: 320px; font-size: 14px; line-height: 1.5; }

/* ---------- Responsiva (impresión) ---------- */
.responsiva-page { background: #fff; }
.responsiva-header { display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--rojo-kosmos); padding-bottom: 16px; margin-bottom: 24px; }
.responsiva-header img { height: 60px; }
.responsiva-header h1 { font-size: 20px; margin: 0; text-align: right; }
.responsiva-table td { padding: 8px 10px; font-size: 14px; }
.responsiva-table td.label { font-weight: 700; color: var(--azul-marino); width: 220px; }
.firma-box { margin-top: 60px; display: flex; justify-content: space-between; gap: 40px; }
.firma-linea { border-top: 1.5px solid #333; margin-top: 60px; padding-top: 8px; text-align: center; font-size: 13px; }

@media print {
    .no-print { display: none !important; }
    body { background: #fff; }
    .container { max-width: 100%; padding: 0; }
    .card { box-shadow: none; border: none; }
}

/* ---------- Layout con barra lateral (estilo panel moderno) ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: #fff;
    border-right: 1px solid var(--gris-borde);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 6px 6px 20px; border-bottom: 1px solid var(--gris-borde); margin-bottom: 14px; }
.sidebar-avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: linear-gradient(135deg, var(--rojo-kosmos), var(--naranja-acento));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px; flex-shrink: 0;
}
.sidebar-user-name { font-weight: 700; font-size: 14px; color: var(--azul-marino); }
.sidebar-user-role { font-size: 12px; color: var(--texto-gris); }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-nav a {
    padding: 11px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14.5px;
    color: var(--texto-oscuro);
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: var(--gris-claro); }
.sidebar-nav a.active { background: linear-gradient(135deg, var(--rojo-kosmos), var(--rojo-kosmos-dark)); color: #fff; }

.sidebar-footer { display: flex; flex-direction: column; align-items: center; gap: 14px; padding-top: 16px; border-top: 1px solid var(--gris-borde); }
.sidebar-logo { width: 100%; max-width: 150px; }
.sidebar-logout {
    background: none; border: none; color: var(--rojo-kosmos); font-weight: 700;
    cursor: pointer; font-family: inherit; font-size: 13.5px; width: 100%; text-align: left; padding: 8px 6px;
    border-radius: 8px; transition: background .15s;
}
.sidebar-logout:hover { background: #fdecea; }

.content-area { flex: 1; min-width: 0; }

.breadcrumb-bar {
    background: #fff;
    border-bottom: 1px solid var(--gris-borde);
    padding: 14px 30px;
    font-size: 13.5px;
    color: var(--texto-gris);
    font-weight: 600;
}
.breadcrumb-bar a { color: var(--azul-marino); }
.breadcrumb-bar a:hover { text-decoration: underline; }

.page-header-card {
    background: linear-gradient(135deg, #eef2f7, #f6f8fb);
    border: 1px solid var(--gris-borde);
    border-radius: 14px;
    padding: 26px 28px;
    margin-bottom: 26px;
}
.page-header-card h1 { margin-bottom: 4px; }
.page-header-card p { margin: 0; color: var(--texto-gris); }

/* ---------- Tiles del panel principal ---------- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px; }

.dashboard-tile {
    background: #fff;
    border: 1px solid var(--gris-borde);
    border-radius: 14px;
    padding: 24px;
    display: block;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
.dashboard-tile:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(16,42,67,.1); border-color: transparent; }

.tile-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.tile-icon-red { background: #fde3e2; }
.tile-icon-blue { background: #dbeafe; }
.tile-icon-purple { background: #ede9fe; }

.tile-title { font-weight: 700; font-size: 17px; color: var(--azul-marino); margin-bottom: 6px; }
.tile-desc { font-size: 13.5px; color: var(--texto-gris); margin-bottom: 14px; line-height: 1.4; }
.tile-link { font-weight: 700; font-size: 13.5px; color: var(--naranja-acento); }

@media print {
    .sidebar, .breadcrumb-bar { display: none !important; }
    .app-shell { display: block; }
    .content-area { width: 100%; }
}

@media (max-width: 850px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; height: auto; position: static; flex-direction: row; flex-wrap: wrap; }
    .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar-footer { flex-direction: row; }
}

/* ---------- Pestañas (tabs) ---------- */
.tabs-bar { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 2px solid var(--gris-borde); }

.tab-link {
    padding: 10px 18px;
    font-weight: 700;
    font-size: 14px;
    color: var(--texto-gris);
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.tab-link:hover { color: var(--azul-marino); }
.tab-link.active { color: var(--rojo-kosmos); border-bottom-color: var(--rojo-kosmos); }

.tile-icon-green { background: #dcfce7; }

.tile-icon-orange { background: #ffedd5; }

/* ---------- Notificaciones del panel principal ---------- */
.notif-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; margin-bottom: 26px; }

.notif-card { background: #fff; border-radius: 14px; padding: 18px 20px; border-left: 5px solid; box-shadow: 0 2px 10px rgba(16,42,67,.06); }
.notif-orange { border-color: var(--naranja-acento); }
.notif-red { border-color: var(--rojo-kosmos); }
.notif-blue { border-color: var(--azul-marino); }

.notif-title { font-weight: 700; font-size: 14px; color: var(--azul-marino); margin-bottom: 10px; }
.notif-item { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; padding: 5px 0; border-bottom: 1px solid var(--gris-borde); }
.notif-item:last-of-type { border-bottom: none; }
.notif-big { font-size: 34px; font-weight: 700; color: var(--rojo-kosmos); line-height: 1; margin: 4px 0; }
.notif-link { display: inline-block; margin-top: 10px; font-size: 12.5px; font-weight: 700; color: var(--naranja-acento); }
