:root {
  --bg: #f4f4f2; --card: #ffffff; --text: #111111; --muted: #6b6b6b; --line: #e4e4e0;
  --accent: #111111; --accent-text: #ffffff; --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b;
  --c1: #111111; --c2: #8a8a86; --c3: #c9a227;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121212; --card: #1c1c1c; --text: #f1f1f1; --muted: #a0a0a0; --line: #2c2c2c;
    --accent: #f1f1f1; --accent-text: #111111; --c1: #f1f1f1; --c2: #7a7a7a; --c3: #d8b43a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; }
#app { max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
.hidden { display: none !important; }
h1 { margin: 0; font-size: 22px; letter-spacing: .02em; }
h1 span { font-weight: 400; color: var(--muted); }
h2 { margin: 0 0 12px; font-size: 14px; text-transform: uppercase; letter-spacing: .08em; }
.muted { color: var(--muted); font-weight: 400; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
header p { margin: 4px 0 0; font-size: 12px; }
.acciones { display: flex; gap: 8px; align-items: center; }
button { background: var(--accent); color: var(--accent-text); border: 0; border-radius: 8px;
  padding: 9px 14px; font-weight: 600; cursor: pointer; }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button:disabled { opacity: .5; cursor: wait; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 12px; }
.kpi small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.kpi b { display: block; font-size: 26px; margin-top: 4px; }
.kpi em { font-style: normal; color: var(--muted); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
td a { color: inherit; }
.scroll { overflow-x: auto; max-height: 420px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.row h2 { margin: 0; }
input, select, textarea { width: 100%; padding: 9px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit; }
#buscar { max-width: 320px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); color: var(--ok); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.badge.bad { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.empty { color: var(--muted); padding: 12px 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 340px; display: grid; gap: 10px; text-align: center; }
.login p { margin: 0; color: var(--muted); }
.link { color: var(--muted); font-size: 12px; }
.error { color: var(--bad); font-size: 12px; min-height: 1em; margin: 0; }
dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--text);
  width: min(440px, calc(100vw - 32px)); padding: 20px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
.form { display: grid; gap: 10px; }
.form label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.form .acciones { justify-content: flex-end; }
