/* Tokens de tema. Compilar con Tailwind CLI para producción.
   Para el piloto, se usa junto con el CDN de Tailwind. */

:root, [data-theme=dark] {
  --bg: #111215; --bg-2: #16181D;
  --surface: rgba(255,255,255,.035); --surface-2: rgba(255,255,255,.06); --surface-solid: #1B1D23;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --text: #ECEDEF; --muted: #9097A3; --faint: #646B77; --on-text: #111111;
  --blue: #60A5FA; --brand: #22B8C0; --green: #34D399; --pink: #F472B6;
  --orange: #FB923C; --yellow: #FBBF24; --red: #F87171;
  --chrome: rgba(17,18,21,.72); --menu-bg: rgba(27,29,35,.94);
  --hover: rgba(255,255,255,.09); --soft: rgba(255,255,255,.02); --track: rgba(255,255,255,.07);
  --shadow: rgba(0,0,0,.4);
  --glow-1: rgba(34,184,192,.10); --glow-2: rgba(96,165,250,.08);
  color-scheme: dark;
}

[data-theme=light] {
  --bg: #F5F6F8; --bg-2: #FFFFFF;
  --surface: rgba(255,255,255,.75); --surface-2: rgba(15,23,42,.05); --surface-solid: #FFFFFF;
  --line: rgba(15,23,42,.09); --line-2: rgba(15,23,42,.16);
  --text: #14161B; --muted: #5B6270; --faint: #8A909C; --on-text: #FFFFFF;
  --blue: #2563EB; --brand: #017C83; --green: #059669; --pink: #DB2777;
  --orange: #EA580C; --yellow: #B45309; --red: #DC2626;
  --chrome: rgba(245,246,248,.8); --menu-bg: rgba(255,255,255,.96);
  --hover: rgba(15,23,42,.07); --soft: rgba(15,23,42,.025); --track: rgba(15,23,42,.08);
  --shadow: rgba(15,23,42,.12);
  --glow-1: rgba(2,144,152,.08); --glow-2: rgba(37,99,235,.06);
  color-scheme: light;
}

html { font-family: -apple-system, "Segoe UI", sans-serif; }
body {
  color: var(--text);
  background:
    radial-gradient(900px 500px at 85% -10%, var(--glow-1), transparent 60%),
    radial-gradient(700px 400px at -10% 110%, var(--glow-2), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  margin: 0;
}

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* App shell */
.app-shell { display: grid; grid-template-columns: 220px minmax(0,1fr); min-height: 100vh; }
@media (max-width: 760px) { .app-shell { grid-template-columns: 1fr; } }

/* Sidebar */
.sidebar {
  background: var(--surface-solid);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (max-width: 760px) {
  .sidebar { position: fixed; bottom: 0; left: 0; right: 0; height: 56px; flex-direction: row; border-right: none; border-top: 1px solid var(--line); z-index: 40; }
}

.sidebar-nav-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-radius: 10px; color: var(--muted); text-decoration: none; font-size: 14px;
  transition: background .15s, color .15s; cursor: pointer;
}
.sidebar-nav-item:hover { background: var(--hover); color: var(--text); }
.sidebar-nav-item[aria-current=page] { background: var(--surface-2); color: var(--text); font-weight: 500; }

/* Top bar */
.topbar {
  background: var(--chrome); backdrop-filter: blur(14px) saturate(130%);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 0 20px;
  height: 52px; position: sticky; top: 0; z-index: 30;
}

/* Cards */
.card {
  background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px;
}
.card-glass {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 18px;
  backdrop-filter: blur(14px) saturate(130%);
}

/* Tags/chips */
.tag {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
}
.tag-soft { background: rgba(255,255,255,.08); }
.tag-proposed { background: transparent; border: 1px dashed currentColor; }

/* Band colors */
.band-prioritize { color: var(--green); }
.band-include { color: var(--blue); }
.band-manual_review { color: var(--yellow); }
.band-deprioritize { color: var(--muted); }
.band-excluded { color: var(--red); }

/* Status badges */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
}
.badge-open { background: rgba(96,165,250,.15); color: var(--blue); }
.badge-accepted { background: rgba(52,211,153,.15); color: var(--green); }
.badge-rejected { background: rgba(248,113,113,.15); color: var(--red); }
.badge-excluded { background: rgba(100,107,119,.15); color: var(--faint); }

/* Table */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); font-weight: 500; padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; }
.data-table tr:hover td { background: var(--hover); }
.data-table tr:last-child td { border-bottom: none; }

/* Toasts */
#toast-region { position: fixed; bottom: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 340px;
  box-shadow: 0 4px 20px var(--shadow);
  animation: toast-in .2s ease;
}
.toast-good { background: var(--surface-solid); border: 1px solid var(--green); color: var(--green); }
.toast-bad { background: var(--surface-solid); border: 1px solid var(--red); color: var(--red); }
.toast-info { background: var(--surface-solid); border: 1px solid var(--line-2); color: var(--text); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Forms */
.form-input {
  width: 100%; padding: 8px 12px; border-radius: 10px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  color: var(--text); font-size: 14px;
  transition: border-color .15s;
}
.form-input:focus { border-color: var(--brand); outline: none; }
.form-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; display: block; }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 10px; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: background .15s, opacity .15s; text-decoration: none; }
.btn-primary { background: var(--text); color: var(--on-text); }
.btn-primary:hover { opacity: .88; }
.btn-default { background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text); }
.btn-default:hover { background: var(--hover); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: rgba(248,113,113,.12); color: var(--red); border: 1px solid rgba(248,113,113,.2); }
.btn-danger:hover { background: rgba(248,113,113,.2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

/* KPI cards */
.kpi-card { display: flex; align-items: center; gap: 14px; }
.kpi-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.kpi-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* Utils */
.mono { font-family: ui-monospace, monospace; }
.text-muted { color: var(--muted); }
.text-faint { color: var(--faint); }
.text-brand { color: var(--brand); }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow); }
.divider { border: none; border-top: 1px solid var(--line); margin: 12px 0; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }
.htmx-request.htmx-indicator { opacity: 1; }
