/* E2D Prospector panel: one small design system (P56-6). Variables, light and dark by
   prefers-color-scheme, system fonts, no external resources. */
:root {
  --bg: #f4f5f9; --surface: #ffffff; --surface-2: #f8f9fc; --fg: #1b1e2b; --muted: #636a7c;
  --line: #e1e4ed; --brand: #4338ca; --brand-fg: #ffffff; --brand-soft: #eceafd;
  --ok: #15803d; --ok-soft: #e3f6ea; --warn: #a15c00; --warn-soft: #fdf1d9;
  --bad: #b42318; --bad-soft: #fde8e6; --info: #0e6ba8; --info-soft: #e2f1fb;
  --shadow: 0 1px 2px rgba(20, 24, 45, .06), 0 4px 14px rgba(20, 24, 45, .05);
  --radius: .75rem; --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117; --surface: #181b25; --surface-2: #1d2130; --fg: #e8eaf2; --muted: #98a0b4;
    --line: #2a2f42; --brand: #8b93ff; --brand-fg: #0f1117; --brand-soft: #23264a;
    --ok: #4ade80; --ok-soft: #12301f; --warn: #fbbf24; --warn-soft: #33270b;
    --bad: #f87171; --bad-soft: #3a1714; --info: #5cc0f5; --info-soft: #11293a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--fg); background: var(--bg); }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .05rem .3rem; border-radius: .3rem; }

/* header and navigation */
header.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { max-width: 74rem; margin: 0 auto; padding: .6rem 1rem; display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; }
.brand { font-weight: 800; letter-spacing: -.01em; color: var(--fg); display: flex; align-items: center; gap: .5rem; }
.brand::before { content: ""; width: 1.1rem; height: 1.1rem; border-radius: .35rem; background: linear-gradient(135deg, var(--brand), #14b8a6); }
.brand:hover { text-decoration: none; }
nav.main { display: flex; gap: .25rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
nav.main a { color: var(--muted); padding: .35rem .7rem; border-radius: 2rem; white-space: nowrap; font-weight: 500; }
nav.main a:hover { background: var(--surface-2); text-decoration: none; color: var(--fg); }
nav.main a.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
nav.sub { max-width: 74rem; margin: 0 auto; padding: 0 1rem .5rem; display: flex; gap: .25rem; overflow-x: auto; }
nav.sub a { color: var(--muted); padding: .2rem .65rem; border-radius: .4rem; font-size: .9rem; white-space: nowrap; }
nav.sub a.active { color: var(--fg); background: var(--surface-2); font-weight: 600; }
.banner-test { background: var(--bad); color: #fff; text-align: center; font-weight: 700; padding: .4rem 1rem; letter-spacing: .04em; font-size: .85rem; }
main { max-width: 74rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

/* typography */
h1 { font-size: 1.65rem; line-height: 1.2; margin: .25rem 0 .35rem; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 0 0 .4rem; }
.lead { color: var(--muted); margin: 0 0 1.25rem; max-width: 46rem; }
.muted { color: var(--muted); } .small { font-size: .85rem; }
.ok { color: var(--ok); } .warn { color: var(--warn); } .error { color: var(--bad); }
.num { font-variant-numeric: tabular-nums; }
.back { display: inline-block; margin-bottom: .5rem; font-size: .9rem; }

/* cards, tiles, grids */
.card, section.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.card > :first-child { margin-top: 0; } .card > :last-child { margin-bottom: 0; }
div.error { background: var(--bad-soft); border: 1px solid var(--bad); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; color: var(--fg); }
.flash { background: var(--info-soft); border: 1px solid var(--info); border-radius: var(--radius); padding: .6rem 1rem; margin: 0 0 1rem; }
.alert { border-radius: var(--radius); padding: .7rem 1rem; margin-bottom: 1rem; border: 1px solid var(--warn); background: var(--warn-soft); }
.alert.bad { border-color: var(--bad); background: var(--bad-soft); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.tiles { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); margin-bottom: 1.25rem; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; box-shadow: var(--shadow); }
.tile .v { font-size: 1.85rem; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .v small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.tile .k { color: var(--muted); font-size: .82rem; margin-top: .2rem; }
.tile.hot { border-color: var(--warn); background: var(--warn-soft); }
a.tile { color: inherit; display: block; } a.tile:hover { border-color: var(--brand); text-decoration: none; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.facts dt { color: var(--muted); } dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* chips */
.chip, .tag { display: inline-block; font-size: .76rem; font-weight: 600; line-height: 1.5; padding: 0 .55rem; border-radius: 2rem; white-space: nowrap;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.chip.c-ok, .tag.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.c-run, .tag.run { background: var(--info-soft); color: var(--info); border-color: transparent; }
.chip.c-warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.c-bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.c-brand { background: var(--brand-soft); color: var(--brand); border-color: transparent; }
.chip.c-run::before { content: ""; display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; background: currentColor; margin-right: .35rem; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .chip.c-run::before { animation: none; } }

/* progress bars and CSS bar charts */
.bar { height: .6rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: 1rem; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), #14b8a6); border-radius: 1rem; min-width: 2px; }
.bar.done > span { background: var(--ok); }
.progress-row { display: flex; align-items: center; gap: .75rem; }
.progress-row .bar { flex: 1; } .progress-row b { min-width: 2.8rem; text-align: right; font-variant-numeric: tabular-nums; }
.hbars { display: grid; grid-template-columns: minmax(7rem, 14rem) 1fr 3.2rem; gap: .35rem .75rem; align-items: center; font-size: .9rem; }
.hbars .bar { height: .7rem; } .hbars .n { text-align: right; font-variant-numeric: tabular-nums; }
.hbars .bar.bad > span { background: var(--bad); opacity: .75; }

/* stage list */
ol.stages { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
ol.stages li { display: grid; grid-template-columns: 1.4rem 1fr auto; gap: .5rem; padding: .3rem .1rem; align-items: baseline; border-bottom: 1px dashed var(--line); }
ol.stages li:last-child { border-bottom: 0; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; border: 2px solid var(--line); display: inline-block; vertical-align: -.1rem; }
.dot.done { background: var(--ok); border-color: var(--ok); } .dot.running { border-color: var(--info); background: var(--info-soft); }
.dot.failed { background: var(--bad); border-color: var(--bad); }

/* tables */
.tablewrap { overflow: auto; max-height: 75vh; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 1rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; z-index: 1; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; } tbody tr:hover td { background: var(--surface-2); }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap table { margin: 0; }

/* forms and buttons */
.stack { display: flex; flex-direction: column; gap: .75rem; } .narrow { max-width: 28rem; }
label { display: flex; flex-direction: column; gap: .25rem; font-size: .88rem; color: var(--muted); font-weight: 500; }
input, textarea, select { font: inherit; color: var(--fg); background: var(--surface); padding: .5rem .65rem; border: 1px solid var(--line); border-radius: .5rem; width: 100%; }
input:focus-visible, textarea:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; gap: .75rem; }
button, a.button { font: inherit; font-weight: 600; padding: .5rem 1rem; border: 1px solid transparent; border-radius: .55rem; background: var(--brand); color: var(--brand-fg); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, a.button:hover { filter: brightness(1.08); text-decoration: none; }
button.secondary, a.button.secondary { background: var(--surface); color: var(--brand); border-color: var(--line); }
button.danger { background: var(--bad); color: #fff; }
button.link { background: none; color: var(--muted); padding: 0; border: 0; font-weight: 500; }
button.link:hover { color: var(--fg); text-decoration: underline; filter: none; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
form.inline { display: inline; }
.filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 1rem; }
.filters a { padding: .2rem .7rem; border-radius: 2rem; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: .85rem; }
.filters a.active { background: var(--brand); border-color: var(--brand); color: var(--brand-fg); }
.filters a:hover { text-decoration: none; border-color: var(--brand); }
.filters .count { opacity: .7; margin-left: .25rem; }

/* images and emails */
.shots { display: flex; flex-wrap: wrap; gap: .75rem; }
.shots figure { margin: 0; max-width: 16rem; } .shots figcaption { color: var(--muted); font-size: .8rem; }
.shots img { max-width: 100%; max-height: 22rem; border: 1px solid var(--line); border-radius: .5rem; background: #fff; display: block; }
.msg iframe { width: 100%; min-height: 24rem; border: 1px solid var(--line); border-radius: .5rem; background: #fff; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

/* a checkbox or radio sits in a row, left of its label: the generic `label` stacks a caption
   over a field, which is right for text inputs and wrong for these */
input[type="checkbox"], input[type="radio"] { width: 1.15rem; height: 1.15rem; padding: 0; margin: .15rem 0 0; flex: none; accent-color: var(--brand); }
label.check, label.choice, label.prov { flex-direction: row; align-items: flex-start; gap: .6rem; color: var(--fg); font-size: 1rem; font-weight: 400; cursor: pointer; }
label.check > span, label.choice > span { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
label.check small, label.choice small { color: var(--muted); font-size: .84rem; }
label small { color: var(--muted); font-size: .8rem; font-weight: 400; }
.choice-row { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .9rem; }
label.choice { flex: 1 1 14rem; border: 1px solid var(--line); border-radius: .6rem; padding: .65rem .8rem; background: var(--surface-2); }
label.choice:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
label.check { padding: .15rem 0; }
[hidden] { display: none !important; }

/* province picker: search box, count and the checkboxes grouped by initial */
.provinces { border: 1px solid var(--line); border-radius: .6rem; background: var(--surface-2); }
.prov-tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem; border-bottom: 1px solid var(--line); }
.prov-tools input[type="search"] { flex: 1 1 12rem; width: auto; }
.prov-scroll { max-height: 18rem; overflow: auto; padding: .25rem .8rem .75rem; }
.prov-group h4 { margin: .7rem 0 .25rem; font-size: .8rem; color: var(--brand); letter-spacing: .06em; }
.prov-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: .1rem .75rem; }
label.prov { font-size: .92rem; align-items: center; padding: .12rem 0; }
.dim { opacity: .4; pointer-events: none; }
button.small { padding: .25rem .65rem; font-size: .85rem; }

/* «Nueva prospección» and «Configuración» forms */
.newrun-grid { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1rem; align-items: start; }
.newrun-side { position: sticky; top: 5rem; }
.fields3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: .9rem; }
.hint { color: var(--muted); font-size: .85rem; margin: .6rem 0 0; }
.hint.warn { color: var(--warn); font-weight: 600; }
.card > label + label, .card > .fields3 + label, .card > .hint + label { margin-top: .9rem; }
button.big { width: 100%; padding: .75rem 1rem; font-size: 1.05rem; margin-top: .4rem; }
button.big-inline { padding: .65rem 1.4rem; font-size: 1rem; }
ul.plain, ul.plain-list { list-style: none; margin: .3rem 0 0; padding: 0; }
ul.plain-list { margin-bottom: .4rem; }
.cfgform .card { margin-bottom: .85rem; }
.cfg-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); align-items: start; }
.cfg-grid dl.facts { grid-template-columns: 10rem 1fr; }

/* a row of «Problemas» and of the actions: text on the left, the button on the right */
.row-card { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: center; justify-content: space-between; }
.row-main { flex: 1 1 20rem; min-width: 0; }
.row-act { flex: none; }
.contact-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; flex: 1 1 28rem; }
.contact-form label { flex: 1 1 13rem; }
.action-card { display: flex; flex-direction: column; justify-content: space-between; gap: .6rem; }
.action-card p { margin: 0; }

/* the log of a launched process */
.logbox { max-height: 70vh; overflow: auto; display: flex; flex-direction: column-reverse; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface-2); margin-bottom: 1rem; }
pre.log { margin: 0; padding: .8rem 1rem; font: .8rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* the number on «Problemas» and the call to action of the navigation */
.badge { display: inline-block; min-width: 1.3rem; padding: 0 .4rem; border-radius: 1rem; background: var(--bad); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.35rem; margin-left: .15rem; }
nav.main a.cta { background: var(--brand); color: var(--brand-fg); font-weight: 650; }
nav.main a.cta:hover { filter: brightness(1.1); color: var(--brand-fg); }
nav.main a.cta.active { outline: 2px solid var(--brand-soft); outline-offset: 1px; }

/* login */
.login { max-width: 25rem; margin: 3rem auto; }

@media (max-width: 40rem) {
  main { padding: 1rem .75rem 2rem; }
  .top-in { padding: .5rem .75rem; gap: .5rem .75rem; }
  nav.main { order: 3; flex-basis: 100%; }
  h1 { font-size: 1.4rem; }
  .tile .v { font-size: 1.5rem; }
  dl.facts, .cfg-grid dl.facts { grid-template-columns: 1fr; gap: 0; } dl.facts dt { margin-top: .5rem; }
  .hbars { grid-template-columns: 1fr 2.8rem; } .hbars .bar { grid-column: 1 / -1; order: 3; }
  th, td { padding: .45rem .55rem; }
  .newrun-grid { grid-template-columns: 1fr; }
  .newrun-side { position: static; }
  .prov-list { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
}
