/* Estilos compartidos de /admin y /colegio.
   Misma estetica que los paneles de Katu School: Inter, cian #05C3DD,
   sidebar blanco + topbar translucido, login oscuro. */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

[hidden] { display: none !important; }
:root {
  --primary: #05C3DD;
  --primary-dark: #03A0B8;
  --primary-light: #E8F9FC;
  --primary-glow: rgba(5,195,221,0.18);
  --bg: #F0F4F8;
  --surface: #FFFFFF;
  --surface-alt: #F8FAFC;
  --ink: #1A2332;
  --muted: #5A6B7B;
  --faint: #94A3B8;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --dark-bg: #0F1923;
  --dark-surface: #1A2332;
  --dark-surface-2: #222E3F;
  --success: #22C55E;
  --success-light: #F0FDF4;
  --warning: #F59E0B;
  --warning-light: #FFFBEB;
  --danger: #EF4444;
  --danger-light: #FEF2F2;
  --info: #3B82F6;
  --info-light: #EFF6FF;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius: var(--radius-lg);
  --shadow-card: 0 2px 8px rgba(5,195,221,0.12), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 24px rgba(5,195,221,0.18), 0 4px 8px rgba(0,0,0,0.08);
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; color: var(--ink); }
a { color: var(--primary-dark); text-decoration: none; font-weight: 600; }
a:hover { color: var(--primary); }

/* ---------- Login (igual al acceso de Katu School) ---------- */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; position: relative; background: var(--dark-bg); color: #fff;
}
.login-screen::before {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 20% 50%, rgba(5,195,221,0.07) 0%, transparent 70%),
    radial-gradient(ellipse 600px 500px at 80% 20%, rgba(3,160,184,0.05) 0%, transparent 70%);
}
.login-screen::after {
  content: ''; position: fixed; inset: 0; pointer-events: none;
  background-image: radial-gradient(rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 32px 32px;
}
.login-box { width: 100%; max-width: 440px; position: relative; z-index: 1; }
.login-header { text-align: center; margin-bottom: 32px; }
.logo-badge { display: inline-flex; align-items: center; gap: 12px; margin-bottom: 24px; text-align: left; }
.logo-badge img { width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 4px 20px rgba(5,195,221,0.35); }
.logo-badge .name { font-size: 22px; font-weight: 900; color: #fff; letter-spacing: -0.5px; line-height: 1.2; }
.logo-badge .sub { font-size: 10px; font-weight: 700; letter-spacing: 3px; color: var(--primary); text-transform: uppercase; }
.login-header h1 { font-size: 26px; font-weight: 800; color: #fff; margin-bottom: 8px; letter-spacing: -0.3px; }
.login-header p { font-size: 14px; color: rgba(255,255,255,0.55); line-height: 1.6; margin: 0; }
.login-card {
  background: var(--dark-surface); border: 1px solid rgba(255,255,255,0.08); border-radius: 20px; padding: 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.03);
}
.role-chip {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(5,195,221,0.12);
  border: 1px solid rgba(5,195,221,0.25); border-radius: 100px; padding: 5px 12px 5px 8px;
  font-size: 12px; font-weight: 700; color: var(--primary); letter-spacing: 0.04em; margin-bottom: 24px;
}
.role-chip::before { content: ''; width: 7px; height: 7px; background: var(--primary); border-radius: 50%; }
.login-card label.campo { margin-bottom: 18px; }
.login-card label.campo > span { font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.55); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 8px; }
.login-card .input-wrap { position: relative; }
.login-card .input-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: rgba(255,255,255,0.25); pointer-events: none; transition: color 0.2s; }
.login-card .input-wrap:focus-within svg { color: var(--primary); }
.login-card .input-wrap input {
  padding: 12px 14px 12px 42px; font-size: 15px; color: #fff; background: var(--dark-surface-2);
  border: 1.5px solid rgba(255,255,255,0.08); border-radius: 10px;
}
.login-card .input-wrap input::placeholder { color: rgba(255,255,255,0.2); }
.login-card .input-wrap input:focus { border-color: var(--primary); background: rgba(5,195,221,0.05); box-shadow: 0 0 0 3px var(--primary-glow); }
.login-card .btn-block { padding: 13px; margin-top: 8px; font-size: 15px; border-radius: 10px; }
.login-error {
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.3); border-left: 3px solid var(--danger);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #FCA5A5; margin: 0 0 18px;
}
.login-footer { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 24px; font-size: 11px; color: rgba(255,255,255,0.3); font-weight: 500; }

/* ---------- Formularios ---------- */
label.campo { display: block; margin-bottom: 14px; }
label.campo > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; letter-spacing: 0.02em; }
label.campo small { display: block; color: var(--faint); font-size: 12px; margin-top: 5px; line-height: 1.4; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=time], input[type=tel], input[type=date], input[type=url], select, textarea {
  width: 100%; padding: 10px 13px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; background: #fff; color: var(--ink); outline: none; transition: all 0.2s ease;
}
input:hover:not(:focus), select:hover:not(:focus), textarea:hover:not(:focus) { border-color: var(--border-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow); }
input::placeholder { color: var(--faint); }
select {
  appearance: none; padding-right: 36px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%235A6B7B' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 13px center;
}
input[type=checkbox] { accent-color: var(--primary); width: 16px; height: 16px; }
.fila { display: flex; gap: 12px; flex-wrap: wrap; }
.fila > * { flex: 1 1 160px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-sm); padding: 10px 18px; font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: all 0.2s ease; text-decoration: none;
}
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-pri { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: #fff; box-shadow: 0 2px 12px rgba(5,195,221,0.35); }
.btn-pri:hover:not(:disabled) { box-shadow: 0 4px 20px rgba(5,195,221,0.45); transform: translateY(-1px); color: #fff; }
.btn-sec { background: var(--surface); color: var(--ink); border: 1.5px solid var(--border-strong); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.btn-sec:hover:not(:disabled) { border-color: var(--primary); color: var(--primary-dark); }
.btn-peligro { background: linear-gradient(135deg, #EF4444, #DC2626); color: #fff; box-shadow: 0 2px 12px rgba(239,68,68,0.3); }
.btn-link { background: none; border: 0; color: var(--primary-dark); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; padding: 5px 8px; border-radius: 6px; transition: background 0.15s; }
.btn-link:hover { background: var(--primary-light); }
.btn-link.peligro { color: var(--danger); }
.btn-link.peligro:hover { background: var(--danger-light); }
.btn-block { width: 100%; padding: 12px; }

/* ---------- Layout del panel: sidebar + topbar ---------- */
.sidebar {
  width: var(--sidebar-w); height: 100vh; background: #fff; border-right: 1.5px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; z-index: 100;
  transition: transform 0.3s ease; overflow-y: auto;
}
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.sidebar-logo img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 4px 14px rgba(5,195,221,0.25); }
.sidebar-logo .name { font-size: 18px; font-weight: 900; letter-spacing: -0.4px; line-height: 1.15; }
.sidebar-logo .sub { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--primary); text-transform: uppercase; }
.sidebar-section-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 14px 12px 6px; }
.sidebar-nav { flex: 1; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; background: none;
  border-radius: var(--radius-sm); color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500; text-align: left;
  cursor: pointer; transition: all 0.2s ease; position: relative; text-decoration: none;
}
.nav-item:hover { background: var(--primary-light); color: var(--primary-dark); }
.nav-item.activa { background: var(--primary-light); color: var(--primary-dark); font-weight: 600; }
.nav-item.activa::before { content: ''; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; background: var(--primary); border-radius: 0 3px 3px 0; }
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; pointer-events: none; }
.nav-item span { pointer-events: none; }
.sidebar-bottom { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sidebar-bottom .nav-item:hover { background: var(--danger-light); color: var(--danger); }
.sidebar-backdrop { display: none; }

.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: rgba(255,255,255,0.93); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 28px;
  position: sticky; top: 0; z-index: 50; box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.topbar-brand { font-weight: 700; font-size: 15px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-brand span { color: var(--muted); font-weight: 400; }
.topbar-right { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.topbar-user { font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; line-height: 1.3; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.btn-menu { display: none; width: 38px; height: 38px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); background: #fff; color: var(--ink); cursor: pointer; align-items: center; justify-content: center; }
.btn-menu svg { width: 20px; height: 20px; }

main { padding: 28px 32px; width: 100%; max-width: 1400px; }
.encabezado { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.encabezado h2 { font-size: 22px; font-weight: 800; }
.encabezado p { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.encabezado .acciones { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-card); }
.vacio { color: var(--muted); text-align: center; padding: 36px 12px; }
.muted { color: var(--muted); }
.animate-up { animation: fadeUp 0.4s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Tablas ---------- */
.tabla-wrap { overflow-x: auto; }
.card.tabla-wrap { padding: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead { background: var(--surface-alt); }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 11px; color: var(--faint); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
tbody tr { transition: background 0.15s; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--primary-light); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; background: var(--bg); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok, .badge.warn, .badge.danger, .badge.info { border: 0; }
.badge.ok { background: var(--success-light); color: #15803D; }
.badge.warn { background: var(--warning-light); color: #92400E; }
.badge.danger { background: var(--danger-light); color: #B91C1C; }
.badge.info { background: var(--primary-light); color: var(--primary-dark); }
.badge.ok::before, .badge.warn::before, .badge.danger::before, .badge.info::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.codigo { font-family: Consolas, 'Courier New', monospace; font-size: 15px; font-weight: 700; letter-spacing: .12em; background: var(--primary-light); color: var(--primary-dark); border: 1.5px dashed var(--primary); padding: 2px 9px; border-radius: 6px; }

/* ---------- Dialogos ---------- */
dialog.dialogo { border: 0; border-radius: var(--radius-xl); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 16px 48px rgba(5,195,221,0.16), 0 8px 24px rgba(0,0,0,0.10); color: var(--ink); font-family: var(--font); }
dialog.dialogo[open] { animation: dialogIn 0.25s ease; }
dialog.dialogo::backdrop { background: rgba(15,25,35,.65); backdrop-filter: blur(4px); }
.dialogo-form { padding: 0; display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
.dialogo-form h3 { font-size: 19px; font-weight: 700; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.dialogo-cuerpo { overflow-y: auto; padding: 20px 24px 6px; }
.dialogo-error { color: var(--danger); font-size: 13px; margin: 0; padding: 0 24px 10px; }
.dialogo-acciones { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-alt); }
@keyframes dialogIn { from { transform: translateY(20px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 20px; right: 20px; transform: translateX(30px); opacity: 0;
  background: var(--surface); color: var(--ink); padding: 14px 18px; border-radius: var(--radius-md); font-weight: 600; font-size: 13.5px;
  border-left: 4px solid var(--success); box-shadow: 0 8px 32px rgba(5,195,221,0.14), 0 4px 12px rgba(0,0,0,0.08);
  transition: .25s; z-index: 2000; pointer-events: none; max-width: 420px;
}
.toast.visible { opacity: 1; transform: none; }
.toast.error { border-left-color: var(--danger); color: #B91C1C; }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: 4px 0 24px rgba(0,0,0,0.12); }
  .sidebar.open { transform: none; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(15,25,35,.45); z-index: 99; }
  .main-wrapper { margin-left: 0; }
  .btn-menu { display: inline-flex; }
}
@media (max-width: 640px) {
  main { padding: 18px 16px; }
  .topbar { padding: 0 16px; }
  .topbar-user { display: none; }
  .login-card { padding: 26px 22px; }
}

/* Clave mostrada una sola vez (integraciones) */
.clave-box { display: flex; gap: 8px; align-items: center; background: var(--surface-alt); border: 1.5px dashed var(--primary); border-radius: var(--radius-sm); padding: 10px 12px; }
.clave-box code { flex: 1; font-family: Consolas, 'Courier New', monospace; font-size: 13px; word-break: break-all; color: var(--primary-dark); font-weight: 700; }
.pasos { margin: 0; padding-left: 20px; color: var(--muted); line-height: 1.7; }
code { font-family: Consolas, 'Courier New', monospace; font-size: .92em; background: var(--surface-alt); padding: 1px 5px; border-radius: 4px; }
