:root {
  color-scheme: dark;
  --nb-light:  #edf3f0;
  --nb-sage:   #9bbfb4;
  --nb-teal:   #4a8595;
  --nb-navy:   #1a3040;
  --bg:        #0e1e2a;
  --bg-deep:   #091520;
  --surface:   rgba(21, 38, 54, 0.92);
  --surface-strong: #152636;
  --text:      #edf3f0;
  --muted:     #7aa8b4;
  --line:      rgba(74, 133, 149, 0.18);
  --accent:    #4a8595;
  --accent-strong: #376a7a;
  --accent-soft:   rgba(74, 133, 149, 0.15);
  --accent-hi: #6db5c8;
  --warning:   #c89a4a;
  --danger:    #b85a60;
  --success:   #4a9a6e;
  --shadow:    0 14px 32px rgba(0, 0, 0, 0.5);
  --radius-lg: 8px;
  --radius-md: 6px;
  --radius-sm: 4px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top left, rgba(74, 133, 149, 0.09), transparent 35%),
    radial-gradient(ellipse at bottom right, rgba(26, 48, 64, 0.5), transparent 45%),
    linear-gradient(180deg, var(--bg), var(--bg-deep));
  color: var(--text);
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, p {
  margin: 0;
}

.app-shell {
  position: relative;
}

.app-shell__bg,
.app-shell__grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.app-shell__bg {
  background: linear-gradient(135deg, rgba(74, 133, 149, 0.04), transparent 60%);
}

.app-shell__grain {
  opacity: 0.03;
  background-image:
    linear-gradient(0deg, rgba(237, 243, 240, 0.4) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 243, 240, 0.4) 1px, transparent 1px);
  background-size: 24px 24px;
}

.topbar,
.layout,
.mobile-nav {
  width: min(100%, var(--max-width));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 16px 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand__mark {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--accent);
  color: var(--nb-light);
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 0.02em;
}

.brand__text {
  display: grid;
}

.brand__text strong {
  font-size: 1rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #e8f2fb;
}

.brand__text small,
.muted,
.movement-card p,
.field span,
.metric-card__label {
  color: var(--muted);
}

.topbar__status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

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

.pill--success {
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.auth-pill {
  background: var(--accent-soft);
  color: var(--accent-hi);
}

.layout {
  display: grid;
  gap: 16px;
  padding: 8px 16px 92px;
}

.layout--auth {
  grid-template-columns: minmax(0, 1fr);
  padding: 12px 20px 36px;
}

.sidebar {
  display: none;
  gap: 14px;
}

.nav-card,
.info-card,
.hero-card,
.panel,
.auth-card,
.metric-card,
.action-card,
.movement-card,
.alert {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.nav-card {
  display: grid;
  padding: 6px;
  border-radius: var(--radius-lg);
}

.nav-card__item {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
  transition: background 0.1s, border-left-color 0.1s, color 0.1s;
  color: var(--nb-sage);
}

.nav-card__item:hover {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--nb-light);
}

.info-card,
.panel,
.auth-card,
.hero-card {
  border-radius: var(--radius-lg);
  padding: 18px;
}

.content {
  display: grid;
  gap: 16px;
}

.hero-card {
  display: grid;
  gap: 16px;
}

.hero-card__header {
  display: grid;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent-hi);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-card h1,
.auth-card h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 6vw, 3.4rem);
  line-height: 1;
  letter-spacing: -0.03em;
}

.auth-copy h1,
.auth-card--login h1 {
  font-family: Inter, "Segoe UI", sans-serif;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  font-weight: 700;
  color: var(--nb-light);
}

.balance {
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  border: 1px solid var(--line);
}

.balance span,
.section h2 {
  display: block;
}

.balance strong {
  display: block;
  margin-top: 4px;
  font-size: 1.55rem;
  color: var(--nb-light);
}

.summary-grid,
.action-grid,
.section--split {
  display: grid;
  gap: 12px;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card {
  padding: 14px;
  border-radius: var(--radius-md);
}

.metric-card__label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.82rem;
}

.metric-card__value {
  font-size: 1.06rem;
}

.section {
  display: grid;
  gap: 12px;
}

.section__heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
}

.action-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.action-card {
  display: grid;
  gap: 4px;
  min-height: 100px;
  padding: 16px;
  border-radius: var(--radius-md);
  border-left: 3px solid var(--accent);
}

.action-card strong {
  font-size: 1rem;
  color: var(--nb-light);
}

.action-card span {
  color: var(--muted);
  font-size: 0.92rem;
}

.movement-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: var(--radius-md);
}

.movement-card--positive {
  border-left: 4px solid var(--success);
}

.movement-card--negative {
  border-left: 4px solid var(--danger);
}

.movement-card--neutral {
  border-left: 4px solid var(--warning);
}

.panel--warning {
  background: rgba(200, 154, 74, 0.08);
  border-color: rgba(200, 154, 74, 0.25);
}

.bullet-list {
  margin: 0;
  padding-left: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack--tight {
  gap: 8px;
}

.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
}

.alert--error,
.alert--danger {
  border-color: rgba(184, 90, 96, 0.35);
  background: rgba(184, 90, 96, 0.1);
  color: #dd9598;
}

.alert--success {
  border-color: rgba(74, 154, 110, 0.35);
  background: rgba(74, 154, 110, 0.1);
  color: #7dd4a0;
}

.auth-shell {
  min-height: calc(100vh - 154px);
  display: grid;
  align-items: center;
  padding: 28px 0 36px;
}

.auth-layout {
  display: grid;
  gap: 24px;
  width: min(100%, 1120px);
  margin: 0 auto;
}

.auth-copy {
  order: 2;
  display: grid;
  gap: 16px;
  max-width: 520px;
  justify-self: center;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-lead {
  max-width: 34ch;
  font-size: 1rem;
  color: var(--muted);
  line-height: 1.6;
}

.auth-list {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 10px;
  color: var(--muted);
}

.auth-list strong {
  color: var(--text);
}

.auth-card {
  width: 100%;
}

.auth-card--login {
  order: 1;
  width: min(100%, 400px);
  justify-self: center;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--accent);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: var(--surface-strong);
  box-shadow: var(--shadow);
}

.auth-card__header {
  display: grid;
  gap: 6px;
  margin-bottom: 2px;
}

.auth-card__header h2 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--nb-light);
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-hi);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-stack {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field input,
.app-input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(14, 30, 42, 0.8);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s;
}

.field input:focus,
.app-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Todos los checkboxes: tamaño fijo, nunca se estiran */
.field input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: unset;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* Checkbox simple (BooleanField): fila label — checkbox */
.field:has(> input[type="checkbox"]) {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
}

.field:has(> input[type="checkbox"]) > label {
  flex: 1;
  font-weight: 600;
  cursor: pointer;
  margin: 0;
}

.field:has(> input[type="checkbox"]) > small {
  width: 100%;
  order: 3;
}

/* CheckboxSelectMultiple — lista de opciones */
.field ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.field ul li + li {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.field ul li label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 0.92rem;
  transition: background 0.1s;
}

.field ul li label:hover {
  background: rgba(255, 255, 255, 0.04);
}

.field__error {
  color: var(--danger);
  font-size: 0.88rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.12s;
}

.button--primary {
  color: var(--nb-light);
  background: var(--accent);
}

.button--primary:hover {
  background: var(--accent-hi);
}

.button--block {
  width: 100%;
}

.button--ghost {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.button--ghost:hover {
  border-color: var(--accent);
}

.auth-help {
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.landing-hero {
  display: grid;
  gap: 18px;
}

.landing-hero__copy,
.landing-hero__panel,
.landing-section {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
  border-radius: var(--radius-lg);
}

.landing-hero__copy {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.landing-hero__copy h1 {
  font-size: clamp(2rem, 4.1vw, 3.2rem);
  line-height: 1.03;
  letter-spacing: -0.03em;
  color: var(--nb-light);
}

.landing-lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 58ch;
}

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

.landing-kpis {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.landing-hero__panel {
  padding: 22px;
}

.landing-hero__panel h3 {
  margin-bottom: 10px;
}

.landing-section {
  margin-top: 16px;
  padding: 22px;
  display: grid;
  gap: 14px;
}

.landing-cards {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.landing-section--cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.app-shell--auth .topbar {
  padding-bottom: 10px;
}

.app-shell--auth .content {
  gap: 0;
}

.app-shell--auth .app-shell__grain {
  display: none;
}

.mobile-nav {
  position: fixed;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: min(calc(100% - 24px), var(--max-width));
  padding: 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(21, 38, 54, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.mobile-nav a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.mobile-nav a:hover {
  background: var(--accent-soft);
  color: var(--nb-light);
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: 260px minmax(0, 1fr);
    align-items: start;
    padding-bottom: 32px;
  }

  .layout--auth {
    grid-template-columns: minmax(0, 1fr);
    padding: 16px 20px 36px;
  }

  .sidebar {
    display: grid;
    position: sticky;
    top: 16px;
  }

  .mobile-nav {
    display: none;
  }

  .hero-card__header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .section--split {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .auth-layout {
    grid-template-columns: minmax(460px, 1fr) minmax(380px, 460px);
    align-items: center;
    gap: 44px;
  }

  .auth-copy {
    order: 1;
    justify-self: end;
  }

  .auth-card--login {
    order: 2;
    justify-self: start;
    width: min(100%, 440px);
  }

  .landing-hero {
    grid-template-columns: minmax(0, 1.25fr) minmax(340px, 0.75fr);
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .summary-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

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

  .auth-card--login {
    padding: 22px;
  }

  .auth-layout {
    gap: 18px;
  }

  .auth-copy {
    order: 2;
    width: 100%;
  }
}
