/* =============================================================
   COLEGIO SAN IGNACIO DE CALAMA | CONCIERTO CORO CARDENAL 2026
   Edición visual «Nocturno de Gala» — solo presentación
   Sin cambios en identificadores, clases de JS, PHP ni SQL.
   ============================================================= */

:root {
  --navy: #152842;
  --navy2: #253d59;
  --navy-deep: #0b1a2d;
  --navy-soft: #345171;
  --gold: #be903b;
  --gold-light: #e9ce8c;
  --gold-pale: #fff7e9;
  --paper: #f6f2e9;
  --ink: #253246;
  --muted: #627184;
  --line: #e4e4e1;
  --good: #215f4b;
  --bad: #a13535;
  --white: #fff;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, "Times New Roman", serif;
  --sans: "Segoe UI", Inter, -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  --shadow-lg: 0 28px 72px rgba(15, 32, 52, .13), 0 4px 14px rgba(17, 35, 52, .05);
  --shadow-sm: 0 7px 22px rgba(11, 30, 51, .075);
  --focus: 0 0 0 4px rgba(190, 144, 59, .22);
}

*, *::before, *::after { box-sizing: border-box; }
html { color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 52% 38% at 1% 4%, rgba(224, 205, 159, .38) 0%, transparent 95%),
    radial-gradient(ellipse 48% 42% at 98% 16%, rgba(179, 195, 206, .30) 0%, transparent 96%),
    radial-gradient(ellipse 54% 28% at 50% 101%, rgba(213, 190, 154, .22) 0%, transparent 100%),
    #f8f7f3;
  background-attachment: fixed;
  line-height: 1.55;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(42, 57, 73, .12) .55px, transparent .65px);
  background-size: 17px 17px;
  opacity: .23;
}
button, input { font: inherit; }
button { appearance: none; -webkit-appearance: none; }
a { color: #1a4a79; text-underline-offset: 4px; text-decoration-color: rgba(190, 144, 59, .55); transition: color .18s ease; }
a:hover { color: #986922; }
::selection { background: #e8cb88; color: #10243b; }
[hidden], input[type="hidden"] { display: none !important; }

/* ---------- Contenedor y portada editorial ---------- */
.container {
  position: relative;
  isolation: isolate;
  max-width: 990px;
  margin: 42px auto 60px;
  padding: 0 20px;
  animation: page-appear .5s ease both;
}
.container::before {
  content: "";
  position: absolute;
  top: -14px;
  left: 36px;
  right: 36px;
  height: 22px;
  border: 1px solid rgba(193, 157, 91, .26);
  border-radius: 25px 25px 0 0;
  z-index: -1;
}
.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: #fff;
  text-align: center;
  padding: 45px 60px 58px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-bottom: 0;
  border-radius: 23px 23px 0 0;
  background:
    radial-gradient(ellipse 48% 90% at 50% -35%, rgba(188, 154, 88, .19), transparent 92%),
    radial-gradient(ellipse 38% 78% at 100% 100%, rgba(97, 125, 154, .24), transparent 98%),
    linear-gradient(127deg, #101f35 0%, #1d3450 55%, #2c4965 100%);
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: "";
  position: absolute;
  pointer-events: none;
  inset: 16px;
  z-index: -1;
  border: 1px solid rgba(231, 201, 144, .24);
  border-radius: 12px 12px 0 0;
  background:
    repeating-linear-gradient(180deg, transparent 0 20px, rgba(234, 212, 156, .085) 21px, transparent 22px) 8% 57% / 19% 105px no-repeat,
    repeating-linear-gradient(180deg, transparent 0 20px, rgba(234, 212, 156, .085) 21px, transparent 22px) 92% 57% / 19% 105px no-repeat;
  opacity: .85;
}
.hero::after {
  content: "";
  position: absolute;
  pointer-events: none;
  left: 50%; bottom: 24px;
  transform: translateX(-50%);
  width: 88px;
  height: 14px;
  background: radial-gradient(circle, #e4c37c 2px, transparent 3px) center / 12px 12px no-repeat,
              linear-gradient(90deg, transparent, rgba(228, 195, 124, .68) 22%, transparent 22% 78%, rgba(228, 195, 124, .68) 78%, transparent) center / 100% 1px no-repeat;
  opacity: .9;
}
.kicker {
  display: inline-block;
  max-width: 100%;
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .22em;
  line-height: 1.9;
  text-transform: uppercase;
}
.hero h1 {
  color: #fffdf7;
  font: 400 clamp(34px, 5.3vw, 56px)/1.12 var(--serif);
  letter-spacing: -.027em;
  max-width: 790px;
  margin: 18px auto 15px;
  text-wrap: balance;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .1);
}
.hero p { margin: 5px auto; color: #e8eaf0; line-height: 1.7; font-size: 14px; }
.hero p:last-of-type { color: #d9d7ca; }
.music {
  position: relative;
  display: block;
  width: fit-content;
  margin: 18px auto 2px;
  color: #e9cf91;
  font: 28px/1 var(--serif);
  letter-spacing: .34em;
  padding-left: .34em;
  text-shadow: 0 1px 8px rgba(240, 196, 106, .22);
}
.music::before, .music::after {
  content: "";
  position: absolute;
  top: 48%;
  width: 36px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(220, 190, 121, .75));
}
.music::before { right: calc(100% + 16px); }
.music::after { left: calc(100% + 16px); transform: rotate(180deg); }
.control-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; text-align: left; padding-bottom: 12px; }
.control-header .kicker { font-size: 10px; }
.control-header form { margin: 0; }
.control-header a { color: white; }

/* ---------- Superficie principal ---------- */
.panel {
  position: relative;
  margin: 0;
  padding: clamp(25px, 5vw, 56px) clamp(22px, 5.8vw, 64px) 39px;
  background: linear-gradient(180deg, #fff 0%, #fff 72%, #fefdfa 100%);
  border: 1px solid rgba(219, 207, 184, .75);
  border-top: 4px solid var(--gold);
  border-radius: 0 0 22px 22px;
  box-shadow: var(--shadow-lg);
}
.panel::after {
  content: "";
  position: absolute;
  left: 42px;
  right: 42px;
  bottom: 12px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(191, 153, 82, .5), transparent);
  pointer-events: none;
}
.panel h2, .panel h3, dialog h2 {
  font-family: var(--serif);
  color: #1a3049;
  letter-spacing: -.022em;
  font-weight: 500;
}
.panel h2 { font-size: clamp(27px, 4vw, 34px); margin: 0 0 15px; line-height: 1.2; }
.panel h3 {
  position: relative;
  padding: 0 0 13px;
  margin: 33px 0 16px;
  font-size: 23px;
  border-bottom: 1px solid #e6e4df;
}
.panel h3::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 62px;
  height: 2px;
  background: linear-gradient(90deg, var(--gold), #ead3a4);
}
.muted { color: var(--muted); line-height: 1.75; }
.mini { font-size: 13px; }
.center { text-align: center; }
.admin-note { border-left: 3px solid var(--gold); padding-left: 13px; }
.monospace { font: 600 13px/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; word-break: break-word; color: #345274; }

/* ---------- Avisos y mensajes ---------- */
.notice {
  position: relative;
  margin: 22px 0;
  padding: 18px 21px;
  border-left: 4px solid var(--gold);
  border-radius: 0 12px 12px 0;
  color: #6d511d;
  background: linear-gradient(120deg, #fff7e5, #fffaf1);
  box-shadow: 0 4px 20px rgba(147, 106, 38, .045);
  line-height: 1.7;
}
.notice.soft {
  padding: 16px 19px;
  color: #4d657b;
  border-left-color: #91aabd;
  background: #f4f8fa;
  font-size: 13px;
  box-shadow: none;
}
.feedback { min-height: 0; margin: 14px 0; }
.feedback:not(:empty) {
  padding: 15px 18px;
  color: #19553c;
  background: #eaf6ef;
  border: 1px solid #cce8d5;
  border-left: 4px solid #2c8c61;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
}
.feedback.error:not(:empty) {
  background: #fff1ef;
  color: #9f302e;
  border-color: #f4d7d3;
  border-left-color: #b7463f;
}

/* ---------- Campos y composición de formularios ---------- */
label:not(.check):not(.choice) {
  display: block;
  margin: 19px 0 8px;
  font-weight: 650;
  color: #283c54;
  font-size: 13px;
  letter-spacing: .005em;
}
input:not([type=checkbox]):not([type=radio]) {
  display: block;
  width: 100%;
  min-width: 0;
  height: 51px;
  padding: 12px 15px;
  border: 1px solid #cbd5de;
  border-radius: 11px;
  background: #fcfdff;
  color: #152940;
  box-shadow: inset 0 1px 2px rgba(12, 30, 48, .02);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
input::placeholder { color: #8996a4; opacity: 1; }
input:not([type=checkbox]):not([type=radio]):hover { border-color: #a8b8c7; }
input:not([type=checkbox]):not([type=radio]):focus {
  outline: none;
  border-color: #c49745;
  background: #fff;
  box-shadow: var(--focus);
}
button:focus-visible, a:focus-visible, .choice:focus-within, .check:focus-within {
  outline: 3px solid rgba(190, 144, 59, .66);
  outline-offset: 3px;
}
.inline { display: flex; align-items: stretch; gap: 11px; }
.inline > input { flex: 1 1 auto; min-width: 0; }
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 0; }
.fields label:last-child:nth-child(odd) { grid-column: 1 / -1; }
.check {
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  max-width: 100%;
  padding: 13px 0;
  color: #2c3d52;
  font-weight: 580;
  cursor: pointer;
}
.check input, .choice input { width: 19px; height: 19px; accent-color: #b98c37; flex-shrink: 0; cursor: pointer; }
.choice {
  display: flex;
  align-items: center;
  gap: 13px;
  margin: 10px 0;
  padding: 16px 18px;
  border: 1px solid #dde3e8;
  border-radius: 12px;
  color: #2e4055;
  background: #fbfcfd;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, box-shadow .2s ease;
}
.choice:hover { background: #f7f8fb; border-color: #b3c4d4; }
.choice:has(input:checked) { background: #fffaf0; border-color: #ca9e51; box-shadow: 0 0 0 3px rgba(201, 155, 73, .10); }
.choice:has(input:disabled) { opacity: .58; cursor: not-allowed; }

/* ---------- Botones e interacciones ---------- */
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  max-width: 100%;
  min-height: 46px;
  padding: 12px 20px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: white;
  font-weight: 680;
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
  background: linear-gradient(135deg, #1c3554, #10233d);
  box-shadow: 0 5px 13px rgba(13, 38, 69, .14);
  cursor: pointer;
  transition: transform .19s ease, background .19s ease, box-shadow .19s ease, filter .19s ease;
}
button:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.11); box-shadow: 0 9px 19px rgba(13, 38, 69, .19); }
button:active:not(:disabled) { transform: translateY(0); box-shadow: 0 3px 8px rgba(13, 38, 69, .16); }
button:disabled { opacity: .55; cursor: not-allowed; filter: grayscale(.2); }
button.secondary, .secondary {
  color: #253b55;
  border-color: #e0e7ec;
  background: linear-gradient(180deg, #eff3f5, #dee7ee);
  box-shadow: none;
}
button.secondary:hover:not(:disabled) { background: #dce7ef; box-shadow: 0 4px 12px rgba(38, 70, 96, .09); }
button.danger, .danger { color: #fff; background: linear-gradient(135deg, #b24843, #92302d); box-shadow: none; }
button.danger:hover:not(:disabled) { box-shadow: 0 6px 16px rgba(150, 49, 43, .22); }
button.wide, .wide { width: 100%; min-height: 52px; margin-top: 20px; }
/* Solo el botón público de confirmación recibe el acento dorado. */
#submitReg { background: linear-gradient(115deg, #b7802e, #d7ad61 48%, #ac7729); color: #1e2c3a; box-shadow: 0 7px 21px rgba(165, 116, 42, .21); }
#submitReg:hover:not(:disabled) { filter: brightness(1.055); box-shadow: 0 10px 25px rgba(165, 116, 42, .26); }
#extraOpenBtn { background: linear-gradient(135deg, #b28137, #ca9c4d); color: #172c45; border-color: #e4bf75; box-shadow: 0 5px 14px rgba(148, 108, 40, .16); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 13px 0 4px; }
.actions button { min-height: 42px; padding: 10px 15px; font-size: 12.5px; }
.actions small { font-size: 12px; color: #286245; font-weight: 750; background: #e8f5ed; border-radius: 8px; padding: 9px 11px; }

/* ---------- Links y secciones complementarias ---------- */
.footerlinks { display: flex; align-items: center; flex-wrap: wrap; gap: 11px 22px; border-top: 1px solid #e8e5df; margin-top: 34px; padding-top: 21px; font-size: 13px; }
.footerlinks a { font-weight: 610; }
.footerlinks a:hover { text-decoration-color: currentColor; }
.link { display: inline-block; margin-left: 16px; font-size: 14px; }

/* ---------- Resumen de asistencia ---------- */
.stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 11px; margin: 21px 0 24px; }
.stat {
  position: relative;
  overflow: hidden;
  min-width: 0;
  padding: 20px 7px 17px;
  border: 1px solid #e0e6ea;
  border-radius: 14px;
  text-align: center;
  background: linear-gradient(160deg, #fff 10%, #f7f9fa 100%);
  box-shadow: 0 4px 15px rgba(18, 46, 75, .04);
}
.stat::before { content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 3px; background: linear-gradient(90deg, transparent, #d6b471, transparent); opacity: .8; }
.stat strong { display: block; color: var(--navy); font: 600 clamp(26px, 3.1vw, 33px)/1.2 var(--serif); font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 8px; font-size: 11px; color: #607084; font-weight: 560; letter-spacing: .01em; }
.stat:nth-child(4) { background: linear-gradient(155deg, #f7fcf9, #f0f7f3); border-color: #d7e8de; }
.stat:nth-child(4)::before { background: linear-gradient(90deg, transparent, #7ca98a, transparent); }
.stat:nth-child(5) { background: linear-gradient(155deg, #fffaf0, #fff4df); border-color: #f0dfbd; }
.stat:nth-child(5)::before { background: linear-gradient(90deg, transparent, #c19a50, transparent); }

/* ---------- Resultado de escaneo e invitaciones ---------- */
.results { display: grid; gap: 17px; margin: 22px 0; }
.result-card {
  position: relative;
  overflow: hidden;
  padding: 23px 24px 18px;
  border: 1px solid #dce4e9;
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.result-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(180deg, #dab975, #a87930); }
.result-card h3 { border-bottom: 1px solid #e5e8eb; padding-bottom: 13px; margin: 0 0 9px; font-size: 21px; }
.result-card h3::after { display: none; }
.person { display: flex; gap: 16px; align-items: center; justify-content: space-between; border-top: 1px solid #eef0f2; padding: 17px 0; }
.person > div:first-child { flex: 1 1 180px; min-width: 0; }
.person strong { display: block; color: #233852; font-weight: 720; letter-spacing: -.01em; }
.person small { display: block; color: #69788a; margin-top: 5px; line-height: 1.55; }
.person button { white-space: nowrap; }
.result-card > .actions:empty { display: none; }

/* ---------- QR y credenciales ---------- */
.qr { display: flex; align-items: center; justify-content: center; min-height: 260px; margin: 22px auto 17px; }
.qr img, .qr canvas {
  max-width: 100%; height: auto;
  background: white;
  padding: 12px;
  border: 1px solid #e7e0d2;
  border-radius: 12px;
  box-shadow: 0 0 0 7px rgba(239, 226, 203, .45), 0 11px 30px rgba(24, 49, 79, .09);
}
.manual { color: var(--muted); font-size: 13px; letter-spacing: .075em; overflow-wrap: anywhere; }
.manual strong { display: inline-block; margin-top: 5px; color: #1b3555; font-size: clamp(19px, 3.6vw, 25px); font-weight: 750; letter-spacing: .09em; font-variant-numeric: tabular-nums; }
.people-print { display: inline-block; text-align: left; padding-left: 21px; margin: 2px auto 15px; }
.people-print li { padding: 7px 4px; }
.people-print span { color: var(--muted); font-size: 13px; }

/* ---------- Diálogos administrativos ---------- */
dialog {
  width: min(535px, calc(100vw - 24px));
  max-width: 100%;
  max-height: min(90vh, 900px);
  overflow-y: auto;
  border: 1px solid #e2d8c4;
  border-top: 5px solid var(--gold);
  border-radius: 18px;
  padding: clamp(22px, 5vw, 34px);
  color: var(--ink);
  background: #fff;
  box-shadow: 0 32px 110px rgba(9, 23, 42, .36);
}
dialog::backdrop { background: rgba(8, 24, 45, .7); backdrop-filter: blur(5px); }
dialog h2 { font-size: clamp(23px, 4vw, 30px); line-height: 1.2; margin: 0 0 12px; }
dialog .muted { font-size: 13px; }
dialog .fields { column-gap: 12px; }
dialog label:not(.check):not(.choice) { margin-top: 15px; }
dialog .dialog-buttons { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 23px; }
dialog .dialog-buttons > button { flex: 1 1 155px; }
#extraQrDialog { text-align: center; }
#extraQrDialog .qr { margin-bottom: 26px; }

/* ---------- Pantallas pequeñas ---------- */
@media (max-width: 780px) {
  .container { max-width: 760px; margin: 22px auto 34px; padding: 0 14px; }
  .hero { padding: 40px 35px 50px; }
  .panel { padding: 30px 29px 34px; }
  .stats { gap: 8px; }
  .stat span { font-size: 10px; }
  .person { align-items: flex-start; flex-direction: column; }
  .person .actions { width: 100%; }
}
@media (max-width: 600px) {
  body { background-attachment: scroll; }
  .container { margin: 0; padding: 0 0 25px; }
  .container::before { display: none; }
  .hero { border-radius: 0; padding: 33px 22px 50px; }
  .hero::before { inset: 9px 11px; }
  .hero h1 { font-size: clamp(30px, 8vw, 42px); }
  .hero p { font-size: 12px; }
  .kicker { font-size: 9px; letter-spacing: .15em; }
  .music { margin-top: 13px; font-size: 23px; }
  .music::before, .music::after { width: 20px; }
  .panel { border-radius: 0 0 17px 17px; padding: 27px 19px 37px; }
  .panel::after { left: 22px; right: 22px; }
  .panel h2 { font-size: 28px; }
  .panel h3 { font-size: 21px; }
  .inline { flex-direction: column; }
  .inline > button { width: 100%; }
  .fields { grid-template-columns: 1fr; gap: 0; }
  .fields label:last-child:nth-child(odd) { grid-column: auto; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 17px 6px; }
  .stat:nth-child(5) { grid-column: 1 / -1; }
  .result-card { padding: 19px 17px 16px; }
  .person { padding: 13px 0; }
  .person .actions { gap: 7px; }
  .person .actions button { flex: 1 1 auto; }
  #searchForm .inline { gap: 8px; }
  .actions > button { flex: 1 1 auto; }
  #extraOpenBtn { flex-basis: 100%; }
  .control-header { gap: 10px; }
  .control-header .kicker { max-width: 50%; }
  .control-header button { min-height: 39px; padding: 9px 12px; }
  dialog { width: min(100vw - 16px, 500px); padding: 21px 17px; }
  .footerlinks { flex-direction: column; align-items: flex-start; }
  .link { margin: 14px 0 0; }
  .manual strong { letter-spacing: .035em; }
}
@media (max-width: 365px) {
  .hero { padding-left: 14px; padding-right: 14px; }
  .panel { padding-left: 15px; padding-right: 15px; }
  .stats { gap: 7px; }
  .stat span { font-size: 9.5px; }
}

/* ---------- Movimiento discreto y accesibilidad ---------- */
@keyframes page-appear { from { opacity: .65; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ---------- Impresión de invitaciones: limpia, tinta económica ---------- */
@media print {
  @page { margin: 12mm; }
  html, body { background: white !important; color: #000 !important; }
  body::before, .container::before { display: none !important; }
  .container { max-width: 100%; margin: 0; padding: 0; animation: none; }
  .hero { color: #142b45 !important; background: white !important; border: 0; border-bottom: 1px solid #c8b17b; box-shadow: none; border-radius: 0; padding: 10px 0 15px; }
  .hero::before, .hero::after { display: none; }
  .hero h1 { color: #142b45 !important; text-shadow: none; font-size: 28px; }
  .hero p, .hero .kicker, .hero .music { color: #142b45 !important; }
  .panel { padding: 16px 0; border: 0; box-shadow: none; background: white; }
  .panel::after { display: none; }
  .qr { margin: 12px auto; min-height: 240px; }
  .qr img, .qr canvas { box-shadow: none; border: 1px solid #ddd; padding: 6px; }
  .manual { margin-bottom: 12px; }
  .no-print, .footerlinks, button, .actions, .notice.soft { display: none !important; }
  .people-print li { padding: 3px 0; }
  .result-card { box-shadow: none; }
  /* Al imprimir una credencial extraordinaria, no imprimir el panel. */
  body:has(#extraQrDialog[open]) > main { display: none !important; }
  body:has(#extraQrDialog[open]) #extraQrDialog {
    display: block !important;
    position: static !important;
    overflow: visible;
    margin: 14px auto !important;
    max-width: 410px;
    max-height: none;
    box-shadow: none;
    border: 0;
    background: white;
    color: black;
    text-align: center;
  }
  body:has(#extraQrDialog[open]) #extraQrDialog::backdrop { display: none; }
}
