/* Reset ligero, tipografía global, utilidades. */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, textarea, select, button { font-family: inherit; font-size: inherit; color: inherit; }
input:not([type="checkbox"]):not([type="radio"]), textarea { -webkit-appearance: none; appearance: none; }
textarea { resize: vertical; }
::placeholder { color: var(--text-muted); opacity: 1; }
img { max-width: 100%; display: block; }

.mono { font-family: var(--font-mono); }
.muted { color: var(--text-muted); }
.soft { color: var(--text-soft); }
.row { display: flex; align-items: center; gap: var(--sp-3); }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.col { display: flex; flex-direction: column; gap: var(--sp-3); }
.gap-1 { gap: var(--sp-1); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.grow { flex-grow: 1; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  height: 36px; padding: 0 var(--sp-4);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background var(--t), border-color var(--t), color var(--t), transform var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:hover { background: var(--bg-hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--accent-inv); border-color: var(--accent); }
.btn-primary:hover { background: #222; border-color: #222; }
.btn-danger { color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--accent-inv); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { height: 30px; padding: 0 var(--sp-3); font-size: var(--fs-sm); }
.btn-icon { width: 32px; height: 32px; padding: 0; border-radius: var(--r-sm); }

/* Inputs */
.input, .textarea, .select {
  width: 100%;
  padding: 0 var(--sp-3);
  height: 36px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--t), box-shadow var(--t);
  outline: none;
}
.textarea { padding: var(--sp-2) var(--sp-3); height: auto; min-height: 80px; line-height: 1.45; }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(0,0,0,0.06);
}

label.field-label {
  display: block;
  font-size: var(--fs-sm);
  color: var(--text-soft);
  margin-bottom: var(--sp-2);
  font-weight: 500;
}

/* Badges */
.badge {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 2px var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  border-radius: var(--r-sm);
  background: var(--state-draft-bg);
  color: var(--state-draft-fg);
}
.badge-complete { background: var(--state-complete-bg); color: var(--state-complete-fg); }
.badge-incomplete { background: var(--state-incomplete-bg); color: var(--state-incomplete-fg); }
.badge-warning { background: #fff8d5; color: #8a6500; }

/* Empty / loading states */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: var(--sp-10) var(--sp-4);
  color: var(--text-muted);
  text-align: center;
  gap: var(--sp-3);
}
.empty-state h3 { color: var(--text); }

.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar discreto */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d8d8d8; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #bbbbbb; }
::-webkit-scrollbar-track { background: transparent; }
