/* 360 Consulting — tokens DESIGN.md v2.2 (product + auth legacy) */
:root {
  --color-action-primary: #1c51dd;
  --color-action-primary-hover: #1644b8;
  --color-action-primary-pressed: #123a9e;
  --color-accent-impact: #ff4bd2;
  --color-accent-impact-soft: #ff4bd21a;
  --color-canvas: #ffffff;
  --color-canvas-soft: #f5f5f5;
  --color-canvas-workspace: #f5f7fa;
  --color-canvas-chart: #171717;
  --color-canvas-invert: #000000;
  --color-canvas-invert-soft: #171717;
  --color-canvas-invert-mid: #0d0d0d;
  --color-metric-positive: #16a34a;
  --color-metric-warning: #d97706;
  --color-metric-danger: #dc2626;
  --color-quadrant-ideal: #22c55e;
  --color-quadrant-opportunity: #f59e0b;
  --color-quadrant-prices: #1c51dd;
  --color-quadrant-urgent: #ef4444;
  --color-focus-halo: rgba(28, 81, 221, 0.12);
  --color-ink: #171717;
  --color-ink-secondary: #212121;
  --color-ink-muted: #707070;
  --color-ink-faint: #9a9a9a;
  --color-on-primary: #ffffff;
  --color-on-dark: #ffffff;
  --color-on-dark-muted: #a3a3a3;
  --color-border-default: #e5e5e5;
  --color-border-strong: #c7c7c7;
  --color-border-focus: #ff4bd2;
  --color-border-accent-light: #ffb7d5;
  --color-placeholder: #9a9a9a;
  --color-placeholder-hover: rgba(255, 75, 210, 0.52);
  --color-placeholder-focus: #707070;
  --color-border-error: #b42318;
  --duration-input-border: 0.3s;
  --color-surface-error: #fef3f2;
  --color-hairline: #ededed;
  --color-hairline-dark: #262626;

  --font-display: "Century Gothic", "CenturyGothic", "Apple Gothic", sans-serif;
  --font-hero: "Futura", "Century Gothic", "CenturyGothic", sans-serif;
  --font-body: Helvetica, Arial, sans-serif;

  --rounded-sm: 4px;
  --rounded-md: 8px;
  --rounded-panel: 12px;
  --rounded-card: 16px;
  --rounded-card-auth: 24px;
  --rounded-full: 9999px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-xxl: 32px;
  --space-huge: 40px;
  --space-section: 64px;

  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.12);
  --shadow-card-hover: 0 12px 48px rgba(0, 0, 0, 0.22);

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast: 150ms;
  --duration-normal: 280ms;

  --layout-max: 1080px;
  --layout-dashboard-max: 1280px;
  --panel-width: 460px;
}

/* —— Dashboard shell (Sales Intelligence v2.2 · dark + rosa) —— */
body.dashboard-shell {
  --color-canvas-invert: #000000;
  --color-canvas-invert-soft: #171717;
  --color-border-focus: #ff4bd2;
  --color-border-accent-light: #ffb7d5;
  --color-accent-impact-soft: #ff4bd21a;
  --color-focus-halo: rgba(255, 75, 210, 0.14);
  --panel-surface-top: #1a2030;
  --panel-surface-bottom: #12161f;
  --panel-border: rgba(255, 255, 255, 0.08);
  --panel-border-glow: rgba(255, 75, 210, 0.22);
  --panel-inset-highlight: rgba(255, 255, 255, 0.05);
  --font-display: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --font-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --rounded-card: 16px;
  --rounded-panel: 12px;
  --shadow-panel:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 16px 48px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 var(--panel-inset-highlight);
  --shadow-panel-hover:
    0 0 0 1px rgba(0, 0, 0, 0.4),
    0 20px 56px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 var(--panel-inset-highlight);
  background-color: var(--color-canvas-invert);
  color: var(--color-on-dark);
  font-family: var(--font-body);
}

body.dashboard-shell::before {
  display: block;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-ink);
  background-color: var(--color-canvas-invert);
}

/* Fondo: profundidad neutra (sin gradiente de marca) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(
      120% 80% at 12% 18%,
      rgba(255, 255, 255, 0.04) 0%,
      transparent 55%
    ),
    radial-gradient(
      80% 60% at 88% 90%,
      rgba(255, 255, 255, 0.02) 0%,
      transparent 50%
    );
}

.skip-link {
  position: fixed;
  top: var(--space-lg);
  left: var(--space-lg);
  z-index: 200;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-on-primary);
  text-decoration: none;
  background: var(--color-action-primary);
  border-radius: var(--rounded-sm);
  transform: translateY(-160%);
  transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus-visible {
  transform: translateY(0);
  outline: 2px solid var(--color-on-primary);
  outline-offset: 3px;
}

/* —— Layout —— */
.login-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr var(--panel-width);
  gap: var(--space-section);
  align-items: stretch;
  width: min(100% - 48px, var(--layout-max));
  min-height: 100dvh;
  margin: 0 auto;
  padding: var(--space-xxl) 0;
}

/* —— Aside (foto B/N + marca) —— */
.login-aside {
  position: relative;
  min-height: 560px;
  overflow: hidden;
  color: var(--color-on-dark);
  border-radius: var(--rounded-card-auth);
  isolation: isolate;
}

.login-aside__visual {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.login-aside__photo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 58% 22%;
  filter: grayscale(100%) contrast(1.08);
}

.login-aside__scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      165deg,
      rgba(0, 0, 0, 0.35) 0%,
      rgba(0, 0, 0, 0.72) 48%,
      rgba(0, 0, 0, 0.94) 100%
    ),
    linear-gradient(90deg, rgba(0, 0, 0, 0.5) 0%, transparent 42%);
}

.login-aside__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  justify-content: space-between;
  min-height: 560px;
  padding: var(--space-xxl);
}

/* Logo oficial — entrada + pulso sutil */
.brand-logo-wrap {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-bottom: var(--space-sm);
}

.brand-logo-wrap::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 12%;
  z-index: 0;
  width: 42%;
  aspect-ratio: 1;
  pointer-events: none;
  background: radial-gradient(
    circle,
    var(--color-accent-impact-soft) 0%,
    transparent 72%
  );
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.6);
}

.brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(220px, 72%);
  height: auto;
  object-fit: contain;
  object-position: left center;
  transform-origin: left center;
  will-change: transform, opacity;
}

body:not(.is-booting) .brand-logo-wrap::before {
  animation: logo-halo-in 1s var(--ease-out) 0.2s both;
}

body:not(.is-booting) .brand-logo {
  animation:
    logo-reveal 0.9s var(--ease-out) both,
    logo-breathe 4.5s ease-in-out 1.1s infinite;
}

@keyframes logo-reveal {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0) scale(0.88);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

@keyframes logo-halo-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes logo-breathe {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  50% {
    transform: translate3d(0, 0, 0) scale(1.025);
  }
}

@media (prefers-reduced-motion: reduce) {
  body:not(.is-booting) .brand-logo {
    animation: none;
  }

  body:not(.is-booting) .brand-logo-wrap::before {
    animation: none;
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
}

.login-aside__body {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.login-aside__hero {
  margin: 0;
  font-family: var(--font-hero);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.login-aside__hero-accent {
  color: var(--color-on-dark-muted);
}

.login-aside__lead {
  max-width: 38ch;
  margin: 0;
  font-size: 17px;
  line-height: 1.55;
  color: var(--color-on-dark-muted);
}

.login-aside__pillars {
  display: flex;
  gap: var(--space-xxl);
  padding: 0;
  margin: var(--space-lg) 0 0;
  list-style: none;
}

.login-aside__pillars li {
  position: relative;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-on-dark-muted);
}

.login-aside__pillars li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 50%;
  right: calc(-1 * var(--space-xl));
  width: 4px;
  height: 4px;
  background: var(--color-hairline-dark);
  border-radius: 50%;
  transform: translate(50%, -50%);
}

.login-aside__legal {
  margin: 0;
  font-size: 12px;
  color: var(--color-on-dark-muted);
  opacity: 0.85;
}

/* —— card-main-tool —— */
.login-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 560px;
  padding: var(--space-huge);
  background: var(--color-canvas);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--rounded-card-auth);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.login-panel:focus-within {
  box-shadow: var(--shadow-card-hover);
}

/* —— Panel brand (login) —— */
.panel-brand {
  margin-bottom: var(--space-xl);
}

.panel-brand__logo {
  display: block;
  width: min(280px, 100%);
  height: auto;
  object-fit: contain;
  object-position: left center;
  filter: invert(1);
}

/* —— Panel header —— */
.panel-header {
  margin-bottom: var(--space-xxl);
}

.panel-header__eyebrow {
  margin: 0 0 var(--space-sm);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-ink-faint);
}

.panel-header__title {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-ink);
}

.panel-header__desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--color-ink-muted);
}

/* —— Views —— */
.view {
  display: none;
}

.view.is-active {
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  align-items: start;
  flex: 1;
  animation: fade-up var(--duration-normal) var(--ease-out) both;
}

.view__content {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}

/* Panel: boot skeleton + contenido comparten altura (sin salto) */
.panel-stage {
  display: grid;
  grid-template-columns: 1fr;
  flex: 1;
  align-content: start;
  align-items: start;
  width: 100%;
}

.panel-stage__main {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  width: 100%;
  min-width: 0;
}

.panel-stage__main > .view.is-active {
  flex: 1;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .view.is-active {
    animation: none;
  }

  .login-panel:focus-within {
    box-shadow: var(--shadow-card);
  }
}

/* —— Alert —— */
.alert {
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
  padding: var(--space-md) var(--space-lg);
  margin-bottom: var(--space-xl);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-border-error);
  background: var(--color-surface-error);
  border-radius: var(--rounded-md);
}

.alert[hidden] {
  display: none !important;
}

.alert__dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  background: var(--color-border-error);
  border-radius: 50%;
}

.alert--success {
  color: var(--color-ink-secondary);
  background: var(--color-canvas-soft);
}

.alert__dot--success {
  background: var(--color-action-primary);
}

/* —— Form —— */
.form {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.field__label-row {
  display: flex;
  gap: var(--space-md);
  align-items: baseline;
  justify-content: space-between;
}

.field__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-ink-secondary);
}

.field__hint {
  margin: 0;
  font-size: 13px;
  color: var(--color-ink-muted);
}

.field__error {
  margin: 0;
  font-size: 13px;
  color: var(--color-border-error);
}

.field__error[hidden] {
  display: none;
}

/* input-text */
.input-wrap {
  position: relative;
}

.input-text {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-ink);
  background: var(--color-canvas-soft);
  border: 1px solid transparent;
  border-radius: var(--rounded-sm);
  transition:
    background-color var(--duration-fast) ease,
    border-color var(--duration-input-border) ease,
    box-shadow var(--duration-fast) ease;
}

.input-text::placeholder {
  color: var(--color-placeholder);
  transition: color var(--duration-fast) ease;
}

#view-login:hover .input-text:not(:focus):not(.input-text--error)::placeholder,
#view-login:focus-within .input-text:not(:focus):not(.input-text--error)::placeholder {
  color: var(--color-placeholder-hover);
}

#view-login .input-text:focus::placeholder {
  color: var(--color-placeholder-focus);
}

.input-text--error::placeholder {
  color: var(--color-ink-faint);
}

body:not(.is-booting) .input-text:not(:disabled):not(.input-text--error) {
  border-color: var(--color-border-accent-light);
}

.input-text:hover:not(:disabled):not(.input-text--error) {
  background: var(--color-canvas);
  border-color: var(--color-border-accent-light);
}

.input-text:focus {
  outline: none;
  background: var(--color-canvas);
  border: 2px solid var(--color-border-focus);
  padding: 11px 13px;
  box-shadow: 0 0 0 4px var(--color-accent-impact-soft);
}

.input-text--error {
  background: var(--color-surface-error);
  border: 1px solid var(--color-border-error);
}

.input-text--error:focus {
  border-color: var(--color-border-error);
  box-shadow: 0 0 0 4px rgba(180, 35, 24, 0.12);
}

.input-text:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.input-wrap--password .input-text {
  padding-right: 48px;
}

.input-wrap--password .input-text:focus {
  padding-right: 47px;
}

.btn-icon {
  position: absolute;
  top: 50%;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--color-ink-muted);
  cursor: pointer;
  background: transparent;
  border: none;
  border-radius: var(--rounded-sm);
  transform: translateY(-50%);
  transition: color var(--duration-fast) ease;
}

.btn-icon:hover {
  color: var(--color-ink);
}

.btn-icon:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

/* Checkbox custom */
.checkbox {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.checkbox__input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.checkbox__box {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  background: var(--color-canvas);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--rounded-sm);
  transition:
    border-color var(--duration-fast) ease,
    background-color var(--duration-fast) ease;
}

.checkbox__box::after {
  width: 5px;
  height: 9px;
  content: "";
  border: solid var(--color-on-primary);
  border-width: 0 2px 2px 0;
  opacity: 0;
  transform: rotate(45deg) scale(0.6);
  transition: opacity var(--duration-fast) ease;
}

.checkbox__input:checked + .checkbox__box {
  background: var(--color-action-primary);
  border-color: var(--color-action-primary);
}

.checkbox__input:checked + .checkbox__box::after {
  opacity: 1;
}

.checkbox__input:focus-visible + .checkbox__box {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
}

.checkbox__text {
  font-size: 14px;
  color: var(--color-ink-muted);
}

/* link-action */
.link-action {
  flex-shrink: 0;
  padding: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 400;
  color: var(--color-action-primary);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  transition: color var(--duration-fast) ease;
}

.link-action:hover {
  color: var(--color-action-primary-hover);
  text-decoration: underline;
}

.link-action:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* button-primary-360 */
.btn {
  display: inline-flex;
  gap: var(--space-sm);
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  border: none;
  border-radius: var(--rounded-full);
  transition:
    background-color var(--duration-fast) ease,
    transform 80ms ease-out;
}

.btn:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 3px;
}

.btn:active:not(:disabled) {
  transform: scale(0.98);
}

.btn--primary {
  color: var(--color-on-primary);
  background: var(--color-action-primary);
}

.btn--primary:hover:not(:disabled) {
  background: var(--color-action-primary-hover);
}

.btn--primary:active:not(:disabled) {
  background: var(--color-action-primary-pressed);
}

.btn:disabled:not(.is-loading) {
  cursor: not-allowed;
  opacity: 0.5;
}

.btn.is-loading {
  opacity: 1;
  cursor: wait;
}

.btn.is-loading .btn__label {
  display: none;
}

.btn__spinner {
  display: none;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--color-on-primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

.btn.is-loading .btn__spinner {
  display: block;
}

.btn--secondary-dark.is-loading .btn__spinner {
  border-color: rgba(255, 255, 255, 0.25);
  border-top-color: var(--color-on-dark);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn__spinner {
    animation: none;
  }
}

.btn__label--loading[hidden] {
  display: none;
}

body.dashboard-shell .input-text:not(:disabled):not(.input-text--error) {
  background: var(--color-canvas);
  border-color: var(--color-border-default);
}

body.dashboard-shell .input-text:hover:not(:disabled):not(.input-text--error) {
  border-color: var(--color-border-strong);
}

body.dashboard-shell .input-text:focus {
  border: 2px solid var(--color-border-focus);
  padding: 8px 11px;
  box-shadow: 0 0 0 3px var(--color-focus-halo);
}

/* Back */
.btn-back {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin: calc(-1 * var(--space-md)) 0 var(--space-lg);
  padding: var(--space-sm) 0;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--color-ink-muted);
  cursor: pointer;
  background: none;
  border: none;
  transition: color var(--duration-fast) ease;
}

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

.btn-back:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Footer */
.panel-footer {
  margin-top: var(--space-xxl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-hairline);
}

.panel-footer__link {
  font-size: 13px;
  color: var(--color-ink-faint);
  text-decoration: none;
  transition: color var(--duration-fast) ease;
}

.panel-footer__link:hover {
  color: var(--color-action-primary);
}

.panel-footer__link:focus-visible {
  outline: 2px solid var(--color-action-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

/* —— Desktop grande / pantalla completa —— */
@media (min-width: 1024px) {
  .login-aside,
  .login-panel {
    align-self: stretch;
  }

  .login-aside__content {
    min-height: 100%;
  }
}

@media (min-width: 1280px) {
  :root {
    --layout-max: 1240px;
    --panel-width: 500px;
    --space-section: 72px;
    --space-huge: 48px;
  }

  .login-layout {
    width: min(100% - 64px, var(--layout-max));
    padding: var(--space-section) 0;
  }

  .login-aside {
    min-height: 640px;
  }

  .login-aside__content {
    padding: var(--space-section);
    gap: var(--space-xxl);
  }

  .brand-logo {
    width: min(260px, 68%);
  }

  .login-aside__hero {
    font-size: clamp(36px, 2.8vw, 44px);
  }

  .login-aside__lead {
    max-width: 42ch;
    font-size: 18px;
  }

  .login-panel {
    min-height: 640px;
    padding: var(--space-huge);
  }

  .panel-header__title {
    font-size: 28px;
  }

  .panel-header__desc {
    font-size: 16px;
  }
}

@media (min-width: 1440px) {
  :root {
    --layout-max: 1360px;
    --panel-width: 540px;
    --space-section: 80px;
  }

  body {
    font-size: 17px;
  }

  .login-layout {
    width: min(100% - 80px, var(--layout-max));
  }

  .login-aside {
    min-height:  min(720px, calc(100dvh - var(--space-section) * 2));
  }

  .login-panel {
    min-height: min(720px, calc(100dvh - var(--space-section) * 2));
  }

  .input-text {
    min-height: 52px;
    padding: 14px 16px;
    font-size: 16px;
  }

  .input-text:focus {
    padding: 13px 15px;
  }

  .btn {
    min-height: 52px;
    padding: 16px 32px;
    font-size: 15px;
  }

  .sk--input,
  .sk--btn {
    height: 52px;
  }
}

@media (min-width: 1680px) {
  :root {
    --layout-max: 1520px;
    --panel-width: 580px;
    --space-section: 96px;
    --space-huge: 56px;
  }

  .login-layout {
    width: min(100% - 96px, var(--layout-max));
  }

  .login-aside__hero {
    font-size: 48px;
  }

  .login-aside__lead {
    font-size: 19px;
  }

  .panel-header__title {
    font-size: 30px;
  }

  .form {
    gap: var(--space-xxl);
  }
}

@media (min-width: 1920px) {
  :root {
    --layout-max: 1680px;
    --panel-width: 620px;
  }

  .login-aside__content {
    padding: 56px 64px;
  }

  .login-panel {
    padding: 56px 64px;
  }
}

/* —— Tablet / mobile —— */
@media (max-width: 1023px) {
  .login-layout {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
    align-items: center;
    width: min(100% - 32px, 480px);
    padding: var(--space-xl) 0;
  }

  .login-aside {
    min-height: 280px;
  }

  .login-aside__content {
    gap: var(--space-lg);
    min-height: 280px;
    padding: var(--space-xl);
  }

  .brand-logo {
    width: min(180px, 60%);
  }

  .login-aside__hero {
    font-size: 22px;
  }

  .login-aside__lead {
    display: none;
  }

  .login-aside__pillars {
    display: none;
  }

  .login-aside__photo {
    object-position: 50% 20%;
  }

  .login-panel {
    min-height: auto;
    padding: var(--space-xl);
  }

  .panel-header__title {
    font-size: 22px;
  }
}

@media (max-width: 767px) {
  .login-layout {
    width: min(100% - 24px, 100%);
  }

  .field__label-row {
    flex-direction: column;
    gap: var(--space-xs);
    align-items: flex-start;
  }
}

/* —— Loading skeletons —— */
:root {
  --sk-base: #ebebeb;
  --sk-shine: #f5f5f5;
  --sk-base-dark: rgba(255, 255, 255, 0.08);
  --sk-shine-dark: rgba(255, 255, 255, 0.16);
}

@keyframes sk-shimmer {
  0% {
    background-position: 120% 0;
  }
  100% {
    background-position: -40% 0;
  }
}

.sk {
  display: block;
  border-radius: var(--rounded-sm);
  background: linear-gradient(
    90deg,
    var(--sk-base) 0%,
    var(--sk-shine) 42%,
    var(--sk-base) 84%
  );
  background-size: 220% 100%;
  animation: sk-shimmer 1.35s ease-in-out infinite;
}

.skeleton-layer--aside .sk {
  background: linear-gradient(
    90deg,
    var(--sk-base-dark) 0%,
    var(--sk-shine-dark) 42%,
    var(--sk-base-dark) 84%
  );
  background-size: 220% 100%;
}

@media (prefers-reduced-motion: reduce) {
  .sk {
    animation: none;
    background: var(--sk-base);
  }

  .skeleton-layer--aside .sk {
    background: var(--sk-base-dark);
  }
}

.skeleton-layer--aside {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: none;
  flex-direction: column;
  gap: var(--space-lg);
  justify-content: flex-end;
  padding: var(--space-xxl);
  pointer-events: none;
}

body.is-booting .skeleton-layer--aside {
  display: flex;
}

body.is-booting .login-aside__content[data-content-ready] {
  visibility: hidden;
}

.skeleton-layer--panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  grid-column: 1;
  grid-row: 1;
  visibility: hidden;
  pointer-events: none;
}

body.is-booting:not(.dashboard-shell) .skeleton-layer--panel {
  visibility: visible;
}

body.is-booting:not(.dashboard-shell) .panel-stage__main {
  visibility: hidden;
  pointer-events: none;
}

.skeleton-layer--view {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  grid-column: 1;
  grid-row: 1;
  visibility: hidden;
  pointer-events: none;
}

.view.is-loading .skeleton-layer--view {
  visibility: visible;
}

.view.is-loading .view__content {
  visibility: hidden;
  pointer-events: none;
}

.sk--logo {
  width: min(200px, 55%);
  height: 48px;
  margin-bottom: var(--space-md);
  border-radius: var(--rounded-md);
  transform-origin: left center;
  animation:
    sk-shimmer 1.35s ease-in-out infinite,
    logo-sk-pulse 2.2s ease-in-out infinite;
}

@keyframes logo-sk-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.97);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sk--logo {
    animation: none;
    background: var(--sk-base-dark);
  }
}

.sk--line {
  height: 14px;
}

.sk--line.sk--short {
  height: 12px;
  margin-top: var(--space-sm);
}

.sk--w-90 {
  width: 90%;
}

.sk--w-85 {
  width: 85%;
}

.sk--w-75 {
  width: 75%;
}

.sk--w-70 {
  width: 70%;
}

.sk--w-60 {
  width: 60%;
}

.sk--w-50 {
  width: 50%;
}

.sk--w-40 {
  width: 40%;
}

.sk--pillars {
  display: flex;
  gap: var(--space-xl);
  margin-top: var(--space-lg);
  background: none;
  animation: none;
}

.sk--chip {
  width: 56px;
  height: 10px;
  border-radius: var(--rounded-full);
}

.sk--xs {
  width: 56px;
  height: 11px;
}

.sk--title {
  width: 68%;
  height: 26px;
  border-radius: var(--rounded-md);
}

.sk--desc {
  width: 92%;
  height: 14px;
}

.sk--field {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  background: none;
  animation: none;
}

.sk--label {
  width: 36%;
  height: 12px;
}

.sk--input {
  width: 100%;
  height: 48px;
}

.sk--row {
  width: 72%;
  height: 20px;
  margin-top: calc(-1 * var(--space-sm));
}

.sk--btn {
  width: 100%;
  height: 48px;
  border-radius: var(--rounded-full);
}

/* —— Extensiones dashboard (DESIGN.md / LogIn) —— */
.btn--auto {
  width: auto;
}

.btn--secondary-dark {
  color: var(--color-on-dark);
  background: var(--color-canvas-invert);
}

.btn--secondary-dark:hover:not(:disabled) {
  background: var(--color-canvas-invert-soft);
}

.card-main-tool,
.card-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--space-huge);
  background: var(--color-canvas);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--rounded-card-auth);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

.card-main-tool:focus-within {
  box-shadow: var(--shadow-card-hover);
}

body.dashboard-shell .card-main-tool,
body.dashboard-shell .card-panel {
  position: relative;
  padding: var(--space-xl);
  overflow: hidden;
  background: linear-gradient(
    168deg,
    var(--panel-surface-top) 0%,
    var(--panel-surface-bottom) 100%
  );
  border: 1px solid var(--panel-border);
  border-radius: var(--rounded-card);
  box-shadow: var(--shadow-panel);
}

body.dashboard-shell .card-panel::before {
  content: "";
  position: absolute;
  top: 0;
  right: 12%;
  left: 12%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    var(--panel-border-glow) 50%,
    transparent
  );
  pointer-events: none;
}

body.dashboard-shell .card-main-tool:focus-within,
body.dashboard-shell .card-panel:focus-within {
  box-shadow: var(--shadow-panel);
}

body.dashboard-shell .card-panel .input-text:not(:disabled):not(.input-text--error) {
  color: var(--color-on-dark);
  background: rgba(0, 0, 0, 0.35);
  border-color: rgba(255, 255, 255, 0.1);
}

body.dashboard-shell .card-panel .input-text:hover:not(:disabled):not(.input-text--error) {
  border-color: rgba(255, 75, 210, 0.28);
}

body.dashboard-shell .card-panel .input-text::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

body.dashboard-shell .card-panel select.input-text:not(:disabled):not(.input-text--error),
body.dashboard-shell .card-panel select.input-text:hover:not(:disabled):not(.input-text--error),
body.dashboard-shell .card-panel select.input-text:focus,
body.dashboard-shell select.input-text:not(:disabled):not(.input-text--error),
body.dashboard-shell select.input-text:hover:not(:disabled):not(.input-text--error),
body.dashboard-shell select.input-text:focus {
  background: rgba(255, 255, 255, 0.03);
}

body.dashboard-shell .btn {
  width: auto;
  min-height: 40px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--rounded-md);
}

body.dashboard-shell .btn--secondary-dark {
  background: var(--color-canvas-invert-soft);
}

body.dashboard-shell .btn--secondary-dark:hover:not(:disabled) {
  background: #243044;
}

body.dashboard-shell .input-text {
  min-height: 40px;
  padding: 9px 12px;
  font-size: 14px;
  border-radius: var(--rounded-md);
}

body.dashboard-shell .input-text:focus {
  padding: 8px 11px;
}

body.dashboard-shell .alert {
  border: 1px solid transparent;
  border-radius: var(--rounded-md);
}

body.dashboard-shell .panel-header__title {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.02em;
}

body.dashboard-shell .muted.small,
body.dashboard-shell .kpi-sub {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--color-ink-muted);
}

.is-section-loading .skeleton-layer--panel,
.is-chart-loading .skeleton-layer--chart {
  visibility: visible;
}

.dashboard-panel-section:not(.is-section-loading) .skeleton-layer--panel {
  display: none;
}

.is-section-loading .panel-stage__main,
.is-chart-loading .plotly-stage__main {
  visibility: hidden;
  pointer-events: none;
}

.skeleton-layer--chart {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  visibility: hidden;
  pointer-events: none;
}

.sk--chart {
  width: 100%;
  min-height: 480px;
  border-radius: var(--rounded-md);
}

.skeleton-layer--header {
  grid-column: 1 / -1;
  display: none;
  flex-direction: column;
  gap: var(--space-md);
  pointer-events: none;
}

.skeleton-layer--header .sk {
  background: linear-gradient(
    90deg,
    var(--sk-base-dark) 0%,
    var(--sk-shine-dark) 42%,
    var(--sk-base-dark) 84%
  );
  background-size: 220% 100%;
}

body.is-booting .skeleton-layer--header {
  display: flex;
}

body.is-booting .app-header__content {
  visibility: hidden;
}

.sk--kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-md);
  background: none;
  animation: none;
}

.sk--kpi-card {
  min-height: 88px;
  border-radius: var(--rounded-md);
}

/* —— Pipeline status (carga progresiva) —— */
.pipeline-status {
  --pipeline-scale: 1.2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: calc(var(--space-md) * var(--pipeline-scale)) calc(var(--space-lg) * var(--pipeline-scale));
  margin-top: calc(var(--space-lg) * var(--pipeline-scale));
  margin-bottom: 0;
  padding: calc(var(--space-md) * var(--pipeline-scale)) calc(var(--space-lg) * var(--pipeline-scale));
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline-on-dark, rgba(255, 255, 255, 0.08));
  border-radius: var(--rounded-md);
}

.pipeline-status[hidden] {
  display: none !important;
}

.pipeline-status__dot {
  flex-shrink: 0;
  width: calc(8px * var(--pipeline-scale, 2));
  height: calc(8px * var(--pipeline-scale, 2));
  border-radius: 50%;
  background: var(--color-accent-impact, #ff4bd2);
  animation: pipeline-dot-pulse 1.4s ease-in-out infinite;
}

.pipeline-status.is-success .pipeline-status__dot {
  background: var(--color-metric-positive, #16a34a);
  animation: none;
}

.pipeline-status__text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: calc(13px * var(--pipeline-scale, 2));
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-on-dark-muted, #a3a3a3);
}

.pipeline-status.is-success .pipeline-status__text {
  color: var(--color-metric-positive, #16a34a);
}

.pipeline-status__steps {
  display: flex;
  flex-wrap: wrap;
  gap: calc(var(--space-xs) * var(--pipeline-scale, 2));
  margin: 0;
  padding: 0;
  list-style: none;
  flex: 1 1 100%;
}

.pipeline-status__step {
  padding: calc(2px * var(--pipeline-scale, 2)) calc(8px * var(--pipeline-scale, 2));
  font-size: calc(11px * var(--pipeline-scale, 2));
  font-weight: 500;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
}

.pipeline-status__step.is-active {
  color: var(--color-accent-impact, #ff4bd2);
  background: rgba(255, 75, 210, 0.1);
  border-color: rgba(255, 75, 210, 0.25);
}

.pipeline-status__step.is-done {
  color: var(--color-metric-positive, #16a34a);
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.2);
}

@keyframes pipeline-dot-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

/* —— Section loading status (skeleton overlay) —— */
.section-loading-status {
  display: none;
  align-items: center;
  gap: var(--space-sm);
  margin: 0 0 var(--space-md);
  padding: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--color-on-dark-muted, #a3a3a3);
  background: none;
  animation: none;
}

.is-section-loading .section-loading-status:not(:empty),
.is-chart-loading .section-loading-status:not(:empty) {
  display: flex;
}

.section-loading-status.is-complete {
  color: var(--color-metric-positive, #16a34a);
}

.section-loading-status__dots {
  display: inline-flex;
  gap: 3px;
  align-items: center;
}

.section-loading-status__dots span {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: section-status-dot 1.2s ease-in-out infinite;
}

.section-loading-status__dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.section-loading-status__dots span:nth-child(3) {
  animation-delay: 0.3s;
}

.section-loading-status.is-complete .section-loading-status__dots {
  display: none;
}

.section-loading-status__check {
  display: none;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  color: var(--color-metric-positive, #16a34a);
}

.section-loading-status.is-complete .section-loading-status__check {
  display: block;
}

@keyframes section-status-dot {
  0%,
  80%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .pipeline-status__dot {
    animation: none;
  }

  .section-loading-status__dots span {
    animation: none;
    opacity: 0.7;
  }
}
