/* =====================================================================
   admin.css — Panel de administración y caseta · tema "navy Microjack"
   Sobre Bootstrap 5.3 (data-bs-theme light/dark). Iconos SVG en línea.
   ===================================================================== */
:root {
  --navy-900: #0d2c4f; --navy-800: #12386a; --navy-700: #1a4a8a; --navy-500: #2f6bb8; --navy-100: #e7eef9;
  --green: #16a34a; --green-bg: #e8f7ee; --amber: #d97706; --amber-bg: #fff4e0; --red: #dc2626; --red-bg: #fdecec; --slate: #64748b; --slate-bg: #eef1f5;
  --adm-bg: #f3f5f9; --adm-surface: #ffffff; --adm-border: #e4e8ef; --adm-text: #0f172a; --adm-text-2: #475569; --adm-text-3: #7c8797;
  --adm-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 10px 24px -14px rgba(15, 23, 42, .2);
  --adm-sidebar-w: 256px; --adm-radius: 14px;
  --bs-primary: #1a4a8a; --bs-primary-rgb: 26, 74, 138; --bs-link-color: #1a4a8a; --bs-link-color-rgb: 26, 74, 138; --bs-link-hover-color: #0d2c4f;
  --bs-body-font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --bs-body-bg: var(--adm-bg); --bs-body-color: var(--adm-text); --bs-border-color: var(--adm-border);
}
[data-bs-theme="dark"] {
  --adm-bg: #0b1220; --adm-surface: #121b2d; --adm-border: #243149; --adm-text: #e8edf5; --adm-text-2: #b6c2d4; --adm-text-3: #8391a8;
  --adm-shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 24px -14px rgba(0, 0, 0, .7);
  --navy-100: #1c2c49;
  --green: #34c26a; --amber: #f0a23c; --red: #f06565; --slate: #9aa8bd;
  --green-bg: rgba(22, 163, 74, .18); --amber-bg: rgba(217, 119, 6, .18); --red-bg: rgba(220, 38, 38, .18); --slate-bg: rgba(100, 116, 139, .22);
  --bs-primary: #6b9be6; --bs-primary-rgb: 107, 155, 230; --bs-link-color: #8fb3ee; --bs-link-color-rgb: 143, 179, 238; --bs-link-hover-color: #b7cdf5;
  --bs-body-bg: var(--adm-bg); --bs-body-color: var(--adm-text); --bs-border-color: var(--adm-border);
  --bs-secondary-bg: #182339; --bs-tertiary-bg: #142033;
}

body.adm { font-family: var(--bs-body-font-family); background: var(--adm-bg); color: var(--adm-text); min-height: 100dvh; -webkit-font-smoothing: antialiased; }
.ico { width: 1.25em; height: 1.25em; flex: none; vertical-align: -.25em; }
.ico-xs { width: 1em; height: 1em; }
.ico-lg { width: 1.6em; height: 1.6em; }
.only-dark { display: none !important; }
[data-bs-theme="dark"] .only-dark { display: inline-block !important; }
[data-bs-theme="dark"] .only-light { display: none !important; }

/* ---------- sidebar ---------- */
.adm-sidebar {
  width: var(--adm-sidebar-w); background: linear-gradient(180deg, var(--navy-900), var(--navy-800)); color: #fff;
  display: flex; flex-direction: column; border-right: 0;
}
@media (min-width: 992px) { .adm-sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; } }
.adm-sidebar__brand { padding: 20px 18px 14px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; position: relative; }
.adm-logo { display: block; height: 46px; width: auto; align-self: flex-start; }
.adm-sidebar__cond { font-size: .82rem; font-weight: 600; opacity: .8; letter-spacing: .01em; }
.adm-sidebar__close { position: absolute; top: 18px; right: 14px; }
.adm-nav { display: flex; flex-direction: column; gap: 4px; padding: 6px 12px; }
.adm-nav__link {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  color: rgba(255, 255, 255, .78); text-decoration: none; font-weight: 500; font-size: .92rem; transition: background .15s, color .15s;
}
.adm-nav__link:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.adm-nav__link.is-active { background: #fff; color: var(--navy-900); font-weight: 600; box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }
.adm-nav__link--danger { color: #ffb4b4; }
.adm-nav__link--danger:hover { background: rgba(255, 90, 90, .15); color: #ffd1d1; }
.adm-sidebar__foot { margin-top: auto; padding: 10px 12px 18px; border-top: 1px solid rgba(255, 255, 255, .1); display: flex; flex-direction: column; gap: 4px; }

/* ---------- cuerpo ---------- */
.adm-body { min-height: 100dvh; display: flex; flex-direction: column; }
@media (min-width: 992px) { .adm-body { margin-left: var(--adm-sidebar-w); } }
.adm-topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px 22px; background: color-mix(in srgb, var(--adm-bg) 85%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--adm-border);
}
.adm-topbar__title { flex: 1; min-width: 0; }
.adm-topbar__title h1 { font-size: 1.25rem; font-weight: 600; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-topbar__sub { font-size: .82rem; color: var(--adm-text-3); }
.adm-topbar__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.adm-topbar__menu, .adm-iconbtn { width: 40px; height: 40px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; border: 1px solid var(--adm-border); background: var(--adm-surface); color: var(--adm-text-2); }
.adm-user { align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 999px; background: var(--adm-surface); border: 1px solid var(--adm-border); }
.adm-user__avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--navy-100); color: var(--navy-700); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; }
[data-bs-theme="dark"] .adm-user__avatar { color: #bcd2f7; }
.adm-user__name { font-size: .85rem; font-weight: 500; }
.adm-main { padding: 22px; display: flex; flex-direction: column; gap: 18px; flex: 1; }
@media (max-width: 575px) { .adm-main { padding: 14px; } .adm-topbar { padding: 12px 14px; } }
.adm-foot { padding: 14px 22px; font-size: .76rem; color: var(--adm-text-3); }

/* ---------- tarjetas y KPI ---------- */
.adm-card { background: var(--adm-surface); border: 1px solid var(--adm-border); border-radius: var(--adm-radius); box-shadow: var(--adm-shadow); }
.adm-card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px 0; }
.adm-card__title { font-size: 1rem; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 8px; }
.adm-card__body { padding: 16px 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { display: flex; align-items: center; gap: 14px; padding: 16px 18px; }
.kpi__icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--navy-100); color: var(--navy-700); flex: none; }
.kpi__icon .ico { width: 24px; height: 24px; }
.kpi--green .kpi__icon { background: var(--green-bg); color: var(--green); }
.kpi--amber .kpi__icon { background: var(--amber-bg); color: var(--amber); }
.kpi--slate .kpi__icon { background: var(--slate-bg); color: var(--slate); }
.kpi__num { font-size: 1.7rem; font-weight: 700; line-height: 1.05; }
.kpi__label { font-size: .8rem; color: var(--adm-text-3); font-weight: 500; }
.kpi__sub { font-size: .74rem; color: var(--adm-text-3); }

/* ---------- gráfica de barras simple ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar__fill { width: 100%; max-width: 44px; border-radius: 8px 8px 4px 4px; background: linear-gradient(180deg, var(--navy-500), var(--navy-700)); min-height: 4px; position: relative; transition: height .3s; }
.bar__fill::after { content: attr(data-v); position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: .72rem; font-weight: 600; color: var(--adm-text-2); }
.bar__label { font-size: .72rem; color: var(--adm-text-3); }
.bar--today .bar__fill { background: linear-gradient(180deg, #34c26a, var(--green)); }

/* ---------- actividad ---------- */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--adm-border); }
.feed__item:first-child { border-top: 0; }
.feed__avatar { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex: none; background: var(--navy-100); color: var(--navy-700); }
.feed__avatar--ingresado { background: var(--green-bg); color: var(--green); }
.feed__avatar--pendiente { background: var(--amber-bg); color: var(--amber); }
.feed__avatar--finalizado { background: var(--slate-bg); color: var(--slate); }
.feed__avatar--expirado { background: var(--red-bg); color: var(--red); }
.feed__body { flex: 1; min-width: 0; }
.feed__title { font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__meta { font-size: .78rem; color: var(--adm-text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed__right { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.feed__time { font-size: .72rem; color: var(--adm-text-3); }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: .72rem; font-weight: 600; line-height: 1.4; white-space: nowrap; }
.chip--pendiente { background: var(--amber-bg); color: var(--amber); }
.chip--ingresado { background: var(--green-bg); color: var(--green); }
.chip--finalizado { background: var(--slate-bg); color: var(--slate); }
.chip--expirado { background: var(--red-bg); color: var(--red); }
.chip--info { background: var(--navy-100); color: var(--navy-700); }
[data-bs-theme="dark"] .chip--info { color: #bcd2f7; }
.chip--live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 1.6s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }

/* ---------- tablas y formularios ---------- */
.adm-table { margin: 0; }
.adm-table thead th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--adm-text-3); font-weight: 600; border-bottom: 1px solid var(--adm-border); background: transparent; padding: 12px 14px; white-space: nowrap; }
.adm-table tbody td { padding: 12px 14px; vertical-align: middle; border-color: var(--adm-border); font-size: .9rem; }
.adm-table tbody tr:hover { background: color-mix(in srgb, var(--navy-100) 45%, transparent); }
.adm-table .sub { display: block; font-size: .78rem; color: var(--adm-text-3); }
.adm-evgroup { display: inline-flex; gap: 4px; }
.adm-evbtn { padding: 4px 8px; border-radius: 8px; }
.adm-evidencia { text-align: center; }
.adm-evidencia img { max-width: 100%; max-height: 70vh; border-radius: 10px; }
.adm-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.adm-filters .form-control, .adm-filters .form-select { min-width: 150px; }
.form-control, .form-select { border-radius: 10px; border-color: var(--adm-border); background: var(--adm-surface); color: var(--adm-text); }
.form-control:focus, .form-select:focus { border-color: var(--navy-500); box-shadow: 0 0 0 4px rgba(26, 74, 138, .15); }
.btn { border-radius: 10px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.btn-primary { --bs-btn-bg: #1a4a8a; --bs-btn-border-color: #1a4a8a; --bs-btn-hover-bg: #12386a; --bs-btn-hover-border-color: #12386a; --bs-btn-active-bg: #0d2c4f; --bs-btn-active-border-color: #0d2c4f; }
.btn-light, .btn-outline-secondary { --bs-btn-bg: var(--adm-surface); --bs-btn-border-color: var(--adm-border); --bs-btn-color: var(--adm-text-2); --bs-btn-hover-bg: var(--navy-100); --bs-btn-hover-border-color: var(--adm-border); --bs-btn-hover-color: var(--adm-text); }
.modal-content { border-radius: 16px; border: 1px solid var(--adm-border); background: var(--adm-surface); color: var(--adm-text); }
.modal-header, .modal-footer { border-color: var(--adm-border); }
.adm-alert { display: flex; align-items: center; gap: 10px; border-radius: 12px; }
.adm-alert > .ico { flex: none; }
.adm-alert > div { flex: 1; }
.card, .list-group-item { background: var(--adm-surface); border-color: var(--adm-border); color: var(--adm-text); }
.badge.text-bg-navy { background: var(--navy-100); color: var(--navy-700); }
.text-body-tertiary { color: var(--adm-text-3) !important; }
.adm-empty { text-align: center; padding: 34px 16px; color: var(--adm-text-3); }
.adm-empty .ico { width: 40px; height: 40px; margin-bottom: 8px; }
.adm-empty strong { display: block; color: var(--adm-text); margin-bottom: 2px; }
.adm-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1200px) { .adm-grid--2 { grid-template-columns: 3fr 2fr; } }
.pwd-reveal { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.adm-danger-zone { border: 1px dashed var(--red); border-radius: 12px; padding: 14px; }
.dropdown-menu { border-radius: 12px; border-color: var(--adm-border); background: var(--adm-surface); }
.dropdown-item { color: var(--adm-text); display: flex; align-items: center; gap: 8px; }
.dropdown-item:hover { background: var(--navy-100); color: var(--adm-text); }

/* ---------- login admin / caseta ---------- */
body.adm-auth { margin: 0; font-family: var(--bs-body-font-family); min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; color: var(--adm-text);
  background: linear-gradient(160deg, var(--navy-900) 0%, var(--navy-700) 60%, var(--navy-500) 100%); }
.adm-auth-card { width: 100%; max-width: 420px; background: var(--adm-surface); border-radius: 22px; padding: 30px 26px 24px; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55); }
.adm-auth-card h1 { font-size: 1.3rem; font-weight: 600; text-align: center; margin: 0; }
.adm-auth-card .lead { text-align: center; color: var(--adm-text-3); font-size: .9rem; margin: 4px 0 20px; }
.adm-auth-logo { margin: 0 auto 14px; }
.adm-auth-logo img { height: 44px; width: auto; display: inline-block; }
.adm-auth-card .form-control { min-height: 50px; font-size: 16px; }
.adm-auth-card .btn-primary { min-height: 50px; font-weight: 600; width: 100%; }
.adm-auth-foot { text-align: center; font-size: .78rem; color: var(--adm-text-3); margin-top: 18px; }
.adm-auth-foot a { color: var(--bs-link-color); text-decoration: none; }

/* ---------- móvil: barra superior compacta ---------- */
@media (max-width: 575px) {
  .adm-topbar__sub { display: none; }
  .adm-topbar__title h1 { font-size: 1.05rem; }
  .adm-topbar__actions .btn:not(.adm-iconbtn):not(.adm-topbar__menu) { padding: 0 10px; font-size: .82rem; }
}
