:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #171717;
  --muted: #58677a;
  --line: #d7deea;
  --red: #ed1b2f;
  --blue: #078cc8;
  --navy: #1e2074;
  --brand: #078cc8;
  --brand-strong: #1e2074;
  --accent: #ed1b2f;
  --warning: #a76300;
  --ok: #16804f;
  --shadow: 0 18px 45px rgba(30, 32, 116, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(7, 140, 200, 0.08), rgba(255, 255, 255, 0) 260px),
    var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

button, input, select, textarea { font: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(16px, 4vw, 48px);
  background: var(--surface);
  border-bottom: 4px solid var(--blue);
  box-shadow: 0 8px 26px rgba(23, 23, 23, 0.06);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
}

.school-logo {
  width: 74px;
  height: 74px;
  object-fit: contain;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  color: var(--ink);
}

h2 { font-size: 1.35rem; }
h3 { margin-top: 28px; font-size: 1.05rem; }

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.user-email { color: var(--muted); font-size: 0.92rem; }

.layout {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 32px) 48px;
}

.hero {
  min-height: 410px;
  display: grid;
  align-items: center;
  background:
    linear-gradient(110deg, rgba(30, 32, 116, 0.92), rgba(7, 140, 200, 0.86) 58%, rgba(237, 27, 47, 0.78)),
    url("https://images.unsplash.com/photo-1523240795612-9a054b0db644?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  padding: clamp(24px, 6vw, 58px);
  color: #fff;
  overflow: hidden;
}

.hero-copy { max-width: 760px; }

.hero-logo {
  width: 118px;
  height: 118px;
  object-fit: contain;
  display: block;
  margin-bottom: 18px;
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.24));
}

.hero h2 {
  font-size: clamp(2rem, 5vw, 3.75rem);
  line-height: 1.04;
  margin-bottom: 16px;
}

.hero p { font-size: 1.12rem; max-width: 620px; }

.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }

.tab-btn, .primary-btn, .ghost-btn, .danger-btn, .success-btn {
  min-height: 42px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 800;
}

.primary-btn { background: var(--blue); color: #fff; }
.primary-btn:hover { background: var(--navy); }
.primary-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.ghost-btn, .tab-btn { background: #fff; color: var(--ink); border-color: var(--line); }
.tab-btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.danger-btn { background: var(--red); color: #fff; }
.success-btn { background: var(--ok); color: #fff; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--blue);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow);
}

.panel-title { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }
.panel-actions { margin-top: 0; justify-content: flex-end; }
.muted { color: var(--muted); }

.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

.role-card {
  text-align: left;
  padding: 18px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--red);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.role-card:hover { border-left-color: var(--blue); box-shadow: 0 10px 24px rgba(7, 140, 200, 0.12); }
.role-card strong, .role-card span { display: block; }
.role-card span { margin-top: 6px; color: var(--muted); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
label { display: grid; gap: 6px; color: var(--ink); font-weight: 800; }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
}

input:focus, select:focus, textarea:focus { outline: 3px solid rgba(7, 140, 200, 0.18); border-color: var(--blue); }
textarea { resize: vertical; }
.full { grid-column: 1 / -1; }
.drive-picker-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.94rem;
}
.drive-picker-actions .ghost-btn { flex: 0 0 auto; }
.check { grid-template-columns: auto 1fr; align-items: center; font-weight: 400; }
.check input { width: auto; }
.consent-check {
  padding: 12px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f2f8fc;
}
hr { border: 0; border-top: 1px solid var(--line); margin: 28px 0; }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 10px;
  background: #e8f6fc;
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}

.badge.warning { background: #fff5df; color: var(--warning); }
.badge.application-revisada { background: #edf0ff; color: var(--navy); }
.badge.application-contactada { background: #e6f7ee; color: #12633f; }
.badge.application-descartada { background: #fbeaec; color: #8e2334; }
.badge.application-seleccionada { background: #e6f7ee; color: #12633f; }
.list { display: grid; gap: 12px; }

.item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; }
.item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.item h4 { margin: 0 0 6px; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.empty { color: var(--muted); padding: 14px; border: 1px dashed var(--line); border-radius: 8px; }

.notice {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 11px 12px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f2f8fc;
  color: var(--muted);
}

.notice strong { color: var(--ink); }
.danger-notice { border-left-color: var(--red); background: #fff4f5; }
.review-reason { padding: 10px 12px; border-left: 4px solid var(--red); background: #fff4f5; }

.notification-item {
  border-left: 4px solid var(--line);
}

.notification-item.unread {
  border-left-color: var(--blue);
  background: #f3f9fc;
}

.notification-item p { margin-bottom: 0; }

.account-management {
  margin-top: 30px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.account-request-status:not(:empty) {
  margin: 12px 0;
  padding: 12px;
  border-left: 4px solid var(--warning);
  border-radius: 6px;
  background: #fff8e8;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  box-shadow: var(--shadow);
}

.hidden { display: none !important; }

@media (max-width: 720px) {
  .topbar, .panel-title, .item-head { flex-direction: column; align-items: stretch; }
  .brand-lockup { align-items: flex-start; }
  .school-logo { width: 58px; height: 58px; }
  .hero-logo { width: 92px; height: 92px; }
  .auth-actions { justify-content: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .hero { min-height: 420px; }
}

.status-control {
  min-width: 150px;
  font-size: 0.82rem;
}

.status-control select {
  margin-top: 4px;
  font-weight: 700;
  text-transform: capitalize;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 23, 23, 0.58);
}

.modal-panel {
  width: min(820px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  background: var(--surface);
  border-top: 5px solid var(--blue);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 6px;
}

.modal-message {
  margin: 4px 0 8px;
  color: var(--muted);
  font-size: 1.02rem;
}

.send-summary {
  display: grid;
  gap: 4px;
  padding: 12px;
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #f2f8fc;
}

.send-summary span { color: var(--muted); }
.copy-btn { justify-self: start; }

.badge.expired {
  background: #f3e8eb;
  color: #8e2334;
}

@media (max-width: 720px) {
  .modal-backdrop { padding: 8px; }
  .modal-panel { max-height: calc(100vh - 16px); padding: 16px; }
  .modal-actions { flex-direction: column-reverse; }
}
.readonly-field {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.readonly-field strong {
  color: var(--navy);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.readonly-field span {
  white-space: pre-wrap;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 22px 0 16px;
}

.stat {
  display: grid;
  gap: 3px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 6px;
  background: #fff;
}

.stat strong {
  color: var(--navy);
  font-size: 1.55rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.86rem;
}

.subtabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.subtab-btn {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.subtab-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 220px) minmax(140px, 190px);
  gap: 10px;
  margin: 16px 0 8px;
}

.application-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px);
  gap: 10px;
  margin: 16px 0;
}

.application-history {
  border-left: 4px solid var(--blue);
}

.application-history.application-descartada { border-left-color: var(--red); }
.application-history.application-seleccionada { border-left-color: var(--ok); }

.admin-section-view h3 {
  margin-top: 22px;
}

.item:has(.badge.expired) {
  border-left: 4px solid var(--red);
}

.activity-item {
  display: grid;
  grid-template-columns: minmax(150px, 190px) 1fr;
  gap: 14px;
}

.activity-time {
  color: var(--muted);
  font-size: 0.86rem;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-top: 22px;
}

.section-heading h3 { margin-top: 0; }
.section-heading label { min-width: 190px; }

.analytics-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.metric {
  padding: 14px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--blue);
  border-radius: 6px;
  background: #fff;
}

.metric strong {
  display: block;
  color: var(--navy);
  font-size: 1.65rem;
}

.metric span { color: var(--muted); font-size: 0.86rem; }

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-panel {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.chart-panel h4 { margin: 0 0 12px; }
.bar-list { display: grid; gap: 10px; }

.bar-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, 2fr) 45px;
  gap: 10px;
  align-items: center;
  font-size: 0.88rem;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9eef5;
}

.bar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--blue);
}

.bar-value { color: var(--navy); font-weight: 800; text-align: right; }

@media (max-width: 820px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .admin-filters { grid-template-columns: 1fr; }
  .application-filters { grid-template-columns: 1fr; }
  .activity-item { grid-template-columns: 1fr; gap: 6px; }
  .section-heading { flex-direction: column; }
  .section-heading label { width: 100%; }
  .analytics-summary, .analytics-grid { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: minmax(100px, 1fr) minmax(80px, 1.5fr) 38px; }
}
