:root {
  --navy: #1B2D70;
  --navy-dark: #101B46;
  --electric: #326BFA;
  --gray-bg: #F4F6FA;
  --gray-text: #667085;
  --bs-primary: #326BFA;
  --bs-primary-rgb: 50, 107, 250;
  --bs-link-color: #326BFA;
  --bs-link-color-rgb: 50, 107, 250;
  --bs-link-hover-color: #1B2D70;
}
body { background: var(--gray-bg); color: #1d2433; font-size: .95rem; }
.btn-primary { --bs-btn-bg: var(--electric); --bs-btn-border-color: var(--electric); --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy); --bs-btn-active-bg: var(--navy-dark); }
.btn-outline-primary { --bs-btn-color: var(--electric); --bs-btn-border-color: var(--electric); --bs-btn-hover-bg: var(--electric); --bs-btn-hover-border-color: var(--electric); }
.text-bg-primary { background-color: var(--electric) !important; }

.app { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: var(--navy-dark) !important; color: #fff; flex-shrink: 0; }
@media (min-width: 992px) { .sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; } }
.sidebar.offcanvas-lg { --bs-offcanvas-bg: var(--navy-dark); --bs-offcanvas-color: #fff; --bs-offcanvas-width: 260px; }
.brand { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.1rem 1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { height: 42px; }
.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: .5px; }
.brand-sub { font-size: .72rem; color: #aab4d4; }
.sidebar .nav { padding: .7rem .6rem; }
.sidebar .nav-link { color: #c9d1ec; border-radius: 8px; padding: .55rem .8rem; display: flex; align-items: center; gap: .65rem; }
.sidebar .nav-link i { font-size: 1.05rem; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar .nav-link.active { background: var(--electric); color: #fff; }
.nav-sep { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7f8bb3; padding: 1rem .8rem .3rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid #e4e7ef; padding: .6rem 1.25rem; display: flex; align-items: center; gap: .75rem; position: sticky; top: 0; z-index: 10; }
.topbar-title { font-weight: 600; color: var(--navy); }
.content { padding: 1.25rem; max-width: 1400px; width: 100%; }
@media (max-width: 576px) { .content { padding: 1rem; } }

.page-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.1rem; }
.page-head h1 { font-size: 1.45rem; font-weight: 700; color: var(--navy); margin: 0; }

.card { border: 1px solid #e4e7ef; border-radius: 12px; box-shadow: 0 1px 2px rgba(16,27,70,.04); }
.card-header { background: #fff; font-weight: 600; color: var(--navy); border-bottom: 1px solid #eef0f5; border-radius: 12px 12px 0 0 !important; }
.stat { padding: 1rem 1.1rem; }
.stat .v { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.1; }
.stat .l { color: var(--gray-text); font-size: .82rem; }
.stat i { font-size: 1.5rem; color: var(--electric); }

.table { --bs-table-bg: transparent; margin-bottom: 0; }
.table thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--gray-text); font-weight: 600; background: #fafbfd; white-space: nowrap; }
.table td { vertical-align: middle; }
.table-hover tbody tr { cursor: default; }
.table a.row-link { color: inherit; text-decoration: none; font-weight: 600; }
.table a.row-link:hover { color: var(--electric); }

.dl-grid { display: grid; grid-template-columns: 140px 1fr; gap: .35rem .75rem; margin: 0; }
.dl-grid dt { color: var(--gray-text); font-weight: 500; }
.dl-grid dd { margin: 0; }
@media (max-width: 576px) { .dl-grid { grid-template-columns: 1fr; } .dl-grid dt { margin-top: .4rem; } }

.empty { text-align: center; color: var(--gray-text); padding: 2rem 1rem; }
.empty i { font-size: 2rem; display: block; margin-bottom: .4rem; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.3rem; border-left: 2px solid #e4e7ef; margin-left: .4rem; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: .3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--electric); }
.timeline li:last-child { border-left-color: transparent; }
.timeline .t { font-size: .78rem; color: var(--gray-text); }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy-dark), var(--navy)); padding: 1rem; }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card img { height: 70px; }

.imp-banner { background: #ffc107; color: #3a2c00; text-align: center; padding: .4rem; font-size: .9rem; }
.logo-preview { max-height: 90px; max-width: 260px; background: repeating-conic-gradient(#eee 0% 25%, #fff 0% 50%) 50% / 16px 16px; padding: 6px; border-radius: 8px; border: 1px solid #e4e7ef; }
.rating input { display: none; }
.rating label { font-size: 2rem; color: #d0d5dd; cursor: pointer; }
.rating label:hover, .rating label:hover ~ label, .rating input:checked ~ label { color: #f5b301; }
.rating { display: inline-flex; flex-direction: row-reverse; }
.key-box { font-family: ui-monospace, monospace; background: #101B46; color: #9fe8b0; padding: .75rem 1rem; border-radius: 8px; word-break: break-all; }
.form-label { font-weight: 500; font-size: .88rem; }
.req::after { content: ' *'; color: #dc3545; }

/* Lista con buscador */
.buscador { position: relative; }
.buscador-oculto { position: absolute; inset: 0; opacity: 0; pointer-events: none; height: 100%; }
.buscador-lista { display: none; position: absolute; z-index: 1080; left: 0; right: 0; top: calc(100% + 2px); max-height: 260px; overflow-y: auto;
  background: #fff; border: 1px solid #d0d5dd; border-radius: 8px; box-shadow: 0 8px 24px rgba(16,27,70,.15); }
.buscador-lista.abierta { display: block; }
.buscador-item { padding: .45rem .7rem; cursor: pointer; font-size: .9rem; border-bottom: 1px solid #f2f4f7; }
.buscador-item:hover, .buscador-item.activo { background: #eef3ff; }
.buscador-item.elegido { font-weight: 600; color: var(--navy); }
.buscador-item.deshabilitado { color: #98a2b3; cursor: not-allowed; background: #fafafa; }
.buscador-vacio { padding: .6rem .7rem; color: var(--gray-text); font-size: .88rem; }
