/* EduGestión — Estilos principales */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0d2137;
  --navy-2:     #163352;
  --blue:       #1a6fc4;
  --blue-lt:    #e8f2fc;
  --blue-mid:   #4b9ae0;
  --green:      #15803d;
  --green-lt:   #dcfce7;
  --red:        #b91c1c;
  --red-lt:     #fee2e2;
  --amber:      #b45309;
  --amber-lt:   #fef3c7;
  --purple:     #6d28d9;
  --purple-lt:  #ede9fe;
  --gray-50:    #f8fafc;
  --gray-100:   #f1f5f9;
  --gray-200:   #e2e8f0;
  --gray-400:   #94a3b8;
  --gray-600:   #475569;
  --gray-800:   #1e293b;
  --white:      #ffffff;
  --text:       #1e293b;
  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  14px;
  --sidebar-w:  240px;
  --topbar-h:   58px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.07);
  --shadow:     0 2px 12px rgba(0,0,0,.09);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.14);
}

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--gray-100);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ── */
.app { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 16px 18px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.brand-logo {
  width: 36px; height: 36px;
  background: var(--blue);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Lora', serif;
  font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}

.brand-name {
  font-family: 'Lora', serif;
  font-weight: 700; font-size: 16px;
  line-height: 1.1;
}

.brand-sub {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
}

.sidebar-nav { padding: 12px 10px; flex: 1; }

.nav-section {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: rgba(255,255,255,.3);
  padding: 14px 8px 5px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 7px;
  border: none;
  background: none;
  color: rgba(255,255,255,.6);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 400;
  cursor: pointer;
  width: 100%;
  text-align: left;
  margin-bottom: 1px;
  transition: all .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.15); color: #fff; font-weight: 500; }

.nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: .8; }
.nav-item.active .nav-icon,
.nav-item:hover .nav-icon { opacity: 1; }

/* MAIN */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

/* TOPBAR */
.topbar {
  height: var(--topbar-h);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0; z-index: 50;
}

.page-title {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
}

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-date { font-size: 12px; color: var(--gray-400); }

/* CONTENT */
.content { padding: 24px; flex: 1; }

/* ── COMPONENTS ── */

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--navy);
}

.card-body { padding: 18px; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  margin-bottom: 8px;
}

.stat-value {
  font-family: 'Lora', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 8px;
}

.stat-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary    { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1560ab; }
.btn-success    { background: var(--green); color: #fff; }
.btn-success:hover { background: #166534; }
.btn-danger     { background: var(--red); color: #fff; }
.btn-danger:hover { background: #991b1b; }
.btn-outline    { background: var(--white); color: var(--gray-800); border-color: var(--gray-200); }
.btn-outline:hover { background: var(--gray-50); }
.btn-ghost      { background: none; color: var(--gray-600); border-color: transparent; }
.btn-ghost:hover { background: var(--gray-100); }
.btn-amber      { background: var(--amber); color: #fff; }
.btn-amber:hover { background: #92400e; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-xs { padding: 3px 7px; font-size: 11px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table { width: 100%; border-collapse: collapse; }

thead { background: var(--gray-50); }

th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-400);
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13.5px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* Badges / Pills */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
}

.pill-green  { background: var(--green-lt);  color: var(--green);  }
.pill-red    { background: var(--red-lt);    color: var(--red);    }
.pill-amber  { background: var(--amber-lt);  color: var(--amber);  }
.pill-blue   { background: var(--blue-lt);   color: var(--blue);   }
.pill-purple { background: var(--purple-lt); color: var(--purple); }
.pill-gray   { background: var(--gray-100);  color: var(--gray-600);}

/* Forms */
.form-grid   { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-full   { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 4px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}

.form-required::after { content: ' *'; color: var(--red); }

.form-control {
  padding: 8px 11px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--white);
  transition: border .15s, box-shadow .15s;
  width: 100%;
}

.form-control:focus {
  outline: none;
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(26,111,196,.1);
}

select.form-control { cursor: pointer; }

.form-hint { font-size: 11px; color: var(--gray-400); margin-top: 2px; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
}

.search-box svg {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--gray-400);
}

.search-box .form-control { padding-left: 30px; }

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,20,40,.55);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-title {
  font-family: 'Lora', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.modal-close {
  background: none; border: none;
  font-size: 22px; line-height: 1;
  cursor: pointer; color: var(--gray-400);
  padding: 2px;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* Toast */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--gray-800);
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
  max-width: 340px;
}

.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warning { background: var(--amber); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Alerts */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.alert-info    { background: var(--blue-lt);   color: var(--blue);   border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-lt);  color: var(--green);  border: 1px solid #bbf7d0; }
.alert-warning { background: var(--amber-lt);  color: var(--amber);  border: 1px solid #fde68a; }
.alert-danger  { background: var(--red-lt);    color: var(--red);    border: 1px solid #fecaca; }

/* Loading */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 300px;
  color: var(--gray-400);
  gap: 16px;
}

.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--gray-400);
}

.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
  gap: 0;
}

.tab-btn {
  padding: 10px 18px;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all .15s;
}

.tab-btn:hover { color: var(--navy); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }

/* Divider */
.divider { height: 1px; background: var(--gray-200); margin: 16px 0; }

/* Text utilities */
.text-muted  { color: var(--gray-400); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.text-right  { text-align: right; }
.fw-600      { font-weight: 600; }
.fw-700      { font-weight: 700; }
.text-navy   { color: var(--navy); }
.text-blue   { color: var(--blue); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.text-amber  { color: var(--amber); }

/* Ficha alumno */
.ficha-section {
  margin-bottom: 20px;
}
.ficha-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--gray-400);
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gray-200);
}

.ficha-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 13.5px;
}

.ficha-label { color: var(--gray-600); }
.ficha-value { font-weight: 500; text-align: right; }

/* Descuentos tags */
.desc-tags { display: flex; flex-wrap: wrap; gap: 5px; }

/* Cuota detail */
.cuota-desglose {
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 14px;
}

.cuota-desglose-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 13px;
}

.cuota-desglose-row.total {
  border-top: 1px solid var(--gray-200);
  margin-top: 6px;
  padding-top: 8px;
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
}

.cuota-desglose-row.descuento { color: var(--green); }
.cuota-desglose-row.interes   { color: var(--red); }

/* Checkbox custom */
.check-group {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}

.check-group input[type=checkbox] {
  width: 16px; height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.check-group label { cursor: pointer; font-size: 13.5px; }

/* Grid de dos columnas */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.three-col { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* Interés warning bar */
.mora-bar {
  background: var(--red-lt);
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12.5px;
  color: var(--red);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

/* Print */
@media print {
  .sidebar, .topbar { display: none !important; }
  .main { margin-left: 0 !important; }
  .content { padding: 0 !important; }
  .no-print { display: none !important; }
}

@media (max-width: 1100px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.btn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
}
.btn-hamburger span {
  display: block;
  width: 22px;
  height: 3px;
  background: #0d2137;
  border-radius: 2px;
  transition: all .2s;
}
.btn-hamburger:hover span { background: #163352; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 99;
}
.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 100;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .btn-hamburger { display: flex !important; }
  .form-grid, .form-grid-3, .two-col, .three-col { grid-template-columns: 1fr; }
}

/* ── LOGIN SCREEN (admin) ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  padding: 20px;
}
.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  max-width: 420px;
  width: 100%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}
.login-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  font-family: 'Lora', serif;
}
.login-title {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--navy);
}
.login-sub {
  color: var(--gray-600);
  font-size: 13px;
  margin-top: 2px;
}
.login-hint {
  font-size: 12px;
  color: var(--gray-400);
  text-align: center;
  margin-top: 18px;
  line-height: 1.5;
}
.btn-block {
  width: 100%;
  display: block;
  padding: 12px;
  font-size: 15px;
}

/* ── SIDEBAR FOOT ── */
.sidebar-foot {
  margin-top: auto;
  padding: 16px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.user-chip {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.75);
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  text-align: center;
}
.sidebar { display: flex; flex-direction: column; }

/* ── CUENTA CORRIENTE ── */
.row-vencida td { background: #fff8f0; }
.row-vencida td:first-child { border-left: 3px solid #e07b39; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill-pendiente { background: #fef3c7; color: #92400e; }
.pill-parcial   { background: #dbeafe; color: #1e40af; }
.pill-pagado    { background: #dcfce7; color: #166534; }
.pill-anulado   { background: #f3f4f6; color: #6b7280; }

/* ── WHATSAPP WEB ── */
.wsp-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  height: calc(100vh - 110px);
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  overflow: hidden;
  background: #f0f2f5;
}
.wsp-sidebar {
  background: #fff;
  border-right: 1px solid #e5e5e5;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.wsp-search {
  padding: 10px 12px;
  display: flex;
  gap: 6px;
  border-bottom: 1px solid #eee;
}
.wsp-search .form-control { font-size: 13px; }
.wsp-icon-btn {
  background: transparent; border: 1px solid #ddd;
  padding: 6px 10px; border-radius: 6px; cursor: pointer; font-size: 14px;
}
.wsp-icon-btn.active { background: #0d2137; color: #fff; }
.wsp-list { flex: 1; overflow-y: auto; }
.wsp-item {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  align-items: center;
}
.wsp-item:hover { background: #f5f5f5; }
.wsp-item.sel { background: #e7f3ec; }
.wsp-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: #0d2137; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; flex-shrink: 0;
}
.wsp-item-body { flex: 1; min-width: 0; }
.wsp-item-line {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
}
.wsp-item-nombre {
  font-weight: 600; font-size: 14px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wsp-item-hora { font-size: 11px; color: #888; flex-shrink: 0; }
.wsp-item-prev {
  font-size: 12px; color: #666;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex: 1;
}
.wsp-badge {
  background: #25d366; color: #fff;
  border-radius: 10px; padding: 2px 7px; font-size: 11px; font-weight: 700;
}
.wsp-empty, .wsp-empty-main {
  padding: 30px 20px; text-align: center; color: #999;
}
.wsp-empty-main {
  height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.wsp-main {
  display: flex; flex-direction: column;
  background: #efeae2;
  background-image:
    linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.6)),
    repeating-linear-gradient(45deg, transparent 0 6px, rgba(0,0,0,.02) 6px 12px);
  min-height: 0;
  overflow: hidden;
  height: 100%;
}
.wsp-header {
  background: #fff; border-bottom: 1px solid #ddd;
  padding: 10px 16px; display: flex; justify-content: space-between; align-items: center;
}
.wsp-h-nombre { font-weight: 600; font-size: 15px; }
.wsp-h-sub { font-size: 12px; color: #666; }
.wsp-thread {
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.wsp-msg {
  max-width: 65%;
  padding: 6px 10px 4px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.35;
  word-wrap: break-word;
  position: relative;
}
.wsp-msg-in  { background: #fff; align-self: flex-start; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wsp-msg-out { background: #d9fdd3; align-self: flex-end; box-shadow: 0 1px 1px rgba(0,0,0,.06); }
.wsp-msg-text { white-space: pre-wrap; }
.wsp-msg-img { max-width: 280px; border-radius: 6px; display: block; }
.wsp-msg-meta { font-size: 10px; color: #667781; text-align: right; margin-top: 2px; }
.wsp-tick-read { color: #53bdeb; }

.wsp-input-wrap {
  background: #f0f2f5; border-top: 1px solid #ddd;
  padding: 10px 12px; display: flex; gap: 8px; align-items: flex-end;
}
.wsp-input {
  flex: 1; resize: none;
  border: 1px solid #ddd; border-radius: 6px;
  padding: 8px 10px; font-size: 14px; font-family: inherit;
  max-height: 120px;
}
.wsp-input:disabled { background: #f5f5f5; color: #999; }

@media (max-width: 768px) {
  .wsp-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - 60px);
    position: relative;
    overflow: hidden;
  }
  /* En mobile mostramos sidebar O main, nunca los dos a la vez */
  .wsp-sidebar {
    display: flex;
    position: absolute;
    inset: 0;
    z-index: 2;
    transform: translateX(0);
    transition: transform .25s ease;
  }
  .wsp-sidebar.wsp-hidden {
    transform: translateX(-100%);
    pointer-events: none;
  }
  .wsp-main {
    position: absolute;
    inset: 0;
    z-index: 1;
    transform: translateX(100%);
    transition: transform .25s ease;
  }
  .wsp-main.wsp-visible {
    transform: translateX(0);
    z-index: 3;
  }
  /* Botón volver en el header mobile */
  .wsp-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px; height: 34px;
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0;
    color: #0d2137;
  }
  .wsp-header {
    gap: 8px;
  }
  .wsp-input-wrap {
    padding: 8px;
  }
  .wsp-input {
    font-size: 16px; /* evita zoom en iOS */
  }
}
@media (min-width: 769px) {
  .wsp-back-btn { display: none; }
}

/* ── WHATSAPP FLOATING BUTTON ── */
.tienda-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 90px;
  width: 48px;
  height: 48px;
  background-color: #F59E0B;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
  cursor: pointer;
  z-index: 999;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.tienda-floating-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 16px rgba(245, 158, 11, 0.55);
}
.tienda-floating-icon {
  width: 22px;
  height: 22px;
}
.tienda-floating-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #EF4444;
  color: white;
  font-size: 11px;
  font-weight: bold;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
body[data-rol="lectura"] #tienda-floating-btn { display: none !important; }

.ws-floating-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background-color: #25D366;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none;
}
.ws-floating-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.5);
}
.ws-floating-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #EF4444;
  color: white;
  font-size: 12px;
  font-weight: bold;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.ws-bounce {
  animation: wsBounce 0.5s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}
@keyframes wsBounce {
  0% { transform: scale(1); }
  30% { transform: scale(1.2); }
  50% { transform: scale(0.9); }
  70% { transform: scale(1.1); }
  100% { transform: scale(1); }
}
.ws-floating-icon {
  width: 30px;
  height: 30px;
  fill: currentColor;
}

/* ── ROL LECTURA: ocultar acciones de escritura ── */
/* Topbar y botón flotante */
body[data-rol="lectura"] #btn-accion-principal,
body[data-rol="lectura"] #ws-floating-btn,
/* Acciones de creación */
body[data-rol="lectura"] [onclick^="modalNuevo"],
body[data-rol="lectura"] [onclick^="modalNueva"],
body[data-rol="lectura"] [onclick^="crear"],
/* Acciones de edición */
body[data-rol="lectura"] [onclick^="modalEditar"],
body[data-rol="lectura"] [onclick^="modalGestion"],
body[data-rol="lectura"] [onclick^="modalFicha"],
body[data-rol="lectura"] [onclick^="modalInscribir"],
body[data-rol="lectura"] [onclick^="modalAjuste"],
body[data-rol="lectura"] [onclick^="modalAplicar"],
body[data-rol="lectura"] [onclick^="modalRegistrar"],
body[data-rol="lectura"] [onclick^="modalPagar"],
body[data-rol="lectura"] [onclick^="modalEmail"],
body[data-rol="lectura"] [onclick^="modalGenerar"],
body[data-rol="lectura"] [onclick^="modalReset"],
body[data-rol="lectura"] [onclick^="guardar"],
body[data-rol="lectura"] [onclick^="actualizar"],
body[data-rol="lectura"] [onclick^="agregar"],
body[data-rol="lectura"] [onclick^="quitar"],
body[data-rol="lectura"] [onclick^="activarCiclo"],
body[data-rol="lectura"] [onclick^="bajaProfesor"],
body[data-rol="lectura"] [onclick^="reactivarProfesor"],
body[data-rol="lectura"] [onclick^="cerrarCuota"],
/* Acciones destructivas */
body[data-rol="lectura"] [onclick^="eliminar"],
body[data-rol="lectura"] [onclick^="anular"],
/* Confirmaciones de acciones (no las que solo cierran modales de lectura) */
body[data-rol="lectura"] [onclick^="confirmarPago"],
body[data-rol="lectura"] [onclick^="confirmarAplicar"],
body[data-rol="lectura"] [onclick^="confirmarAjuste"],
body[data-rol="lectura"] [onclick^="confirmarGenerar"],
body[data-rol="lectura"] [onclick^="confirmarInscribir"],
body[data-rol="lectura"] [onclick^="confirmarDesactivar"],
body[data-rol="lectura"] [onclick^="confirmarReset"],
/* Acciones específicas */
body[data-rol="lectura"] [onclick^="enviarEmail"],
body[data-rol="lectura"] [onclick^="enviarBackup"],
body[data-rol="lectura"] [onclick^="cargarBackup"],
body[data-rol="lectura"] [onclick^="iniciarChat"],
body[data-rol="lectura"] [onclick^="facturar"],
body[data-rol="lectura"] [onclick^="resetPassword"],
/* Backup section: descargar también queda admin-only */
body[data-rol="lectura"] #btn-backup-export {
  display: none !important;
}

/* Inputs de texto/select dentro de modales abiertos por error: deshabilitar */
body[data-rol="lectura"] .modal-overlay .form-group input:not([type="search"]),
body[data-rol="lectura"] .modal-overlay .form-group select,
body[data-rol="lectura"] .modal-overlay .form-group textarea {
  pointer-events: none;
  background: #f5f5f5;
}

/* ── TIENDA ADMIN ─────────────────────────────────────────── */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (max-width: 540px) { .form-grid-2 { grid-template-columns: 1fr; } }

.form-control-sm {
  padding: 5px 8px;
  font-size: 13px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  font-family: inherit;
  color: var(--text);
  width: 100%;
  background: white;
}
.form-control-sm:focus { outline: none; border-color: var(--blue); }

.table.table-sm td, .table.table-sm th { padding: 8px 10px; font-size: 13px; }

.row-inactive { opacity: .5; }

/* Chips de filtro (tienda pedidos) */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--gray-200);
  background: white;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: all .12s;
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip-active { background: var(--blue); border-color: var(--blue); color: white; }
.chip-count {
  background: rgba(0,0,0,.12);
  border-radius: 10px;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 700;
}
.chip-active .chip-count { background: rgba(255,255,255,.25); }

/* Stat cards mini (resumen pedidos) */
.stat-card-mini {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 120px;
}
.stat-card-mini-val {
  font-family: 'Lora', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 3px;
}
.stat-card-mini-lbl {
  font-size: 11px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Info boxes (detalle pedido) */
.info-box {
  background: var(--gray-50);
  border-radius: 10px;
  padding: 12px 14px;
}
.info-box-label {
  font-size: 11px;
  color: var(--gray-400);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 3px;
}
.info-box-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
}

/* ── TIENDA: STOCK ALERTS ── */
.stock-alert-box {
  background: var(--amber-lt);
  border: 1px solid #fcd34d;
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
}
.stock-alert-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--amber);
  margin-bottom: 10px;
  font-size: 13px;
}
.stock-alert-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.stock-alert-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fff;
  border: 1px solid #fcd34d;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  color: var(--amber);
  font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.stock-alert-item:hover { background: #fef9ec; }
.stock-alert-item strong { color: var(--text); }
.stock-alert-item .sa-badge {
  background: var(--amber);
  color: #fff;
  border-radius: 10px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 700;
}

/* ── TIENDA: IMAGE UPLOAD AREA ── */
.img-upload-area {
  width: 100%;
  border: 2px dashed var(--gray-200);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--gray-50);
  position: relative;
  overflow: hidden;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.img-upload-area:hover,
.img-upload-area.drag-over {
  border-color: var(--blue);
  background: var(--blue-lt);
}
.img-upload-area img {
  max-height: 160px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  object-fit: contain;
}
.img-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--gray-400);
  pointer-events: none;
}
.img-upload-placeholder svg { color: var(--gray-400); }
.img-upload-placeholder span { font-size: 13px; }
.img-upload-status {
  font-size: 12px;
  margin-top: 4px;
  color: var(--gray-600);
  min-height: 16px;
}

/* ── GOOSE AWARD WIDGET (dashboard admin) ── */
.goose-dash-card { margin-bottom: 24px; }
.goose-dash-actions { display: flex; align-items: center; gap: 8px; }
.goose-pin-input {
  width: 62px; padding: 4px 8px; border: 1.5px solid var(--gray-200);
  border-radius: 6px; font-size: 13px; text-align: center;
  font-family: monospace; letter-spacing: 3px;
}
.goose-pin-input:focus { outline: none; border-color: var(--primary); }
.goose-votes-badge {
  display: inline-block; background: var(--green-lt); color: var(--green);
  border-radius: 99px; padding: 2px 10px; font-size: 12px; font-weight: 700;
}
.goose-total-badge {
  background: var(--blue-lt); color: var(--blue);
  border-radius: 99px; padding: 3px 10px; font-size: 12px; font-weight: 600;
}
.goose-empty { padding: 20px; text-align: center; color: var(--gray-400); font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 11px; gap: 3px; }

/* modal detalle votos */
.goose-modal-voters { display: flex; flex-direction: column; gap: 10px; }
.goose-modal-voter {
  background: var(--gray-50); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
}
.goose-modal-voter strong { font-size: 13px; color: var(--text); }
.goose-modal-just { font-size: 12px; color: var(--gray-500); font-style: italic; }

