:root {
  --bg: #eef2f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fc;
  --line: #d5deea;
  --text: #1d2a3b;
  --muted: #617185;
  --primary: #134f2a;
  --primary-strong: #0e3e21;
  --institutional-blue: #062f7f;
  --institutional-gold: #d6a729;
  --ok: #2f8a4f;
  --danger: #b23b3b;
  --radius: 12px;
  --shadow-soft: 0 8px 24px rgba(18, 41, 66, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Montserrat", "Segoe UI", sans-serif;
  background:
    radial-gradient(850px 420px at 6% -8%, #dfe9f7 0%, transparent 70%),
    var(--bg);
  color: var(--text);
}

.admin-login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    linear-gradient(135deg, rgba(6, 47, 127, 0.94), rgba(19, 79, 42, 0.9)),
    url("../colegio/hero.jpg") center/cover fixed;
  position: relative;
}

.admin-login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 28%),
    rgba(7, 20, 42, 0.24);
  pointer-events: none;
}

.login-card {
  position: relative;
  width: min(480px, 94vw);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.64);
  border-radius: 18px;
  padding: 1.55rem;
  box-shadow: 0 28px 70px rgba(3, 20, 47, 0.34);
  overflow: hidden;
}

.login-card::before {
  content: "";
  display: block;
  height: 5px;
  background: linear-gradient(90deg, var(--institutional-blue), var(--primary), var(--institutional-gold));
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
}

.login-brand {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.2rem;
}

.login-brand img {
  width: 112px;
  height: auto;
  display: block;
  object-fit: contain;
}

.login-brand span {
  display: block;
  margin-bottom: 0.18rem;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-brand h1 {
  margin: 0;
  color: #132036;
  font-size: clamp(1.72rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.login-card .stack-form {
  gap: 0.82rem;
}

.login-card label {
  color: #243246;
  font-size: 0.94rem;
}

.login-card input {
  min-height: 46px;
  border-color: #cbd6e5;
  background: #fdfefe;
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(19, 79, 42, 0.14);
}

.login-card .btn-primary {
  min-height: 48px;
  margin-top: 0.18rem;
  background: linear-gradient(135deg, var(--institutional-blue), var(--primary));
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 20px rgba(6, 47, 127, 0.22);
}

.login-card .btn-primary:hover {
  background: linear-gradient(135deg, #05286c, var(--primary-strong));
}

.login-footnote {
  margin: 1rem 0 0;
  padding-top: 0.95rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

@media (max-width: 520px) {
  .admin-login-body {
    padding: 1rem;
    background-attachment: scroll;
  }

  .login-card {
    padding: 1.25rem;
  }

  .login-brand {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
    gap: 0.75rem;
  }

  .login-brand img {
    width: 136px;
  }
}

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

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 270px 1fr;
}

.admin-sidebar {
  background: linear-gradient(180deg, #102942 0%, #0f2a45 100%);
  color: #e5eef8;
  padding: 1rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-block {
  padding: 0.3rem 0.4rem 0.2rem;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;
  margin: 0 0 0.55rem;
  border-radius: 10px;
  background: #fff;
  border: 1px solid rgba(20, 37, 58, 0.22);
  padding: 0.35rem;
  object-fit: contain;
}

.brand-block h2 {
  margin: 0;
  font-size: 1.2rem;
}

.brand-block p {
  margin: 0.18rem 0 0;
  color: #a7bed6;
  font-size: 0.83rem;
}

.admin-nav {
  display: grid;
  gap: 0.28rem;
}

.nav-group-title {
  margin: 0.55rem 0 0.16rem;
  padding: 0 0.45rem;
  color: #9eb2c9;
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-sidebar a {
  text-decoration: none;
  color: #dce7f4;
  border-radius: 10px;
  padding: 0.5rem 0.55rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s ease, color 0.2s ease;
}

.admin-sidebar a.active,
.admin-sidebar a:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

.sidebar-bottom {
  margin-top: auto;
  display: grid;
  gap: 0.35rem;
  padding: 0.6rem 0.4rem 0.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-bottom small {
  color: #adc0d4;
}

.admin-main {
  padding: 1.05rem 1.1rem 1.6rem;
}

.admin-page-head {
  margin-bottom: 0.85rem;
}

.admin-page-head h1 {
  margin: 0;
  font-size: clamp(1.4rem, 2.3vw, 2rem);
  line-height: 1.15;
}

.admin-page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.admin-main > h1 {
  display: none;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.95rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-soft);
}

.fold-panel summary {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 0.6rem;
  align-items: center;
  padding: 0.18rem 0.05rem;
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
}

.fold-panel summary span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
}

.subpanel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
  padding: 0.7rem;
  margin: 0.8rem 0;
}

.stack-form {
  display: grid;
  gap: 0.68rem;
}

label {
  display: grid;
  gap: 0.24rem;
  font-weight: 700;
}

.faq-delete-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #243246;
}

.faq-delete-toggle input[type="checkbox"] {
  width: auto;
  margin: 0;
  transform: translateY(1px);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0.56rem;
  font: inherit;
  color: var(--text);
  background: #fff;
}

label input[type="checkbox"] {
  width: auto;
  margin: 0;
  justify-self: start;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #8dbce0;
  box-shadow: 0 0 0 3px rgba(41, 128, 185, 0.13);
  outline: none;
}

.lang-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.btn {
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 0.5rem 0.82rem;
  background: #edf3f9;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.btn:hover {
  filter: brightness(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-strong);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.inline-form {
  margin: -0.35rem 0 0.9rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-inline {
  width: auto;
  justify-self: start;
}

.news-create-row {
  margin: 0.3rem 0 1rem;
}

.news-create-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  align-items: center;
  margin: 0.3rem 0 1rem;
}

.news-create-tools .news-create-row {
  margin: 0;
}

.news-instagram-add {
  display: flex;
  flex: 1 1 420px;
  gap: 0.5rem;
  align-items: center;
}

.news-instagram-add input,
.news-instagram-add textarea {
  flex: 1 1 260px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.56rem 0.65rem;
  font: inherit;
  min-height: 42px;
  resize: vertical;
}

.news-instagram-add .btn {
  width: auto;
  white-space: nowrap;
}

.instagram-admin-panel {
  margin-bottom: 1rem;
}

.instagram-admin-panel h2 {
  margin-bottom: 0.6rem;
}

.instagram-admin-list {
  display: grid;
  gap: 0.5rem;
}

.instagram-admin-item {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0.65rem;
}

.instagram-admin-item a {
  color: var(--primary);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.news-save-row {
  margin: 0.3rem 0 0.7rem;
}

.campus-topic {
  margin-bottom: 0.55rem;
}

.campus-item-list {
  display: grid;
  gap: 0.55rem;
  margin: 0.45rem 0 0.65rem;
}

.campus-item-card {
  background: #fff;
  border: 1px solid var(--line);
}

.campus-item-card > summary {
  margin-bottom: 0.45rem;
}

.admin-section-title {
  margin: 0.4rem 0 0.55rem;
  font-size: 1rem;
  color: #233347;
}

.campus-current-preview {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.45rem;
}

.campus-current-preview img {
  width: min(280px, 100%);
  height: 138px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.campus-current-preview small {
  color: var(--muted);
  word-break: break-all;
}

.campus-order-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.35rem;
  margin-bottom: 0.2rem;
}

.current-file-ref {
  margin-top: 0.35rem;
  display: grid;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.current-file-ref a {
  color: var(--primary);
  text-decoration: none;
  word-break: break-all;
}

.current-file-ref img {
  width: min(240px, 100%);
  height: 120px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.row-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  align-items: end;
}

.row-grid-news-gallery {
  grid-template-columns: 1.2fr 1fr 1.2fr 1fr 1.2fr auto;
}

.news-gallery-rows {
  display: grid;
  gap: 0.45rem;
}

.news-gallery-row {
  align-items: center;
}

.news-gallery-row-remove {
  min-width: 40px;
  padding: 0.5rem 0.55rem;
  line-height: 1;
  font-size: 1.1rem;
}

.row-grid-link-excellence {
  grid-template-columns: 1.6fr 1fr 1fr auto;
}

.row-grid-link-excellence label {
  font-weight: 600;
}

.row-grid-admission-window {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row-grid-create-news {
  grid-template-columns: 1fr 1fr 1fr 1.4fr auto;
}

.row-grid-create-news label {
  font-weight: 600;
}

.row-grid-news-main {
  grid-template-columns: 1.2fr 1fr 0.8fr;
}

.row-grid-news-publish {
  grid-template-columns: 1fr 1fr;
  align-items: center;
}

.row-grid-news-publish label {
  font-weight: 700;
}

.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.check-inline input[type="checkbox"] {
  margin: 0;
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.check-inline span {
  line-height: 1.2;
}

.news-edit-form {
  gap: 0.55rem;
}

.news-edit-form h3 {
  margin: 0.15rem 0 0.2rem;
}

.news-fold {
  margin-top: 0.55rem;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.66rem;
  margin: 0.7rem 0;
}

.thumb-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.thumb-item img {
  width: 100%;
  height: 105px;
  object-fit: cover;
  border-radius: 8px;
}

.thumb-item small {
  color: var(--muted);
  font-size: 0.78rem;
}

.mini-actions {
  display: flex;
  gap: 0.3rem;
  align-items: center;
  flex-wrap: wrap;
}

.mini-actions input[type="file"] {
  max-width: 180px;
  font-size: 0.78rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem;
}

.dashboard-enterprise {
  display: grid;
  gap: 0.9rem;
}

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  background:
    linear-gradient(115deg, rgba(15, 95, 148, 0.07) 0%, rgba(108, 142, 45, 0.06) 100%),
    var(--surface);
}

.dash-hero h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
}

.dash-hero p {
  margin: 0.4rem 0 0;
  color: var(--muted);
  max-width: 70ch;
}

.dash-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: flex-end;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.dash-kpi {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid #8ca66a;
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 0.2rem;
}

.dash-kpi small {
  color: var(--muted);
  font-weight: 700;
}

.dash-kpi strong {
  font-size: clamp(1.25rem, 2.1vw, 1.9rem);
  line-height: 1.05;
  color: #183353;
}

.dash-kpi span {
  font-size: 0.82rem;
  color: var(--muted);
}

.dash-section-title {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
}

.dash-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.dash-step {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.75rem;
  position: relative;
}

.dash-step b {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #0f5f94;
  color: #fff;
  font-size: 0.9rem;
  margin-bottom: 0.45rem;
}

.dash-step h4 {
  margin: 0;
  font-size: 0.95rem;
}

.dash-step p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.dash-module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.72rem;
}

.dash-module {
  display: grid;
  gap: 0.25rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 0.72rem;
  background: #fff;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.dash-module strong {
  font-size: 0.96rem;
}

.dash-module p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

.dash-module small {
  color: #3f5f83;
  font-weight: 700;
  font-size: 0.77rem;
}

.dash-module:hover {
  transform: translateY(-1px);
  border-color: #b8cbdf;
  box-shadow: 0 6px 20px rgba(18, 41, 66, 0.09);
}

.dash-notes ul {
  margin: 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.35rem;
}

.dash-notes li {
  color: #2c3d52;
  line-height: 1.4;
}

.dash-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.95rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
}

.dash-card:hover {
  border-color: #c4d4e7;
}

.flash {
  position: sticky;
  top: 0.8rem;
  z-index: 20;
  width: fit-content;
  border-radius: 9px;
  color: #fff;
  padding: 0.56rem 0.78rem;
  margin-bottom: 0.9rem;
  box-shadow: var(--shadow-soft);
}

.flash-success {
  background: var(--ok);
}

.flash-error {
  background: var(--danger);
}

@media (max-width: 1200px) {
  .dash-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dash-module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dash-flow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .thumb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    border-right: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.28rem 0.5rem;
  }

  .nav-group-title {
    grid-column: 1 / -1;
  }

  .admin-main {
    padding: 0.95rem;
  }

  .dash-hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .dash-hero-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .lang-fields,
  .row-grid,
  .row-grid-news-gallery,
  .row-grid-link-excellence,
  .row-grid-create-news,
  .row-grid-admission-window {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .dash-kpi-grid,
  .dash-module-grid,
  .dash-flow,
  .dashboard-grid,
  .thumb-grid,
  .admin-nav {
    grid-template-columns: 1fr;
  }
}
