:root {
    --accent: #4a9eff;
    --accent-dim: #1e2a3a;
}

* { box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f0f;
    color: #e8e8e8;
    min-height: 100vh;
}

/* ── Topbar ── */
.topbar {
    background: #141414;
    border-bottom: 1px solid #2e2e2e;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar-brand {
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.topbar-brand:hover { color: var(--accent); }

.topbar nav a {
    color: rgba(255, 255, 255, .55);
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    transition: .2s;
    padding-bottom: 2px;
}

.topbar nav a:hover { color: #fff; }

.topbar nav a.active {
    color: #fff;
    border-bottom: 2px solid var(--accent);
}

.topbar-back {
    color: rgba(255,255,255,.4);
    text-decoration: none;
    font-size: 13px;
    margin-right: 16px;
    transition: .2s;
}

.topbar-back:hover { color: rgba(255,255,255,.8); }

/* ── Main content ── */
.main-content {
    padding: 1.75rem 2rem;
}

/* ── Bootstrap dark overrides ── */
.card {
    background: #1a1a1a !important;
    border: 1px solid #2e2e2e !important;
    border-radius: 12px !important;
    color: #e8e8e8 !important;
    box-shadow: none !important;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.4) !important;
}

.card-header {
    background: #242424 !important;
    border-color: #2e2e2e !important;
    color: #e8e8e8 !important;
}

.card-footer {
    background: #1a1a1a !important;
    border-color: #2e2e2e !important;
}

.table {
    color: #e8e8e8 !important;
    --bs-table-bg: transparent;
    --bs-table-color: #e8e8e8;
    --bs-table-hover-bg: rgba(255, 255, 255, .04);
}

.table thead th {
    color: #888 !important;
    border-color: #2e2e2e !important;
    background: #242424;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.table td, .table th {
    border-color: #2e2e2e !important;
    color: #e8e8e8 !important;
    vertical-align: middle;
    padding: 10px 14px;
}

.table-light {
    --bs-table-bg: #242424;
    --bs-table-color: #e8e8e8;
}

.table-danger {
    --bs-table-bg: rgba(220,53,69,.08) !important;
    --bs-table-color: #e8e8e8 !important;
}

.text-muted { color: #888 !important; }
.text-body  { color: #e8e8e8 !important; }

/* Form controls */
.form-control, .form-select {
    background: #1e1e1e !important;
    border-color: #3a3a3a !important;
    color: #e8e8e8 !important;
}

.form-control:focus, .form-select:focus {
    background: #242424 !important;
    border-color: var(--accent) !important;
    color: #e8e8e8 !important;
    box-shadow: 0 0 0 3px rgba(74,158,255,.15) !important;
}

.form-control::placeholder { color: #555 !important; }
.form-text { color: #666 !important; }
.form-label { color: #ccc !important; }
.form-check-label { color: #ccc !important; }
.form-check-input { background-color: #2a2a2a; border-color: #555; }

/* Inline border box (groups selector) */
.border { border-color: #3a3a3a !important; }
.rounded { border-radius: 8px !important; }

/* Alerts */
.alert-success  { background: rgba(25,135,84,.15)  !important; border-color: rgba(25,135,84,.3)  !important; color: #75d9a3 !important; }
.alert-danger   { background: rgba(220,53,69,.15)  !important; border-color: rgba(220,53,69,.3)  !important; color: #f08080 !important; }
.alert-warning  { background: rgba(255,193,7,.12)  !important; border-color: rgba(255,193,7,.3)  !important; color: #ffd966 !important; }
.alert-warning a { color: var(--accent); }
.btn-close { filter: invert(1) grayscale(1); }

/* Pagination */
.page-link {
    background: #1e1e1e !important;
    border-color: #3a3a3a !important;
    color: #ccc !important;
}
.page-link:hover { background: #2e2e2e !important; color: #fff !important; }
.page-item.active .page-link {
    background: var(--accent) !important;
    border-color: var(--accent) !important;
    color: #fff !important;
}
.page-item.disabled .page-link { color: #555 !important; }

/* Modals */
.modal-content {
    background: #1a1a1a !important;
    border: 1px solid #2e2e2e !important;
    color: #e8e8e8 !important;
}
.modal-header { border-color: #2e2e2e !important; }
.modal-footer { border-color: #2e2e2e !important; }

/* Buttons */
.btn-outline-secondary {
    color: #aaa !important;
    border-color: #444 !important;
}
.btn-outline-secondary:hover {
    background: #2e2e2e !important;
    color: #fff !important;
    border-color: #555 !important;
}

/* Grupo badge (was purple, now blue-tinted) */
.badge-grupo {
    background: #1e2a3a !important;
    color: var(--accent) !important;
}

/* Isorga badge */
.badge-isorga {
    background: #1e2a3a !important;
    color: var(--accent) !important;
}

/* Stat card KPI */
.stat-card {
    border: 1px solid #2e2e2e !important;
    background: #1a1a1a !important;
    transition: .2s;
}

.stat-card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,.4) !important;
    transform: translateY(-2px);
}

/* "Añadir en bloque" card */
.card-bloque {
    background: #1e2a3a !important;
    border: 1px solid #2e4060 !important;
}

/* Section title */
.section-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #666;
    margin-bottom: 12px;
}

/* Mobile nav */
.mobile-header {
    display: none;
    background: #141414;
    border-bottom: 1px solid #2e2e2e;
    color: #fff;
    padding: 0.75rem 1rem;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 999;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #141414;
    border-top: 1px solid #2e2e2e;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav-list {
    display: flex;
    list-style: none;
    margin: 0; padding: 0;
}

.mobile-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 0.6rem 0.5rem;
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.65rem;
    font-weight: 500;
    transition: color 0.2s;
    min-width: 60px;
    text-align: center;
}

.mobile-nav-link i { font-size: 1.1rem; }
.mobile-nav-link.active { color: var(--accent); }

@media (max-width: 768px) {
    .topbar nav { display: none; }
    .topbar-back { display: none; }
    .main-content { padding: 1rem; padding-bottom: 80px; }
    .mobile-header { display: flex; }
    .mobile-nav    { display: block; }
}
