/* ============================================================
   Portal Escolar — v3.1
   Paleta: Rojo #cc0000 · Negro #111 · Blanco #fff
   ============================================================ */

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

:root {
  --rojo:      #cc0000;
  --rojo-h:    #aa0000;
  --rojo-lt:   #fff5f5;
  --negro:     #111111;
  --gris-bg:   #f0f0ee;
  --gris-brd:  #e0e0e0;
  --gris-brd2: #c8c8c8;
  --gris-txt:  #555555;
  --gris-sm:   #888888;
  --surface:   #ffffff;
  --radius:    5px;
  --radius-lg: 10px;
  --topbar-h:  50px;
  --navbar-h:  44px;
}

html { font-size: 15px; }
body {
  overflow-x: hidden;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--gris-bg);
  color: var(--negro);
  min-height: 100vh;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════════
   LOGIN
   ════════════════════════════════════════════════════════════ */
.login-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-wrap {
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.login-escudo {
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.login-escudo img {
  height: 190px;
  width: auto;
  display: block;
}
.login-monogram {
  width: 64px; height: 64px; background: var(--rojo);
  border-radius: var(--radius-lg); display: flex;
  align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 1.25rem;
  letter-spacing: .05em; margin-bottom: .75rem;
}
.login-nombre { font-size: 1.5rem; font-weight: 700; color: var(--negro); text-align: center; }
.login-sub    { font-size: .85rem; color: var(--gris-sm); text-align: center; margin-top: .2rem; }
.login-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-radius: var(--radius-lg); padding: 2.25rem 2rem;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
  border-top: 4px solid var(--rojo);
}
.login-card .form-group { margin-bottom: 1.1rem; }
.login-footer { text-align: center; margin-top: 1.1rem; font-size: .78rem; color: var(--gris-sm); }

/* ════════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════════ */
.topbar {
  background: var(--rojo); height: var(--topbar-h);
  display: flex;
  justify-content: space-between; padding: 0 1.75rem;
  position: sticky; top: 0; z-index: 300;
}
.topbar-inner {
  width: 100%;
  max-width: 1280px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-title img {
  height: 25px;   /* ajusta según tu diseño */
  width: auto;
  display: block;
}
.topbar-user {
  display: flex; align-items: center; gap: .75rem;
  color: rgba(255,255,255,.88); font-size: .8rem; flex-shrink: 0;
}
.topbar-user .nombre { display: inline-block; }

/* Íconos del topbar (campana, mensajes) */
.topbar-icon {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: var(--radius);
  background: rgba(255,255,255,.12); text-decoration: none; font-size: 1rem;
  transition: background .15s;
}
.topbar-icon:hover { background: rgba(255,255,255,.26); }
.topbar-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ff3d3d; color: #fff; font-size: .6rem; font-weight: 700;
  padding: 1px 5px; border-radius: 8px; min-width: 16px;
  border: 2px solid var(--rojo-osc, #9d0000); line-height: 1.2;
}

/* Búsqueda global */
.topbar-search {
  flex: 1; max-width: 380px; margin: 0 1rem;
  display: flex; align-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--radius);
  overflow: hidden;
}
.topbar-search input {
  flex: 1; background: transparent; border: none;
  padding: .4rem .75rem; color: #fff; font-size: .82rem; outline: none;
}
.topbar-search input::placeholder { color: rgba(255,255,255,.65); }
.topbar-search button {
  background: transparent; border: none; color: #fff;
  padding: .4rem .7rem; cursor: pointer; font-size: .95rem;
}
.topbar-search button:hover { background: rgba(255,255,255,.18); }
.logout-link {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.35); border-radius: var(--radius);
  padding: .3rem .9rem; font-size: .78rem; font-weight: 600;
  text-decoration: none; transition: background .15s; white-space: nowrap;
}
.logout-link:hover { background: rgba(255,255,255,.32); }

/* Hamburger (mobile) */
.menu-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: none; cursor: pointer; padding: 4px;
}
.menu-toggle span {
  display: block; width: 22px; height: 2px;
  background: #fff; border-radius: 2px; transition: all .25s;
}
.menu-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

/* ════════════════════════════════════════════════════════════
   NAVBAR
   ════════════════════════════════════════════════════════════ */
.navbar {
  background: var(--negro);
  display: flex;
  align-items: stretch;
  padding: 0 1rem;
  border-bottom: 3px solid var(--rojo);
  position: sticky; top: var(--topbar-h); z-index: 299;
  overflow-x: auto; scrollbar-width: none;
}
.navbar-inner {
  width: 100%;
  max-width: 1280px;
  display: flex;
}
.navbar::-webkit-scrollbar { display: none; }
.nav-item {
  color: rgba(255,255,255,.65); font-size: .85rem; font-weight: 500;
  padding: 0 1.4rem; height: var(--navbar-h);
  display: flex; align-items: center; justify-content: center;
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -3px;
  transition: color .15s, border-color .15s, background .15s;
  white-space: nowrap; cursor: pointer; letter-spacing: .01em;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav-item.active { color: #fff; border-bottom-color: var(--rojo); background: rgba(255,255,255,.05); }

/* ════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════ */
.main-content {
  padding: 1.75rem 2rem;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  min-height: calc(100vh - var(--topbar-h) - var(--navbar-h));
}

/* ════════════════════════════════════════════════════════════
   PAGE HEADER
   ════════════════════════════════════════════════════════════ */
.page-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.25rem; padding-bottom: .875rem;
  border-bottom: 1px solid var(--gris-brd);
  gap: .75rem; flex-wrap: wrap;
}
.page-title {
  font-size: .88rem; font-weight: 700; color: var(--negro);
  text-transform: uppercase; letter-spacing: .06em;
  border-left: 3px solid var(--rojo); padding-left: .6rem;
  line-height: 1.3;
}
.page-sub { font-size: .75rem; color: var(--gris-sm); margin-top: .2rem; }
.breadcrumb-back {
  display: inline-block; font-size: .77rem; color: var(--gris-sm);
  text-decoration: none; margin-bottom: .4rem;
}
.breadcrumb-back:hover { color: var(--rojo); }

/* ════════════════════════════════════════════════════════════
   TABS
   ════════════════════════════════════════════════════════════ */
.tab-strip {
  display: flex; border-bottom: 2px solid var(--gris-brd);
  margin-bottom: 1.1rem; overflow-x: auto; scrollbar-width: none;
}
.tab-strip::-webkit-scrollbar { display: none; }
.tab {
  padding: .55rem 1.1rem; font-size: .82rem; font-weight: 600;
  cursor: pointer; color: var(--gris-sm);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color .15s, border-color .15s; white-space: nowrap;
}
.tab:hover  { color: var(--rojo); }
.tab.active { color: var(--rojo); border-bottom-color: var(--rojo); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ════════════════════════════════════════════════════════════
   STATS GRID — ocupa todo el ancho uniformemente
   ════════════════════════════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.75rem;
  width: 100%;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-radius: var(--radius-lg); padding: 1.25rem 1.4rem;
  border-top: 3px solid var(--rojo);
  display: flex; flex-direction: column; justify-content: space-between;
}
.stat-card .lbl {
  font-size: .72rem; color: var(--gris-sm);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: .35rem;
}
.stat-card .val { font-size: 2rem; font-weight: 700; line-height: 1; color: var(--negro); }
.stat-card.warn .val { color: var(--rojo); }

/* ════════════════════════════════════════════════════════════
   TABLE — ancho completo, columnas distribuidas
   ════════════════════════════════════════════════════════════ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gris-brd);
  background: var(--surface);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: var(--surface);
  table-layout: auto;
}
thead tr { background: var(--negro); }
thead th {
  padding: .75rem 1rem; text-align: left;
  font-weight: 700; font-size: .72rem; color: #fff;
  letter-spacing: .05em; text-transform: uppercase; white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--gris-brd); transition: background .1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
tbody td { padding: .7rem 1rem; vertical-align: middle; color: #333; }
table.compact thead th,
table.compact tbody td { padding: .5rem .75rem; font-size: .8rem; }

/* Filas reactivas por adeudo */
.row-verde    td:first-child { border-left: 3px solid #22a355; }
.row-amarillo td:first-child { border-left: 3px solid #e6a817; }
.row-rojo     td:first-child { border-left: 3px solid var(--rojo); }

/* ════════════════════════════════════════════════════════════
   BADGES
   ════════════════════════════════════════════════════════════ */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 3px;
  font-size: .7rem; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; white-space: nowrap;
}
.b-green,.b-activo,.b-activa,.b-pagado,.b-pagada { background:#e6f4ec; color:#1a5c35; }
.b-yellow,.b-pendiente { background:#fff8e6; color:#7a4f00; }
.b-red,.b-vencido,.b-baja { background:#fdf0f0; color:var(--rojo); }
.b-gray     { background:#f0f0f0; color:#444; }
.b-blue,.b-egresado { background:#e8f0fe; color:#1a3a8f; }
.b-suspendido { background:#f5f0e8; color:#6b5020; }
.b-finalizada { background:#f0f0f0; color:#555; }

/* ════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .52rem 1.1rem; font-family: inherit; font-size: .84rem;
  font-weight: 600; border-radius: var(--radius); border: none;
  cursor: pointer; text-decoration: none;
  transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn:active { opacity: .85; }
.btn-primary { background: var(--rojo); color: #fff; }
.btn-primary:hover { background: var(--rojo-h); }
.btn-outline { background: var(--surface); color: var(--rojo); border: 1.5px solid var(--rojo); }
.btn-outline:hover { background: var(--rojo-lt); }
.btn-dark { background: var(--negro); color: #fff; }
.btn-dark:hover { background: #333; }
.btn-danger { background: var(--rojo); color: #fff; }
.btn-danger:hover { background: var(--rojo-h); }
.btn-ghost { background: transparent; color: var(--gris-txt); border: 1.5px solid var(--gris-brd2); }
.btn-ghost:hover { border-color: var(--rojo); color: var(--rojo); }
.btn-sm { font-size: .78rem; padding: .4rem .85rem; }
.btn-xs { font-size: .72rem; padding: .22rem .6rem; }
.btn-block { width: 100%; justify-content: center; margin-top: .5rem; }
.btn-group { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════ */
.form-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-radius: var(--radius-lg); padding: 1.75rem;
  border-top: 3px solid var(--rojo);
  max-width: 900px; margin-left: auto; margin-right: auto;
}
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: .875rem; margin-bottom: .875rem;
}
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }

label {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--gris-txt); margin-bottom: .3rem;
  text-transform: uppercase; letter-spacing: .04em;
}
.form-control {
  display: block; width: 100%;
  padding: .55rem .8rem;
  font-family: inherit; font-size: .875rem; color: var(--negro);
  background: var(--surface); border: 1px solid var(--gris-brd2);
  border-radius: var(--radius); outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  border-color: var(--rojo);
  box-shadow: 0 0 0 3px rgba(204,0,0,.1);
}
.form-control--sm  { font-size: .82rem; padding: .38rem .65rem; width: auto; }
.form-control--num { width: 90px; text-align: center; }
textarea.form-control { resize: vertical; min-height: 110px; }
select.form-control   { cursor: pointer; }
.form-hint { font-size: .72rem; color: var(--gris-sm); margin-top: .25rem; }
.form-section {
  font-size: .72rem; font-weight: 700; color: var(--rojo);
  text-transform: uppercase; letter-spacing: .05em;
  margin: 1.25rem 0 .75rem; padding-bottom: .3rem;
  border-bottom: 1px solid var(--gris-brd);
}
.section-title {
  font-size: .78rem; font-weight: 700; color: var(--rojo);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--gris-brd);
  padding-bottom: .35rem; margin: 1.25rem 0 .875rem;
}
.form-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  margin-top: 1.25rem; padding-top: .875rem;
  border-top: 1px solid var(--gris-brd);
}
.check-group { display: flex; gap: 1.5rem; flex-wrap: wrap; margin-top: .4rem; }
.check-label {
  display: flex; align-items: center; gap: .4rem;
  font-size: .85rem; font-weight: 400; color: var(--negro);
  text-transform: none; letter-spacing: 0; cursor: pointer;
}
.check-label input { accent-color: var(--rojo); width: 15px; height: 15px; }

/* ════════════════════════════════════════════════════════════
   SEARCH / FILTER
   ════════════════════════════════════════════════════════════ */
.search-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.search-bar .form-control { flex: 1; min-width: 0; }
.filter-chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip {
  padding: .32rem .85rem; border-radius: 20px; font-size: .77rem;
  font-weight: 600; text-decoration: none; color: var(--gris-txt);
  border: 1px solid var(--gris-brd); background: var(--surface);
  cursor: pointer; transition: all .15s; white-space: nowrap;
}
.chip:hover  { border-color: var(--rojo); color: var(--rojo); }
.chip.active { background: var(--rojo); color: #fff; border-color: var(--rojo); }

/* ════════════════════════════════════════════════════════════
   PAGOS
   ════════════════════════════════════════════════════════════ */
.pago-select {
  padding: .38rem .7rem; border: 1px solid var(--gris-brd2);
  border-radius: var(--radius); font-size: .8rem; font-family: inherit;
  outline: none; cursor: pointer; background: var(--surface);
}
.pago-select:focus { border-color: var(--rojo); }
.adeudo-banner {
  background: #fdf0f0; border: 1px solid #f0c0c0;
  border-left: 3px solid var(--rojo); border-radius: var(--radius);
  padding: .7rem 1rem; font-size: .85rem; color: var(--rojo);
  margin-bottom: 1.1rem;
}

/* ════════════════════════════════════════════════════════════
   ANUNCIOS
   ════════════════════════════════════════════════════════════ */
.anuncio-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-left: 3px solid var(--rojo); border-radius: var(--radius-lg);
  padding: 1rem 1.25rem; margin-bottom: .75rem; transition: box-shadow .15s;
}
.anuncio-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.07); }
.anuncio-titulo { font-weight: 700; font-size: .92rem; color: var(--negro); margin-bottom: .2rem; }
.anuncio-meta   { font-size: .75rem; color: var(--gris-sm); margin-bottom: .4rem; }
.anuncio-body   { font-size: .85rem; color: #444; line-height: 1.6; white-space: pre-wrap; }

/* ════════════════════════════════════════════════════════════
   CARDS GRID
   ════════════════════════════════════════════════════════════ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: .875rem;
}
.group-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-top: 3px solid var(--rojo); border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem; text-decoration: none; color: inherit;
  transition: box-shadow .15s; display: block;
}
.group-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.09); }
.group-clave { font-family: monospace; font-size: .78rem; color: var(--gris-sm); }
.group-name  { font-weight: 700; font-size: .92rem; margin: .25rem 0; }
.group-meta  { font-size: .78rem; color: var(--gris-sm); }
.horario-pill {
  display: inline-block; background: #f0f0f0; border: 1px solid var(--gris-brd);
  border-radius: 3px; padding: .12rem .45rem; font-size: .72rem; color: var(--gris-txt);
  margin: .2rem .2rem 0 0;
}

/* ════════════════════════════════════════════════════════════
   DETAIL GRID
   ════════════════════════════════════════════════════════════ */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: .875rem; margin-bottom: 1.25rem;
}
.detail-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-radius: var(--radius-lg); padding: 1.1rem 1.2rem;
  border-top: 3px solid var(--rojo);
}
.detail-card--wide { grid-column: 1 / -1; }
.detail-card-title {
  font-size: .78rem; font-weight: 700; color: var(--negro);
  text-transform: uppercase; letter-spacing: .04em;
  margin-bottom: .75rem; padding-bottom: .4rem;
  border-bottom: 1px solid var(--gris-brd);
}
.data-list {
  display: grid; grid-template-columns: auto 1fr;
  gap: .3rem .75rem; font-size: .85rem;
}
.data-list dt { color: var(--gris-sm); font-weight: 600; white-space: nowrap; }
.data-list dd { color: var(--negro); word-break: break-word; }

/* ════════════════════════════════════════════════════════════
   CALIFICACIONES
   ════════════════════════════════════════════════════════════ */
.calif-card {
  background: var(--surface); border: 1px solid var(--gris-brd);
  border-radius: var(--radius-lg); margin-bottom: .875rem; overflow: hidden;
}
.calif-card-header {
  background: var(--negro); color: #fff; padding: .65rem 1rem;
  display: flex; justify-content: space-between;
  align-items: center; font-size: .85rem;
}
.calif-val { display: inline-block; padding: .12rem .45rem; border-radius: 3px; font-weight: 700; font-size: .88rem; }
.calif-aprobado      { background: #e6f4ec; color: #1a5c35; }
.calif-reprobado     { background: #fdf0f0; color: var(--rojo); }
.calif-sobresaliente { background: #e8f0fe; color: #1a3a8f; }

/* ════════════════════════════════════════════════════════════
   MODAL
   ════════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 999;
  align-items: center; justify-content: center; padding: 1rem;
}
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 1.75rem; width: 100%; max-width: 400px;
  border-top: 4px solid var(--rojo);
  box-shadow: 0 12px 40px rgba(0,0,0,.2);
  animation: popIn .18s ease;
}
@keyframes popIn {
  from { transform: scale(.95); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}
.modal-title { font-weight: 700; font-size: 1rem; margin-bottom: .5rem; }
.modal-msg   { font-size: .875rem; color: var(--gris-txt); margin-bottom: 1.5rem; line-height: 1.6; }
.modal-actions { display: flex; justify-content: flex-end; gap: .5rem; }

/* ════════════════════════════════════════════════════════════
   ALERTS
   ════════════════════════════════════════════════════════════ */
.alert {
  padding: .65rem 1rem; border-radius: var(--radius);
  font-size: .855rem; margin-bottom: 1rem; border-left: 3px solid;
  display: flex; align-items: center; gap: .5rem;
}
.alert a { font-weight: 600; }
.alert-success { background: #e6f4ec; color: #1a5c35; border-color: #1a5c35; }
.alert-warning  { background: #fff8e6; color: #7a4f00; border-color: #e6a817; }
.alert-danger   { background: #fdf0f0; color: var(--rojo); border-color: var(--rojo); }

/* ════════════════════════════════════════════════════════════
   MISC
   ════════════════════════════════════════════════════════════ */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--gris-sm); font-size: .9rem; }
.text-muted  { color: var(--gris-sm); }
.text-danger { color: var(--rojo); font-weight: 700; }
.text-success{ color: #1a5c35; font-weight: 700; }
code {
  font-family: 'Consolas', 'Courier New', monospace; font-size: .84em;
  background: #f0f0f0; padding: .1em .35em;
  border-radius: 3px; color: var(--gris-txt);
}
hr.sep { border: none; border-top: 1px solid var(--gris-brd); margin: 1.25rem 0; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: .5rem; }
.legend-item { display: flex; align-items: center; gap: .35rem; font-size: .75rem; color: var(--gris-sm); }
.legend-dot  { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — TABLET  (≤ 900px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .main-content { padding: 1.25rem; }
  .stats-grid   { grid-template-columns: repeat(3, 1fr); }
  .detail-grid  { grid-template-columns: 1fr 1fr; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — MOBILE  (≤ 640px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 640px) {

  html { font-size: 14px; }

  .topbar { padding: 0 1rem; }
  .topbar-title { font-size: .82rem; }
  .topbar-user .nombre { display: none; }
  .topbar-search { display: none; }
  .menu-toggle { display: flex; }

  .navbar {
    position: fixed; top: var(--topbar-h); left: 0; right: 0;
    flex-direction: column; height: 0; overflow: hidden;
    padding: 0; border-bottom: none;
    transition: height .25s ease;
    z-index: 298;
  }
  .navbar.open {
    height: auto; border-bottom: 3px solid var(--rojo); overflow: visible;
  }
  .nav-item {
    height: 46px; padding: 0 1.25rem; justify-content: flex-start;
    border-bottom: 1px solid rgba(255,255,255,.08);
    border-left: 3px solid transparent; font-size: .88rem;
  }
  .nav-item.active {
    border-bottom-color: rgba(255,255,255,.08);
    border-left-color: var(--rojo);
  }

  .main-content { padding: 1rem; }
  .form-grid    { grid-template-columns: 1fr; }
  .form-group.full { grid-column: 1; }
  .detail-grid  { grid-template-columns: 1fr; }
  .detail-card--wide { grid-column: 1; }
  .stats-grid   { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .stat-card .val { font-size: 1.6rem; }
  .cards-grid   { grid-template-columns: 1fr; }
  .tab-strip    { flex-wrap: nowrap; }
  .tab          { padding: .45rem .8rem; font-size: .77rem; }
  .page-header  { flex-direction: column; align-items: flex-start; }
  .page-header > .btn { align-self: flex-start; }
  .login-card   { padding: 1.5rem 1.25rem; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; justify-content: center; }
  .btn-group    { flex-direction: column; }
  .check-group  { gap: .875rem; }
  .modal-box    { padding: 1.25rem; }
}

/* ════════════════════════════════════════════════════════════
   RESPONSIVE — SMALL  (≤ 380px)
   ════════════════════════════════════════════════════════════ */
@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card  { padding: .75rem .875rem; }
  .stat-card .val { font-size: 1.3rem; }
}