/* ============================================================
   PORTAL ACADÉMICO CFO · TEMA VISUAL ALERTA TÁCTICA PD v3.1
   CSS completo y mejorado para todos los divs y componentes
   ============================================================ */

/* ---------- VARIABLES ---------- */
:root {
  /* Colores identitarios */
  --gold: #e7a300;
  --gold-light: #ffc928;
  --gold-soft: #fff2c7;
  --gold-deep: #ae6800;
  --gold-gradient: linear-gradient(135deg, var(--gold-light), var(--gold));
  --gold-glow: 0 0 20px rgba(231, 163, 0, 0.15);

  /* Neutros */
  --ink: #16181c;
  --ink-soft: #343a43;
  --muted: #69707c;
  --muted-light: #8f96a3;
  --line: #ded9cf;
  --line-dark: rgba(255, 202, 40, 0.19);
  --paper: #ffffff;
  --surface: #f3f1ec;
  --surface-alt: #ece8e0;

  /* Fondos oscuros */
  --nav: #111214;
  --nav-light: #1a1c20;
  --bg-dark: linear-gradient(105deg, #0b0c0e 0%, #17191d 65%, #101113 100%);

  /* Estados */
  --danger: #bd3f4e;
  --danger-soft: #fbecee;
  --success: #19724d;
  --success-soft: #e8f6ed;
  --discord: #5865f2;

  /* Sombras */
  --shadow-sm: 0 4px 12px rgba(20, 21, 24, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 21, 24, 0.10);
  --shadow-lg: 0 16px 48px rgba(20, 21, 24, 0.14);
  --shadow-gold: 0 8px 24px rgba(174, 104, 0, 0.20);

  /* Radios */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Tipografía */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, system-ui, sans-serif;
  --font-size: 15px;
  --line-height: 1.5;

  /* Transiciones */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.25s;
  --transition: var(--duration) var(--ease);
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 92% 0%, rgba(231, 163, 0, 0.07), transparent 26rem),
    linear-gradient(180deg, #f8f6f1 0%, var(--surface) 48rem, #eeece7 100%);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--font-size);
  line-height: var(--line-height);
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition), border-color var(--transition);
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

/* ---------- UTILIDADES ---------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
}

.text-center  { text-align: center; }
.text-muted   { color: var(--muted); }
.text-gold    { color: var(--gold); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================================
   HEADER (site-header)
   ============================================================ */
.site-header {
  position: sticky;
  z-index: 20;
  top: 0;
  background: var(--bg-dark);
  border-bottom: 1px solid var(--line-dark);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.20);
}

.header-inner {
  width: min(100% - 48px, 1360px);
  min-height: 78px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.logo {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  font-weight: 700;
  font-size: 1.2rem;
}

.logo-icon {
  font-size: 1.8rem;
  line-height: 1;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.3));
}

.logo-text {
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-text:hover {
  color: var(--gold-light);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 20px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 720;
}

.header-nav a {
  padding: 28px 0 24px;
  border-bottom: 3px solid transparent;
  transition: color var(--transition), border-color var(--transition);
}

.header-nav a:hover {
  color: var(--gold-light);
  border-bottom-color: var(--gold);
}

.admin-link {
  color: var(--gold-light) !important;
}
.admin-link:hover {
  color: #ffd866 !important;
}

.logout-link {
  color: rgba(255, 150, 150, 0.8) !important;
}
.logout-link:hover {
  color: #ff9999 !important;
}

.login-link {
  background: var(--gold-gradient);
  color: #151515 !important;
  padding: 8px 18px !important;
  border-radius: var(--radius-sm);
  font-weight: 850;
  border-bottom: none !important;
  box-shadow: 0 4px 14px rgba(160, 97, 0, 0.18);
  transition: transform var(--transition), box-shadow var(--transition);
}

.login-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold);
  border-bottom: none !important;
}

/* ============================================================
   CONTENEDOR PRINCIPAL
   ============================================================ */
.container {
  width: min(100% - 48px, 1360px);
  margin: 0 auto;
  padding: 38px 0 72px;
  flex: 1;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  padding: 24px;
  border-top: 1px solid rgba(255, 202, 40, 0.13);
  background: #0e0f11;
  color: rgba(255, 255, 255, 0.56);
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.025em;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 350px;
  padding: clamp(32px, 5vw, 64px);
  border: 1px solid rgba(255, 205, 53, 0.20);
  border-radius: var(--radius-xl);
  background: linear-gradient(112deg, rgba(11, 12, 14, 0.98), rgba(24, 25, 29, 0.96) 56%, rgba(93, 56, 0, 0.92) 100%);
  box-shadow: var(--shadow-lg);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 38px;
}

.hero::before {
  position: absolute;
  z-index: -1;
  right: -9rem;
  bottom: -16rem;
  width: 36rem;
  height: 36rem;
  border: 1px solid rgba(255, 207, 63, 0.16);
  border-radius: 50%;
  box-shadow: 0 0 0 44px rgba(255, 207, 63, 0.035), 0 0 0 90px rgba(255, 207, 63, 0.022);
  content: "";
}

.hero::after {
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image: linear-gradient(125deg, transparent 0 60%, rgba(255, 210, 70, 0.045) 60% 61%, transparent 61% 100%);
  content: "";
}

.hero > div:first-child {
  max-width: 790px;
}

.hero h1 {
  max-width: 800px;
  margin: 10px 0 17px;
  font-size: clamp(38px, 5.1vw, 67px);
  font-weight: 880;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.hero h1 em {
  display: inline-block;
  color: var(--gold-light);
  font-style: normal;
  text-shadow: 0 6px 26px rgba(231, 163, 0, 0.22);
}

.hero p {
  max-width: 650px;
  margin: 0 0 27px;
  color: rgba(255, 255, 255, 0.73);
  font-size: 15px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Hero Card */
.hero-card {
  position: relative;
  width: 232px;
  min-height: 212px;
  flex: 0 0 auto;
  overflow: hidden;
  padding: 27px;
  border: 1px solid rgba(255, 211, 74, 0.28);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.10), rgba(255, 193, 25, 0.10));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.hero-card::after {
  position: absolute;
  right: -10px;
  top: -25px;
  color: rgba(255, 210, 70, 0.12);
  content: "◆";
  font-size: 108px;
  line-height: 1;
}

.hero-card span,
.hero-card small {
  position: relative;
  z-index: 1;
  color: rgba(255, 255, 255, 0.65);
  font-size: 11px;
}

.hero-card b {
  position: relative;
  z-index: 1;
  color: var(--gold-light);
  font-size: 28px;
  line-height: 1.02;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--gold-gradient);
  box-shadow: 0 4px 14px rgba(160, 97, 0, 0.18);
  color: #151515;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.01em;
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.btn:hover {
  box-shadow: var(--shadow-gold);
  filter: brightness(1.04);
  transform: translateY(-2px);
}

.btn:focus-visible {
  outline: 3px solid rgba(231, 163, 0, 0.34);
  outline-offset: 3px;
}

.btn.discord {
  background: linear-gradient(135deg, #6977ff, var(--discord));
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.22);
  color: #fff;
}

.btn.ghost {
  border-color: rgba(255, 212, 89, 0.52);
  background: transparent;
  box-shadow: none;
  color: #fff6da;
}

.btn.ghost:hover {
  background: rgba(255, 203, 51, 0.10);
  transform: translateY(-2px);
}

.btn.outline {
  border-color: rgba(174, 104, 0, 0.34);
  background: #fffdf9;
  box-shadow: none;
  color: var(--gold-deep);
}

.btn.outline:hover {
  background: var(--gold-soft);
}

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

.btn.danger:hover {
  filter: brightness(0.92);
}

.btn.full {
  width: 100%;
  justify-content: center;
}

.btn.mini {
  min-height: 31px;
  padding: 6px 12px;
  font-size: 11px;
}

/* ============================================================
   SECCIONES Y ENCABEZADOS
   ============================================================ */
.section-head,
.page-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin: 56px 0 18px;
}

.section-head h2,
.page-title h1 {
  margin: 5px 0 0;
  color: #17191d;
  font-size: clamp(25px, 2.2vw, 32px);
  font-weight: 850;
  letter-spacing: -0.032em;
  line-height: 1.08;
}

.section-head > p,
.page-title > div > p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.eyebrow {
  color: var(--gold-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: var(--gold-light);
}

.admin-title {
  margin-top: 0;
}

/* ============================================================
   TARJETAS Y GRID
   ============================================================ */
.conv-grid,
.op-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.conv-card,
.op-card,
.paper,
.side-card,
.center-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-sm);
}

.conv-card,
.op-card {
  position: relative;
  overflow: hidden;
  padding: 22px;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.conv-card::before,
.op-card::before {
  position: absolute;
  top: 0;
  left: 22px;
  width: 46px;
  height: 3px;
  border-radius: 0 0 99px 99px;
  background: var(--gold);
  content: "";
}

.conv-card:hover,
.op-card:hover {
  border-color: rgba(231, 163, 0, 0.60);
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.card-top > span:first-child {
  color: var(--ink-soft);
  font-weight: 850;
}

.conv-card h3,
.op-card h3 {
  margin: 18px 0 8px;
  color: #1b1d20;
  font-size: 18px;
  font-weight: 850;
  letter-spacing: -0.02em;
  line-height: 1.18;
}

.conv-card p,
.op-card p {
  min-height: 34px;
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}

.conv-card small {
  color: #59606a;
  font-size: 11px;
  font-weight: 650;
}

/* ============================================================
   PAPER, SIDE-CARD, CENTER-CARD
   ============================================================ */
.paper,
.side-card {
  margin-top: 18px;
  padding: 28px;
}

.paper h2,
.side-card h3 {
  margin: 0 0 16px;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.paper h3 {
  margin: 26px 0 8px;
  font-size: 15px;
}

.side-card {
  align-self: start;
}

.side-card p {
  color: var(--muted);
  font-size: 13px;
}

.center-card {
  max-width: 650px;
  margin: 70px auto;
  padding: 50px;
  text-align: center;
}

.center-card h1 {
  margin: 7px 0 11px;
  color: #1a1c20;
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.035em;
}

.center-card p {
  max-width: 480px;
  margin: 0 auto 21px;
  color: var(--muted);
}

.positive {
  color: var(--success) !important;
  font-weight: 800;
}

.richtext {
  color: #363b44;
  font-size: 14px;
  line-height: 1.7;
}

/* ============================================================
   DETALLE DE CONVOCATORIA
   ============================================================ */
.detail-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 31px;
  border: 1px solid #d8cfbf;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background: linear-gradient(130deg, #fffdf9, #f5ecd4);
}

.detail-hero h1 {
  margin: 6px 0;
  font-size: 33px;
  letter-spacing: -0.03em;
}

.detail-hero p {
  margin: 0;
  color: var(--muted);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: 18px;
  margin-top: 18px;
}

.detail-grid > .paper:first-child,
.detail-grid > .side-card {
  margin-top: 0;
}

.detail-hero + .detail-grid,
.detail-hero + .detail-grid + .paper {
  margin-top: 18px;
}

/* ============================================================
   DEFINITION LISTS
   ============================================================ */
dl {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 8px 18px;
  font-size: 13px;
}

dt {
  color: #34383f;
  font-weight: 850;
}

dd {
  margin: 0;
  color: var(--muted);
}

/* ============================================================
   TIMELINE Y FASES
   ============================================================ */
.timeline {
  display: grid;
  gap: 14px;
}

.phase {
  padding: 5px 0 5px 16px;
  border-left: 3px solid var(--gold);
}

.phase b,
.phase span {
  display: block;
}

.phase span,
.phase small {
  color: var(--muted);
  font-size: 11px;
}

.phase p {
  margin: 8px 0;
  font-size: 13px;
}

/* ============================================================
   DOCUMENTOS
   ============================================================ */
.doc-list {
  display: grid;
  gap: 9px;
}

.doc-list a {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), background var(--transition);
}

.doc-list a::before {
  content: "↗";
  width: 27px;
  height: 27px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--gold-soft);
  color: var(--gold-deep);
  font-size: 15px;
  font-weight: 900;
}

.doc-list a b {
  margin-right: auto;
  color: #24262a;
}

.doc-list a:hover {
  border-color: rgba(231, 163, 0, 0.46);
  background: #fffbef;
}

.doc-list span {
  color: var(--muted);
  font-size: 11px;
}

.private-note {
  padding: 15px;
  border: 1px dashed #cfbe93;
  border-radius: var(--radius-sm);
  color: #766846;
  font-size: 13px;
}

/* ============================================================
   ADMIN / CFO
   ============================================================ */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.metrics > div {
  padding: 20px;
  border: 1px solid rgba(255, 202, 40, 0.15);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #16171a, #26292e);
  color: #fff;
}

.metrics b {
  display: block;
  color: var(--gold-light);
  font-size: 29px;
}

.metrics span {
  color: rgba(255, 255, 255, 0.60);
  font-size: 12px;
}

.admin-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 11px;
  margin: 17px 0;
}

.admin-nav a {
  display: flex;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.admin-nav a:hover {
  border-color: rgba(231, 163, 0, 0.55);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.admin-nav b {
  color: var(--gold-deep);
  font-size: 22px;
}

.admin-nav span {
  display: block;
  font-size: 13px;
  font-weight: 850;
}

.admin-nav small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 500;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

/* ============================================================
   LISTAS (STACK, LIST-ROW)
   ============================================================ */
.stack {
  display: grid;
  gap: 9px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}

.list-row:hover {
  background: #fffaf0;
}

.list-row b,
.list-row small {
  display: block;
}

.list-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.list-row form {
  margin: 0;
}

/* ============================================================
   FORMULARIOS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

:where(.form-grid, .paper > form) label {
  display: grid;
  gap: 6px;
  color: #343940;
  font-size: 12px;
  font-weight: 800;
}

.form-grid label.wide {
  grid-column: 1 / -1;
}

input,
textarea,
select {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid #cfc8bb;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(231, 163, 0, 0.12);
  outline: none;
}

input:disabled,
textarea:disabled,
select:disabled {
  background: #f1f3f5;
  color: #868e96;
  border-color: #dee2e6;
  cursor: not-allowed;
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.check input {
  width: auto;
  accent-color: var(--gold);
  cursor: pointer;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 35px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin: 12px 0;
}

.inline-form input {
  flex: 1;
}

.option-builder {
  display: grid;
  gap: 8px;
}

.option-builder > label {
  display: grid !important;
  grid-template-columns: 20px 1fr;
  align-items: center;
}

.option-builder > label input[type="radio"] {
  width: auto;
}

.form-grid .btn {
  align-self: end;
  justify-self: start;
}

.form-grid select[multiple] {
  min-height: 140px;
  padding: 8px;
}

.form-grid option {
  padding: 7px 8px;
}

.form-grid option:checked {
  background: var(--gold-soft);
  color: var(--ink);
}

.paper > form > :is(.btn, .form-actions, .check) {
  margin-top: 17px;
}

.paper > form > label:not(.check) {
  margin-top: 15px;
}

.paper > form > label:not(.check):first-of-type {
  margin-top: 0;
}

.paper form .check + .btn {
  margin-top: 14px;
}

.paper form > table + .check {
  margin-top: 16px;
}

/* ============================================================
   CATEGORÍAS (oportunidades cerradas)
   ============================================================ */
.category {
  margin-top: 20px;
  padding: 19px;
  border: 1px solid #ddd7cb;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #f7f5f0, #eeebe4);
}

.category-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 15px;
  padding: 0 3px;
}

.category-title::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(231, 163, 0, 0.14);
  content: "";
}

.category-title b {
  color: #24262a;
  font-size: 15px;
}

.category-title span {
  color: var(--muted);
  font-size: 11px;
}

.interest-ok {
  padding: 10px 0 0;
  color: var(--success);
  font-size: 13px;
  font-weight: 850;
}

/* ============================================================
   BADGES Y CLOSED
   ============================================================ */
.badge,
.closed {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.015em;
  white-space: nowrap;
}

.badge-abierta,
.badge-apto,
.badge-seleccionado {
  background: var(--success-soft);
  color: #176442;
}

.badge-programada,
.badge-reserva {
  background: var(--gold-soft);
  color: #8a5200;
}

.badge-cerrada,
.badge-no_apto,
.badge-no_seleccionado,
.badge-excluido {
  background: var(--danger-soft);
  color: #a43342;
}

.badge-borrador,
.badge-pendiente,
.badge-finalizada {
  background: #ecebe8;
  color: #5f636b;
}

.closed {
  background: #fff1c8;
  color: #8b5700;
}

/* ============================================================
   FLASH / ALERTAS
   ============================================================ */
.flash {
  margin: 0 0 20px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
}

.flash.success {
  border: 1px solid #bde2ca;
  background: var(--success-soft);
  color: #17603e;
}

.flash.error {
  border: 1px solid #edc5ca;
  background: var(--danger-soft);
  color: #97313e;
}

.back {
  display: inline-flex;
  color: var(--gold-deep);
  font-size: 13px;
  font-weight: 850;
}

.back:hover {
  color: var(--gold);
}

/* ============================================================
   EXÁMENES
   ============================================================ */
.exam-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 17px;
  padding: 25px;
  border: 1px solid rgba(255, 208, 58, 0.2);
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, #111214, #313037);
  color: #fff;
}

.exam-head h1 {
  margin: 5px 0;
  font-size: 29px;
}

.exam-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.70);
  font-size: 13px;
}

.exam-clock {
  min-width: 120px;
  text-align: right;
}

.exam-clock span,
.exam-clock b {
  display: block;
}

.exam-clock span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 11px;
}

.exam-clock b {
  color: var(--gold-light);
  font-size: 28px;
}

.exam-form {
  max-width: 980px;
}

.exam-form > .btn.full {
  position: sticky;
  bottom: 18px;
  z-index: 4;
  min-height: 48px;
  box-shadow: var(--shadow-gold);
}

.question {
  margin-bottom: 15px;
  padding: 19px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fffdfa;
  box-shadow: 0 4px 12px rgba(20, 21, 24, 0.035);
  transition: border-color var(--transition);
}

.question:hover {
  border-color: rgba(231, 163, 0, 0.46);
}

.question h3 {
  margin: 0 0 5px;
  font-size: 15px;
}

.question > small {
  color: var(--muted);
  font-size: 11px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid #ddd6c9;
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.option:hover {
  border-color: var(--gold);
  background: #fffaf0;
}

.option input {
  width: auto;
  margin-top: 2px;
  accent-color: var(--gold-deep);
}

.option:has(input:checked) {
  border-color: var(--gold);
  background: #fff3c9;
  box-shadow: inset 0 0 0 1px rgba(231, 163, 0, 0.12);
}

.review-option {
  padding: 5px 0;
  font-size: 13px;
}

.review-option.correct {
  color: var(--success);
  font-weight: 850;
}

/* ============================================================
   TABLAS
   ============================================================ */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

thead {
  background: #f8f4e9;
}

th {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  color: #666a72;
  font-size: 10px;
  letter-spacing: 0.06em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

td small {
  color: var(--muted);
  font-size: 11px;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:nth-child(even) {
  background: rgba(244, 240, 231, 0.34);
}

tbody tr:hover td {
  background: #fff8e7;
}

td:first-child,
th:first-child {
  padding-left: 14px;
}

td:last-child,
th:last-child {
  padding-right: 14px;
}

.result-table {
  margin-top: 15px;
  margin-bottom: 5px;
}

.result-table input,
.result-table select {
  padding: 7px;
  font-size: 12px;
}

.phase-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 15px;
}

.phase-tabs a {
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  font-size: 12px;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}

.phase-tabs a:hover {
  border-color: var(--gold);
}

.phase-tabs a.active {
  border-color: var(--gold);
  background: var(--gold);
  color: #171717;
  font-weight: 850;
}

/* ============================================================
   EDIT PANEL
   ============================================================ */
.edit-panel {
  border-top: 3px solid var(--gold);
}

.edit-panel summary {
  color: var(--gold-deep);
  cursor: pointer;
  font-size: 15px;
  font-weight: 850;
  list-style: none;
}

.edit-panel summary::-webkit-details-marker {
  display: none;
}

.edit-panel summary::after {
  float: right;
  color: var(--gold-deep);
  content: "+";
  font-size: 21px;
  line-height: 0.8;
}

.edit-panel[open] summary {
  margin-bottom: 20px;
}

.edit-panel[open] summary::after {
  content: "−";
}

.edit-panel form {
  margin-top: 18px;
}

/* ============================================================
   ESTADO VACÍO
   ============================================================ */
.empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed #cdbf9c;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  color: #7d7466;
  font-size: 13px;
}

.empty-state {
  padding: 3.5rem 2rem;
  margin: 1.5rem 0;
  text-align: center;
  background: #fafafa;
  border: 2px dashed #e0e0e0;
  border-radius: var(--radius-md);
}

.empty-state-icon {
  display: block;
  font-size: 2.5rem;
  color: #b0b0b0;
  margin-bottom: 1rem;
}

.empty-state h4 {
  margin: 0 0 0.5rem;
  color: var(--nav);
  font-size: 1.15rem;
}

.empty-state p {
  max-width: 400px;
  margin: 0 auto 1.5rem;
  color: #777;
  font-size: 0.9rem;
}

/* ============================================================
   PAGINACIÓN
   ============================================================ */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2rem;
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
}

.pagination a:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.pagination .active {
  background: var(--nav);
  border-color: var(--nav);
  color: var(--gold-light);
  font-weight: 700;
}

.pagination .disabled {
  background: #f5f5f5;
  color: #ccc;
  border-color: #e0e0e0;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================
   MODALES
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-window {
  width: 90%;
  max-width: 550px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--gold);
  transform: translateY(-20px);
  transition: transform var(--transition);
  overflow: hidden;
}

.modal-overlay.active .modal-window {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.25rem 1.5rem;
  background: var(--nav);
  color: #fff;
}

.modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition);
}

.modal-close:hover {
  color: #fff;
}

.modal-body {
  padding: 1.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: #f9f9f9;
  border-top: 1px solid #eee;
}

/* ============================================================
   BARRAS DE PROGRESO
   ============================================================ */
.progress-container {
  margin: 1rem 0;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  font-weight: 600;
  color: #555;
  margin-bottom: 0.4rem;
}

.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: #e9ecef;
  border-radius: 10px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 10px;
  background: var(--gold-gradient);
  transition: width 0.4s ease;
  width: 0%;
}

/* ============================================================
   MISC (utilidades internas)
   ============================================================ */
:where(.paper) > :is(form, .stack, .doc-list, .timeline) {
  min-width: 0;
}

.paper:has(.result-table),
.paper:has(table) {
  overflow-x: auto;
}

.doc-mini {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

/* ============================================================
   REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001s !important;
    animation-duration: 0.001s !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1040px) {
  .conv-grid,
  .op-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .header-nav {
    gap: 13px;
  }
  .header-nav a {
    padding: 28px 0 24px;
  }
  .hero {
    gap: 24px;
  }
}

@media (max-width: 850px) {
  .header-inner {
    min-height: auto;
    padding: 13px 0;
    align-items: flex-start;
  }

  .header-nav {
    flex-wrap: wrap;
    gap: 9px 13px;
    padding-top: 4px;
  }

  .header-nav a {
    padding: 7px 0;
  }

  .header-nav a:not(.admin-link):not(.login-link):not(.logout-link) {
    display: none;
  }

  .hero {
    min-height: 0;
  }

  .hero-card {
    display: none;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .metrics,
  .admin-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .form-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .wide {
    grid-column: auto !important;
  }

  .section-head,
  .page-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-head > p,
  .page-title > div > p {
    text-align: left;
  }

  .result-table {
    display: block;
    overflow-x: auto;
  }

  .admin-actions {
    align-items: stretch;
  }

  .admin-actions .btn {
    flex: 1 1 auto;
  }

  .list-row {
    align-items: flex-start;
  }

  .list-row > span:first-child b {
    white-space: normal;
  }

  .form-grid .btn {
    width: 100%;
    justify-self: stretch;
  }
}

@media (max-width: 580px) {
  .header-inner,
  .container {
    width: min(100% - 28px, 1360px);
  }

  .logo-icon {
    font-size: 1.4rem;
  }

  .logo-text {
    font-size: 1rem;
  }

  .hero {
    padding: 29px 24px;
    border-radius: var(--radius-md);
  }

  .hero h1 {
    font-size: 39px;
  }

  .hero p {
    font-size: 14px;
  }

  .conv-grid,
  .op-grid,
  .metrics,
  .admin-nav {
    grid-template-columns: 1fr;
  }

  .category {
    padding: 14px;
  }

  .paper,
  .side-card {
    padding: 20px;
  }

  .detail-hero {
    padding: 21px;
  }

  .detail-hero h1 {
    font-size: 26px;
  }

  dl {
    grid-template-columns: 1fr;
  }

  .exam-head {
    flex-direction: column;
  }

  .exam-clock {
    text-align: left;
  }

  .doc-list a {
    align-items: flex-start;
    flex-direction: column;
  }

  .exam-form > .btn.full {
    bottom: 10px;
  }

  table {
    min-width: 640px;
  }

  .result-table {
    min-width: 720px;
  }

  .paper:has(table) {
    padding-bottom: 16px;
  }
}

/* ============================================================
   ESTILOS PARA PÁRRAFOS (<p>) Y CLASES CON "p"
   ============================================================ */

/* --- Párrafos generales --- */
p {
  margin: 0 0 1rem 0;
  line-height: 1.6;
}

/* --- Párrafos dentro de .paper --- */
.paper p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.paper p:last-child {
  margin-bottom: 0;
}

/* --- Párrafos dentro de .side-card --- */
.side-card p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* --- Párrafos dentro de .conv-card y .op-card --- */
.conv-card p,
.op-card p {
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  min-height: 2.5rem; /* Mantiene altura consistente */
}

/* --- Párrafos dentro de .hero --- */
.hero p {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1rem;
  max-width: 650px;
  margin-bottom: 1.5rem;
}

/* --- Párrafos dentro de .detail-hero --- */
.detail-hero p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}

/* --- Párrafos dentro de .phase (timeline) --- */
.phase p {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0.5rem 0 0.25rem 0;
}

/* --- Párrafos dentro de .empty --- */
.empty p {
  color: #7d7466;
  font-size: 0.95rem;
  margin: 0;
}

/* --- Párrafos dentro de .center-card --- */
.center-card p {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 1.25rem auto;
}

/* --- Párrafos dentro de .private-note --- */
.private-note p {
  color: #766846;
  font-size: 0.9rem;
  margin: 0;
}

/* --- Párrafos dentro de .list-row --- */
.list-row p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

/* --- Párrafos dentro de .alert / .flash --- */
.flash p,
.alert p {
  margin: 0;
  font-weight: 500;
}

/* --- Párrafos dentro de .richtext (contenido editorial) --- */
.richtext p {
  margin-bottom: 0.75rem;
  line-height: 1.7;
}

.richtext p:last-child {
  margin-bottom: 0;
}

/* --- Párrafos dentro de .exam-head --- */
.exam-head p {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.95rem;
  margin: 0;
}

/* --- Párrafos dentro de .modal-body --- */
.modal-body p {
  color: var(--ink-soft);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.modal-body p:last-child {
  margin-bottom: 0;
}

/* --- Párrafos dentro de tablas (si se usan) --- */
td p {
  margin: 0;
  font-size: 0.9rem;
}

/* --- Párrafos pequeños (texto auxiliar) --- */
p small,
small p {
  font-size: 0.8rem;
  color: var(--muted);
}

/* --- Párrafos destacados --- */
p.lead {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--ink-soft);
}

p.muted {
  color: var(--muted);
}

p.gold {
  color: var(--gold-deep);
}

p.success {
  color: var(--success);
}

p.danger {
  color: var(--danger);
}