:root {
    --primary: #0e2c4e;
    --primary-light: #00b6e4;
    --scout-red: #C62828;
    --scout-blue: #07747a;
    --scout-purple: #6A1B9A;
    --scout-orange: #E65100;
    --bg-light: #F7F8FA;
    --bg-card: #FFFFFF;
    --text: #2c2c2c;
    --text-muted: #6b7280;
    --border: #e5e7eb;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg-light);
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); font-size: 0.92em; }

/* Layout */
.app-header {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: sticky; top: 0; z-index: 50;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: white; font-weight: bold; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand-mark { font-size: 1.6rem; color: var(--primary-light); }

.menu-toggle {
    display: inline-block;
    background: transparent;
    color: white;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    padding: 0.4rem 0.7rem;
    font-size: 1.1rem;
    cursor: pointer;
}

.main-nav {
    width: 100%;
    display: none;
    flex-direction: column;
    gap: 0.25rem;
    padding-top: 0.75rem;
}
.main-nav.is-open { display: flex; }
.main-nav a {
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
}
.main-nav a:hover { background: rgba(255,255,255,0.1); text-decoration: none; }

.logout-form { margin: 0.25rem 0 0; }
.btn-logout {
    background: var(--scout-red);
    color: white;
    border: 0;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
}

@media (min-width: 768px) {
    .menu-toggle { display: none; }
    .main-nav {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 0.25rem;
        width: auto;
        padding-top: 0;
    }
}

.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem;
}

.app-footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

/* Splash */
.splash {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.splash-card {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 3rem 2rem;
    border-radius: 18px;
    text-align: center;
    box-shadow: 0 12px 30px rgba(0,0,0,0.15);
    max-width: 380px;
    width: 100%;
}
.splash-mark { font-size: 3.5rem; margin-bottom: 0.5rem; }
.splash-card h1 { margin: 0.25rem 0; font-size: 1.6rem; }
.splash-card .btn { margin-top: 1.5rem; }

/* Auth */
.auth-page { min-height: 70vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.auth-card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 380px;
}
.auth-mark { font-size: 2rem; text-align: center; color: var(--primary); }
.auth-card h1 { text-align: center; margin: 0.5rem 0 1rem; }
.auth-help { text-align: center; color: var(--text-muted); font-size: 0.85em; margin-top: 1rem; }

/* Page */
.page { padding-bottom: 2rem; }
.page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.page h1 { margin: 0.5rem 0; }

/* Cards & layout */
.card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
}
.card h3 { margin-top: 0; color: var(--primary); }

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.kpi { display: flex; flex-direction: column; gap: 0.25rem; align-items: flex-start; }
.kpi-label { color: var(--text-muted); font-size: 0.85em; }
.kpi-value { font-size: 1.8rem; font-weight: bold; color: var(--primary); }

.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 0.5rem;
    margin-top: 1rem;
}
.action-card {
    background: white;
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
    color: var(--primary);
    font-weight: 600;
    transition: all 0.15s;
}
.action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    text-decoration: none;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
@media (min-width: 768px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* Forms */
.form-stack {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: white;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}
.form-stack label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.92em;
}
.form-stack label > span:first-child { color: var(--text-muted); font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], input[type="file"],
select, textarea {
    width: 100%;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    background: white;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(0,182,228,0.12);
}
textarea { min-height: 80px; resize: vertical; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 0.75rem; }
legend { font-weight: 600; color: var(--text-muted); padding: 0 0.5rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: white;
    color: var(--primary);
    cursor: pointer;
    font: inherit;
    text-decoration: none;
    font-weight: 600;
}
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); color: white; }
.btn-danger { background: var(--scout-red); color: white; border-color: var(--scout-red); }
.btn-block { display: block; width: 100%; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.1rem; }

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}
.data-table th, .data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    font-size: 0.92em;
}
.data-table th { background: #fafbfc; color: var(--text-muted); font-weight: 600; }
.data-table tr:last-child td { border-bottom: 0; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 0.4rem; }
.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.7rem 0.9rem;
    color: var(--text);
}
.list-item:hover { background: #f9fafb; text-decoration: none; }
.list-item-main { display: flex; flex-direction: column; gap: 0.2rem; }
.list-item-main strong { color: var(--primary); }

/* Definition lists */
.defs { display: grid; grid-template-columns: 1fr; gap: 0.25rem; margin: 0; }
.defs dt { color: var(--text-muted); font-size: 0.85em; font-weight: 600; }
.defs dd { margin: 0 0 0.5rem 0; }
@media (min-width: 768px) {
    .defs { grid-template-columns: 200px 1fr; }
    .defs dd { margin-bottom: 0.25rem; }
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #eef2ff;
    color: var(--primary);
    font-size: 0.78em;
    font-weight: 600;
}
.badge-confirmado, .badge-aprobado, .badge-activo { background: #dcfce7; color: #166534; }
.badge-pendiente, .badge-solicitado { background: #fef9c3; color: #854d0e; }
.badge-rechazado, .badge-baja { background: #fee2e2; color: #991b1b; }
.badge-cerrado, .badge-finalizado { background: #e5e7eb; color: #374151; }
.badge-borrador { background: #f3f4f6; color: #6b7280; }
.badge-en_curso { background: #dbeafe; color: #1e40af; }

/* Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}
.filters input, .filters select { width: auto; flex: 1 1 160px; }

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-weight: 500;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-error { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-error ul { margin: 0; padding-left: 1.25rem; }

/* Timeline */
.timeline { list-style: none; padding: 0; margin: 0; border-left: 3px solid var(--primary-light); padding-left: 0.75rem; }
.timeline li { padding: 0.4rem 0; }

.pagination-wrap { margin-top: 1rem; }
.pagination-wrap nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }
