/* Maps Scraper — "Calle de rótulos"
   Carril verde botella con filete de pan de oro, suelo crema de esmalte,
   rampa fija de 4 estados web. Una sola familia (Archivo), cifras tabulares. */

@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --shell: #16352b;
  --shell-hover: #1f4638;
  --shell-active: #285444;
  --on-shell: #f2ead7;
  --on-shell-2: #b8c9bf;
  --gold: #c9a227;
  --gold-ink: #16352b;

  --ground: #f2ead7;
  --paper: #fffaf0;
  --paper-2: #f7f0de;
  --line: #ddd1b5;
  --line-soft: #ebe2cb;
  --ink: #1b2620;
  --ink-2: #4a564f;
  --ink-3: #5f6a62;

  --s-shut: #34322e;   --s-shut-ink: #f2ead7;
  --s-weak: #d6982a;   --s-weak-ink: #2b1d03;
  --s-fair: #a4b493;   --s-fair-ink: #1b2620;
  --s-solid: #2f7350;  --s-solid-ink: #ffffff;
  --s-none: #e4dac3;   --s-none-ink: #4a564f;

  --run: #c9a227;
  --danger: #a3361f;
  --danger-bg: #f6e1d8;
  --ok: #2f7350;

  --radius: 4px;
  --shadow: 0 1px 2px rgb(22 53 43 / 0.06), 0 4px 14px rgb(22 53 43 / 0.06);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --shell: #0c211a;
    --shell-hover: #143027;
    --shell-active: #1c3d31;
    --on-shell: #ece4d0;
    --on-shell-2: #a9bab0;
    --gold: #d4b03c;
    --gold-ink: #0c211a;

    --ground: #101a16;
    --paper: #16231e;
    --paper-2: #1b2a24;
    --line: #2c3d35;
    --line-soft: #22312a;
    --ink: #ece4d0;
    --ink-2: #b9c2b8;
    --ink-3: #9aa59c;

    --s-shut: #4a4842;   --s-shut-ink: #f2ead7;
    --s-weak: #e0a73c;   --s-weak-ink: #241802;
    --s-fair: #8fa17e;   --s-fair-ink: #101a16;
    --s-solid: #4e9a70;  --s-solid-ink: #08130e;
    --s-none: #2a3a33;   --s-none-ink: #b9c2b8;

    --danger: #f0907a;
    --danger-bg: #3a1d16;
    --ok: #6cc093;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 4px 14px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

/* ---------- Base y superficies del navegador ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.45 "Archivo", system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  caret-color: var(--gold);
  scrollbar-color: var(--line) transparent;
}
::selection { background: var(--gold); color: var(--gold-ink); }
a { color: var(--shell); text-underline-offset: 3px; text-decoration-thickness: 1px; }
@media (prefers-color-scheme: dark) { a { color: var(--gold); } }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 2px; }
h1, h2 { margin: 0; text-wrap: balance; }
p { margin: 0; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type="checkbox"] { accent-color: var(--shell); width: 16px; height: 16px; }
@media (prefers-color-scheme: dark) { input[type="checkbox"] { accent-color: var(--gold); } }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }

.icon {
  width: 16px; height: 16px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- Estructura ---------- */
body.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.main { padding: 24px 32px 64px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Carril */
.rail {
  background: var(--shell); color: var(--on-shell);
  border-right: 3px solid var(--gold);
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px; padding: 22px 16px 16px;
}
.rail-top { display: flex; flex-direction: column; gap: 16px; }
.brand {
  display: block; color: inherit; text-decoration: none;
  font-weight: 800; font-stretch: 72%; font-size: 26px; line-height: 1;
  letter-spacing: 0.01em; text-transform: uppercase;
  padding-bottom: 14px; border-bottom: 1px solid rgb(201 162 39 / 0.45);
}
.brand span {
  display: block; margin-top: 6px;
  font-size: 12px; font-weight: 500; font-stretch: 100%;
  letter-spacing: 0.08em; color: var(--gold);
}
.rail-jobs { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.rail-jobs summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: default; }
.rail-jobs summary::-webkit-details-marker { display: none; }
.rail-jobs summary .chev { display: none; }
.rail-jobs h2 { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-shell-2); padding: 0 8px 8px; }
#job-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; scrollbar-color: var(--shell-active) transparent; }
.job-link {
  display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  color: var(--on-shell); text-decoration: none; font-size: 13.5px;
  transition: background-color 150ms var(--ease);
}
.job-link:hover { background: var(--shell-hover); }
.job-link.is-current { background: var(--shell-active); box-shadow: inset 0 0 0 1px rgb(201 162 39 / 0.55); }
.job-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-count { color: var(--on-shell-2); font-size: 12.5px; }
.job-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--on-shell-2); }
.job-dot[data-status="running"] { background: var(--run); animation: lamp 1.6s ease-in-out infinite; }
.job-dot[data-status="queued"] { background: transparent; box-shadow: inset 0 0 0 1.5px var(--on-shell-2); }
.job-dot[data-status="done"] { background: var(--on-shell); }
.job-dot[data-status="failed"] { background: #e8846c; }
.job-dot[data-status="cancelled"] { background: #6f8379; }
.rail-empty { color: var(--on-shell-2); font-size: 13px; padding: 4px 8px; }
.rail-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding-top: 12px; border-top: 1px solid rgb(201 162 39 / 0.3); color: var(--on-shell-2); font-size: 13px;
}
.rail-foot form { margin: 0; }
.link-btn {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 4px 6px;
  color: var(--on-shell); cursor: pointer; border-radius: var(--radius);
}
.link-btn:hover { background: var(--shell-hover); }

@keyframes lamp { 50% { opacity: 0.35; } }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-weight: 600; font-size: 13.5px; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--ease), border-color 150ms var(--ease);
}
.btn:hover { border-color: var(--ink-3); background: var(--paper-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-shell { background: var(--shell); border-color: var(--shell); color: var(--on-shell); }
.btn-shell:hover { background: var(--shell-hover); border-color: var(--shell-hover); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
.btn-gold:hover { background: #d8b43e; border-color: #d8b43e; }
.btn-quiet-danger { color: var(--danger); width: 36px; padding: 0; }
.btn-quiet-danger:hover { border-color: var(--danger); background: var(--danger-bg); }
.btn-block { width: 100%; }
@media (prefers-color-scheme: dark) {
  .btn-shell { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); }
  .btn-shell:hover { background: #e0bf52; border-color: #e0bf52; }
}

/* ---------- Cabecera de página ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; }
.page-head h1 {
  font-weight: 800; font-stretch: 74%; font-size: 38px; line-height: 1.02;
  text-transform: uppercase; letter-spacing: 0.005em; color: var(--shell);
}
@media (prefers-color-scheme: dark) { .page-head h1 { color: var(--on-shell); } }
.meta { margin-top: 8px; color: var(--ink-2); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.meta .mi:not(:last-child)::after { content: "·"; margin: 0 2px 0 6px; color: var(--ink-3); }
.meta .mi:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

.status {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 12px;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 2px 8px; border-radius: var(--radius);
  background: var(--paper-2); color: var(--ink-2); margin-right: 4px;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: currentColor; }
.status[data-status="running"] { background: #f4e3a6; color: #5a4300; }
.status[data-status="running"]::before { animation: lamp 1.6s ease-in-out infinite; }
.status[data-status="done"] { background: #d9eadf; color: #1f5139; }
.status[data-status="failed"] { background: var(--danger-bg); color: var(--danger); }
@media (prefers-color-scheme: dark) {
  .status[data-status="running"] { background: #3a3110; color: #f0d77a; }
  .status[data-status="done"] { background: #173528; color: #8fd3ad; }
}

.alert { background: var(--danger-bg); color: var(--danger); padding: 10px 14px; border-radius: var(--radius); font-weight: 500; }

/* ---------- Progreso y actividad ---------- */
.run { display: flex; flex-direction: column; gap: 10px; }
.progress { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--shell); transition: width 400ms var(--ease); }
.run[data-active="true"] #progress-bar { background: var(--gold); }
.activity, .terms { font-size: 13px; }
.activity summary, .terms summary { cursor: pointer; color: var(--ink-2); font-weight: 600; width: max-content; max-width: 100%; }
.activity summary .muted { font-weight: 400; margin-left: 6px; }
.log {
  margin: 8px 0 0; max-height: 180px; overflow: auto; padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius);
  font: 12.5px/1.55 ui-monospace, "Cascadia Mono", Consolas, monospace; white-space: pre-wrap; word-break: break-word;
  color: var(--ink-2);
}
.terms ol { margin: 6px 0 0; padding-left: 20px; color: var(--ink-2); columns: 2 240px; }

/* ---------- La calle (interacción firma) ---------- */
.street {
  position: relative;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow);
}
.street-tip {
  position: absolute; z-index: 3; pointer-events: none;
  transform: translate(-50%, calc(-100% - 8px));
  display: grid; gap: 4px; min-width: 180px; max-width: 280px;
  background: var(--shell); color: var(--on-shell); border-radius: var(--radius);
  padding: 8px 12px; box-shadow: 0 6px 20px rgb(0 0 0 / 0.22); font-size: 12.5px;
}
.street-tip strong {
  font-weight: 800; font-stretch: 74%; font-size: 15px; letter-spacing: 0.01em; text-transform: uppercase;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.street-tip span { display: flex; align-items: center; gap: 6px; color: var(--on-shell-2); }
.street-tip .swatch { box-shadow: inset 0 0 0 1px var(--on-shell-2); }
.street-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; list-style: none; cursor: pointer; }
.street-head::-webkit-details-marker { display: none; }
.street[open] > .street-head { margin-bottom: 12px; }
.street-head .chev { margin-left: auto; align-self: center; color: var(--ink-3); transition: transform 150ms var(--ease); }
.street:not([open]) > .street-head .chev { transform: rotate(-90deg); }
.street-head h2 { font-weight: 800; font-stretch: 74%; font-size: 22px; text-transform: uppercase; color: var(--shell); letter-spacing: 0.01em; }
@media (prefers-color-scheme: dark) { .street-head h2 { color: var(--on-shell); } }
.street-sub { color: var(--ink-2); font-size: 13px; }
.cells {
  display: grid; grid-template-columns: repeat(auto-fill, var(--cell-w, 11px)); gap: 3px 2px;
  padding-bottom: 3px; border-bottom: 3px solid var(--s-shut);
}
.cell {
  height: 30px; width: 100%; padding: 0; border: 0; cursor: pointer;
  border-radius: 2px 2px 0 0; background: var(--s-none);
  transition: transform 150ms var(--ease), filter 150ms var(--ease);
}
.cell:hover, .cell:focus-visible { transform: translateY(-3px); filter: brightness(1.08); }
.cell.shut { background: var(--s-shut); box-shadow: inset 0 -10px 0 -7px rgb(255 255 255 / 0.12), inset 0 -20px 0 -17px rgb(255 255 255 / 0.12); }
.cell.weak { background: var(--s-weak); }
.cell.fair { background: var(--s-fair); }
.cell.solid { background: var(--s-solid); }
.cell.none { background: var(--s-none); }
.cell.is-new { animation: light-up 600ms var(--ease) both; }
.cell.is-dim { opacity: 0.25; }
@keyframes light-up { from { background: var(--s-shut); transform: translateY(4px); } }
.street-empty { color: var(--ink-3); font-size: 13px; padding: 10px 0; }

.legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.seg {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  font-weight: 500; font-size: 13px; cursor: pointer; color: var(--ink);
  transition: border-color 150ms var(--ease), background-color 150ms var(--ease);
}
.seg:hover { border-color: var(--ink-3); }
.seg[aria-pressed="true"] { background: var(--shell); border-color: var(--shell); color: var(--on-shell); }
@media (prefers-color-scheme: dark) { .seg[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--gold-ink); } }
.seg b { font-weight: 700; }
.seg[aria-disabled="true"] { color: var(--ink-3); }
.seg[aria-disabled="true"] .swatch { opacity: 0.45; }
.swatch { width: 12px; height: 12px; border-radius: 2px; flex: none; }
.swatch.shut { background: var(--s-shut); } .swatch.weak { background: var(--s-weak); }
.swatch.fair { background: var(--s-fair); } .swatch.solid { background: var(--s-solid); }
.swatch.none { background: var(--s-none); box-shadow: inset 0 0 0 1px var(--line); }
.swatch.opp { background: linear-gradient(90deg, var(--s-shut) 50%, var(--s-weak) 50%); }

/* ---------- Filtros ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 10px; }
.search {
  display: flex; align-items: center; gap: 8px; flex: 1 1 280px; max-width: 420px;
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  color: var(--ink-3);
}
.search:focus-within { border-color: var(--shell); outline: 2px solid var(--gold); outline-offset: -1px; }
.search input { border: 0; background: transparent; outline: 0; flex: 1; min-width: 0; color: var(--ink); height: 100%; }
.search input::placeholder { color: var(--ink-3); }
.toolbar select, .field input, .field select, .field textarea {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.toolbar select:focus-visible, .field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--shell);
}
.toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; cursor: pointer; }
.count { margin-left: auto; color: var(--ink-2); font-size: 13px; }

/* ---------- Tabla ---------- */
.table-wrap { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.grid th {
  position: sticky; top: 0; z-index: 1; background: var(--paper);
  text-align: left; padding: 0; border-bottom: 2px solid var(--shell); white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2);
}
@media (prefers-color-scheme: dark) { .grid th { border-bottom-color: var(--gold); } }
.grid th:not(:has(button)) { padding: 10px 12px; }
.grid th > button {
  all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 4px; width: 100%; cursor: pointer;
  padding: 10px 12px;
}
.grid th > button:hover { color: var(--ink); }
.grid th > button:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.grid th > button[data-dir]::after { content: ""; width: 0; height: 0; border: 4px solid transparent; }
.grid th > button[data-dir="asc"]::after { border-bottom-color: currentColor; margin-top: -4px; }
.grid th > button[data-dir="desc"]::after { border-top-color: currentColor; margin-top: 4px; }
.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.grid tr.row { cursor: pointer; transition: background-color 120ms var(--ease); }
.grid tr.row:hover td { background: var(--paper-2); }
.grid tr.row.is-open td { background: var(--paper-2); border-bottom: 0; }
.grid tr.row.is-flash td { animation: flash 1.4s var(--ease); }
@keyframes flash { 0%, 30% { background: #f4e3a6; } }
@media (prefers-color-scheme: dark) { @keyframes flash { 0%, 30% { background: #3a3110; } } }
.name { font-weight: 600; color: var(--ink); }
.grid td.c-name { min-width: 210px; }
.sub { color: var(--ink-3); font-size: 12.5px; margin-top: 1px; }
.nowrap { white-space: nowrap; }
.clip { display: block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact .socials { margin-top: 4px; }

.badge {
  display: inline-block; font-size: 11.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px; white-space: nowrap;
}
.badge.shut { background: var(--s-shut); color: var(--s-shut-ink); }
.badge.weak { background: var(--s-weak); color: var(--s-weak-ink); }
.badge.fair { background: var(--s-fair); color: var(--s-fair-ink); }
.badge.solid { background: var(--s-solid); color: var(--s-solid-ink); }
.badge.none { background: var(--s-none); color: var(--s-none-ink); }

.score { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.webcell { white-space: nowrap; }
.score-bar { position: relative; width: 64px; height: 6px; background: var(--line-soft); border-radius: 1px; }
.score-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 1px; background: var(--shell); }
@media (prefers-color-scheme: dark) { .score-bar i { background: var(--on-shell-2); } }
.score b { font-weight: 600; min-width: 2ch; }
.c-issues { max-width: 260px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.chips .more { color: var(--ink-3); font-size: 12px; font-weight: 600; cursor: help; }
.socials { display: flex; gap: 6px; }
.socials a { font-size: 12px; font-weight: 700; text-decoration: none; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.socials a:hover { color: var(--shell); border-color: currentColor; }

/* Ficha desplegada */
.detail td { background: var(--paper-2); padding: 4px 12px 18px; border-top: 0; }
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.detail h3 { margin: 10px 0 8px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.checks { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.checks li { display: grid; grid-template-columns: 16px 110px minmax(0, 1fr); gap: 8px; align-items: start; }
.checks .icon { margin-top: 1px; }
.checks .yes { color: var(--ok); }
.checks .no { color: var(--danger); }
.checks .k { color: var(--ink-2); }
.checks .v { overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 6px 8px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.links .btn { height: 32px; font-size: 13px; }

.empty { padding: 36px 16px; text-align: center; color: var(--ink-2); display: grid; gap: 12px; justify-items: center; }

/* ---------- Formulario nueva búsqueda ---------- */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.new-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px 28px; max-width: 1080px; }
.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13.5px; }
.field em { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 6px; }
.field textarea { height: auto; min-height: 168px; padding: 10px 12px; line-height: 1.5; resize: vertical; }
.file-pick { display: flex; align-items: center; gap: 10px; min-width: 0; }
.file-pick input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; }
.file-name { color: var(--ink-2); font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field-terms { grid-row: span 2; }
.form-side { display: flex; flex-direction: column; gap: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { color: var(--ink-3); font-size: 12.5px; margin-top: -8px; }
.check { grid-column: 1 / -1; display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); }
.check input { margin-top: 2px; }
.check strong { color: var(--ink); }
.form-actions { grid-column: 1 / -1; }

/* ---------- Login ---------- */
body.login { min-height: 100vh; background: var(--shell); }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; border-top: 3px solid var(--gold); }
.login-card {
  width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 16px;
  background: var(--paper); color: var(--ink); border-radius: var(--radius); padding: 28px; box-shadow: 0 10px 40px rgb(0 0 0 / 0.25);
}
.brand-lg { color: var(--shell); border-bottom-color: var(--line); font-size: 34px; }
@media (prefers-color-scheme: dark) { .brand-lg { color: var(--on-shell); } }
.login-lead { color: var(--ink-2); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .detail-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; border-right: 0; border-bottom: 3px solid var(--gold); padding: 14px 16px; gap: 12px; }
  .rail-top { flex-direction: row; align-items: center; justify-content: space-between; }
  .brand { border: 0; padding: 0; font-size: 22px; }
  .brand span { display: none; }
  .rail-top .btn { width: auto; }
  .rail-jobs summary { cursor: pointer; }
  .rail-jobs summary .chev { display: block; color: var(--on-shell-2); }
  .rail-jobs h2 { padding: 0; }
  .rail-jobs[open] summary { margin-bottom: 8px; }
  #job-list { max-height: 40vh; }
  .rail-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .page-head h1 { font-size: 30px; }
  .new-form { grid-template-columns: 1fr; padding: 16px; }
  .field-terms { grid-row: auto; }
  .detail-grid { grid-template-columns: 1fr; gap: 8px; }
  .count { margin-left: 0; width: 100%; }
  .btn-label { display: none; }
  .actions .btn { padding: 0 12px; }
  .search { max-width: none; }
}

/* Móvil: cada negocio como ficha compacta */
@media (max-width: 700px) {
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  .grid thead { display: none; }
  .grid, .grid tbody { display: block; }
  .grid tr.row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px;
    background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 12px; margin-bottom: 8px;
  }
  .grid tr.row.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; margin-bottom: 0; }
  .grid td { display: block; padding: 0; border: 0; min-width: 0; }
  .grid td.c-name { min-width: 0; }
  .grid tr.row td.c-web { justify-self: end; text-align: right; }
  .grid tr.row td.c-web .score { justify-content: flex-end; }
  .grid tr.row td.c-platform { color: var(--ink-2); grid-column: 1 / -1; }
  .grid tr.row td.c-issues, .grid tr.row td.c-phone, .grid tr.row td.c-contact { grid-column: 1 / -1; max-width: none; }
  .grid tr.row td.c-lead { grid-column: 1 / -1; }
  .grid tr.row td.is-empty { display: none; }
  .clip { max-width: 100%; }
  .grid tr.row:hover td, .grid tr.row.is-open td { background: transparent; }
  .detail { display: block; background: var(--paper-2); border: 1px solid var(--line); border-top: 0; margin-bottom: 8px; border-radius: 0 0 var(--radius) var(--radius); }
  .detail td { display: block; background: transparent; padding: 4px 12px 14px; }
  .checks li { grid-template-columns: 16px 96px minmax(0, 1fr); }
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Resumen ---------- */
.overview {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); display: grid; gap: 18px;
}
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 8px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; align-items: flex-start; text-align: left;
  padding: 10px 12px; border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--paper-2);
  font: inherit; color: var(--ink);
}
button.kpi { cursor: pointer; transition: border-color 150ms var(--ease), background-color 150ms var(--ease); }
button.kpi:hover { border-color: var(--ink-3); }
button.kpi[aria-pressed="true"] { border-color: var(--shell); box-shadow: inset 0 0 0 1px var(--shell); }
@media (prefers-color-scheme: dark) { button.kpi[aria-pressed="true"] { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); } }
.kpi b { font-weight: 800; font-stretch: 74%; font-size: 28px; line-height: 1.05; letter-spacing: 0.005em; }
.kpi span { color: var(--ink-2); font-size: 12.5px; }
.kpi-accent b { color: var(--shell); }
@media (prefers-color-scheme: dark) { .kpi-accent b { color: var(--gold); } }
.overview-cols { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px 28px; }
.ov-block h3 { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-2); }
.ov-block h3 .muted { text-transform: none; letter-spacing: 0; font-weight: 400; margin-left: 4px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bar-row {
  all: unset; box-sizing: border-box; width: 100%; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(60px, 38%) 3ch; gap: 10px; align-items: center;
  padding: 4px 6px; border-radius: var(--radius); font-size: 13px;
}
.bar-row:hover { background: var(--paper-2); }
.bar-row:focus-visible { outline: 2px solid var(--gold); outline-offset: -2px; }
.bar-row[aria-pressed="true"] { background: var(--paper-2); box-shadow: inset 3px 0 0 var(--shell); font-weight: 600; }
@media (prefers-color-scheme: dark) { .bar-row[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--gold); } }
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 8px; background: var(--line-soft); border-radius: 1px; }
.bar-track i { position: absolute; inset: 0 auto 0 0; border-radius: 1px; background: var(--s-fair); }
.bar-row.sev-critical .bar-track i { background: var(--danger); }
.bar-row.sev-warning .bar-track i { background: var(--s-weak); }
.bar-row.sev-info .bar-track i { background: var(--ink-3); }
.bar-row b { font-weight: 600; text-align: right; }

/* ---------- Severidad de problemas ---------- */
.chip {
  display: inline-block; font-size: 11.5px; font-weight: 600; line-height: 1.35;
  padding: 2px 7px; border-radius: 3px; white-space: nowrap; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis;
  background: var(--paper-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line);
}
.chip.sev-critical { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
.chip.sev-warning { background: #f4e3a6; color: #5a4300; box-shadow: none; }
@media (prefers-color-scheme: dark) { .chip.sev-warning { background: #3a3110; color: #f0d77a; } }
.issue-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.issue-list li { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; align-items: start; }
.issue-list .chip { text-align: center; }
.all-checks summary { cursor: pointer; color: var(--ink-2); font-weight: 600; font-size: 13px; margin-bottom: 8px; width: max-content; }

/* ---------- Filtros activos y herramientas ---------- */
.toolbar-2 { margin-top: -2px; min-height: 30px; }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; flex: 1 1 auto; min-width: 0; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 10px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
}
.filter-chip .icon { width: 13px; height: 13px; color: var(--ink-3); }
.filter-chip:hover { border-color: var(--ink-3); }
.filter-chip:hover .icon { color: var(--danger); }
.filter-chip.sev-critical { background: var(--danger-bg); border-color: transparent; color: var(--danger); }
.filter-chip.sev-warning { background: #f4e3a6; border-color: transparent; color: #5a4300; }
@media (prefers-color-scheme: dark) { .filter-chip.sev-warning { background: #3a3110; color: #f0d77a; } }
.link-quiet { background: none; border: 0; padding: 4px; color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 12.5px; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; gap: 6px; }
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 4; min-width: 180px;
  display: grid; gap: 8px; padding: 10px 12px;
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.toolbar .count { margin-left: auto; }
.more-rows { padding: 14px; display: flex; justify-content: center; border-top: 1px solid var(--line-soft); }

/* Columnas ocultables */
.grid.hide-platform .c-platform, .grid.hide-issues .c-issues, .grid.hide-phone .c-phone,
.grid.hide-contact .c-contact, .grid.hide-lead .c-lead { display: none; }

/* ---------- Seguimiento comercial ---------- */
.lead-select {
  height: 30px; padding: 0 6px; max-width: 132px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
  font-size: 12.5px; font-weight: 600;
}
.lead-select[data-status="contactado"] { border-color: var(--s-fair); background: color-mix(in srgb, var(--s-fair) 22%, var(--paper)); }
.lead-select[data-status="interesado"] { border-color: var(--s-weak); background: color-mix(in srgb, var(--s-weak) 22%, var(--paper)); }
.lead-select[data-status="cliente"] { border-color: var(--s-solid); background: color-mix(in srgb, var(--s-solid) 20%, var(--paper)); }
.lead-select[data-status="descartado"] { color: var(--ink-3); text-decoration: line-through; }
.lead-box { display: grid; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.lead-row { display: flex; align-items: center; gap: 10px; color: var(--ink-2); }
.lead-row .lead-select { max-width: none; }
.lead-note {
  width: 100%; min-height: 64px; padding: 8px 10px; resize: vertical; line-height: 1.45;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper);
}
.lead-note:focus-visible, .lead-select:focus-visible { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--shell); }
.lead-box .btn { justify-self: start; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 10;
  max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; border-radius: var(--radius);
  background: var(--shell); color: var(--on-shell); box-shadow: 0 6px 20px rgb(0 0 0 / 0.25); font-size: 13.5px;
}
.toast.is-error { background: var(--danger); color: #fff; }

@media (max-width: 900px) {
  .overview-cols { grid-template-columns: 1fr; }
  .toolbar select { flex: 1 1 160px; min-width: 0; }
}
@media (max-width: 700px) {
  .overview { padding: 12px; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .kpi { padding: 8px; }
  .kpi b { font-size: 21px; }
  .kpi span { font-size: 11.5px; line-height: 1.25; }
  .street-sub { display: none; }
  .toolbar-2 .count { width: auto; margin-left: 0; order: -1; flex-basis: 100%; }
  .lead-select { max-width: none; width: 100%; }
  .issue-list li { grid-template-columns: 70px minmax(0, 1fr); }
  .more-rows { border: 0; }
}
