/* =====================================================================
   base.css — Reset + tipografía + utilidades base (Carbon)
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--link-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
h1,h2,h3,h4,h5 { margin: 0; font-weight: var(--type-weight-semibold); color: var(--text-primary); }
h1 { font-size: 28px; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); }
::selection { background: var(--cds-blue-20); }

/* Scrollbar discreto estilo Carbon */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 0; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Helpers ---- */
.u-flex { display: flex; }
.u-between { display: flex; align-items: center; justify-content: space-between; }
.u-center { display: flex; align-items: center; }
.u-gap-4 { gap: 4px; } .u-gap-8 { gap: 8px; } .u-gap-12 { gap: 12px; } .u-gap-16 { gap: 16px; }
.u-grow { flex: 1; }
.u-muted { color: var(--text-secondary); }
.u-helper { color: var(--text-helper); font-size: 12px; }
.u-mono { font-family: var(--font-mono); font-size: 12px; }
.u-right { text-align: right; }
.u-nowrap { white-space: nowrap; }
.u-truncate { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-hidden { display: none !important; }
.u-mt-8 { margin-top: 8px; } .u-mt-16 { margin-top: 16px; } .u-mt-24 { margin-top: 24px; }
.u-mb-8 { margin-bottom: 8px; } .u-mb-16 { margin-bottom: 16px; } .u-mb-24 { margin-bottom: 24px; }

/* ---- Botones Carbon ---- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px; border: 1px solid transparent;
  font-size: 14px; font-weight: var(--type-weight-regular); letter-spacing: .16px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast);
  white-space: nowrap; user-select: none; min-width: 0;
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--button-primary); color: var(--text-on-color); }
.btn--primary:hover { background: var(--button-primary-hover); }
.btn--primary:active { background: var(--button-primary-active); }
.btn--secondary { background: var(--button-secondary); color: var(--text-on-color); }
.btn--secondary:hover { background: var(--button-secondary-hover); }
.btn--danger { background: var(--button-danger); color: var(--text-on-color); }
.btn--danger:hover { background: var(--button-danger-hover); }
.btn--ghost { background: transparent; color: var(--link-primary); padding: 0 12px; }
.btn--ghost:hover { background: var(--layer-hover); }
.btn--tertiary { background: transparent; color: var(--interactive); border-color: var(--interactive); }
.btn--tertiary:hover { background: var(--interactive); color: var(--text-on-color); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn--icon { width: 40px; height: 40px; padding: 0; justify-content: center; background: transparent; color: var(--icon-primary); }
.btn--icon:hover { background: var(--layer-hover); }
.btn:disabled { background: var(--text-disabled); color: var(--text-on-color); cursor: not-allowed; }

/* ---- Campos de formulario Carbon ---- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field__label { font-size: 12px; color: var(--text-secondary); }
.field__label .req { color: var(--support-error); }
.field__control,
.field input[type=text], .field input[type=email], .field input[type=number],
.field input[type=password], .field input[type=date], .field input[type=url],
.field input[type=color], .field select, .field textarea {
  width: 100%; height: 40px; padding: 0 12px;
  background: var(--field-01); color: var(--text-primary);
  border: none; border-bottom: 1px solid var(--border-strong);
  font-family: inherit; font-size: 14px; outline: none;
  transition: outline var(--dur-fast);
}
.field textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--border-interactive); outline-offset: -2px;
}
.field input::placeholder, .field textarea::placeholder { color: var(--text-placeholder); }
.field input[type=color] { padding: 4px; height: 40px; cursor: pointer; }
.field__help { font-size: 12px; color: var(--text-helper); }
.field--inline { flex-direction: row; align-items: center; gap: 10px; }
.field--checkbox { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; }
.field--checkbox input { width: 18px; height: 18px; accent-color: var(--interactive); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 24px; }
.form-grid .field--full { grid-column: 1 / -1; }
.form-section-title { font-size: 12px; font-weight: var(--type-weight-semibold); text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-helper); margin: 8px 0 12px; grid-column: 1 / -1; border-bottom: 1px solid var(--border-subtle); padding-bottom: 6px; }

/* ---------- Texto solo para lectores de pantalla ----------
   Lo que el diseno comunica con color o forma tiene que llegar tambien como
   texto: un estado pintado de verde no existe para quien no ve la pantalla.
   No se usa display:none, que lo sacaria tambien del lector. */
.solo-lectores { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
