:root {
  --red: #c92134;
  --red-dark: #a7192d;
  --navy: #172b50;
  --navy-dark: #101f3b;
  --teal: #087f8c;
  --green: #1fbe62;
  --gold: #ddb968;
  --ink: #111827;
  --muted: #697586;
  --line: #d7dee8;
  --paper: #f2f5f9;
  --white: #fff;
  --soft-red: #fff2f2;
  --soft-gold: #fff8ea;
  --shadow: 0 24px 64px rgba(23, 43, 80, 0.11);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--paper);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 3%, rgba(201, 33, 52, 0.05), transparent 28%),
    radial-gradient(circle at 92% 14%, rgba(8, 127, 140, 0.06), transparent 24%),
    var(--paper);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  padding: 0 22px;
  color: var(--white);
  background: var(--red);
  box-shadow: 0 12px 24px rgba(201, 33, 52, 0.18);
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 16px 28px rgba(201, 33, 52, 0.24);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

input,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  background: #fbfcfe;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

input:focus,
select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 4px rgba(23, 43, 80, 0.08);
}

label {
  display: grid;
  gap: 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal) !important;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.brand-image {
  display: block;
  width: 255px;
  height: auto;
  object-fit: contain;
}

/* Inicio de sesión */
.login-page {
  background: #eef2f7;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(440px, 1.08fr) minmax(480px, 1fr);
  min-height: 100vh;
}

.login-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  overflow: hidden;
  padding: 52px 56px;
  color: var(--white);
  background: linear-gradient(145deg, #af2035 0 31%, var(--navy) 31.4% 100%);
}

.login-hero::after {
  content: "CIP";
  position: absolute;
  right: -16px;
  bottom: -66px;
  color: rgba(255, 255, 255, 0.035);
  font-size: 230px;
  font-weight: 900;
  line-height: 1;
}

.hero-brand {
  position: relative;
  z-index: 1;
  width: fit-content;
  border-left: 4px solid var(--gold);
  padding: 8px 14px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.hero-kicker {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(48px, 5.2vw, 78px);
  line-height: 0.98;
  letter-spacing: -0.045em;
}

.hero-copy > p:last-child {
  max-width: 590px;
  margin: 28px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 19px;
  line-height: 1.55;
}

.calendar-card {
  position: relative;
  z-index: 1;
  width: 390px;
  overflow: hidden;
  border-radius: 18px;
  color: var(--navy);
  background: #e8edf4;
  box-shadow: 0 24px 52px rgba(8, 18, 36, 0.28);
}

.calendar-card > strong {
  display: block;
  padding: 14px 18px;
  color: var(--white);
  background: var(--red);
  font-size: 13px;
}

.calendar-body {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
}

.calendar-date {
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border-radius: 18px;
  color: var(--white);
  background: var(--red);
  font-size: 38px;
  font-weight: 900;
  line-height: 0.8;
}

.calendar-date small {
  font-size: 11px;
}

.calendar-lines {
  display: grid;
  flex: 1;
  gap: 12px;
}

.calendar-lines i {
  display: block;
  width: 100%;
  height: 11px;
  border-radius: 999px;
  background: var(--navy);
}

.calendar-lines i:nth-child(2) {
  width: 72%;
  background: #dae4f2;
}

.calendar-lines i:nth-child(3) {
  width: 52%;
  background: var(--gold);
}

.login-access {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 48px;
  background-color: #f5f7fa;
  background-image:
    linear-gradient(rgba(23, 43, 80, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 43, 80, 0.025) 1px, transparent 1px);
  background-size: 36px 36px;
}

.login-card {
  display: grid;
  width: min(100%, 540px);
  gap: 19px;
  border: 1px solid rgba(215, 222, 232, 0.7);
  border-radius: 26px;
  padding: 42px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.login-brand {
  width: 250px;
  margin-bottom: 10px;
}

.login-card h2 {
  margin: -2px 0 0;
  color: var(--navy);
  font-size: 36px;
  letter-spacing: -0.035em;
}

.login-description {
  margin: -8px 0 4px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.login-card .primary-action {
  width: 100%;
  min-height: 56px;
}

.form-message {
  min-height: 18px;
  color: var(--red-dark);
  font-weight: 700;
}

.login-note {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
  border: 1px solid #f1d6c7;
  border-radius: 16px;
  padding: 15px;
  color: var(--muted);
  background: linear-gradient(110deg, var(--soft-red), var(--soft-gold));
  font-size: 13px;
  line-height: 1.4;
}

.login-note strong,
.login-note span span {
  display: block;
}

.login-note strong {
  margin-bottom: 3px;
  color: var(--navy);
}

.date-badge {
  display: grid !important;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 14px;
  color: var(--white);
  background: var(--navy);
  font-size: 24px;
  font-weight: 900;
}

/* Pantallas internas */
.app-page {
  display: grid;
  width: min(100% - 48px, 1600px);
  min-height: 100vh;
  align-content: start;
  gap: 28px;
  margin: 0 auto;
  padding: 30px 0 64px;
}

.topbar,
.view {
  border: 1px solid rgba(215, 222, 232, 0.78);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  min-height: 104px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
}

.topbar-identity {
  display: flex;
  align-items: center;
  gap: 28px;
}

.topbar-identity .brand-image {
  width: 275px;
}

.topbar-identity > div {
  border-left: 1px solid var(--line);
  padding-left: 28px;
}

.topbar-identity span,
.topbar-identity strong {
  display: block;
}

.topbar-identity span {
  color: var(--muted);
  font-size: 17px;
}

.topbar-identity strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.outline-button,
.secondary-action {
  color: var(--navy);
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: none;
}

.outline-button:hover:not(:disabled),
.secondary-action:hover:not(:disabled) {
  box-shadow: 0 12px 22px rgba(23, 43, 80, 0.1);
}

.view {
  display: grid;
  align-content: start;
  gap: 28px;
  overflow: hidden;
  padding: 40px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  border-radius: 20px;
  padding: 28px 30px;
  background: linear-gradient(110deg, rgba(201, 33, 52, 0.08), rgba(221, 185, 104, 0.13));
}

.page-intro h1,
.member-hero h1 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(34px, 4vw, 50px);
  letter-spacing: -0.045em;
}

.page-intro p:last-child,
.member-hero > p:last-child,
.section-title > p:last-child,
.bulk-heading > div > p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.system-badges,
.member-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.system-badges span,
.member-badges span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--navy);
  background: rgba(255, 255, 255, 0.82);
  font-size: 13px;
  font-weight: 800;
}

.system-badges i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 190, 98, 0.12);
}

.institutional-card,
.admin-section {
  display: grid;
  gap: 20px;
  border: 1px solid rgba(215, 222, 232, 0.8);
  border-radius: 20px;
  padding: 28px;
  background: var(--white);
}

.dashboard-panel {
  gap: 24px;
}

.dashboard-heading > div {
  max-width: 880px;
}

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

.metric-card {
  --metric-color: var(--navy);
  display: grid;
  gap: 7px;
  min-height: 132px;
  border: 1px solid #e4e9f0;
  border-top: 5px solid var(--metric-color);
  border-radius: 14px;
  padding: 17px;
  background: linear-gradient(145deg, #fff, #f8fafc);
}

.metric-card span {
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  color: var(--metric-color);
  font-size: 34px;
  line-height: 1;
}

.metric-card small {
  color: var(--muted);
  line-height: 1.35;
}

.metric-navy { --metric-color: var(--navy); }
.metric-gold { --metric-color: #a87716; }
.metric-green { --metric-color: #148246; }
.metric-gray { --metric-color: #687386; }
.metric-red { --metric-color: var(--red); }
.metric-teal { --metric-color: var(--teal); }
.metric-blue { --metric-color: #2166c2; }

.dashboard-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-radius: 14px;
  padding: 14px 16px;
  background: #f5f7fa;
}

.share-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.share-breakdown span {
  border: 1px solid #dce3ec;
  border-radius: 999px;
  padding: 8px 11px;
  color: var(--muted);
  background: var(--white);
  font-size: 12px;
}

.share-breakdown strong {
  color: var(--navy);
}

.dashboard-job-status {
  color: var(--navy);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.bulk-panel {
  position: relative;
  overflow: hidden;
}

.bulk-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, var(--red), var(--gold), var(--teal), var(--navy));
}

.automatic-send-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border: 1px solid #dfe6ef;
  border-radius: 16px;
  padding: 20px 22px;
  background: linear-gradient(120deg, #f7f9fc, #fff8f5);
}

.automatic-send-card h3,
.automatic-send-card p {
  margin: 0;
}

.automatic-send-card h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 21px;
}

.automatic-send-card p,
.automatic-send-card small {
  color: var(--muted);
}

.switch-control {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 11px;
  cursor: pointer;
  color: var(--navy);
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch-track {
  position: relative;
  width: 58px;
  height: 32px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.switch-track i {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(23, 43, 80, 0.25);
  transition: transform 160ms ease;
}

.switch-control input:checked + .switch-track {
  background: var(--green);
}

.switch-control input:checked + .switch-track i {
  transform: translateX(26px);
}

.switch-control input:focus-visible + .switch-track {
  outline: 3px solid rgba(33, 102, 194, 0.28);
  outline-offset: 3px;
}

.switch-control input:disabled + .switch-track {
  opacity: 0.55;
  cursor: wait;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.section-heading h2,
.section-title h2 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 30px;
  letter-spacing: -0.03em;
}

.process-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.process-steps div {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  column-gap: 12px;
  border-radius: 14px;
  padding: 14px;
  color: var(--navy);
  background: #f5f7fa;
}

.process-steps span {
  display: grid;
  grid-row: 1 / 3;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--white);
  background: var(--navy);
  font-size: 18px;
  font-weight: 900;
}

.process-steps strong {
  font-size: 15px;
}

.process-steps small {
  color: var(--muted);
  font-size: 12px;
}

.bulk-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: 14px;
  padding: 8px;
  background: linear-gradient(100deg, #f4f7fb, #fbfcfe);
}

.bulk-summary {
  flex: 1 1 auto;
  border-radius: 14px;
  padding: 9px 10px;
  color: var(--muted);
}

.bulk-summary strong {
  color: var(--navy);
}

.compact-button {
  flex: 0 0 auto;
  min-width: 170px;
  padding: 10px 14px;
  font-size: 13px;
}

.birthday-list[hidden] {
  display: none;
}

.bulk-progress {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, auto);
  align-items: center;
  gap: 16px;
  border: 1px solid #d8e3ee;
  border-radius: 14px;
  padding: 15px 18px;
  color: var(--navy);
  background: #f8fafc;
}

.bulk-progress[hidden] {
  display: none;
}

.bulk-progress progress {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  accent-color: var(--teal);
}

.bulk-progress strong {
  font-size: 14px;
}

.bulk-footer {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.danger-action {
  margin-left: auto;
  background: var(--red-dark);
}

.section-title p {
  margin: 0;
}

.search-row {
  display: grid;
  grid-template-columns: 150px minmax(240px, 1fr) auto;
  gap: 12px;
}

.result-card,
pre {
  min-height: 96px;
  margin: 0;
  overflow: auto;
  border: 1px solid #e6ebf1;
  border-radius: 14px;
  padding: 18px;
  color: var(--muted);
  background: #f8fafc;
}

.result-card {
  display: grid;
  gap: 7px;
}

.result-card strong {
  color: var(--ink);
}

.individual-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.individual-actions .form-message {
  flex: 1 1 280px;
}

.permit-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px auto;
  align-items: end;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  background: #f8fafc;
}

.permit-form h3,
.permit-form small {
  grid-column: 1 / -1;
  margin: 0;
}

.events-list {
  display: grid;
  gap: 10px;
}

.event-row {
  display: grid;
  grid-template-columns: 190px 1fr 210px;
  align-items: center;
  gap: 18px;
  border: 1px solid #e9edf3;
  border-radius: 14px;
  padding: 17px 18px;
  color: var(--muted);
  background: #fbfcfe;
}

.event-row strong {
  color: var(--ink);
}

.trace-event {
  --trace-color: var(--navy);
  grid-template-columns: 46px minmax(0, 1fr) minmax(150px, auto);
  gap: 16px;
  border-left: 5px solid var(--trace-color);
  padding: 16px 18px;
  background: linear-gradient(105deg, color-mix(in srgb, var(--trace-color) 5%, white), #fff 55%);
}

.trace-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: var(--white);
  background: var(--trace-color);
  font-size: 21px;
  font-weight: 900;
}

.trace-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.trace-copy strong {
  font-size: 15px;
}

.trace-copy span,
.trace-copy small {
  overflow-wrap: anywhere;
  line-height: 1.4;
}

.trace-copy small {
  color: #7a8494;
}

.trace-event time {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
}

.trace-success { --trace-color: #148246; }
.trace-admin { --trace-color: var(--navy); }
.trace-error { --trace-color: var(--red); }
.trace-download { --trace-color: var(--teal); }
.trace-share { --trace-color: #2166c2; }
.trace-neutral { --trace-color: #687386; }

.birthday-row {
  border-left: 5px solid var(--teal);
  background: linear-gradient(100deg, rgba(8, 127, 140, 0.055), #fff 38%);
}

/* Vista del colegiado */
.member-view {
  gap: 0;
  padding: 0 0 44px;
}

.member-hero {
  padding: 38px 40px 30px;
  background: linear-gradient(110deg, rgba(23, 43, 80, 0.07), rgba(201, 33, 52, 0.075), rgba(221, 185, 104, 0.12));
}

.member-badges {
  padding: 0 40px;
  transform: translateY(-1px);
}

.birthday-card {
  display: grid;
  justify-items: center;
  gap: 30px;
  padding: 34px 40px 0;
}

.greeting-frame {
  width: min(100%, 850px);
  border-radius: 30px;
  padding: 18px;
  background: linear-gradient(145deg, rgba(201, 33, 52, 0.1), rgba(221, 185, 104, 0.18));
  box-shadow: 0 30px 64px rgba(23, 43, 80, 0.16);
}

.greeting-preview {
  overflow: hidden;
  border: 10px solid var(--white);
  border-radius: 22px;
  background: var(--white);
}

.greeting-preview img {
  display: block;
  width: 100%;
  height: auto;
}

.member-actions {
  display: grid;
  width: min(100%, 700px);
  justify-items: center;
  gap: 18px;
}

.download-action {
  width: min(100%, 540px);
  min-height: 58px;
  font-size: 18px;
}

.share-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.share-button {
  display: grid;
  min-width: 104px;
  min-height: 92px;
  place-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  color: var(--navy);
  background: var(--white);
  box-shadow: 0 14px 26px rgba(23, 43, 80, 0.08);
  font-size: 24px;
}

.share-button span {
  font-size: 11px;
  font-weight: 700;
}

.share-button:hover:not(:disabled) {
  box-shadow: 0 18px 32px rgba(23, 43, 80, 0.13);
}

.whatsapp {
  color: #14aa58;
}

.facebook {
  color: #2364c5;
}

.linkedin {
  color: #15589b;
}

.countdown {
  display: grid;
  width: min(calc(100% - 80px), 720px);
  justify-self: center;
  justify-items: center;
  gap: 12px;
  margin-top: 38px;
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 62px 24px;
  background: linear-gradient(130deg, rgba(8, 127, 140, 0.11), rgba(221, 185, 104, 0.18));
}

.countdown strong {
  color: var(--red);
  font-size: 110px;
  line-height: 0.9;
}

.countdown span {
  color: var(--navy);
  font-size: 23px;
  font-weight: 900;
}

.countdown small {
  max-width: 470px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
}

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

  .login-hero {
    min-height: 720px;
  }

  .login-access {
    min-height: auto;
  }

  .page-intro,
  .section-heading {
    align-items: flex-start;
  }

  .page-intro {
    flex-direction: column;
  }

  .process-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .trace-event {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .trace-event time {
    grid-column: 2;
    text-align: left;
  }

  .bulk-summary-row {
    align-items: stretch;
    flex-direction: column;
  }

  .automatic-send-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .bulk-progress {
    grid-template-columns: 1fr;
  }

  .dashboard-details {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-job-status {
    text-align: left;
  }

  button {
    width: 100%;
  }

  .login-hero,
  .login-access {
    padding: 28px 22px;
  }

  .login-hero {
    min-height: 650px;
  }

  .hero-copy h1 {
    font-size: 48px;
  }

  .calendar-card {
    width: 100%;
  }

  .login-card {
    border-radius: 20px;
    padding: 28px 22px;
  }

  .brand-image,
  .login-brand,
  .topbar-identity .brand-image {
    width: 220px;
  }

  .app-page {
    width: min(100% - 24px, 1600px);
    padding-top: 12px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    border-radius: 18px;
    padding: 18px;
  }

  .topbar-identity {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .topbar-identity > div {
    border-left: 0;
    padding-left: 0;
  }

  .view {
    border-radius: 18px;
    padding: 18px;
  }

  .member-view {
    padding: 0 0 28px;
  }

  .member-hero,
  .birthday-card {
    padding-right: 18px;
    padding-left: 18px;
  }

  .member-badges {
    padding: 0 18px;
  }

  .page-intro,
  .institutional-card,
  .admin-section {
    padding: 20px;
  }

  .section-heading {
    flex-direction: column;
  }

  .search-row,
  .permit-form,
  .event-row {
    grid-template-columns: 1fr;
  }

  .bulk-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .countdown {
    width: calc(100% - 36px);
  }

  .share-button {
    width: 92px;
    min-width: 0;
  }
}
