:root {
  --red: #F01428;
  --ink: #0D0D0D;
  --cream: #F5F0E8;
  --bg: #F5F0E8;
  --surface: #FFFDF8;
  --surface-2: #EFE9DE;
  --text: #0D0D0D;
  --muted: #6B645A;
  --line: #E0D8CA;
  --focus: #0D0D0D;
  --side-bg: #0D0D0D;
  --side-text: #F5F0E8;
  --side-muted: #A39B8E;
  --accent: #F01428;
  --accent-text: #FFFFFF;
  --shadow: 0 1px 0 rgba(13, 13, 13, .04), 0 8px 24px -16px rgba(13, 13, 13, .25);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0D0D0D; --surface: #171512; --surface-2: #211E1A; --text: #F5F0E8; --muted: #A39B8E; --line: #2C2823;
    --focus: #F5F0E8; --side-bg: #090909; --shadow: 0 1px 0 rgba(255, 255, 255, .03);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--cream); padding: 8px 14px; z-index: 50; border-radius: 6px; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); padding: 28px 18px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 32px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--red); color: #fff; font-weight: 800; font-size: 24px; line-height: 1; }
.brand-text { font-weight: 700; font-size: 17px; letter-spacing: -.01em; display: flex; flex-direction: column; line-height: 1.2; }
.brand-text small { font-weight: 500; color: var(--side-muted); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 14px; border-radius: 8px; color: var(--side-muted); text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
.nav a:hover { color: var(--side-text); background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { color: var(--side-text); background: rgba(255, 255, 255, .09); border-left-color: var(--red); font-weight: 650; }
.nav a:focus-visible { outline-color: var(--cream); }
.nav-pill { background: var(--red); color: #fff; font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; padding: 1px 7px; border-radius: 999px; }
.main { padding: 40px clamp(20px, 4vw, 56px) 72px; max-width: 1240px; width: 100%; outline: none; }
.main[aria-busy="true"] { opacity: .65; transition: opacity .15s .15s; }
.loading { padding: 32px 0; }

/* ---------- headings ---------- */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 28px; }
h1 { font-size: clamp(28px, 3.4vw, 38px); line-height: 1.1; letter-spacing: -.025em; font-weight: 800; }
.lead { color: var(--muted); margin-top: 8px; max-width: 60ch; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
h3 { font-size: 16px; font-weight: 650; }
.main > section, .main > .stats, .main > .table-wrap, .main > .two-col { margin-bottom: 28px; }
.pill { background: var(--ink); color: var(--cream); font-size: 12px; padding: 1px 9px; border-radius: 999px; font-weight: 700; }
@media (prefers-color-scheme: dark) { .pill { background: var(--cream); color: var(--ink); } }

/* ---------- cards & stats ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); }
.stat-n { font-size: 44px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-weight: 500; }
.stat-alert { border-color: var(--red); box-shadow: inset 4px 0 0 var(--red), var(--shadow); }
.stat-alert .stat-n { color: var(--red); }
.estado-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.estado-link { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; background: var(--bg); }
.estado-link:hover { border-color: var(--text); }
.estado-n { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }

/* ---------- badges ---------- */
.badge { --b: #7A7367; display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 650; line-height: 1.6; white-space: nowrap;
  background: color-mix(in srgb, var(--b) 16%, transparent); color: color-mix(in srgb, var(--b) 78%, var(--text)); }
.badge-nuevo { --b: #7A7367; }
.badge-candidato { --b: #3E6FB0; }
.badge-agendar { --b: #B7791F; }
.badge-entrevistado { --b: #0F8B8D; }
.badge-finalista { --b: #6B4FBB; }
.badge-contratar { --b: #2E8B57; }
.badge-descartado { --b: #A33A3A; }
.badge-fuerte { --b: #2E8B57; }
.badge-intermedio { --b: #B7791F; }
.badge-debil { --b: #A33A3A; }
.badge-abierta { --b: #2E8B57; }
.badge-pausada { --b: #B7791F; }
.badge-cerrada { --b: #7A7367; }
.badge-resuelta { --b: #2E8B57; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); background: var(--surface); border: 1px solid color-mix(in srgb, var(--text) 28%, var(--line)); border-radius: 8px; padding: 10px 12px; min-height: 44px; width: 100%; }
textarea { resize: vertical; min-height: 88px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
:disabled { opacity: .55; cursor: progress; }
.btn { font: inherit; font-weight: 650; min-height: 44px; padding: 0 20px; border-radius: 8px; border: 1px solid var(--text); background: transparent; color: var(--text); cursor: pointer; }
.btn:hover:not(:disabled) { background: var(--text); color: var(--bg); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn-primary:hover:not(:disabled) { background: color-mix(in srgb, var(--accent) 85%, #000); border-color: color-mix(in srgb, var(--accent) 85%, #000); color: #fff; }
.filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.6fr) auto; gap: 14px; align-items: end; background: var(--surface); border: 1px solid var(--line); padding: 18px; border-radius: var(--radius); }
.filters .grow { min-width: 0; }
.chips { display: flex; gap: 8px; margin: 16px 0 4px; }
.chip { font: inherit; font-weight: 600; min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; }
.chip:hover { border-color: var(--text); }
.chip-on { background: var(--ink); color: var(--cream); border-color: var(--ink); }
@media (prefers-color-scheme: dark) { .chip-on { background: var(--cream); color: var(--ink); border-color: var(--cream); } }
.count { color: var(--muted); margin: 8px 0 14px; font-size: 14px; }
.stack-form, .grid-form { display: grid; gap: 14px; }
.grid-form { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); align-items: end; }
.grid-form .wide { grid-column: 1 / -1; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }

/* ---------- tables ---------- */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table.grid { width: 100%; border-collapse: collapse; }
.grid th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 14px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.grid th.num { text-align: right; }
.grid td { padding: 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.grid tfoot td { border-top: 2px solid var(--text); border-bottom: 0; background: var(--surface-2); }
.foot-label { text-align: right; font-weight: 650; }
.name { font-weight: 700; font-size: 16px; }
a.name { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.sub { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; word-break: break-all; }
.reason { max-width: 34ch; color: color-mix(in srgb, var(--text) 82%, var(--muted)); }
.is-discarded td { opacity: .78; }
.is-discarded .name { font-weight: 600; }
.estado-select { min-height: 40px; padding: 6px 30px 6px 12px; font-weight: 650; width: auto; min-width: 150px; border-left-width: 4px; }
.estado-nuevo { border-left-color: #7A7367; } .estado-candidato { border-left-color: #3E6FB0; } .estado-agendar { border-left-color: #B7791F; }
.estado-entrevistado { border-left-color: #0F8B8D; } .estado-finalista { border-left-color: #6B4FBB; } .estado-contratar { border-left-color: #2E8B57; } .estado-descartado { border-left-color: #A33A3A; }
.links a { white-space: nowrap; }

/* ---------- notes / decisions ---------- */
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.notes li { border-left: 3px solid var(--line); padding-left: 14px; }
.note-head { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; }
.note-head .muted { font-size: 13px; }
.decisions { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 12px; }
.decision { display: flex; justify-content: space-between; align-items: center; gap: 20px; background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--red); border-radius: var(--radius); padding: 18px 20px; }
.decision-done { border-left-color: var(--line); opacity: .85; }
.decision-main { min-width: 0; display: grid; gap: 4px; }
.resolve { display: flex; gap: 10px; flex: 0 1 460px; }
.resolve input { flex: 1; min-width: 0; }
.main section > h2 { margin-top: 8px; }

/* ---------- empty states ---------- */
.empty { text-align: center; padding: 56px 24px; border: 1.5px dashed var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.empty-title { font-weight: 700; font-size: 18px; margin-bottom: 4px; }
.empty-error { border-color: var(--red); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 10px; z-index: 40; max-width: min(420px, calc(100vw - 40px)); }
.toast { padding: 13px 16px; border-radius: 8px; background: var(--ink); color: var(--cream); font-weight: 550; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5); border-left: 4px solid #2E8B57; transition: opacity .35s, transform .35s; }
.toast-error { border-left-color: var(--red); background: #2A0A0E; color: #FFE9EB; }
.toast-out { opacity: 0; transform: translateY(8px); }
@media (prefers-color-scheme: dark) { .toast { background: var(--cream); color: var(--ink); } .toast-error { background: #FFE9EB; color: #4A0A12; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .grow, .filters .btn { grid-column: 1 / -1; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 14px; gap: 14px; overflow-x: auto; }
  .brand { flex: none; padding: 0; }
  .brand-text { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { flex: none; padding: 10px 14px; border-left: 0; border-bottom: 3px solid transparent; border-radius: 6px; }
  .nav a[aria-current="page"] { border-bottom-color: var(--red); }
  .main { padding: 24px 16px 56px; }
  .view-head { margin-bottom: 20px; }
  .decision { flex-direction: column; align-items: stretch; }
  .resolve { flex: none; flex-direction: column; }
  .filters { grid-template-columns: 1fr; padding: 14px; }
  .stat-n { font-size: 36px; }

  /* tables become stacked cards */
  .table-wrap { background: none; border: 0; box-shadow: none; overflow: visible; }
  .grid, .grid tbody, .grid tfoot, .grid tr, .grid td { display: block; width: 100%; }
  .grid thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .grid tbody tr, .grid tfoot tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
  .grid td { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; padding: 8px 0; border: 0; text-align: left; align-items: center; }
  .grid td.num { text-align: left; }
  .grid td::before { content: attr(data-label); font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
  .grid td:first-child { grid-template-columns: 1fr; padding-top: 0; padding-bottom: 10px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
  .grid td:first-child::before { display: none; }
  .grid tfoot tr { background: var(--surface-2); }
  .grid tfoot td { display: flex; justify-content: space-between; border: 0; background: none; padding: 0; }
  .grid tfoot td:empty { display: none; }
  .foot-label { text-align: left; }
  .reason { max-width: none; }
  .estado-select { width: 100%; }
  .grid tbody tr:hover { background: var(--surface); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.noscript { padding: 1rem; }
