/* =========================================================
   Orbita — Base / reset
   ========================================================= */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--surface-page);
  color: var(--text-primary);
  font-size: var(--fs-md);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img, svg, video, canvas { max-width: 100%; display: block; }

h1, h2, h3, h4, h5 { line-height: 1.15; margin: 0 0 var(--sp-3); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); }
h4 { font-size: var(--fs-lg); }
p  { margin: 0 0 var(--sp-3); color: var(--text-secondary); }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

ul, ol { margin: 0; padding: 0; list-style: none; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

.container {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--sp-5);
}

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

/* --- Botones --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 12px 22px;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: var(--fs-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: var(--brand-strong); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-hairline);
}
.btn-ghost:hover { background: var(--surface-sunken); }

.btn-outline {
  background: var(--surface-1);
  color: var(--brand);
  border-color: var(--brand-soft);
}
.btn-outline:hover { background: var(--brand-wash); }

.btn-sm { padding: 8px 16px; font-size: var(--fs-xs); }
.btn-block { width: 100%; }
.btn-danger { background: var(--status-critical); color: #fff; }
.btn-danger:hover { filter: brightness(1.08); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Tarjetas --- */
.card {
  background: var(--surface-1);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--sp-5); }

/* --- Badges / pills --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: 600;
  background: var(--surface-sunken);
  color: var(--text-secondary);
  border: 1px solid var(--border-hairline);
}
.badge-brand { background: var(--brand-wash); color: var(--brand-strong); border-color: transparent; }
.badge-good  { background: color-mix(in srgb, var(--status-good) 14%, transparent); color: var(--status-good-text); border-color: transparent; }
.badge-warn  { background: color-mix(in srgb, var(--status-warning) 22%, transparent); color: #7a4f00; border-color: transparent; }
:root[data-theme="dark"] .badge-warn { color: #ffce6b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-warn { color: #ffce6b; } }

/* --- Formularios --- */
.field { margin-bottom: var(--sp-4); }
.field label {
  display: block;
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-bottom: var(--sp-2);
  color: var(--text-primary);
}
.field .hint { font-size: var(--fs-xs); color: var(--text-muted); margin-top: 6px; }
.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-hairline);
  background: var(--surface-1);
  color: var(--text-primary);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, select.input:focus, textarea.input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-wash);
}
textarea.input { resize: vertical; min-height: 90px; }

/* --- Scrollbar sutil --- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-grid); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }

/* --- Toasts --- */
#toast-root {
  position: fixed;
  bottom: var(--sp-5);
  right: var(--sp-5);
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.toast {
  background: var(--text-primary);
  color: var(--surface-page);
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: var(--fs-sm);
  max-width: 320px;
  animation: toast-in .2s ease;
}
@keyframes toast-in { from { opacity:0; transform: translateY(8px); } to { opacity:1; transform:none; } }

/* --- Utilidades de skeleton / carga --- */
.skeleton {
  background: linear-gradient(90deg, var(--surface-sunken) 25%, var(--border-grid) 37%, var(--surface-sunken) 63%);
  background-size: 400% 100%;
  animation: skeleton-loading 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
