/* ═══════════════════════════════════════════════════════════════
   S&S GESTIÓN — Clean Black & White Theme
   ═══════════════════════════════════════════════════════════════ */

/* ── Variables ─────────────────────────────────────────────────── */
:root {
  --sw: 252px;
  --sw-collapsed: 56px;

  /* Sidebar */
  --sb-bg:          #ffffff;
  --sb-border:      #e5e7eb;
  --sb-text:        #6b7280;
  --sb-text-active: #ffffff;
  --sb-active-bg:   #2563eb;

  /* Contenido */
  --bg:             #f5f5f5;
  --surface:        #ffffff;
  --surface-2:      #fafafa;
  --border:         #e5e7eb;
  --border-2:       #d1d5db;

  /* Texto */
  --text:           #0a0a0a;
  --text-2:         #374151;
  --text-muted:     #6b7280;
  --text-light:     #9ca3af;

  /* Acento — azul rey */
  --accent:         #2563eb;
  --accent-hover:   #1d4ed8;
  --accent-pale:    #eff6ff;

  /* Mantener colores de estado */
  --green:          #16a34a;
  --red:            #dc2626;
  --blue:           #2563eb;
  --purple:         #7c3aed;
  --amber:          #d97706;
  --amber-dark:     #b45309;
  --amber-light:    #fef3c7;
  --amber-pale:     #fffbeb;
  --success:        #16a34a;
  --danger:         #dc2626;

  /* Forma */
  --radius:         8px;
  --radius-sm:      6px;
  --radius-xs:      4px;

  /* Sombras — muy sutiles */
  --shadow-xs:      0 1px 3px rgba(0,0,0,.06);
  --shadow-sm:      0 2px 8px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);

  /* Tipografía */
  --mono: 'SF Mono', 'Fira Code', 'Consolas', 'Courier New', monospace;
}

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: .875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Sidebar — Blanco con borde ─────────────────────────────────── */
#sidebar {
  width: var(--sw);
  height: 100vh;
  position: fixed; top: 0; left: 0;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex; flex-direction: column;
  z-index: 1050;
  overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: #e5e7eb transparent;
  transition: width .2s ease;
}
#topbar { transition: margin-left .2s ease; }
#main   { transition: margin-left .2s ease; }

/* ── Sidebar colapsado (solo íconos) ───────────────────────────── */
body.sb-collapsed #sidebar { width: var(--sw-collapsed); }
body.sb-collapsed #topbar,
body.sb-collapsed #main   { margin-left: var(--sw-collapsed); }

body.sb-collapsed .sb-label,
body.sb-collapsed .sb-footer,
body.sb-collapsed .sb-arrow,
body.sb-collapsed .sb-brand .logo-text { display: none !important; }

body.sb-collapsed .sb-brand { padding: 1.1rem 0; }
body.sb-collapsed .sb-brand .logo-wrap { justify-content: center; }

body.sb-collapsed .sb-link {
  font-size: 0;
  gap: 0;
  padding: .52rem 0;
  justify-content: center;
  border-left: none;
}
body.sb-collapsed .sb-link .bi { font-size: .95rem; }
body.sb-collapsed .sb-link.active { border-radius: 0; }

body.sb-collapsed .sb-sublink,
body.sb-collapsed #sidebar .collapse { display: none !important; }
#sidebar::-webkit-scrollbar { width: 3px; }
#sidebar::-webkit-scrollbar-thumb { background: #e5e7eb; }

/* Brand */
.sb-brand {
  padding: 1.1rem 1rem;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.sb-brand .logo-wrap { display: flex; align-items: center; gap: .65rem; }
.sb-brand .logo-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: .9rem; color: #fff; flex-shrink: 0;
  font-weight: 900; letter-spacing: -.03em;
}
.sb-brand .logo-text strong {
  display: block; font-size: .88rem; font-weight: 700;
  color: var(--text); letter-spacing: -.01em;
}
.sb-brand .logo-text span { font-size: .67rem; color: var(--text-muted); }

/* Sección header */
.sb-section { padding: .65rem 0 .2rem; }
.sb-label {
  font-size: .62rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-light);
  padding: .45rem 1rem .2rem;
}

/* Nav links */
.sb-link {
  display: flex; align-items: center; gap: .6rem;
  padding: .44rem 1rem;
  color: var(--sb-text);
  text-decoration: none;
  font-size: .84rem; font-weight: 400;
  border-radius: 0;
  transition: color .1s, background .1s;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  appearance: none;
  -webkit-appearance: none;
}
.sb-link .bi {
  font-size: .95rem; min-width: 1rem; flex-shrink: 0;
}
.sb-link:hover {
  color: var(--text);
  background: var(--surface-2);
}
.sb-link.active {
  color: #ffffff;
  background: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}
.sb-link.active .bi { color: #ffffff; }

/* Sub-links */
.sb-sublink { padding-left: 2.2rem; font-size: .8rem; }
.sb-sublink .bi { font-size: .82rem; }
.sb-sublink--deep { padding-left: 4.5rem; }

/* Colapsable sidebar */
.sb-collapsible {
  width: 100%; text-align: left; background: none; border: none;
  cursor: pointer;
}
.sb-arrow {
  font-size: .7rem; transition: transform .2s ease; flex-shrink: 0;
}
.sb-collapsible[aria-expanded="true"] .sb-arrow {
  transform: rotate(90deg);
}

/* Módulo con link + chevron separados */
.sb-module-row { display: flex; align-items: stretch; }
.sb-module-row .sb-link { flex: 1; border-radius: 6px 0 0 6px; }
.sb-chevron-btn {
  background: none; border: none; border-radius: 0 6px 6px 0;
  padding: 0 .6rem; color: var(--sb-text); cursor: pointer;
  display: flex; align-items: center;
}
.sb-chevron-btn:hover { background: var(--surface-2); }
.sb-chevron-btn[aria-expanded="true"] .sb-arrow { transform: rotate(90deg); }
body.sb-collapsed .sb-module-row .sb-link { border-radius: 0; }
body.sb-collapsed .sb-chevron-btn { display: none; }

/* Chips de submódulos */
.submodule-chips {
  display: flex; flex-wrap: wrap; gap: 0;
  border: 1px solid #dee2e6; border-radius: 6px;
  overflow: hidden; width: fit-content;
  margin-bottom: 1.25rem;
}
.submodule-chips .s-chip {
  cursor: pointer; font-size: .8rem; font-weight: 500;
  padding: .35rem .85rem; background: #fff; color: #374151;
  border-right: 1px solid #dee2e6; text-decoration: none;
  transition: background .15s, color .15s; white-space: nowrap;
}
.submodule-chips .s-chip:last-child { border-right: none; }
.submodule-chips .s-chip:hover { background: #2563eb; color: #fff; }
.submodule-chips .s-chip.active { background: #2563eb; color: #fff; font-weight: 600; }

/* Footer sidebar */
.sb-footer {
  margin-top: auto;
  padding: .75rem 1rem;
  border-top: 1px solid var(--sb-border);
  font-size: .67rem; color: var(--text-light);
  font-family: var(--mono);
}

/* ── Topbar ─────────────────────────────────────────────────────── */
#topbar {
  margin-left: var(--sw);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem;
  position: sticky; top: 0; z-index: 900;
  height: 48px;
  box-shadow: var(--shadow-xs);
}
#topbar .breadcrumb {
  margin: 0; flex-grow: 1; background: none; padding: 0;
}
#topbar .breadcrumb-item,
#topbar .breadcrumb-item a {
  color: var(--text-muted); font-size: .79rem; text-decoration: none;
}
#topbar .breadcrumb-item a:hover { color: var(--text); text-decoration: underline; }
#topbar .breadcrumb-item.active { color: var(--text); font-weight: 600; font-size: .8rem; }
#topbar .breadcrumb-item + .breadcrumb-item::before { color: var(--text-light); }

.topbar-badge {
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xs);
  padding: .18rem .6rem;
  font-size: .72rem; font-weight: 600;
  color: var(--text); white-space: nowrap;
  font-family: var(--mono);
}
.btn-topbar {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  padding: .26rem .7rem; font-size: .77rem;
  text-decoration: none;
  display: inline-flex; align-items: center; gap: .3rem;
  transition: all .1s;
}
.btn-topbar:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }

/* ── Main ───────────────────────────────────────────────────────── */
#main { margin-left: var(--sw); min-height: 100vh; }
.page-content { padding: 1.5rem 1.6rem 3rem; }

.page-header { margin-bottom: 1.35rem; }
.page-header h4 {
  font-size: 1.05rem; font-weight: 700;
  letter-spacing: -.02em; color: var(--text);
}
.page-header .text-muted { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }

/* ── Cards ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-sm); }
.card-header {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  border-radius: 0 !important;
  font-size: .75rem; font-weight: 700;
  padding: .65rem 1.1rem;
  color: var(--text);
  display: flex; align-items: center;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.card-body { padding: 1.1rem; }

/* Stat cards */
.stat-card { border-top: 2px solid var(--accent); transition: box-shadow .15s; }
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  background: var(--surface-2);
}
.stat-val {
  font-size: 1.85rem; font-weight: 800;
  letter-spacing: -.04em; line-height: 1;
  font-family: var(--mono); color: var(--text);
}
.stat-label {
  font-size: .7rem; color: var(--text-muted);
  margin-top: .25rem; text-transform: uppercase;
  letter-spacing: .05em; font-weight: 600;
}

/* Module cards */
.mod-card {
  border: 1px solid var(--border) !important;
  box-shadow: var(--shadow-xs) !important;
  transition: all .15s !important;
  text-decoration: none !important;
  color: var(--text) !important;
}
.mod-card:hover {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent) !important;
}
.mod-icon {
  width: 42px; height: 42px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; flex-shrink: 0;
  background: var(--surface-2);
}

/* ── Tables ─────────────────────────────────────────────────────── */
.table-modern {
  width: 100%; border-collapse: collapse; font-size: .845rem;
}
.table-modern thead th {
  color: var(--text-muted);
  font-size: .67rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  padding: .58rem 1rem;
  border-bottom: 2px solid var(--accent);
  background: var(--surface-2);
  white-space: nowrap;
}
.table-modern tbody td {
  padding: .68rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle; color: var(--text);
}
.table-modern tbody tr:last-child td { border-bottom: none; }
.table-modern tbody tr { transition: background .07s; }
.table-modern tbody tr:hover { background: #f5f5f5; }
.table-modern tfoot td {
  padding: .68rem 1rem;
  border-top: 2px solid var(--border);
}
.table-modern code, .table-modern .fw-semibold { font-family: var(--mono); }

/* Botones de acción en tabla */
.btn-tbl {
  padding: .22rem .55rem;
  font-size: .75rem; font-weight: 500;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border-2);
  background: var(--surface);
  color: var(--text-muted);
  transition: all .1s;
  display: inline-flex; align-items: center; gap: .2rem;
  text-decoration: none; cursor: pointer;
}
.btn-tbl:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }
.btn-tbl.danger:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

/* ── Badges ─────────────────────────────────────────────────────── */
.badge {
  font-size: .67rem; font-weight: 700;
  padding: .22em .65em; border-radius: var(--radius-xs);
  letter-spacing: .04em; text-transform: uppercase;
}
.bg-success  { background: #dcfce7 !important; color: #15803d !important; }
.bg-danger   { background: #fee2e2 !important; color: #b91c1c !important; }
.bg-warning  { background: #fef9c3 !important; color: #a16207 !important; }
.bg-primary  { background: #eff6ff !important; color: #1d4ed8 !important; }
.bg-secondary{ background: #f3f4f6 !important; color: #4b5563 !important; border: 1px solid var(--border); }
.bg-info     { background: #e0f2fe !important; color: #0369a1 !important; }
.text-dark   { color: var(--text) !important; }

/* ── Forms ──────────────────────────────────────────────────────── */
.form-label {
  font-size: .77rem; font-weight: 600;
  color: var(--text-2); margin-bottom: .3rem; display: block;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-control, .form-select {
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: .875rem; color: var(--text);
  background: var(--surface);
  padding: .46rem .75rem;
  transition: border-color .1s, box-shadow .1s;
  font-family: inherit;
}
.form-control:focus, .form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,0,0,.07);
  outline: none;
}
.form-control::placeholder { color: var(--text-light); }
.form-control-sm, .form-select-sm { font-size: .82rem; padding: .35rem .65rem; }
input[type="number"] { font-family: var(--mono); }

/* Formset rows */
.formset-row {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .72rem; margin-bottom: .35rem;
  transition: border-color .1s;
}
.formset-row:focus-within { border-color: var(--accent); background: #fff; }
.btn-add-row {
  border: 1.5px dashed var(--border-2);
  color: var(--text-muted); background: transparent;
  border-radius: var(--radius-sm); padding: .42rem 1rem;
  font-size: .82rem; font-weight: 500;
  transition: all .1s; cursor: pointer;
  width: 100%; display: flex; align-items: center;
  justify-content: center; gap: .3rem;
}
.btn-add-row:hover { border-color: var(--accent); color: var(--accent); background: var(--surface-2); }

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent) !important;
  border: none !important; color: #ffffff !important;
  font-weight: 600; font-size: .84rem;
  padding: .44rem 1.1rem;
  border-radius: var(--radius-sm) !important;
  transition: background .1s, transform .07s;
  box-shadow: none !important;
}
.btn-primary:hover { background: var(--accent-hover) !important; }
.btn-primary:active { transform: scale(.98); }

.btn-success {
  background: var(--green) !important;
  border: none !important; color: #fff !important;
  font-weight: 600; border-radius: var(--radius-sm) !important;
}
.btn-success:hover { background: #15803d !important; }
.btn-danger {
  background: var(--red) !important;
  border: none !important; color: #fff !important;
  font-weight: 600; border-radius: var(--radius-sm) !important;
}
.btn-outline-primary {
  background: transparent !important;
  border: 1.5px solid var(--accent) !important;
  color: var(--accent) !important; font-weight: 600;
  border-radius: var(--radius-sm) !important;
}
.btn-outline-primary:hover { background: var(--accent) !important; color: #fff !important; }
.btn-outline-secondary {
  background: transparent !important;
  border: 1px solid var(--border-2) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-sm) !important;
}
.btn-outline-secondary:hover { background: var(--surface-2) !important; color: var(--text) !important; }
.btn-outline-danger {
  background: transparent !important;
  border: 1px solid var(--red) !important;
  color: var(--red) !important;
  border-radius: var(--radius-sm) !important;
}
.btn-outline-danger:hover { background: #fef2f2 !important; }
.btn-sm { padding: .28rem .7rem !important; font-size: .78rem !important; }

/* ── Partidas tree ──────────────────────────────────────────────── */
.nivel-1 { background: #eff6ff; font-weight: 800; border-left: 3px solid var(--accent); }
.nivel-2 { font-weight: 700; background: #fafafa; border-left: 2px solid var(--border-2); }
.nivel-3 { font-weight: 600; }
.nivel-4 { color: var(--text-2); }
.nivel-5 { color: var(--text-muted); font-size: .82rem; }
.partida-row:hover { background: #f5f5f5 !important; }
.partida-toggle { cursor: pointer; color: var(--text-light); }
.partida-row td { font-size: .82rem; }
.partida-row td:nth-child(1),
.partida-row td:nth-child(3),
.partida-row td:nth-child(4),
.partida-row td:nth-child(5),
.partida-row td:nth-child(6) { font-family: var(--mono); }

/* ── Alerts ─────────────────────────────────────────────────────── */
.messages-container {
  position: fixed; top: 1rem; right: 1rem;
  z-index: 9999; width: 340px;
}
.alert {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: .84rem;
}
.alert-success { border-left: 3px solid var(--green); }
.alert-danger  { border-left: 3px solid var(--red); }
.alert-warning { border-left: 3px solid var(--amber); }
.alert-info    { border-left: 3px solid var(--blue); }

/* ── Botón Regresar ─────────────────────────────────────────────── */
.btn-back {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--text-muted); font-size: .8rem; font-weight: 500;
  text-decoration: none; padding: .15rem 0; margin-bottom: .45rem;
  transition: color .1s; background: none; border: none; cursor: pointer;
}
.btn-back:hover { color: var(--text); }
.btn-back .bi { font-size: .8rem; transition: transform .1s; }
.btn-back:hover .bi { transform: translateX(-2px); }

/* ── Misc ───────────────────────────────────────────────────────── */
code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: .1rem .35rem; border-radius: var(--radius-xs);
  font-size: .78rem; color: var(--text-2);
  font-family: var(--mono);
}
a { color: var(--text); text-decoration: none; }
a:hover { color: #000; text-decoration: underline; }
.text-muted   { color: var(--text-muted) !important; }
.text-primary { color: var(--accent) !important; }
.text-success { color: var(--green) !important; }
.text-danger  { color: var(--red) !important; }

.sidebar-hover { background: var(--surface-2); }

.empty-state { padding: 4rem 1rem; text-align: center; color: var(--text-muted); }
.empty-state i { font-size: 2rem; opacity: .12; color: var(--text); display: block; }
.empty-state p { margin-top: .65rem; font-size: .88rem; }

/* ── Overlay mobile ─────────────────────────────────────────────── */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 1040;
}
#sidebar-overlay.show { display: block; }

/* ── Panel lateral de partida ───────────────────────────────────── */
#partida-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 460px;
  max-width: 92vw;
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -6px 0 28px rgba(0,0,0,.13);
  z-index: 1060;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform .26s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#partida-panel.open { transform: translateX(0); }

#partida-panel-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.22);
  z-index: 1055;
}
#partida-panel-overlay.show { display: block; }

.pnl-header {
  padding: .85rem 1rem .75rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: #f8fafc;
}
.pnl-nivel {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 7px; border-radius: 10px;
  background: #dbeafe; color: #1d4ed8;
}
.pnl-codigo {
  font-family: var(--mono); font-size: .82rem;
  font-weight: 700; color: #2563eb;
}
.pnl-nombre {
  font-size: .9rem; font-weight: 600; color: #111;
  margin-top: .15rem; line-height: 1.3;
}
.pnl-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.pnl-kpi {
  padding: .6rem .75rem; border-right: 1px solid var(--border);
  text-align: center;
}
.pnl-kpi:last-child { border-right: none; }
.pnl-kpi-label {
  font-size: .62rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--text-muted); display: block;
}
.pnl-kpi-val {
  font-size: .88rem; font-weight: 700; color: #111;
  font-family: var(--mono); display: block; margin-top: 2px;
}
.pnl-body { flex: 1; overflow-y: auto; padding: .75rem; }
.pnl-tipo-label {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  border-bottom: 1px solid var(--border); padding-bottom: .3rem;
  margin: .75rem 0 .4rem;
}
.pnl-tipo-label:first-child { margin-top: 0; }
.pnl-recurso-row {
  display: flex; gap: .4rem; padding: .3rem 0;
  border-bottom: 1px solid #f3f4f6; font-size: .78rem; align-items: center;
}
.pnl-recurso-row:last-child { border-bottom: none; }
.pnl-recurso-desc { color: #374151; }
.pnl-recurso-code { font-family: var(--mono); font-size: .68rem; color: #9ca3af; }
.pnl-recurso-qty { text-align: right; color: #374151; white-space: nowrap; }
.pnl-recurso-total { text-align: right; font-weight: 600; color: #111; white-space: nowrap; }
.pnl-subtotal {
  display: flex; justify-content: space-between;
  padding: .3rem .25rem; font-size: .78rem;
  color: var(--text-muted); font-style: italic;
}
.pnl-footer {
  padding: .6rem .75rem;
  border-top: 1px solid var(--border);
  flex-shrink: 0; background: #f8fafc;
  display: flex; gap: .5rem;
}
.partida-row { cursor: pointer; }
.partida-row:hover td { background: #f0f7ff !important; }
.partida-row.pnl-active td { background: #eff6ff !important; }

/* ── Notificaciones ──────────────────────────────────────────────── */
.notif-badge {
  position: absolute; top: 3px; right: 3px;
  background: #dc2626; color: #fff;
  font-size: .58rem; font-weight: 700; line-height: 1;
  border-radius: 10px; padding: 2px 5px; min-width: 16px;
  text-align: center; pointer-events: none;
}
.notif-panel {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 340px; max-height: 480px;
  background: #fff; border: 1px solid #e5e7eb;
  border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.16);
  z-index: 2000; flex-direction: column; overflow: hidden;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .75rem 1rem .6rem;
  border-bottom: 1px solid #f3f4f6;
  font-size: .82rem; font-weight: 700; color: #111;
  flex-shrink: 0; background: #f8fafc;
}
.notif-leer-btn {
  background: none; border: none; cursor: pointer;
  font-size: .74rem; color: #2563eb; padding: 0;
  display: flex; align-items: center; gap: .25rem;
}
.notif-leer-btn:hover { text-decoration: underline; }
.notif-lista { overflow-y: auto; flex: 1; }
.notif-cargando, .notif-vacia {
  padding: 2rem 1rem; text-align: center;
  font-size: .82rem; color: #9ca3af;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
}
.notif-item {
  display: flex; align-items: flex-start; gap: .65rem;
  padding: .7rem 1rem; border-bottom: 1px solid #f3f4f6;
  background: #fffbeb; transition: background .15s;
  position: relative;
}
.notif-item.notif-leida { background: #fff; }
.notif-item:hover { background: #f0f7ff; }
.notif-item:last-child { border-bottom: none; }
.notif-icono { font-size: 1rem; flex-shrink: 0; margin-top: 2px; }
.notif-contenido { flex: 1; min-width: 0; }
.notif-titulo { font-size: .8rem; font-weight: 600; color: #111; line-height: 1.3; }
.notif-msg { font-size: .74rem; color: #6b7280; margin-top: 2px; line-height: 1.4; }
.notif-fecha { font-size: .68rem; color: #9ca3af; margin-top: 3px; }
.notif-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #2563eb; border: none; cursor: pointer;
  flex-shrink: 0; margin-top: 5px; padding: 0;
  align-self: flex-start;
}
.notif-dot:hover { background: #1d4ed8; transform: scale(1.2); }

/* ── Ocultar flechas en inputs numéricos ────────────────────────── */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 992px) {
  :root { --sw: 0px; }
  #sidebar {
    transform: translateX(-252px); width: 252px;
    transition: transform .22s ease;
    z-index: 1050;
  }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
  #main, #topbar { margin-left: 0; }
}

/* ── Filtros de estado (req-chip) ────────────────────────────────── */
.req-chip {
  cursor: pointer;
  font-size: .875rem;
  padding: .3rem .75rem;
  border-right: 1px solid #dee2e6;
  background: #fff;
  color: #374151;
  transition: background .15s, color .15s;
  user-select: none;
}
.req-chip:hover { background: #2563eb; color: #fff; }
.req-chip.active { background: #2563eb; color: #fff; }


/* ── Chips de sección (unidades/cargos) ──────────────────────────── */
.chip-seccion {
  display: inline-flex;
  align-items: center;
  padding: .35rem .9rem;
  border-radius: 20px;
  font-size: .82rem;
  font-weight: 500;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: transparent;
  text-decoration: none;
  transition: background .15s, color .15s, border-color .15s;
  cursor: pointer;
}
.chip-seccion:hover {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}
.chip-seccion.chip-activo {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .chip-seccion { color: #9ca3af; border-color: var(--border); }
  .chip-seccion:hover { background: #1e3a5f; border-color: #3b82f6; color: #93c5fd; }
  .chip-seccion.chip-activo { background: #0284c7; border-color: #0284c7; color: #fff; }
}
