/* Tema institucional Repinel para SPC. Los colores de éxito, advertencia y error
   conservan su significado funcional; el naranja se reserva para identidad y acciones. */
:root,
html[data-theme="dark"] {
  color-scheme: dark;
  --brand: #ff4b0b;
  --brand-dark: #d83a00;
  --brand-light: #ff6b35;
  --brand-soft: rgba(255, 75, 11, .14);
  --bg: #171719;
  --surface: #202124;
  --surface-2: #292a2e;
  --surface-3: #34353a;
  --border: #3d3e43;
  --text: #f7f7f5;
  --muted: #b8b9bd;
  --shadow: 0 18px 50px rgba(0, 0, 0, .32);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #ffffff;
  --surface-2: #eeeeef;
  --surface-3: #e4e4e5;
  --border: #d2d3d6;
  --text: #202124;
  --muted: #66686d;
  --shadow: 0 16px 42px rgba(32, 33, 36, .12);
}

body {
  background: radial-gradient(circle at 85% -10%, rgba(255, 75, 11, .11), transparent 35%), var(--bg);
}

.sidebar {
  background: linear-gradient(180deg, #25262a, #171719);
}

.brand span,
.brand-mark {
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
  color: #fff;
  box-shadow: 0 10px 30px rgba(255, 75, 11, .25);
}

.sidebar nav a.active {
  box-shadow: inset 3px 0 var(--brand);
}

.sidebar-version {
  color: #a4a5aa;
}

.topbar {
  background: rgba(23, 23, 25, .9);
}

.button.primary {
  background: linear-gradient(135deg, var(--brand-light), var(--brand-dark));
  border-color: var(--brand);
  color: #fff;
}

.avatar {
  background: var(--brand);
  color: #fff;
}

.user-menu [data-user-menu] .theme-choice {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 800;
}

.user-menu [data-user-menu] .theme-choice:hover {
  background: var(--surface-3);
}

.user-menu [data-user-menu] form {
  margin: 0;
}

.user-menu [data-user-menu] .global-logout-button {
  color: #ffaaaa;
  font-weight: 800;
}

.user-menu [data-user-menu] .global-logout-button:hover {
  background: rgba(255, 99, 99, .14);
}

.theme-choice-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand-light);
  font-size: 16px;
}

.eyebrow,
.kpi em {
  color: var(--brand-light);
}

.card {
  background: linear-gradient(180deg, rgba(41, 42, 46, .96), rgba(32, 33, 36, .98));
}

th,
td {
  border-bottom-color: rgba(61, 62, 67, .82);
}

th {
  color: #c6c7ca;
  background: rgba(23, 23, 25, .42);
}

label {
  color: #d6d7d9;
}

input,
select,
textarea {
  background: #191a1d;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(255, 75, 11, .14);
}

input[type="checkbox"] {
  accent-color: var(--brand);
}

.progress {
  background: #171719;
}

.progress span {
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-light));
}

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

.timeline-item.current > span {
  border-color: var(--brand);
  box-shadow: 0 0 0 5px rgba(255, 75, 11, .13);
}

.chart-bg {
  fill: #1b1c1f;
}

.chart .grid {
  stroke: #3b3c41;
}

.axis-label,
.x-label {
  fill: #b8b9bd;
}

.metric {
  background: rgba(23, 23, 25, .38);
}

.auth-page {
  background: radial-gradient(circle at top, rgba(255, 75, 11, .16), transparent 36%), #171719;
}

.auth-card code {
  color: var(--brand-light);
}

/* Guía de uso */
.guide-hero {
  background: radial-gradient(circle at 88% 15%, rgba(255, 75, 11, .2), transparent 31%), linear-gradient(135deg, #292a2e, #1d1e21);
}

.guide-hero::after {
  border-color: rgba(255, 75, 11, .25);
}

.guide-hero-metric {
  border-color: rgba(255, 75, 11, .34);
  background: rgba(23, 23, 25, .74);
}

.guide-hero-metric strong,
.guide-checklist a,
.guide-example code {
  color: var(--brand-light);
}

.guide-index,
.guide-section,
.guide-checklist article,
.guide-accordion details,
.example-part,
.example-plan,
.guide-card,
.reaction-steps article,
.role-guide article {
  background: rgba(32, 33, 36, .88);
}

.guide-index nav a:hover,
.guide-index nav a.active {
  border-left-color: var(--brand);
}

.guide-section-head > span,
.guide-checklist article > b,
.guide-accordion summary > span {
  border-color: rgba(255, 75, 11, .34);
  background: var(--brand-soft);
  color: var(--brand-light);
}

.guide-callout {
  border-left-color: var(--brand);
  background: rgba(255, 75, 11, .08);
}

.flow-diagram,
.guide-example,
.limits-lesson > div {
  background: #1b1c1f;
}

.flow-main li {
  border-color: rgba(255, 75, 11, .45);
  background: linear-gradient(180deg, #303136, #242529);
}

.flow-main li:not(:nth-child(5)):not(:last-child)::after,
.flow-main li:nth-child(5)::after,
.reaction-steps article:not(:last-child)::after {
  color: var(--brand-light);
}

.flow-main li > span {
  background: rgba(255, 75, 11, .2);
  color: #ff9a73;
}

.flow-main .flow-ok > span {
  background: rgba(43, 212, 125, .18);
  color: #76efa7;
}

.guide-accordion summary::after,
.reaction-steps span {
  color: var(--brand-light);
}

.guide-accordion details[open] summary {
  background: rgba(255, 75, 11, .07);
}

.guide-accordion details > div {
  color: var(--text);
}

.role-guide span {
  color: var(--brand-light);
}

.guide-finish {
  border-color: rgba(255, 75, 11, .4);
  background: linear-gradient(135deg, rgba(255, 75, 11, .15), rgba(41, 42, 46, .94));
}

.guide-search-match {
  border-color: rgba(255, 75, 11, .7) !important;
  box-shadow: 0 0 0 2px rgba(255, 75, 11, .11);
}

/* Tema claro */
html[data-theme="light"] body {
  background: radial-gradient(circle at 85% -10%, rgba(255, 75, 11, .1), transparent 34%), var(--bg);
}

html[data-theme="light"] .sidebar {
  color: #f7f7f5;
  border-right-color: #45464b;
}

html[data-theme="light"] .sidebar .brand,
html[data-theme="light"] .sidebar nav a.active {
  color: #fff;
}

html[data-theme="light"] .sidebar nav a {
  color: #cfd0d3;
}

html[data-theme="light"] .sidebar nav a:hover,
html[data-theme="light"] .sidebar nav a.active {
  background: #34353a;
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, .92);
}

html[data-theme="light"] .user-menu [data-user-menu] .global-logout-button {
  color: #a02f3a;
}

html[data-theme="light"] .user-menu [data-user-menu] .global-logout-button:hover {
  background: #fee2e2;
}

html[data-theme="light"] .card {
  background: #fff;
  box-shadow: 0 8px 28px rgba(32, 33, 36, .08);
}

html[data-theme="light"] th,
html[data-theme="light"] td {
  border-bottom-color: #dedfe1;
}

html[data-theme="light"] th {
  color: #5b5d62;
  background: #f0f0ef;
}

html[data-theme="light"] label {
  color: #45464b;
}

html[data-theme="light"] input,
html[data-theme="light"] select,
html[data-theme="light"] textarea {
  background: #fff;
}

html[data-theme="light"] .progress {
  background: #dedfe1;
}

html[data-theme="light"] .chart-bg {
  fill: #fff;
}

html[data-theme="light"] .chart .grid {
  stroke: #dedfe1;
}

html[data-theme="light"] .axis-label,
html[data-theme="light"] .x-label {
  fill: #66686d;
}

html[data-theme="light"] .metric {
  background: #f6f6f5;
}

html[data-theme="light"] dialog {
  background: #fff;
}

html[data-theme="light"] .auth-page {
  background: radial-gradient(circle at top, rgba(255, 75, 11, .13), transparent 36%), #f4f4f2;
}

html[data-theme="light"] .guide-hero {
  background: radial-gradient(circle at 88% 15%, rgba(255, 75, 11, .13), transparent 31%), #fff;
}

html[data-theme="light"] .guide-hero-metric,
html[data-theme="light"] .guide-index,
html[data-theme="light"] .guide-section,
html[data-theme="light"] .guide-checklist article,
html[data-theme="light"] .guide-accordion details,
html[data-theme="light"] .example-part,
html[data-theme="light"] .example-plan,
html[data-theme="light"] .guide-card,
html[data-theme="light"] .reaction-steps article,
html[data-theme="light"] .role-guide article {
  background: #fff;
}

html[data-theme="light"] .guide-section,
html[data-theme="light"] .guide-hero,
html[data-theme="light"] .guide-index {
  box-shadow: 0 7px 24px rgba(32, 33, 36, .06);
}

html[data-theme="light"] .flow-diagram,
html[data-theme="light"] .guide-example,
html[data-theme="light"] .limits-lesson > div {
  background: #f0f0ef;
}

html[data-theme="light"] .flow-main li {
  background: #fff;
}

html[data-theme="light"] .flow-reaction li {
  background: rgba(255, 99, 99, .1);
}

html[data-theme="light"] .guide-callout.warning {
  color: #76520a;
}

html[data-theme="light"] .guide-callout.info {
  color: #24598b;
}

html[data-theme="light"] .guide-finish {
  background: linear-gradient(135deg, rgba(255, 75, 11, .1), #fff);
}

@media (prefers-reduced-motion: no-preference) {
  body,
  .topbar,
  .card,
  .user-menu > button,
  input,
  select,
  textarea {
    transition: background-color .18s ease, border-color .18s ease, color .18s ease;
  }
}

/* Acceso corporativo SPC */
body.auth-page.spc-access-page {
  min-height: 100vh;
  padding: clamp(20px, 4vw, 52px);
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 75, 11, .17), transparent 28%),
    radial-gradient(circle at 8% 92%, rgba(69, 70, 75, .45), transparent 30%),
    var(--bg);
}

.spc-access-page .auth-shell {
  width: min(1180px, 100%);
}

.spc-access-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(390px, .88fr);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

.spc-access-brand {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  padding: clamp(36px, 5vw, 62px);
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255, 75, 11, .13), transparent 42%),
    linear-gradient(160deg, #35363b 0%, #202124 50%, #171719 100%);
}

.spc-access-brand::before {
  content: "";
  position: absolute;
  z-index: -1;
  right: -190px;
  top: -210px;
  width: 490px;
  height: 490px;
  border: 78px solid rgba(255, 75, 11, .92);
  transform: rotate(20deg);
}

.spc-access-brand::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .1;
  background-image: linear-gradient(rgba(255, 255, 255, .25) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .25) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom right, transparent 20%, #000 90%);
}

.spc-brand-lockup {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
}

.repinel-emblem {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 14px 4px 14px 4px;
  background: var(--brand);
  box-shadow: 0 12px 28px rgba(255, 75, 11, .3);
}

.repinel-emblem i {
  width: 23px;
  height: 23px;
  border: 4px solid #fff;
  transform: rotate(-8deg);
}

.spc-brand-lockup > span:last-child {
  display: grid;
  gap: 2px;
}

.spc-brand-lockup strong {
  font-size: 24px;
  font-style: italic;
  letter-spacing: .07em;
}

.spc-brand-lockup small {
  color: #c9cacf;
  font-size: 10px;
  letter-spacing: .035em;
}

.spc-access-copy {
  max-width: 590px;
  margin: auto 0 34px;
}

.spc-access-kicker {
  display: inline-flex;
  margin-bottom: 17px;
  padding: 7px 11px;
  border: 1px solid rgba(255, 107, 53, .42);
  border-radius: 999px;
  background: rgba(255, 75, 11, .12);
  color: #ff9a73;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .13em;
}

.spc-access-copy h1 {
  max-width: 570px;
  margin: 0 0 17px;
  font-size: clamp(38px, 4.2vw, 60px);
  line-height: 1.02;
  letter-spacing: -.045em;
}

.spc-access-copy p {
  max-width: 540px;
  margin: 0;
  color: #c9cacf;
  font-size: 16px;
  line-height: 1.7;
}

.spc-access-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.spc-access-features article {
  display: grid;
  gap: 12px;
  min-height: 142px;
  padding: 17px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 15px;
  background: rgba(9, 10, 12, .38);
  backdrop-filter: blur(8px);
}

.spc-access-features article > span {
  color: #ff7f50;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .12em;
}

.spc-access-features article div {
  align-self: end;
}

.spc-access-features strong,
.spc-access-features small {
  display: block;
}

.spc-access-features strong {
  margin-bottom: 5px;
  font-size: 13px;
}

.spc-access-features small {
  color: #adaeb3;
  font-size: 10px;
  line-height: 1.45;
}

.spc-access-trust {
  display: flex;
  align-items: center;
  gap: 11px;
  color: #c9cacf;
}

.spc-access-trust > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(43, 212, 125, .15);
  color: #76efa7;
  font-weight: 900;
}

.spc-access-trust p,
.spc-access-trust strong,
.spc-access-trust small {
  display: block;
  margin: 0;
}

.spc-access-trust strong {
  color: #f7f7f5;
  font-size: 11px;
}

.spc-access-trust small {
  margin-top: 2px;
  font-size: 10px;
}

.spc-access-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: clamp(38px, 5vw, 62px);
  background: var(--surface);
}

.access-theme-toggle {
  position: absolute;
  top: 28px;
  right: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.access-theme-toggle > span:first-child {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-light);
  font-size: 13px;
}

.access-provider {
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 0 0 auto;
}

.access-provider > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #45464b;
  color: #fff;
  font-weight: 900;
}

.access-provider p,
.access-provider strong,
.access-provider small {
  display: block;
  margin: 0;
}

.access-provider small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.access-provider strong {
  margin-top: 2px;
  font-size: 14px;
}

.access-welcome {
  margin: 54px 0 22px;
}

.access-welcome h2 {
  margin: 0 0 12px;
  font-size: clamp(30px, 3vw, 42px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.access-welcome p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.access-alert {
  margin-bottom: 14px;
}

.access-login-button {
  display: grid;
  grid-template-columns: 43px minmax(0, 1fr) auto;
  gap: 12px;
  width: 100%;
  min-height: 72px;
  padding: 12px 16px;
  text-align: left;
  box-shadow: 0 14px 30px rgba(255, 75, 11, .22);
}

.access-login-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 17px 34px rgba(255, 75, 11, .28);
}

.access-login-mark {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  border-radius: 12px;
  background: rgba(255, 255, 255, .2);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
}

.access-login-button > span:nth-child(2),
.access-login-button strong,
.access-login-button small {
  display: block;
}

.access-login-button strong {
  font-size: 14px;
}

.access-login-button small {
  margin-top: 3px;
  color: rgba(255, 255, 255, .78);
  font-size: 10px;
}

.access-login-button > b {
  padding-right: 3px;
  font-size: 21px;
}

.access-security-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 16px;
}

.access-security-grid article {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.access-security-grid article > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 9px;
  background: var(--brand-soft);
  color: var(--brand-light);
  font-weight: 900;
}

.access-security-grid p,
.access-security-grid strong,
.access-security-grid small {
  display: block;
  margin: 0;
}

.access-security-grid strong {
  font-size: 12px;
}

.access-security-grid small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.access-help {
  display: flex;
  gap: 10px;
  margin-top: 17px;
  padding: 13px;
  border-left: 3px solid var(--brand);
  border-radius: 9px;
  background: var(--brand-soft);
}

.access-help > span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 75, 11, .35);
  border-radius: 50%;
  color: var(--brand-light);
  font-size: 11px;
  font-weight: 900;
}

.access-help p,
.access-help strong,
.access-help small {
  display: block;
  margin: 0;
}

.access-help strong {
  font-size: 11px;
}

.access-help small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.spc-access-panel > footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: auto;
  padding-top: 22px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .09em;
}

html[data-theme="light"] body.auth-page.spc-access-page {
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 75, 11, .13), transparent 28%),
    radial-gradient(circle at 8% 92%, rgba(69, 70, 75, .11), transparent 30%),
    #f4f4f2;
}

html[data-theme="light"] .spc-access-shell {
  box-shadow: 0 30px 80px rgba(32, 33, 36, .16);
}

html[data-theme="light"] .spc-access-panel {
  background: #fff;
}

html[data-theme="light"] .access-theme-toggle,
html[data-theme="light"] .access-security-grid article {
  background: #f4f4f2;
}

@media (max-width: 920px) {
  body.auth-page.spc-access-page {
    padding: 20px;
  }

  .spc-access-shell {
    grid-template-columns: 1fr;
  }

  .spc-access-brand {
    min-height: 570px;
    padding: 38px;
  }

  .spc-access-copy {
    margin: 72px 0 30px;
  }

  .spc-access-copy h1 {
    font-size: clamp(38px, 7vw, 56px);
  }

  .spc-access-panel {
    min-height: 590px;
  }
}

@media (max-width: 620px) {
  body.auth-page.spc-access-page {
    display: block;
    padding: 0;
  }

  .spc-access-shell {
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .spc-access-brand {
    min-height: 0;
    padding: 28px 22px 30px;
  }

  .spc-access-brand::before {
    right: -230px;
    top: -250px;
  }

  .spc-brand-lockup small {
    max-width: 210px;
  }

  .spc-access-copy {
    margin: 58px 0 25px;
  }

  .spc-access-copy h1 {
    font-size: 38px;
  }

  .spc-access-copy p {
    font-size: 14px;
  }

  .spc-access-features {
    grid-template-columns: 1fr;
  }

  .spc-access-features article {
    grid-template-columns: 32px 1fr;
    min-height: 0;
  }

  .spc-access-features article div {
    align-self: auto;
  }

  .spc-access-trust {
    align-items: flex-start;
  }

  .spc-access-panel {
    order: -1;
    min-height: 100vh;
    min-height: 100svh;
    padding: 34px 22px;
  }

  .access-theme-toggle {
    top: 24px;
    right: 22px;
  }

  .access-theme-toggle [data-theme-label] {
    display: none;
  }

  .access-welcome {
    margin-top: 58px;
  }

  .access-security-grid {
    grid-template-columns: 1fr;
  }
}
