/* Licitamatic · verde de oficina con un acento lima para lo urgente y lo nuevo. */
:root {
  --bg: #F4F3EE; --card: #FFFFFF; --ink: #15191A; --muted: #646B6A; --line: #E2E0D8; --soft: #ECEAE2;
  --brand: #0E3B2E; --brand-2: #155A45; --lime: #C8F169; --ok: #1F7A55; --warn: #B4570B; --hot: #C2331F;
  --radius: 14px; --shadow: 0 1px 2px rgba(20,25,26,.05), 0 4px 18px rgba(20,25,26,.05);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1413; --card: #171D1C; --ink: #ECEFEC; --muted: #9AA3A0; --line: #26302D; --soft: #1D2523;
    --brand: #C8F169; --brand-2: #A9D94A; --lime: #0E3B2E; --ok: #6FD3A2; --warn: #F0A35A; --hot: #FF7A66;
    --shadow: none; color-scheme: dark;
  }
  .brand svg rect { fill: #C8F169; } .brand svg path, .brand svg circle { stroke: #0E3B2E; fill: #0E3B2E; } .brand svg path { fill: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 'Instrument Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
.num, .mono { font-family: var(--mono); font-size: .92em; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- barra superior ---------- */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -.02em; }
.pulso { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.pulso::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: latido 2.4s infinite; }
.pulso.mal::before { background: var(--hot); animation: none; }
@keyframes latido { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 55%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

main { max-width: 760px; margin: 0 auto; padding: 18px 16px 24px; outline: none; }
h1 { font-size: 26px; line-height: 1.15; letter-spacing: -.03em; margin: 4px 0 6px; }
h2 { font-size: 17px; letter-spacing: -.01em; margin: 26px 0 10px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- pestañas inferiores ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}
.tabs a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0;
  text-decoration: none; font-size: 11.5px; font-weight: 600; color: var(--muted); border-radius: 10px;
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--brand); }
.tabs a.on svg { fill: color-mix(in srgb, var(--brand) 14%, transparent); }

/* ---------- portada ---------- */
.hero { padding: 10px 0 4px; }
.hero h1 { font-size: clamp(30px, 8vw, 44px); }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 58%, var(--lime) 58%); padding: 0 2px; }
@media (prefers-color-scheme: dark) { .hero h1 em { background: none; color: var(--brand); } }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 18px 0 22px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.stat b { display: block; font-size: 22px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.pasos { display: grid; gap: 10px; margin: 6px 0 22px; padding: 0; list-style: none; counter-reset: p; }
.pasos li { counter-increment: p; display: flex; gap: 12px; align-items: flex-start; }
.pasos li::before { content: counter(p); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--brand); color: var(--bg); }

/* ---------- tarjetas y formularios ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.seg { display: flex; background: var(--soft); border-radius: 11px; padding: 3px; margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 9px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
label.f small { font-weight: 400; color: var(--muted); }
.in {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  outline: none; transition: border-color .15s, box-shadow .15s;
}
.in:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 18%, transparent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
  padding: 12px 18px; border-radius: 11px; background: var(--brand); color: var(--bg); font-weight: 650; text-decoration: none;
}
.btn.wide { width: 100%; }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.line { background: none; border: 1px solid var(--line); color: var(--ink); }
.btn.lime { background: var(--lime); color: #0E3B2E; }
.btn:disabled { opacity: .55; cursor: default; }
.err { color: var(--hot); font-size: 13.5px; margin: 6px 0 0; min-height: 1em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* ---------- lista de licitaciones ---------- */
.buscar { position: relative; margin: 2px 0 12px; }
.buscar input { padding-left: 38px; }
.buscar svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; }
.lista { display: grid; gap: 10px; }
.lic { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 14px 12px; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.lic:hover { border-color: color-mix(in srgb, var(--brand-2) 45%, var(--line)); }
.lic:active { transform: scale(.995); }
.lic .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.lic h3 { font-size: 14.5px; font-weight: 650; line-height: 1.35; margin: 0 0 8px; letter-spacing: 0; }
.lic .pie { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; font-size: 12.5px; color: var(--muted); }
.motivo { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; font-weight: 600; color: var(--ok); margin-top: 8px; }
.motivo::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; color: var(--ink); }
.chip.siglas { background: var(--brand); color: var(--bg); }
.chip.nueva { background: var(--lime); color: #0E3B2E; }
.reloj { font-weight: 650; color: var(--ink); }
.reloj.pronto { color: var(--warn); }
.reloj.ya { color: var(--hot); }
.vacio { text-align: center; padding: 36px 16px; color: var(--muted); }
.vacio b { display: block; color: var(--ink); font-size: 17px; margin-bottom: 6px; }
.mas { display: block; margin: 14px auto 0; }

/* ---------- detalle ---------- */
.volver { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); text-decoration: none; margin-bottom: 8px; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; font-size: 14px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.fechas { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.fechas li { display: grid; grid-template-columns: 14px 1fr auto; gap: 10px; align-items: start; padding: 7px 0; position: relative; font-size: 14px; }
.fechas li::before { content: ''; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); z-index: 1; }
.fechas li:not(:last-child)::after { content: ''; position: absolute; left: 6px; top: 22px; bottom: -8px; width: 2px; background: var(--line); }
.fechas li.pasada::before { background: var(--line); }
.fechas li.clave::before { border-color: var(--brand-2); background: var(--lime); }
.partidas { display: grid; gap: 8px; }
.partida { display: flex; gap: 10px; align-items: baseline; font-size: 14px; }
.partida .mono { color: var(--brand-2); font-weight: 500; }
.articulos { margin: 0; padding-left: 18px; font-size: 14px; columns: 2 240px; column-gap: 24px; }
.articulos li { break-inside: avoid; margin-bottom: 3px; }
.acciones { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 18px 0 4px; }

/* ---------- alertas ---------- */
.preview {
  position: sticky; top: 58px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--brand); color: var(--bg); border-radius: var(--radius); padding: 12px 14px; margin: 4px 0 16px;
}
.preview b { font-size: 20px; font-variant-numeric: tabular-nums; }
.preview .btn { background: var(--lime); color: #0E3B2E; padding: 9px 14px; }
@media (prefers-color-scheme: dark) { .preview .btn { background: #0E3B2E; color: var(--lime); } }
.caps { display: grid; gap: 8px; }
.cap { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cap > header { display: flex; align-items: center; gap: 10px; padding: 11px 12px; cursor: pointer; user-select: none; }
.cap > header .mono { color: var(--muted); }
.cap > header .t { flex: 1; font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.cap > header .n { font-size: 12px; color: var(--ok); font-weight: 650; white-space: nowrap; }
.cap > header .flecha { transition: rotate .2s; color: var(--muted); }
.cap.abierto > header .flecha { rotate: 90deg; }
.cap .cons { display: none; border-top: 1px solid var(--line); padding: 6px 12px 10px 40px; }
.cap.abierto .cons { display: grid; gap: 2px; }
.chk { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; font-size: 14px; cursor: pointer; }
.chk input { appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1.6px solid color-mix(in srgb, var(--muted) 70%, transparent); border-radius: 6px; display: grid; place-items: center; cursor: pointer; background: var(--card); }
.chk input:checked { background: var(--brand); border-color: var(--brand); }
.chk input:checked::after { content: ''; width: 10px; height: 6px; border: 2.2px solid var(--bg); border-top: 0; border-right: 0; rotate: -45deg; translate: 0 -1px; }
.chk input:indeterminate { background: var(--brand); border-color: var(--brand); }
.chk input:indeterminate::after { content: ''; width: 10px; height: 2.4px; background: var(--bg); border-radius: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips .x { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 10px; border-radius: 999px; background: var(--soft); font-size: 13px; }
.chips .x button { border: 0; background: none; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.chips .x button:hover { background: var(--line); color: var(--ink); }
.toggle-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.toggle-chips button { border: 1px solid var(--line); background: var(--card); padding: 6px 11px; border-radius: 999px; font-size: 13px; cursor: pointer; }
.toggle-chips button.on { background: var(--brand); color: var(--bg); border-color: var(--brand); }
.sugs { border: 1px solid var(--line); border-radius: 10px; margin-top: 6px; max-height: 260px; overflow: auto; background: var(--card); }
.sugs button { display: flex; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: none; padding: 9px 12px; font-size: 14px; cursor: pointer; }
.sugs button:last-child { border-bottom: 0; }
.sugs button:hover, .sugs button:focus { background: var(--soft); outline: none; }
.canal { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); }
.canal:first-child { border-top: 0; padding-top: 0; }
.canal .t { flex: 1; }
.canal .t b { display: block; font-size: 14.5px; }
.canal .t span { font-size: 13px; color: var(--muted); }
.switch { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 999px; background: var(--line); position: relative; cursor: pointer; transition: background .2s; margin: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: translate .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { translate: 18px 0; }
.aviso { background: color-mix(in srgb, var(--lime) 35%, var(--card)); border: 1px solid color-mix(in srgb, var(--brand-2) 25%, transparent); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin: 0 0 14px; }
@media (prefers-color-scheme: dark) { .aviso { background: color-mix(in srgb, var(--brand) 12%, var(--card)); } }

.toast {
  position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); translate: -50% 20px; opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
  transition: opacity .2s, translate .2s; max-width: calc(100% - 32px); z-index: 50;
}
.toast.on { opacity: 1; translate: -50% 0; }
.skel { height: 104px; border-radius: var(--radius); background: linear-gradient(90deg, var(--soft), var(--line), var(--soft)); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
