:root {
  /* Colores institucionales del club: azul y verde */
  --dc-primary: #1f3a70;
  --dc-primary-dark: #152a54;
  --dc-primary-text: #ffffff;
  --dc-primary-soft: #dfe7f5;
  --sb-bg: #14284f;
  --sb-text: #cbd5e1;
  --sb-title: #ffffff;
  --sb-muted: #64748b;
  --sb-hover: rgba(255,255,255,.06);
  --sb-active-bg: #2e7d32;
  --sb-active-text: #ffffff;
  --sb-border: rgba(255,255,255,.06);
  --top-bg: #ffffff;
  --top-text: #1e293b;
  --top-border: #e2e8f0;
  --dc-dark: #1e293b;
  --dc-darker: #0f172a;
  --dc-bg: #f1f5f9;
  --dc-border: #e2e8f0;
  --sidebar-w: 260px;
  --bs-font-sans-serif: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-primary: #1f3a70;
}
:root:not([data-bs-theme=dark]) { --bs-body-color: #334155; }
body { background: var(--dc-bg); font-size: .925rem; color: var(--bs-body-color); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--sb-bg); color: var(--sb-text); border-right: 1px solid var(--sb-border);
  position: fixed; inset: 0 auto 0 0; z-index: 1040; overflow-y: auto;
  transition: transform .25s ease;
}
/* Barra de desplazamiento del menú: delgada e invisible, aparece al pasar el cursor */
.sidebar { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar:hover { scrollbar-color: rgba(255,255,255,.28) transparent; }
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
.sidebar:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,.28); }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.2rem; text-decoration: none; color: var(--sb-title); border-bottom: 1px solid var(--sb-border); }
.brand strong { display: block; font-size: 1.05rem; letter-spacing: .1px; }
.brand small { display: block; font-size: .7rem; color: var(--sb-muted); }
.menu { padding: .6rem .7rem 2rem; }
.menu-header { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--sb-muted); padding: 1rem .7rem .35rem; font-weight: 600; }
.menu-link { display: flex; align-items: center; gap: .75rem; padding: .55rem .75rem; border-radius: .5rem; color: var(--sb-text); text-decoration: none; font-size: .88rem; margin-bottom: 2px; }
.menu-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.menu-link:hover { background: var(--sb-hover); color: var(--sb-title); }
.menu-link.active { background: var(--sb-active-bg); color: var(--sb-active-text); font-weight: 600; }
.main { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 1020; background: var(--top-bg); color: var(--top-text); border-bottom: 1px solid var(--top-border); display: flex; align-items: center; gap: .75rem; padding: .6rem 1.25rem; min-height: 60px; }
.page-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--top-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .btn-icon, .topbar .btn-user { color: var(--top-text); }
.topbar .btn-user .text-muted { color: inherit !important; opacity: .7; }
.btn-icon { border: 0; font-size: 1.5rem; line-height: 1; padding: .25rem .4rem; }
.btn-user { display: flex; align-items: center; gap: .5rem; border: 0; padding: .25rem .5rem; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--dc-primary); color: var(--dc-primary-text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.content { padding: 1.25rem; flex: 1; }
.footer { padding: .8rem 1.25rem; font-size: .75rem; color: #94a3b8; text-align: center; }
.sidebar-backdrop { display: none; }

/* Menú oculto en PC (botón ☰ de la barra superior) */
@media (min-width: 992px) {
  .main { transition: margin-left .25s ease; }
  .menu-oculto .sidebar { transform: translateX(-100%); }
  .menu-oculto .main { margin-left: 0; }
}
/* Logo en la barra superior: sólo cuando el menú (y su logo) no se ve */
.topbar-logo { display: none; flex-shrink: 0; }
.topbar-logo img { width: 34px; height: 34px; object-fit: contain; border-radius: .5rem; background: #fff; padding: 2px; box-shadow: 0 1px 3px rgba(15,23,42,.15); }
.menu-oculto .topbar-logo { display: inline-flex; animation: logo-entra .25s ease; }
@media (max-width: 991.98px) { .topbar-logo { display: inline-flex; } }
@keyframes logo-entra { from { opacity: 0; transform: scale(.8); } to { opacity: 1; transform: none; } }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1035; }
  .main { margin-left: 0; }
  .content { padding: 1rem; }
}

/* ---------- Componentes ---------- */
.card { border: 1px solid var(--dc-border); border-radius: .75rem; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.card-header { background: var(--bs-body-bg); border-bottom: 1px solid var(--dc-border); font-weight: 600; padding: .85rem 1rem; border-radius: .75rem .75rem 0 0 !important; }
.stat { display: flex; align-items: center; gap: .9rem; padding: 1rem; }
.stat-icon { width: 48px; height: 48px; border-radius: .75rem; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; flex-shrink: 0; }
.stat-label { font-size: .78rem; color: var(--bs-secondary-color); margin: 0; }
.stat-value { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--bs-emphasis-color); line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat > div:last-child { flex: 1 1 auto; min-width: 0; }
.min-w-0 { min-width: 0; }
.bg-soft-primary { background: #dbeafe; color: #1d4ed8; }
.bg-soft-success { background: #dcfce7; color: #15803d; }
.bg-soft-danger  { background: #fee2e2; color: #b91c1c; }
.bg-soft-warning { background: #fef3c7; color: #b45309; }
.bg-soft-info    { background: #cffafe; color: #0e7490; }
.bg-soft-dark    { background: #e2e8f0; color: #1e293b; }

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.filters { background: var(--bs-body-bg); border: 1px solid var(--dc-border); border-radius: .75rem; padding: .85rem 1rem; margin-bottom: 1rem; }
.filters .form-label { font-size: .75rem; color: var(--bs-secondary-color); margin-bottom: .2rem; }

.btn-warning { --bs-btn-bg: var(--dc-primary); --bs-btn-border-color: var(--dc-primary); --bs-btn-color: var(--dc-primary-text);
  --bs-btn-hover-bg: var(--dc-primary-dark); --bs-btn-hover-border-color: var(--dc-primary-dark); --bs-btn-hover-color: var(--dc-primary-text);
  --bs-btn-active-bg: var(--dc-primary-dark); --bs-btn-active-border-color: var(--dc-primary-dark); --bs-btn-active-color: var(--dc-primary-text);
  --bs-btn-disabled-bg: var(--dc-primary); --bs-btn-disabled-border-color: var(--dc-primary); --bs-btn-disabled-color: var(--dc-primary-text); font-weight: 600; }
.progress-bar.bg-warning { background-color: var(--dc-primary) !important; }
.table { font-size: .875rem; }
.table > thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .03em; color: var(--bs-secondary-color); background: var(--bs-tertiary-bg); white-space: nowrap; }
.table td { vertical-align: middle; }
.actions { white-space: nowrap; }
.actions .btn { padding: .2rem .45rem; }
.progress { height: .55rem; border-radius: 1rem; }
.progress-sm { height: .4rem; }
.text-ingreso { color: #15803d !important; }
.text-egreso  { color: #b91c1c !important; }
.money { white-space: nowrap; font-variant-numeric: tabular-nums; }
.saldo-box { border-radius: .75rem; padding: .75rem 1rem; background: var(--bs-tertiary-bg); border: 1px dashed var(--bs-border-color); }
.nav-tabs .nav-link { color: var(--bs-secondary-color); font-weight: 500; }
.nav-tabs .nav-link.active { color: var(--bs-emphasis-color); border-bottom: 3px solid var(--dc-primary); }
.nav-tabs { flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden; }
.nav-tabs .nav-link { white-space: nowrap; }
.timeline { list-style: none; padding-left: 1rem; border-left: 2px solid var(--dc-border); margin: 0; }
.timeline li { position: relative; padding: 0 0 1rem 1rem; }
.timeline li::before { content: ''; position: absolute; left: -1.45rem; top: .3rem; width: .8rem; height: .8rem; border-radius: 50%; background: var(--dc-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--dc-primary); }
.empty { text-align: center; padding: 2rem 1rem; color: #94a3b8; }
.empty i { font-size: 2.5rem; display: block; margin-bottom: .5rem; }
.ts-wrapper.form-select { padding: 0; }
.ts-control { min-height: 38px; }
.modal-header { background: var(--bs-tertiary-bg); }
.form-label { font-weight: 500; font-size: .85rem; }
.required::after { content: ' *'; color: #dc2626; }

/* DataTables */
div.dt-container .dt-buttons .btn { font-size: .8rem; }
div.dt-container div.dt-search input { margin-left: .4rem; }
div.dt-container .dt-paging .page-link { font-size: .8rem; }
@media (max-width: 575.98px) {
  div.dt-container .dt-layout-row { flex-direction: column; align-items: stretch !important; gap: .4rem; }
  div.dt-container .dt-buttons { justify-content: center; }
  .stat-value { font-size: .98rem; }
  .stat { padding: .75rem; gap: .6rem; }
  .stat > .stat-icon { display: none; }
}

/* ---------- Login ---------- */
/* Dos paneles: marca (izquierda, con los colores del tema) y formulario (derecha) */
.auth-body { min-height: 100vh; background: var(--bs-body-bg); }
.auth { display: flex; min-height: 100vh; }
.auth-logo { width: 46px; height: 46px; object-fit: contain; border-radius: .7rem; background: #fff; padding: 3px; flex-shrink: 0; box-shadow: 0 4px 14px rgba(0,0,0,.18); }

.auth-hero { position: relative; overflow: hidden; flex: 0 0 46%; max-width: 640px; display: flex; flex-direction: column; justify-content: space-between;
  padding: 2.5rem 3rem; color: var(--sb-text); background: var(--sb-bg); isolation: isolate; }
/* Cuadrícula + halo del color principal */
.auth-hero::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 32px 32px; mask-image: linear-gradient(160deg, #000 30%, transparent 85%); -webkit-mask-image: linear-gradient(160deg, #000 30%, transparent 85%); }
.auth-hero::after { content: ''; position: absolute; z-index: -1; width: 520px; height: 520px; right: -180px; bottom: -200px; border-radius: 50%;
  background: radial-gradient(circle, var(--dc-primary) 0%, transparent 65%); opacity: .35; }
.auth-hero-top { display: flex; align-items: center; gap: .85rem; color: var(--sb-title); }
.auth-hero-top strong { font-size: 1.1rem; letter-spacing: .2px; }
.auth-hero-top small { display: block; font-size: .75rem; color: var(--sb-muted); }
.auth-hero-body { max-width: 440px; padding: 3rem 0; }
.auth-hero-body h2 { color: var(--sb-title); font-weight: 700; font-size: 2.1rem; line-height: 1.2; letter-spacing: -.02em; margin-bottom: .9rem; }
.auth-hero-body > p { font-size: 1rem; opacity: .85; margin-bottom: 2rem; }
.auth-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 1.1rem; }
.auth-features li { display: flex; gap: .9rem; align-items: flex-start; font-size: .88rem; }
.auth-features li strong { display: block; color: var(--sb-title); font-size: .95rem; margin-bottom: .1rem; }
.auth-features li > span { width: 40px; height: 40px; border-radius: .65rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; background: var(--dc-primary); color: var(--dc-primary-text); }
.auth-hero-foot { font-size: .75rem; color: var(--sb-muted); }

.auth-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1.25rem; background: var(--bs-body-bg); }
.auth-box { width: 100%; max-width: 380px; margin: auto 0; }
.auth-brand-sm { display: none; align-items: center; gap: .75rem; margin-bottom: 2rem; color: var(--bs-emphasis-color); }
.auth-brand-sm strong { font-size: 1.1rem; }
.auth-title { font-size: 1.75rem; font-weight: 700; color: var(--bs-emphasis-color); letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-sub { color: var(--bs-secondary-color); margin-bottom: 1.75rem; }
.auth .form-label { font-weight: 600; font-size: .85rem; color: var(--bs-emphasis-color); }
.auth-input { position: relative; }
.auth-input > .bi { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--bs-secondary-color); pointer-events: none; z-index: 2; }
.auth-input .form-control { padding-left: 2.75rem; font-size: 1rem; border-radius: .65rem; background: var(--bs-tertiary-bg); border-color: var(--dc-border); }
.auth-input .form-control:focus { background: var(--bs-body-bg); border-color: var(--dc-primary); box-shadow: 0 0 0 .25rem var(--dc-primary-soft); }
.auth-input .form-control:focus ~ .bi, .auth-input:focus-within > .bi { color: var(--dc-primary-dark); }
.auth-input #pwd { padding-right: 3rem; }
.auth-eye { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); border: 0; background: transparent; width: 38px; height: 38px; border-radius: .5rem;
  color: var(--bs-secondary-color); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; z-index: 2; }
.auth-eye:hover { background: rgba(128,128,128,.12); color: var(--bs-emphasis-color); }
.was-validated .auth-input .form-control:invalid { background-image: none; padding-right: 1rem; }
.was-validated .auth-input #pwd:invalid { padding-right: 3rem; }
.auth-caps { font-size: .8rem; color: #b45309; margin-top: .4rem; }
.auth-btn { border-radius: .65rem; padding-top: .7rem; padding-bottom: .7rem; font-size: 1rem; box-shadow: 0 6px 18px -6px var(--dc-primary); }
.auth-demo { display: flex; align-items: center; gap: .75rem; padding: .75rem .9rem; margin: 1.25rem 0 0; border-radius: .65rem; font-size: .85rem;
  background: var(--dc-primary-soft); border: 1px dashed var(--dc-primary); color: var(--bs-emphasis-color); }
.auth-demo > .bi { font-size: 1.4rem; color: var(--dc-primary-dark); }
.auth-demo code { font-size: .9em; font-weight: 600; color: var(--bs-emphasis-color); background: rgba(255,255,255,.6); padding: .05rem .35rem; border-radius: .3rem; }
[data-bs-theme=dark] .auth-demo { background: rgba(128,128,128,.12); }
[data-bs-theme=dark] .auth-demo code { background: rgba(0,0,0,.3); }
.auth-help { margin-top: 1.5rem; font-size: .8rem; color: var(--bs-secondary-color); }
.auth-main-foot { font-size: .72rem; color: var(--bs-secondary-color); margin-top: 1.5rem; }

/* Posición del formulario (Datos de la empresa › Inicio de sesión) */
.auth-izquierda { flex-direction: row-reverse; }
.auth-centro .auth-hero { display: none; }
.auth-centro .auth-main { position: relative; isolation: isolate; background: var(--sb-bg); overflow: hidden; }
.auth-centro .auth-main::before { content: ''; position: absolute; inset: 0; z-index: -1; opacity: .55;
  background-image: linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px); background-size: 32px 32px; }
.auth-centro .auth-main::after { content: ''; position: absolute; z-index: -1; width: 640px; height: 640px; right: -200px; bottom: -260px; border-radius: 50%;
  background: radial-gradient(circle, var(--dc-primary) 0%, transparent 65%); opacity: .35; }
.auth-centro .auth-box { max-width: 430px; background: var(--bs-body-bg); border-radius: 1rem; padding: 2.25rem 2rem; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.auth-centro .auth-brand-sm { display: flex; }
.auth-centro .auth-main-foot { color: var(--sb-muted); }

@media (max-width: 991.98px) {
  .auth-hero { display: none; }
  .auth-brand-sm { display: flex; }
  .auth-main { background: linear-gradient(180deg, var(--dc-primary-soft) 0, var(--bs-body-bg) 260px); }
}
/* Altura real de la pantalla en celulares (sin la barra del navegador) */
@supports (height: 100dvh) { .auth-body, .auth { min-height: 100dvh; } }
.auth-demo > div { overflow-wrap: anywhere; }

/* Tablets: el formulario en una tarjeta centrada en lugar de suelto en la pantalla */
@media (min-width: 576px) and (max-width: 991.98px) {
  .auth-main { padding: 2.5rem 1.5rem; }
  .auth-box, .auth-centro .auth-box { max-width: 460px; background: var(--bs-body-bg); border-radius: 1rem; padding: 2.25rem 2.25rem 2rem;
    box-shadow: 0 18px 50px rgba(0,0,0,.12); border: 1px solid var(--dc-border); }
  .auth-centro .auth-box { box-shadow: 0 24px 60px rgba(0,0,0,.35); border: 0; }
}

/* Celulares: todo el ancho, sin tarjeta (también en "Al centro") */
@media (max-width: 575.98px) {
  .auth-main { padding: 1.5rem 1rem; justify-content: flex-start; }
  .auth-box { margin: 0; }
  .auth-brand-sm { margin-bottom: 1.5rem; }
  .auth-title { font-size: 1.5rem; }
  .auth-sub { margin-bottom: 1.25rem; font-size: .92rem; }
  .auth-centro .auth-main { background: linear-gradient(180deg, var(--dc-primary-soft) 0, var(--bs-body-bg) 260px); }
  .auth-centro .auth-main::before, .auth-centro .auth-main::after { display: none; }
  .auth-centro .auth-box { max-width: 380px; background: transparent; box-shadow: none; padding: 0; border-radius: 0; }
  .auth-centro .auth-main-foot { color: var(--bs-secondary-color); }
  .auth-main-foot { margin-top: auto; padding-top: 1.5rem; }
}

/* Pantallas bajas (laptops 1366×600, celular echado): menos espacios para que entre sin desplazarse */
@media (max-height: 760px) {
  .auth-hero { padding: 1.75rem 2.5rem; }
  .auth-hero-body { padding: 1.5rem 0; }
  .auth-hero-body h2 { font-size: 1.7rem; }
  .auth-hero-body > p { margin-bottom: 1.25rem; }
  .auth-features { gap: .75rem; }
  .auth-main { padding-top: 1.25rem; padding-bottom: 1.25rem; }
  .auth-brand-sm { margin-bottom: 1rem; }
  .auth-title { font-size: 1.5rem; }
  .auth-sub { margin-bottom: 1rem; }
  .auth .mb-3 { margin-bottom: .75rem !important; }
  .auth-input .form-control-lg { padding-top: .5rem; padding-bottom: .5rem; }
  .auth-btn { margin-top: 1rem !important; padding-top: .55rem; padding-bottom: .55rem; }
  .auth .auth-demo, .auth .auth-link-registro { margin-top: .85rem; padding-top: .6rem; padding-bottom: .6rem; }
  .auth .auth-help { margin: 1rem 0 0; }
  .auth-main-foot { margin-top: 1rem; }
  .auth-centro .auth-box { padding: 1.5rem 1.75rem; }
  .auth-sub { font-size: .92rem; }
}
/* Con el panel de marca visible, la versión ya figura en su pie */
@media (min-width: 992px) and (max-height: 760px) { .auth-derecha .auth-main-foot, .auth-izquierda .auth-main-foot { display: none; } }

/* ---------- Impresión ---------- */
@media print {
  .sidebar, .topbar, .footer, .no-print, .dt-buttons, .dt-search, .dt-paging, .dt-length { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
  .card { border: 0; box-shadow: none; }
}

/* Visor de PDF (assets/js/pdf.js) */
.pdf-visor { position: relative; height: 78vh; display: flex; flex-direction: column; background: #525659; }
.pdf-visor iframe { flex: 1; width: 100%; border: 0; display: block; }
.pdf-cargando, .pdf-sin-visor { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 1.5rem; background: var(--bs-body-bg); }
.pdf-sin-visor > .bi { font-size: 3rem; color: #dc2626; margin-bottom: .5rem; }
.pdf-cargando.d-none, .pdf-sin-visor.d-none { display: none !important; }
@media (max-width: 991.98px) { .pdf-visor { height: auto; } }

/* Tablas con inputs (planilla, compra) */
#tblPl input, #tblItems input { min-width: 78px; }
#tblPl td:nth-child(2) { min-width: 170px; }

/* Logo de la empresa */
.brand img { border-radius: .5rem; object-fit: contain; background: #fff; padding: 2px; flex-shrink: 0; }
.brand strong { display: block; max-width: 180px; }

.logo-preview { width: 150px; height: 150px; border: 1px dashed var(--bs-border-color); border-radius: .75rem; display: flex; align-items: center; justify-content: center; background: #f8fafc; padding: .5rem; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.membrete { display: flex; align-items: center; gap: 1rem; border-bottom: 2px solid var(--dc-dark); padding-bottom: .75rem; margin-bottom: 1rem; }
.membrete img { width: 70px; height: 70px; object-fit: contain; }
.membrete .datos { font-size: .8rem; line-height: 1.35; }

/* ---------- Responsive general ---------- */
/* El menú nunca se desplaza de costado: los textos largos pasan a dos líneas */
.sidebar { overflow-x: hidden; }
.menu-link span { min-width: 0; overflow-wrap: anywhere; }
.brand > div { min-width: 0; }
/* Botones de guardar fijos al pie de la pantalla en formularios largos (Datos del club, Apariencia) */
.acciones-fijas { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .5rem; justify-content: space-between; align-items: center;
  margin: 1rem -1.25rem -1.25rem; padding: .75rem 1.25rem; background: var(--bs-body-bg); border-top: 1px solid var(--dc-border); box-shadow: 0 -6px 16px -8px rgba(15,23,42,.18); }
@media (max-width: 991.98px) { .acciones-fijas { margin: 1rem -1rem -1rem; padding: .65rem 1rem; } }
@media (max-width: 575.98px) {
  .acciones-fijas .btn { flex: 1 1 auto; }
  .tema-mini { height: 64px; }
  .pos-mini { height: 56px; }
  .tema-card .tema-nombre, .pos-nombre { font-size: .75rem; padding: .35rem .45rem; }
}

/* ---------- Selector de posición del login ---------- */
.pos-card { display: block; cursor: pointer; border: 2px solid var(--dc-border); border-radius: .75rem; overflow: hidden; background: var(--bs-body-bg); transition: border-color .15s, box-shadow .15s; }
.pos-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.btn-check:checked + .pos-card { border-color: var(--dc-primary); box-shadow: 0 0 0 3px var(--dc-primary-soft); }
.btn-check:disabled + .pos-card { cursor: default; opacity: .7; }
.pos-mini { display: flex; height: 72px; background: #f8fafc; }
.pos-hero { flex: 0 0 45%; background: var(--sb-bg); background-image: radial-gradient(circle at 90% 100%, var(--dc-primary) 0, transparent 55%); }
.pos-form { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 5px; padding: 0 14%; }
.pos-form i { display: block; height: 7px; border-radius: 3px; background: #cbd5e1; }
.pos-form b { display: block; height: 9px; border-radius: 3px; background: var(--dc-primary); margin-top: 2px; }
.pos-izquierda .pos-mini { flex-direction: row-reverse; }
.pos-centro .pos-mini { background: var(--sb-bg); background-image: radial-gradient(circle at 90% 100%, var(--dc-primary) 0, transparent 55%); align-items: center; justify-content: center; }
.pos-centro .pos-hero { display: none; }
.pos-centro .pos-form { flex: 0 0 46%; height: 62%; background: #fff; border-radius: 5px; padding: 0 9%; }
.pos-nombre { display: flex; justify-content: space-between; align-items: center; padding: .45rem .6rem; font-size: .82rem; font-weight: 600; border-top: 1px solid var(--dc-border); }
.pos-nombre .bi { color: var(--dc-primary); visibility: hidden; }
.btn-check:checked + .pos-card .pos-nombre .bi { visibility: visible; }
[data-bs-theme=dark] .pos-mini { background: #1e2430; }
[data-bs-theme=dark] .pos-form i { background: #475569; }

/* ---------- Selector de estilos ---------- */
.tema-card { cursor: pointer; border: 2px solid var(--dc-border); border-radius: .75rem; overflow: hidden; background: var(--bs-body-bg); transition: border-color .15s, box-shadow .15s; height: 100%; }
.tema-card:hover { box-shadow: 0 4px 14px rgba(15,23,42,.1); }
.btn-check:checked + .tema-card { border-color: var(--dc-primary); box-shadow: 0 0 0 3px var(--dc-primary-soft); }
.tema-mini { display: flex; height: 78px; }
.tema-mini .mini-sb { width: 32%; padding: 8px 6px; display: flex; flex-direction: column; gap: 5px; }
.tema-mini .mini-sb span { height: 7px; border-radius: 4px; opacity: .55; }
.tema-mini .mini-sb span.on { opacity: 1; height: 10px; }
.tema-mini .mini-main { flex: 1; display: flex; flex-direction: column; }
.tema-mini .mini-top { height: 18px; }
.tema-mini .mini-body { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.tema-mini .mini-body i { display: block; height: 6px; border-radius: 3px; background: rgba(128,128,128,.3); }
.tema-mini .mini-btn { width: 46px; height: 14px; border-radius: 4px; margin-top: auto; }
.tema-card .tema-nombre { padding: .45rem .6rem; font-size: .82rem; font-weight: 600; border-top: 1px solid var(--dc-border); display: flex; justify-content: space-between; align-items: center; }

/* =====================================================================
 * MODO OSCURO (data-bs-theme="dark" en <html>, botón de la barra superior)
 * Bootstrap 5.3 se encarga de formularios, tablas, modales y menús;
 * aquí se ajustan los componentes propios.
 * ===================================================================== */
:root[data-bs-theme=dark] {
  --bs-body-bg: #171b24;
  --bs-body-color: #d1d5db;
  --bs-emphasis-color: #f3f4f6;
  --bs-secondary-color: #9ca3af;
  --bs-tertiary-bg: #1e2430;
  --bs-secondary-bg: #1e2430;
  --bs-border-color: #2b3240;
  --dc-border: #2b3240;
  --dc-dark: #f3f4f6;
}
[data-bs-theme=dark] .card { box-shadow: none; }
[data-bs-theme=dark] .table-light { --bs-table-bg: var(--bs-tertiary-bg); --bs-table-color: var(--bs-body-color); --bs-table-border-color: var(--bs-border-color); }
[data-bs-theme=dark] .table > thead th { background: var(--bs-tertiary-bg); }
[data-bs-theme=dark] .text-ingreso { color: #4ade80 !important; }
[data-bs-theme=dark] .text-egreso  { color: #f87171 !important; }
[data-bs-theme=dark] .bg-soft-primary { background: rgba(59,130,246,.18); color: #93c5fd; }
[data-bs-theme=dark] .bg-soft-success { background: rgba(34,197,94,.18); color: #86efac; }
[data-bs-theme=dark] .bg-soft-danger  { background: rgba(239,68,68,.18); color: #fca5a5; }
[data-bs-theme=dark] .bg-soft-warning { background: rgba(245,158,11,.18); color: #fcd34d; }
[data-bs-theme=dark] .bg-soft-info    { background: rgba(6,182,212,.18); color: #67e8f9; }
[data-bs-theme=dark] .bg-soft-dark    { background: rgba(148,163,184,.18); color: #e2e8f0; }
[data-bs-theme=dark] .alert-warning { --bs-alert-bg: rgba(245,158,11,.12); --bs-alert-color: #fcd34d; --bs-alert-border-color: rgba(245,158,11,.3); }
[data-bs-theme=dark] .ts-control, [data-bs-theme=dark] .ts-dropdown, [data-bs-theme=dark] .ts-control input { background: var(--bs-body-bg) !important; color: var(--bs-body-color) !important; border-color: var(--bs-border-color); }
[data-bs-theme=dark] .ts-dropdown .active { background: var(--bs-tertiary-bg); color: var(--bs-emphasis-color); }
[data-bs-theme=dark] .swal2-popup { background: var(--bs-body-bg); color: var(--bs-body-color); }
[data-bs-theme=dark] .swal2-title, [data-bs-theme=dark] .swal2-html-container { color: var(--bs-body-color); }
[data-bs-theme=dark] .swal2-input { background: var(--bs-tertiary-bg); color: var(--bs-body-color); border-color: var(--bs-border-color); }
[data-bs-theme=dark] .timeline li::before { border-color: var(--bs-body-bg); }
[data-bs-theme=dark] .tema-card { background: var(--bs-tertiary-bg); }
[data-bs-theme=dark] .auth-main { background: var(--bs-body-bg); }
[data-bs-theme=dark] .auth-caps { color: #fcd34d; }
.btn-modo { font-size: 1.2rem !important; border-radius: 50%; width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.btn-modo:hover { background: rgba(128,128,128,.15); }
@media print { :root[data-bs-theme=dark] { --bs-body-bg: #fff; --bs-body-color: #000; } [data-bs-theme=dark] body { background: #fff; color: #000; } }

/* =====================================================================
 * Colores del club y componentes propios
 * ===================================================================== */
:root { --st-green: #2e7d32; --st-red: #c62828; --sb-text: #c9d4ea; --sb-muted: #7f93bb; }
.btn-primary { --bs-btn-bg: var(--dc-primary); --bs-btn-border-color: var(--dc-primary); --bs-btn-hover-bg: var(--dc-primary-dark); --bs-btn-hover-border-color: var(--dc-primary-dark);
  --bs-btn-active-bg: var(--dc-primary-dark); --bs-btn-active-border-color: var(--dc-primary-dark); --bs-btn-disabled-bg: var(--dc-primary); --bs-btn-disabled-border-color: var(--dc-primary); }
.btn-outline-primary { --bs-btn-color: var(--dc-primary); --bs-btn-border-color: var(--dc-primary); --bs-btn-hover-bg: var(--dc-primary); --bs-btn-hover-border-color: var(--dc-primary); --bs-btn-active-bg: var(--dc-primary); }
.text-primary { color: var(--dc-primary) !important; }
.pagination { --bs-pagination-active-bg: var(--dc-primary); --bs-pagination-active-border-color: var(--dc-primary); --bs-pagination-color: var(--dc-primary); }
/* Panel del login y acento: los temas (app/core/Tema.php) cambian --auth-hero, --acento y --hero-oscuro */
.auth-hero { background: var(--auth-hero, linear-gradient(160deg, #14284f 0%, #1f3a70 60%, #23457f 100%)); }
.auth-hero::after { background: radial-gradient(circle, var(--acento, var(--st-green)) 0%, transparent 65%); }
.auth-features li > span { background: var(--acento, var(--st-green)); color: var(--acento-text, #fff); }
.auth-btn { box-shadow: 0 6px 18px -6px var(--dc-primary); }
.auth-franja { height: 6px; background: linear-gradient(90deg, var(--st-red) 0 33%, #fff 33% 66%, var(--st-red) 66%); }
.brand img { border-radius: 50%; }
.auth-logo { border-radius: 50%; padding: 0; }
.topbar-logo img { border-radius: 50%; padding: 0; }

/* Listados paginados */
.paginador { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; padding: .75rem 1rem; border-top: 1px solid var(--dc-border); }
.table-card .table { margin-bottom: 0; }
.table-card .table > :not(caption) > * > * { padding: .55rem .75rem; }
.btn-export { white-space: nowrap; }
.dni { font-variant-numeric: tabular-nums; letter-spacing: .02em; }

/* Tablas como tarjetas en el celular: cada fila se apila con su etiqueta (data-label) */
@media (max-width: 767.98px) {
  .table-movil thead { display: none; }
  .table-movil, .table-movil tbody, .table-movil tr, .table-movil td { display: block; width: 100%; }
  .table-movil tr { border-bottom: 1px solid var(--dc-border); padding: .5rem .25rem; }
  .table-movil td { border: 0 !important; padding: .2rem .75rem !important; display: flex; justify-content: space-between; gap: 1rem; text-align: right !important; }
  .table-movil td::before { content: attr(data-label); font-weight: 600; font-size: .75rem; color: var(--bs-secondary-color); text-align: left; text-transform: uppercase; }
  .table-movil td[data-label=""]::before, .table-movil td:not([data-label])::before { content: none; }
  .table-movil td.actions { justify-content: flex-end; }
  .table-movil tfoot { display: block; } .table-movil tfoot tr { display: flex; justify-content: space-between; }
  .table-movil tfoot td { width: auto; }
}

/* Registro público de ingenieros */
.auth-box-lg { max-width: 780px; }
.auth-centro .auth-box.auth-box-lg { max-width: 820px; }
.registro-sec { display: flex; align-items: center; gap: .5rem; font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--dc-primary); margin: 1.5rem 0 .75rem; padding-bottom: .4rem; border-bottom: 1px solid var(--dc-border); }
[data-bs-theme=dark] .registro-sec { color: #93b4ef; }
.registro-sec:first-of-type { margin-top: 0; }
.registro-hp { position: absolute !important; left: -5000px !important; width: 1px; height: 1px; overflow: hidden; }
.auth-link-registro { display: flex; gap: .75rem; align-items: center; padding: .85rem 1rem; margin-top: 1.25rem; border-radius: .65rem;
  border: 1px dashed var(--dc-primary); background: var(--dc-primary-soft); color: var(--dc-primary-dark); text-decoration: none; font-size: .88rem; }
.auth-link-registro:hover { background: var(--dc-primary); color: #fff; }
.auth-link-registro > .bi { font-size: 1.5rem; }
[data-bs-theme=dark] .auth-link-registro { background: rgba(128,128,128,.12); color: var(--bs-emphasis-color); }
.credencial code { font-size: 1rem; }
.ficha-dl dt { font-weight: 400; color: var(--bs-secondary-color); }

/* ---------- Diálogos (nuevo / editar) en celular, tablet y PC ----------
 * modal-dialog-scrollable: sólo se desplaza el contenido; la cabecera y los botones Guardar/Cancelar quedan siempre a la vista.
 * dvh: en celulares la barra del navegador no tapa el pie del diálogo. */
.modal-dialog-scrollable .modal-body { overscroll-behavior: contain; }
.modal-footer { position: relative; z-index: 2; background: var(--bs-body-bg); box-shadow: 0 -6px 16px -10px rgba(15,23,42,.25); }
@supports (height: 100dvh) {
  .modal-dialog-scrollable:not([class*=modal-fullscreen]) { height: calc(100dvh - var(--bs-modal-margin) * 2); }
  .modal-dialog-centered.modal-dialog-scrollable:not([class*=modal-fullscreen]) { height: auto; max-height: calc(100dvh - var(--bs-modal-margin) * 2); }
  @media (max-width: 575.98px) { .modal-fullscreen-sm-down { height: 100dvh; } }
  @media (max-width: 767.98px) { .modal-fullscreen-md-down { height: 100dvh; } }
  @media (max-width: 991.98px) { .modal-fullscreen-lg-down { height: 100dvh; } }
}
.modal-dialog-centered.modal-dialog-scrollable .modal-content { max-height: calc(100dvh - var(--bs-modal-margin) * 2); }
@media (max-width: 575.98px) {
  .modal-footer { flex-wrap: nowrap; padding: .6rem .75rem; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
  .modal-footer > .btn { flex: 1 1 0; margin: 0 .25rem; }
  .modal-body { padding: .9rem .9rem 1.25rem; }
}
/* Pantalla abierta en el diálogo (perfiles): sus botones quedan fijos al pie del contenido */
.dialogo-contenido .acciones-fijas { margin: 1rem -1rem -1rem; padding: .7rem 1rem; padding-bottom: max(.7rem, env(safe-area-inset-bottom)); }
.dialogo-contenido .solo-pagina { display: none !important; }
@media (max-width: 575.98px) { .dialogo-contenido .acciones-fijas .btn { flex: 1 1 0; } }

/* Actividades del club en "Mi ficha": fecha en bloque a la izquierda */
.actividades-socio .act-fecha { width: 52px; border-radius: .6rem; padding: .35rem 0; background: var(--dc-primary-soft); color: var(--dc-primary-dark); line-height: 1.05; }
.actividades-socio .act-fecha.hoy { background: var(--st-green); color: #fff; }
.actividades-socio .act-dia { font-size: 1.3rem; font-weight: 700; }
.actividades-socio .act-mes { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
[data-bs-theme=dark] .actividades-socio .act-fecha:not(.hoy) { background: rgba(128,128,128,.18); color: var(--bs-emphasis-color); }
.actividades-socio .asistencia { max-width: 320px; }
@media (max-width: 575.98px) { .actividades-socio .asistencia { max-width: none; } }
/* Control de asistencia */
#ctlLista .list-group-item { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
#ctlLista .ctl-quien { flex: 1 1 220px; min-width: 0; }
#ctlLista .btn-group .btn { min-width: 92px; }
#ctlLista .list-group-item.asistio { background: rgba(34,197,94,.08); }
#ctlLista .list-group-item.falto { background: rgba(239,68,68,.06); }
@media (max-width: 575.98px) { #ctlLista .btn-group { width: 100%; } #ctlLista .btn-group .btn { flex: 1; } }


/* ---------- Panel principal amigable: bienvenida, indicadores con íconos pastel y gráficos ---------- */
.panel-hola { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-end;
  padding: 1.4rem 1.5rem; border-radius: 1rem; color: #fff; background: linear-gradient(135deg, var(--dc-primary), var(--dc-primary-dark)); box-shadow: 0 10px 30px -12px var(--dc-primary); }
.panel-hola > *:not(.hola-fondo) { position: relative; z-index: 1; }
.hola-fondo { position: absolute; right: -10px; bottom: -36px; font-size: 9rem; opacity: .12; line-height: 1; pointer-events: none; }
.hola-mano { display: inline-block; transform-origin: 70% 70%; animation: hola 2.4s ease-in-out 1; }
@keyframes hola { 0%, 60%, 100% { transform: rotate(0); } 10%, 30% { transform: rotate(14deg); } 20% { transform: rotate(-8deg); } 40% { transform: rotate(-4deg); } 50% { transform: rotate(10deg); } }
@media (prefers-reduced-motion: reduce) { .hola-mano { animation: none; } }
.hola-aviso { display: inline-flex; align-items: center; gap: .35rem; padding: .3rem .7rem; border-radius: 999px; font-size: .8rem; font-weight: 600; text-decoration: none; background: rgba(255,255,255,.92); }
.hola-aviso:hover { background: #fff; }
.hola-warning { color: #92400e; } .hola-info { color: #0e7490; } .hola-danger { color: #b91c1c; }
.hola-acciones { display: flex; flex-wrap: wrap; gap: .5rem; }
.hola-acciones .btn { border-radius: 999px; font-weight: 600; }

.kpi { padding: 1rem 1.1rem; border-radius: 1rem; transition: transform .15s ease, box-shadow .15s ease; color: inherit; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 24px -14px rgba(15,23,42,.35); }
.kpi-icono { width: 46px; height: 46px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .6rem; }
.kpi-titulo { font-size: .78rem; color: var(--bs-secondary-color); font-weight: 600; }
.kpi-valor { font-size: 1.35rem; font-weight: 700; color: var(--bs-emphasis-color); line-height: 1.25; word-break: break-word; }
.kpi-sub { font-size: .72rem; color: var(--bs-secondary-color); margin-top: .15rem; }
/* Paleta pastel: fondo suave, ícono en el tono fuerte */
.kpi-verde { background: #dcfce7; color: #15803d; } .kpi-ambar { background: #fef3c7; color: #b45309; } .kpi-violeta { background: #ede9fe; color: #6d28d9; }
.kpi-azul { background: #dbeafe; color: #1d4ed8; } .kpi-turquesa { background: #cffafe; color: #0e7490; } .kpi-rosa { background: #ffe4e6; color: #be123c; }
[data-bs-theme=dark] .kpi-verde { background: rgba(34,197,94,.18); color: #86efac; } [data-bs-theme=dark] .kpi-ambar { background: rgba(245,158,11,.18); color: #fcd34d; }
[data-bs-theme=dark] .kpi-violeta { background: rgba(139,92,246,.2); color: #c4b5fd; } [data-bs-theme=dark] .kpi-azul { background: rgba(59,130,246,.2); color: #93c5fd; }
[data-bs-theme=dark] .kpi-turquesa { background: rgba(6,182,212,.18); color: #67e8f9; } [data-bs-theme=dark] .kpi-rosa { background: rgba(244,63,94,.18); color: #fda4af; }

.chart-box { position: relative; height: 260px; }
.chart-pastel { height: 280px; }
.pastel-vacio { height: 240px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--bs-secondary-color); font-size: .85rem; text-align: center; }
.pastel-vacio .bi { font-size: 3rem; opacity: .35; }
@media (max-width: 575.98px) { .kpi-valor { font-size: 1.1rem; } .chart-box { height: 220px; } .chart-pastel { height: 260px; } .hola-fondo { font-size: 6rem; } }

/* ---------- Menú Asistencia ---------- */
.asis-fila { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.asis-fila.asistio { background: rgba(34,197,94,.08); }
.asis-fila.falto { background: rgba(239,68,68,.06); }
.asis-quien { flex: 1 1 240px; min-width: 0; }
.asis-acciones { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-left: auto; }
.asis-acciones .btn-group .btn { min-width: 92px; }
.btn-wa { background: #25d366; border-color: #25d366; color: #fff; }
.btn-wa:hover { background: #1ebe5b; border-color: #1ebe5b; color: #fff; }
@media (max-width: 575.98px) {
  .asis-acciones { width: 100%; margin-left: 0; }
  .asis-acciones .btn-group { flex: 1; } .asis-acciones .btn-group .btn { flex: 1; min-width: 0; }
  .asis-acciones .btn-wa span { display: none; }
}
@media (max-width: 575.98px) {
  #asisBuscar, #asisFiltro { max-width: none !important; width: 100%; }
  #asisSiguiente, #asisCopiar, .asis-edit .btn { flex: 1 1 auto; }
  .asis-edit > div { width: 100%; margin-left: 0 !important; }
}

/* Selección para envío masivo */
.asis-check { width: 22px; flex: 0 0 22px; display: flex; align-items: center; }
.asis-check .form-check-input { width: 1.15rem; height: 1.15rem; margin: 0; cursor: pointer; }
.asis-check-vacio { display: inline-block; width: 1.15rem; }
.asis-fila.seleccionado { box-shadow: inset 3px 0 0 #25d366; }
.active-soft { background: rgba(37,211,102,.12); font-weight: 600; }
@media (max-width: 575.98px) { .asis-quien { flex-basis: calc(100% - 40px); } }

/* =====================================================================
 * DISEÑO UNIFICADO: una sola escala de tamaños para todo el sistema
 *   · Botón normal 36px · pequeño 30px · grande 44px (igual que los campos)
 *   · Acciones de tabla: botones cuadrados neutros, el color sólo en el ícono
 *   · Exportar (PDF / Excel): botones claros con el ícono de color
 * ===================================================================== */
body { font-size: .875rem; -webkit-font-smoothing: antialiased; }

/* Botones */
.btn { --bs-btn-padding-y: .42rem; --bs-btn-padding-x: .9rem; --bs-btn-font-size: .875rem; --bs-btn-font-weight: 500; --bs-btn-border-radius: .5rem;
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem; line-height: 1.5; }
.btn > .bi { line-height: 1; }
.btn > .bi.me-1, .btn > .bi.me-2 { margin-right: 0 !important; }
.btn-sm { --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .65rem; --bs-btn-font-size: .8rem; --bs-btn-border-radius: .45rem; gap: .3rem; }
.btn-lg { --bs-btn-padding-y: .6rem; --bs-btn-padding-x: 1.25rem; --bs-btn-font-size: 1rem; --bs-btn-border-radius: .6rem; gap: .5rem; }
.btn-light { --bs-btn-bg: var(--bs-tertiary-bg); --bs-btn-border-color: var(--dc-border); --bs-btn-hover-bg: var(--dc-border); --bs-btn-hover-border-color: var(--dc-border); --bs-btn-color: var(--bs-body-color); }
.btn:focus-visible { box-shadow: 0 0 0 .2rem var(--dc-primary-soft); }
.btn-group > .btn { gap: .3rem; }

/* Campos: misma altura que los botones */
.form-control, .form-select { padding-top: .42rem; padding-bottom: .42rem; font-size: .875rem; border-radius: .5rem; border-color: var(--dc-border); }
.form-control:focus, .form-select:focus { border-color: var(--dc-primary); box-shadow: 0 0 0 .2rem var(--dc-primary-soft); }
.form-control-sm, .form-select-sm { padding-top: .28rem; padding-bottom: .28rem; font-size: .8rem; border-radius: .45rem; }
.input-group-text { font-size: .875rem; border-color: var(--dc-border); }
.form-label { font-size: .8rem; font-weight: 600; color: var(--bs-emphasis-color); margin-bottom: .3rem; }
.form-text { font-size: .75rem; }
.form-check-input:checked { background-color: var(--dc-primary); border-color: var(--dc-primary); }
.form-check-input:focus { box-shadow: 0 0 0 .2rem var(--dc-primary-soft); }
.ts-control { min-height: 36px; padding: .38rem .75rem; border-radius: .5rem !important; border-color: var(--dc-border); font-size: .875rem; }
.ts-dropdown { font-size: .875rem; border-radius: .5rem; }

/* Tarjetas */
.card { border-radius: .8rem; }
.card-header { padding: .75rem 1rem; font-size: .9rem; border-radius: .8rem .8rem 0 0 !important; }
.card-footer { background: var(--bs-body-bg); border-top-color: var(--dc-border); }
.filters { border-radius: .8rem; padding: .9rem 1rem; }
.filters .form-label { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
/* Botón Buscar: tamaño propio, no una barra que ocupa toda la columna */
@media (min-width: 768px) { .filters .btn.flex-fill { flex: 0 1 auto !important; min-width: 108px; } }

/* Tablas */
.table { font-size: .85rem; --bs-table-hover-bg: rgba(15,23,42,.025); }
.table > thead th { font-size: .68rem; font-weight: 600; letter-spacing: .05em; padding-top: .6rem; padding-bottom: .6rem; }
.table > :not(caption) > * > * { border-bottom-color: var(--dc-border); }
.table-card .table > :not(caption) > * > * { padding: .6rem .8rem; }
.table-card .table > tbody > tr:last-child > * { border-bottom: 0; }

/* Acciones de cada fila: cuadradas, neutras; el ícono lleva el color */
.actions .btn { height: 30px; min-width: 30px; padding: 0 .45rem; margin-left: .2rem; border-radius: .45rem; font-size: .85rem;
  --bs-btn-bg: var(--bs-body-bg); --bs-btn-border-color: var(--dc-border); --bs-btn-color: var(--bs-secondary-color);
  --bs-btn-hover-bg: var(--dc-primary-soft); --bs-btn-hover-border-color: var(--dc-primary-soft); --bs-btn-hover-color: var(--dc-primary-dark);
  --bs-btn-active-bg: var(--dc-primary-soft); --bs-btn-active-border-color: var(--dc-primary); --bs-btn-active-color: var(--dc-primary-dark); }
.actions .btn:first-child { margin-left: 0; }
.actions .btn-outline-danger  { --bs-btn-color: #dc2626; --bs-btn-hover-bg: #fee2e2; --bs-btn-hover-border-color: #fecaca; --bs-btn-hover-color: #b91c1c; }
.actions .btn-outline-success { --bs-btn-color: #16a34a; --bs-btn-hover-bg: #dcfce7; --bs-btn-hover-border-color: #bbf7d0; --bs-btn-hover-color: #15803d; }
.actions .btn-outline-warning { --bs-btn-color: #d97706; --bs-btn-hover-bg: #fef3c7; --bs-btn-hover-border-color: #fde68a; --bs-btn-hover-color: #b45309; }
.actions .btn-success { --bs-btn-color: #fff; --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; --bs-btn-hover-color: #fff; }
.actions .btn-primary { --bs-btn-color: var(--dc-primary-text); --bs-btn-bg: var(--dc-primary); --bs-btn-border-color: var(--dc-primary); --bs-btn-hover-bg: var(--dc-primary-dark); --bs-btn-hover-border-color: var(--dc-primary-dark); --bs-btn-hover-color: var(--dc-primary-text); }
.actions .btn-danger { --bs-btn-color: #fff; --bs-btn-bg: #dc2626; --bs-btn-border-color: #dc2626; --bs-btn-hover-bg: #b91c1c; --bs-btn-hover-border-color: #b91c1c; --bs-btn-hover-color: #fff; }
[data-bs-theme=dark] .actions .btn-outline-danger  { --bs-btn-color: #f87171; --bs-btn-hover-bg: rgba(239,68,68,.15); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: #fca5a5; }
[data-bs-theme=dark] .actions .btn-outline-success { --bs-btn-color: #4ade80; --bs-btn-hover-bg: rgba(34,197,94,.15); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: #86efac; }
[data-bs-theme=dark] .actions .btn-outline-warning { --bs-btn-color: #fbbf24; --bs-btn-hover-bg: rgba(245,158,11,.15); --bs-btn-hover-border-color: transparent; --bs-btn-hover-color: #fcd34d; }

/* Exportar: claros y discretos, con el ícono de color */
.btn-export { --bs-btn-bg: var(--bs-body-bg); --bs-btn-border-color: var(--dc-border); --bs-btn-color: var(--bs-body-color);
  --bs-btn-hover-bg: var(--bs-tertiary-bg); --bs-btn-hover-border-color: var(--dc-border); --bs-btn-hover-color: var(--bs-emphasis-color);
  --bs-btn-active-bg: var(--bs-tertiary-bg); --bs-btn-active-border-color: var(--dc-border); --bs-btn-active-color: var(--bs-emphasis-color); }
.btn-export .bi-printer, .btn-export .bi-file-earmark-pdf { color: #dc2626; }
.btn-export .bi-file-earmark-excel { color: #16a34a; }

/* Etiquetas */
.badge { font-weight: 600; font-size: .7rem; padding: .32em .6em; border-radius: .4rem; letter-spacing: .01em; vertical-align: middle; }
.badge.rounded-pill { border-radius: 999px; }

/* Barra de herramientas sobre las tablas */
.toolbar { gap: .6rem; }

/* Diálogos */
.modal-content { border: 0; border-radius: .9rem; box-shadow: 0 24px 60px -20px rgba(15,23,42,.45); }
.modal-header { padding: .85rem 1.15rem; border-bottom-color: var(--dc-border); }
.modal-title { font-size: 1rem; font-weight: 600; }
.modal-body { padding: 1.15rem; }
.modal-footer { padding: .7rem 1.15rem; gap: .5rem; border-top-color: var(--dc-border); }
.modal-footer > * { margin: 0; }

/* Alertas, pestañas y menús */
.alert { border-radius: .7rem; font-size: .85rem; padding: .7rem 1rem; }
.nav-tabs { border-bottom-color: var(--dc-border); }
.nav-tabs .nav-link { font-size: .875rem; padding: .55rem .95rem; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { background: transparent; border-bottom: 2px solid var(--dc-primary); }
.nav-tabs .nav-link:hover:not(.active) { color: var(--bs-emphasis-color); }
.dropdown-menu { font-size: .875rem; border-color: var(--dc-border); border-radius: .6rem; padding: .35rem; }
.dropdown-item { border-radius: .4rem; padding: .45rem .7rem; }

/* Barra superior y menú lateral */
.topbar { min-height: 56px; padding: .5rem 1.25rem; }
.page-title { font-size: 1.05rem; }
.avatar { width: 34px; height: 34px; font-size: .9rem; }
.btn-modo { width: 36px !important; height: 36px !important; font-size: 1.1rem !important; }
.btn-icon { font-size: 1.35rem; }
.menu-link { padding: .5rem .75rem; font-size: .86rem; }
.menu-link .badge { font-size: .65rem; }

/* Indicadores */
.stat { padding: .9rem 1rem; }
.stat-icon { width: 44px; height: 44px; font-size: 1.25rem; border-radius: .7rem; }
.stat-value { font-size: 1.15rem; }

/* Celulares */
@media (max-width: 575.98px) {
  .content { padding: .85rem; }
  /* 16px en los campos: el iPhone no acerca la pantalla al escribir */
  .form-control, .form-select, .ts-control { font-size: 1rem; padding-top: .4rem; padding-bottom: .4rem; }
  .btn { --bs-btn-padding-y: .48rem; }
  .btn-sm { --bs-btn-padding-y: .32rem; }
  .topbar { padding: .45rem .85rem; gap: .5rem; }
  .page-title { font-size: 1rem; }
  .topbar-logo img { width: 30px; height: 30px; }
  .btn-user { padding: .2rem; }
  /* Botón principal (Nuevo ...) arriba y a lo ancho; exportar debajo, repartidos */
  .toolbar > div:has(.btn-new) { order: -1; width: 100%; }
  .toolbar > div:has(.btn-new) .btn-new { flex: 1 1 0; }
  .toolbar > div:has(.btn-export) { width: 100%; }
  .toolbar > div:has(.btn-export) .btn { flex: 1 1 0; }
  .filters { padding: .8rem; }
  .card-header { padding: .7rem .85rem; }
  .actions .btn { height: 34px; min-width: 34px; }
}

/* Enlaces dentro de tablas: con el color del texto, el color del tema al pasar el cursor */
.table a:not(.btn):not(.badge) { color: var(--bs-emphasis-color); font-weight: 600; text-decoration: none; }
.table a:not(.btn):not(.badge):hover { color: var(--dc-primary); text-decoration: underline; text-underline-offset: 2px; }
[data-bs-theme=dark] .table a:not(.btn):not(.badge):hover { color: var(--bs-emphasis-color); }
.stat-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 575.98px) { .stat { padding: .7rem .75rem; } .stat-label { font-size: .72rem; } }
/* Filtros plegables en el celular (assets/js/app.js) */
@media (max-width: 575.98px) { form.filtros:not(.abierto) .filtro-extra { display: none !important; } }
/* Celdas con varias líneas (nombre + detalle) en el celular: la etiqueta arriba y el contenido debajo, a la izquierda */
@media (max-width: 767.98px) {
  .table-movil td:not(.actions):has(> :nth-child(2)) { display: block; text-align: left !important; }
  .table-movil td:not(.actions):has(> :nth-child(2))::before { display: block; margin-bottom: .15rem; }
  .table-movil td.actions { gap: .35rem; padding-top: .5rem !important; }
  .table-movil td.actions .btn { margin-left: 0; }
}
@media (max-width: 575.98px) { .acciones-fijas { margin: 1rem -.85rem -.85rem; padding: .65rem .85rem; padding-bottom: max(.65rem, env(safe-area-inset-bottom)); } }
.nav-tabs { scrollbar-width: none; } .nav-tabs::-webkit-scrollbar { display: none; }
.form-control-lg, .form-select-lg { padding-top: .6rem; padding-bottom: .6rem; font-size: 1rem; border-radius: .6rem; }

/* Modo oscuro: fondo general oscuro (los temas sólo definen el fondo claro) */
:root[data-bs-theme=dark] { --dc-bg: #11151c; --top-bg: #171b24; --top-text: #e5e7eb; --top-border: #2b3240; }
[data-bs-theme=dark] .filters, [data-bs-theme=dark] .card, [data-bs-theme=dark] .card-header, [data-bs-theme=dark] .card-footer { background: var(--bs-body-bg); }
[data-bs-theme=dark] .table { --bs-table-bg: var(--bs-body-bg); --bs-table-hover-bg: rgba(255,255,255,.03); }
[data-bs-theme=dark] .btn-light { --bs-btn-bg: #222836; --bs-btn-border-color: #2b3240; --bs-btn-hover-bg: #2b3240; --bs-btn-hover-border-color: #343c4c; --bs-btn-color: #d1d5db; --bs-btn-hover-color: #f3f4f6; }
[data-bs-theme=dark] .modal-content { background: var(--bs-body-bg); box-shadow: 0 24px 60px -20px rgba(0,0,0,.7); }
[data-bs-theme=dark] .footer { color: #6b7280; }
.ficha-dl dt, .ficha-dl dd { margin-bottom: .45rem; }
@media (max-width: 575.98px) { .ficha-dl dt { margin-bottom: 0; } .ficha-dl dd { margin-bottom: .6rem; font-weight: 500; color: var(--bs-emphasis-color); } }
