:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f1f0ec;
  --border: #e3e2dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #67665f;
  --accent: #1c5cab;
  --accent-soft: #e4eefb;
  --btn-bg: #1c5cab;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0ca30c;
  --good-ink: #006300;
  --warning: #fab219;
  --warning-ink: #8a5a00;
  --serious: #ec835a;
  --critical: #d03b3b;
  --critical-ink: #b42323;
  --neutral: #9a9992;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.04);
  --radius: 12px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Ubuntu, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #242422;
    --border: #33332f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #5598e7;
    --accent-soft: #15253a;
    --btn-bg: #245fae;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good-ink: #5fd35f;
    --warning-ink: #fab219;
    --critical-ink: #f07d7d;
    --shadow: none;
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #242422;
  --border: #33332f;
  --text: #f0efec;
  --text-2: #c3c2b7;
  --muted: #8f8e86;
  --accent: #5598e7;
  --accent-soft: #15253a;
  --btn-bg: #245fae;
  --series-1: #3987e5;
  --series-2: #d95926;
  --good-ink: #5fd35f;
  --warning-ink: #fab219;
  --critical-ink: #f07d7d;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
a { color: var(--accent); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- cabecera */
.top { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 24px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; flex-wrap: wrap; }
.brand { display: flex; gap: 9px; align-items: center; color: inherit; text-decoration: none; }
.brand h1 { font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; }
.sub { margin: 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; white-space: nowrap; }
.top-actions .sync { font-size: 12px; color: var(--muted); }
@media (max-width: 1500px) { .top-actions .clock { display: none; } }
.clock { font-variant-numeric: tabular-nums; color: var(--text-2); font-size: 13px; }
.sync { font-size: 12px; color: var(--muted); max-width: 320px; }
.sync .bar { height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 3px; width: 180px; }
.sync .bar i { display: block; height: 100%; background: var(--accent); transition: width .4s; }

.btn { background: var(--btn-bg); color: #fff; border: 0; border-radius: 8px; padding: 7px 12px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: progress; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border); font-weight: 500; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.icon { padding: 7px 10px; }
.btn.small { padding: 4px 9px; font-size: 12px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; }

/* ---------- KPIs */
/* accesos rápidos: chips con la cifra (como los atajos de categoría de los portales inmobiliarios) */
.kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 6px 12px; cursor: pointer; color: var(--text-2); font: inherit; font-size: 13px; white-space: nowrap; }
.kpi b { color: var(--text); font-variant-numeric: tabular-nums; margin-right: 2px; }
.kpi:hover { border-color: var(--accent); color: var(--text); }

/* ---------- pestañas */
.nav-top { flex: 1 1 auto; min-width: 0; display: flex; justify-content: center; }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: none; border: 0; border-radius: 999px; padding: 7px 13px; cursor: pointer; color: var(--text-2); font: inherit; font-weight: 500; font-size: 14px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); background: var(--surface-2); }
.tabs button.active { color: var(--accent); background: var(--accent-soft); }
.punto-vivo { width: 7px; height: 7px; border-radius: 50%; background: var(--critical); box-shadow: 0 0 0 3px color-mix(in srgb, var(--critical) 25%, transparent); }
.pill { background: var(--surface-2); border-radius: 10px; padding: 0 7px; font-size: 11px; }

/* ---------- layout */
.layout > * { min-width: 0; }
.only-mobile { display: none; }
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; padding: 16px 24px 40px; align-items: start; }
.filters { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.filters-head { display: flex; justify-content: space-between; margin-bottom: 10px; }
.field { display: block; margin-bottom: 12px; }
.field > span, .field label > span, .facet h4, .facet h3 { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.field input, .field select { min-width: 0; width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.field.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.facet { margin-bottom: 12px; }
.facet .opts { display: flex; flex-wrap: wrap; gap: 5px; }
.facet button { border: 1px solid var(--border); background: var(--bg); border-radius: 14px; padding: 3px 9px; cursor: pointer; font-size: 12px; display: inline-flex; gap: 5px; align-items: center; }
.facet button .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.facet button.on { background: var(--accent-soft); border-color: var(--accent); color: var(--text); font-weight: 600; }
.facet button.zero { opacity: .45; }
.checks label { display: flex; gap: 7px; align-items: center; margin: 5px 0; cursor: pointer; }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.count { color: var(--text-2); }
.count strong { color: var(--text); font-size: 16px; }
.tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sort select { margin-left: 6px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--surface); border: 0; padding: 6px 10px; cursor: pointer; }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
.active-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.active-chips button { border: 0; background: var(--accent-soft); color: var(--text); border-radius: 14px; padding: 3px 10px; cursor: pointer; font-size: 12px; }

/* ---------- tarjetas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(320px, calc((100% - 32px) / 3)), 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; cursor: pointer; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .media { height: 140px; overflow: hidden; background: var(--surface-2); position: relative; display: grid; place-items: center; color: var(--muted); font-size: 38px; }
.card .media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.card .media .tag { z-index: 1; position: absolute; top: 8px; left: 8px; }
.card .media .fav { z-index: 1; position: absolute; top: 6px; right: 6px; }
.card .body { padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card .ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.card h3 { font-size: 14px; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .loc { color: var(--text-2); font-size: 12.5px; }
.card .money { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; border-top: 1px solid var(--border); padding-top: 8px; margin-top: auto; }
.card .money div span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.card .money div b { font-variant-numeric: tabular-nums; font-size: 13px; }
.badges { display: flex; flex-wrap: wrap; gap: 5px; }
.foot-card { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 14px; background: var(--surface-2); font-size: 12.5px; }

.badge { display: inline-flex; align-items: center; gap: 4px; border-radius: 6px; padding: 2px 7px; font-size: 11.5px; font-weight: 600; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); white-space: nowrap; }
.badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; }
.badge.good { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.badge.warning { color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 60%, transparent); }
.badge.critical { color: var(--critical-ink); border-color: color-mix(in srgb, var(--critical) 50%, transparent); }
.badge.neutral { color: var(--text-2); }
.badge.info { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.badge.solid { background: var(--accent); color: #fff; border-color: var(--accent); }
.estado-EJ { background: #087a08; color: #fff; border-color: #087a08; }
.estado-PU { background: #1c5cab; color: #fff; border-color: #1c5cab; } /* fijo: el --accent del tema oscuro es claro y el blanco no contrasta */
.estado-SU { background: #fab219; color: #241a00; border-color: #fab219; }
.estado-PC, .estado-FS, .estado-CA, .estado-FL { background: var(--neutral); color: #fff; border-color: var(--neutral); }

.countdown { font-variant-numeric: tabular-nums; font-weight: 700; }
.countdown.soon { color: var(--warning-ink); }
.countdown.urgent { color: var(--critical-ink); animation: pulse 1.6s ease-in-out infinite; border-radius: 4px; padding: 0 3px; }
.countdown.done { color: var(--muted); font-weight: 500; }
@keyframes pulse { 50% { background: color-mix(in srgb, var(--critical) 18%, transparent); } }

.star { background: rgb(0 0 0 / .45); border: 0; color: #fff; border-radius: 50%; width: 30px; height: 30px; cursor: pointer; font-size: 16px; line-height: 1; }
.star.on { color: #fab219; }

/* ---------- tabla */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.data { border-collapse: collapse; width: 100%; font-size: 12.5px; }
table.data th, table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
table.data th { position: sticky; top: 0; background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-2); cursor: pointer; white-space: nowrap; }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data tbody tr { cursor: pointer; }
table.data tbody tr:hover { background: var(--accent-soft); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }

.more { text-align: center; padding: 18px; color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }

/* ---------- ficha */
dialog#detail { width: min(1080px, 96vw); max-height: 92vh; padding: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--bg); color: var(--text); }
dialog#detail::backdrop { background: rgb(0 0 0 / .45); backdrop-filter: blur(2px); }
.detail-inner { display: flex; flex-direction: column; }
.d-head { position: sticky; top: 0; background: var(--surface); border-bottom: 1px solid var(--border); padding: 16px 20px; z-index: 2; display: grid; grid-template-columns: 1fr auto; gap: 12px; }
.d-head h2 { font-size: 18px; margin: 4px 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.d-head .close { position: absolute; top: 10px; right: 12px; font-size: 22px; background: none; border: 0; cursor: pointer; color: var(--text-2); }
.d-cd { padding-right: 34px; }
.d-cd { text-align: right; }
.d-cd .countdown { font-size: 26px; display: block; }
.d-cd small { color: var(--muted); }
.d-body { padding: 16px 20px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; overflow-wrap: break-word; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.panel > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.stat span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat b { font-size: 17px; font-variant-numeric: tabular-nums; }
.stat small { color: var(--muted); display: block; }
dl.kv { display: grid; grid-template-columns: minmax(130px, 34%) 1fr; gap: 6px 14px; margin: 0; font-size: 13px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; white-space: pre-line; word-break: break-word; }
.refs { display: grid; gap: 6px; }
.ref-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; background: var(--surface-2); border-radius: 8px; }
.ref-row .k { font-size: 11px; color: var(--muted); text-transform: uppercase; min-width: 110px; }
.ref-row .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; flex: 1; word-break: break-all; }
.copy { background: none; border: 1px solid var(--border); border-radius: 6px; cursor: pointer; padding: 2px 7px; font-size: 11px; color: var(--text-2); }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.gallery a { flex: 0 0 auto; }
.gallery img { height: 120px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a { text-decoration: none; border: 1px solid var(--border); padding: 5px 10px; border-radius: 8px; font-size: 12.5px; background: var(--surface); color: var(--text); }
.links a:hover { border-color: var(--accent); color: var(--accent); }
.lote { border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin-top: 10px; }
.lote > header { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.bien { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 10px; }
.bien h4 { font-size: 14px; margin-bottom: 6px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.carga-box { border-left: 4px solid var(--neutral); padding: 8px 10px; background: var(--surface-2); border-radius: 0 8px 8px 0; margin: 8px 0; }
.carga-box.con { border-left-color: var(--critical); }
.carga-box.sin { border-left-color: var(--good); }
.carga-box.revisar { border-left-color: var(--warning); }
.aviso { background: var(--surface-2); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 6px; }
details.raw summary { cursor: pointer; color: var(--accent); font-size: 12.5px; margin-top: 8px; }
textarea.notes { width: 100%; min-height: 80px; border: 1px solid var(--border); border-radius: 8px; padding: 8px; background: var(--bg); resize: vertical; }
.check-list { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.check-list label { display: flex; gap: 7px; align-items: flex-start; cursor: pointer; }
.calc { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.calc input { width: 100%; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }
.timeline { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }

/* ---------- agenda */
.day { margin-bottom: 18px; }
.day > h3 { font-size: 14px; margin-bottom: 8px; display: flex; gap: 8px; align-items: baseline; position: sticky; top: 64px; background: var(--bg); padding: 6px 0; z-index: 1; }
.day > h3 small { color: var(--muted); font-weight: 400; }
.agenda-row { display: grid; grid-template-columns: 64px 120px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 6px; cursor: pointer; }
.agenda-row:hover { border-color: var(--accent); }
.agenda-row .t { font-variant-numeric: tabular-nums; font-weight: 700; }
.agenda-row .what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- estadísticas */
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.chart h3 { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); }
.chart .note { color: var(--muted); font-size: 12px; margin: -6px 0 10px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto; gap: 6px 10px; align-items: center; font-size: 12.5px; }
.hbar .lbl { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 14px; position: relative; cursor: pointer; padding: 2px 0; }
.hbar .track i { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.hbar .track:hover i { filter: brightness(1.15); }
.hbar .val { font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }
.cols-chart { display: flex; align-items: flex-end; gap: 2px; height: 160px; border-bottom: 1px solid var(--border); padding-top: 8px; }
.cols-chart .c { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; cursor: pointer; }
.cols-chart .c i { display: block; background: var(--series-1); border-radius: 4px 4px 0 0; min-height: 2px; }
.cols-chart .c:hover i { filter: brightness(1.15); }
.cols-axis { display: flex; gap: 2px; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.cols-axis span { flex: 1; text-align: center; overflow: hidden; white-space: nowrap; }

.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 8px; font-size: 12px; max-width: 280px; box-shadow: 0 4px 14px rgb(0 0 0 / .2); }
.toast { max-width: min(640px, 92vw); text-align: center; position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 9px 16px; border-radius: 10px; z-index: 200; font-size: 13px; }

.guia { max-width: 860px; }
.guia .panel { margin-bottom: 14px; }
.guia p, .guia li { color: var(--text-2); }
.guia h3 { text-transform: none !important; letter-spacing: 0 !important; font-size: 16px !important; color: var(--text) !important; }

.foot { padding: 20px 24px 30px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); }
.loading { padding: 60px; text-align: center; color: var(--muted); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 12px 16px 40px; }
  .only-mobile { display: inline-flex; }
  .filters { display: none; position: fixed; inset: 0; z-index: 50; max-height: none; border-radius: 0; overflow: auto; }
  .filters.open { display: block; }
  .top-actions { margin-left: auto; }
  .sync { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
  .sort select { max-width: 52vw; }
  /* la barra: marca y acciones arriba, pestañas debajo en una fila desplazable */
  .nav-top { order: 3; flex-basis: 100%; justify-content: flex-start; }
  .top { padding: 10px 16px; position: static; }
  .agenda-row { grid-template-columns: 54px 1fr auto; }
  .agenda-row .hide-sm { display: none; }
  .charts { grid-template-columns: 1fr; }
  .d-head { grid-template-columns: 1fr; }
  .d-cd { text-align: left; }
  .d-head h2 { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
  .d-cd .countdown { font-size: 20px; }
  dl.kv { grid-template-columns: 1fr; }
  dl.kv dt { margin-top: 6px; }
  .day > h3 { top: 0; }
}

.links a.primary { background: var(--btn-bg); color: #fff; border-color: var(--btn-bg); font-weight: 600; }
.links a.primary:hover { color: #fff; filter: brightness(1.08); }
.doclist { display: grid; gap: 6px; }
.doclist a { display: grid; grid-template-columns: 28px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; text-decoration: none; color: var(--text); background: var(--surface); }
.doclist a:hover { border-color: var(--accent); }
.doclist .ico { font-size: 20px; text-align: center; }
.doclist small { display: block; color: var(--muted); }
.anuncio-txt { margin-top: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 8px; font-size: 13px; }
.anuncio-txt p { margin: 4px 0; }
details.map iframe { width: 100%; height: 280px; border: 1px solid var(--border); border-radius: 8px; margin: 8px 0 4px; }
.panel > h3 .links { text-transform: none; letter-spacing: 0; }
.panel > h3 .links a { font-size: 11.5px; padding: 3px 8px; }
.foot-card a { color: var(--accent); text-decoration: none; font-weight: 600; }

.sesion { display: flex; gap: 6px; align-items: center; font-size: 12px; }
.ses { padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); white-space: nowrap; }
.ses.ok { color: var(--good-ink); border-color: color-mix(in srgb, var(--good) 45%, transparent); }
.ses.wait { color: var(--warning-ink); border-color: color-mix(in srgb, var(--warning) 60%, transparent); }
.ses.warn { color: var(--critical-ink); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 900px) { .sesion { width: 100%; flex-wrap: wrap; } }

.card .money small { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .puja-actual { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; background: var(--surface-2); border-radius: 8px; padding: 7px 10px; margin-top: auto; }
.card .puja-actual span { font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.card .puja-actual b { font-size: 16px; font-variant-numeric: tabular-nums; }
.card .puja-actual small { color: var(--text-2); font-size: 12px; }
.card .puja-actual.known { background: var(--accent-soft); }
.card .puja-actual.known b { color: var(--accent); font-size: 18px; }
.card .puja-actual.hidden b { color: var(--text-2); }
.card .puja-actual + .money { margin-top: 0; }
.cargas-line { display: flex; flex-direction: column; gap: 1px; border-left: 4px solid var(--neutral); background: var(--surface-2); border-radius: 0 8px 8px 0; padding: 5px 9px; font-size: 12px; }
.cargas-line b { font-size: 12.5px; }
.cargas-line span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cargas-line.sin { border-left-color: var(--good); } .cargas-line.sin b { color: var(--good-ink); }
.cargas-line.con { border-left-color: var(--critical); } .cargas-line.con b { color: var(--critical-ink); }
.cargas-line.revisar { border-left-color: var(--warning); } .cargas-line.revisar b { color: var(--warning-ink); }

.aviso-riesgo { border-left: 4px solid var(--warning); background: var(--surface-2); border-radius: 0 10px 10px 0; padding: 10px 14px; font-size: 13px; }

.novedades { margin: 10px 24px 0; padding: 10px 14px; border: 1px solid color-mix(in srgb, var(--warning) 60%, transparent); background: var(--surface); border-radius: var(--radius); font-size: 13px; }
.novedades > div { display: flex; justify-content: space-between; gap: 10px; }
.novedades ul { margin: 6px 0 0; padding-left: 18px; }
.novedades li { margin: 3px 0; }
@media (max-width: 900px) { .novedades { margin: 10px 16px 0; } }

#mapa { height: calc(100vh - 230px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }
.leaflet-popup-content .pop { font: 13px/1.45 system-ui, sans-serif; color: #0b0b0b; }
.leaflet-popup-content .pop .badge { margin-top: 4px; }

table.compare th:first-child, table.compare tbody th { position: sticky; left: 0; background: var(--surface-2); text-align: left; white-space: nowrap; }
table.compare td { min-width: 200px; }
table.compare tbody tr { cursor: default; }
table.compare tbody tr:hover { background: transparent; }

.nav-ficha { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin: 2px 0 6px; }

#busquedas { padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); max-width: 200px; }

#printArea { display: none; }
@media print {
  @page { margin: 14mm; }
  body.imprimiendo > *:not(#printArea) { display: none !important; }
  body.imprimiendo #printArea { display: block; }
  #printArea .d-head { position: static; display: block; border: 0; padding: 0 0 8px; }
  #printArea .d-body { padding: 0; }
  #printArea .panel { break-inside: auto; border-color: #ccc; }
  #printArea .panel > h3, #printArea .stat, #printArea .ref-row, #printArea .carga-box { break-inside: avoid; break-after: auto; }
  #printArea .panel > h3 { break-after: avoid; }
  #printArea .d-head h2 { display: block; -webkit-line-clamp: unset; overflow: visible; }
  #printArea .gallery img { height: 90px; }
  #printArea a { color: inherit; text-decoration: none; }
  #printArea .tablewrap { overflow: visible; border: 0; }
  #printArea table.compare { font-size: 10px; }
  #printArea table.compare td { min-width: 0; }
  .countdown { animation: none !important; }
}

.card .media .fuente-foto { position: absolute; bottom: 6px; right: 8px; font-size: 10px; background: rgb(0 0 0 / .55); color: #fff; padding: 1px 6px; border-radius: 6px; }

.docrow { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.analisis { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface-2); }
.analisis h4 { font-size: 13.5px; margin-bottom: 6px; }
.hallazgos { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 6px; font-size: 12.5px; }
.hallazgos mark { background: color-mix(in srgb, var(--warning) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 2px; }

kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }

.card .media .descartar { position: absolute; top: 42px; right: 6px; font-size: 13px; z-index: 1; opacity: .75; }
.card .media .descartar:hover { opacity: 1; }

.novedades .reinicio { margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }

.score { display: inline-block; min-width: 26px; text-align: center; font: 700 11px/18px system-ui, sans-serif; border-radius: 9px; padding: 0 6px; color: #fff; background: hsl(var(--h, 60) 70% 25%); cursor: help; }

.cambios { margin: 0; padding-left: 18px; display: grid; gap: 3px; font-size: 12.5px; }
.cambios .mono { color: var(--muted); }

.veh-filtros summary { cursor: pointer; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }

.barra-movil { display: none; }
@media (max-width: 900px) {
  .d-head { position: static; }
  .barra-movil { display: flex; gap: 8px; justify-content: space-between; position: sticky; bottom: 0; z-index: 3; background: var(--surface); border-top: 1px solid var(--border); padding: 8px 4px; margin: 0 -20px -24px; padding-left: 20px; padding-right: 20px; }
  .barra-movil .btn { flex: 1; text-align: center; text-decoration: none; }
}

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; max-width: 560px; margin: 0 0 18px; }
.cal > b { font-size: 11px; color: var(--muted); text-align: center; }
.cal-d { border: 1px solid var(--border); border-radius: 8px; background: color-mix(in srgb, var(--series-1) calc(var(--a) * 100%), var(--surface)); padding: 4px; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; cursor: pointer; color: var(--text); }
.cal-d:disabled { cursor: default; }
.cal-d span { font-size: 12px; }
.cal-d small { font-weight: 700; font-size: 11px; }
.cal-d.hoy { outline: 2px solid var(--accent); }
.cal-d.pasado, .cal-d.pasado.fuerte { background: var(--surface-2); color: var(--muted); }

.facet h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

.filtros-tit { font-size: 14px; margin: 0; }
.facet button:disabled { cursor: default; }

.cal-d.fuerte { color: #fff; background: color-mix(in srgb, var(--btn-bg) calc(var(--a) * 100%), #0d2a4f); }

@media (max-width: 600px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

.riesgos ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; }
.riesgos li { display: flex; gap: 8px; align-items: flex-start; }
.riesgos li.r-alto { font-weight: 600; }

.riesgos-mini { margin: 0; padding-left: 0; list-style: none; font-size: 12px; display: grid; gap: 3px; }

.directo { display: grid; gap: 8px; }
.directo-fila { display: grid; grid-template-columns: 170px minmax(0, 1fr) 150px 100px 200px; gap: 12px; align-items: center; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; cursor: pointer; }
.directo-fila:hover { border-color: var(--accent); }
.countdown-grande .countdown { font-size: 22px; }
@media (max-width: 900px) { .directo-fila { grid-template-columns: 1fr 1fr; } .directo-fila .what { grid-column: 1 / -1; order: -1; } .directo-fila .hide-sm { display: none; } }

#ordenFavs { margin-left: 8px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

.umbral { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 13px; }
.umbral input { width: 130px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); }

.chk-inline { display: inline-flex; gap: 5px; align-items: center; font-size: 13px; margin-left: 6px; cursor: pointer; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); text-decoration: underline; cursor: pointer; }
.btn[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 600; }
#mapaLista h3 { font-size: 14px; margin: 14px 0 8px; }
.mapa-lista { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; }
.mapa-lista li { display: flex; gap: 4px; }
.mapa-lista .ver-mapa { width: auto; flex: none; display: block; padding: 8px 6px; font-size: 16px; }
.mapa-lista button { width: 100%; text-align: left; display: grid; gap: 3px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.mapa-lista button:hover, .mapa-lista button:focus-visible { border-color: var(--accent); }
.leaflet-tooltip.precio-mapa { padding: 1px 5px; font-size: 11px; font-weight: 700; border-radius: 6px; background: var(--surface); color: var(--text); border-color: var(--border); box-shadow: 0 1px 3px rgb(0 0 0 / 25%); }
.leaflet-container:not(.zoom-alto) .precio-mapa { display: none; }
.leaflet-container .leaflet-control-attribution a { text-decoration: underline; }
@media (max-width: 700px) { .solo-ancho { display: none; } }
.solo-movil { display: none; }
@media (max-width: 700px) {
  .solo-movil { display: inline-flex; }
  .panel > h3 { flex-wrap: wrap; }
}
@media (max-width: 700px) {
  /* accesos rápidos en una fila desplazable */
  .kpis { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  /* tarjeta sin foto: franja baja en vez de un hueco de 140 px con un emoji */
  .card .media:not(:has(img)) { height: 80px; font-size: 28px; }
}
@media (max-width: 700px) {
  /* sesión y «Actualizar todo» en la misma línea (antes cada uno ocupaba la suya) */
  .top-actions .sesion { width: auto; }
  .top-actions .clock { width: 100%; }
}
@media (max-width: 600px) {
  /* agenda: la cuenta atrás pasa a su propia línea para que se lea la descripción */
  .agenda-row { grid-template-columns: 50px 1fr; row-gap: 2px; }
  .agenda-row > :last-child { grid-column: 2; justify-self: start; font-size: 12px; }
  /* eje de cierres por día: etiquetas sin recortar (cada 3 días hay sitio de sobra) */
  .cols-axis span { overflow: visible; font-size: 9.5px; }
}
#btnFiltersClose { margin-left: 10px; }
@media (max-width: 900px) {
  /* «Ver N resultados» siempre a mano mientras se recorren los filtros */
  .filters-head { position: sticky; top: -14px; z-index: 2; background: var(--surface); margin: -14px -14px 0; padding: 14px 14px 8px; }
}
/* mapa oscuro en el tema oscuro: solo las teselas (los puntos conservan sus colores) */
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .leaflet-tile-pane .capa-calles { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9); } }
:root[data-theme='dark'] .leaflet-tile-pane .capa-calles { filter: invert(1) hue-rotate(180deg) brightness(.95) contrast(.9); }
@media (max-width: 700px) {
  /* tabla en el móvil: fuera estado, puja mínima, depósito y tipo de pujas para que se vean valor, puja y cierre */
  table.data th:nth-child(3), table.data td:nth-child(3),
  table.data th:nth-child(8), table.data td:nth-child(8),
  table.data th:nth-child(9), table.data td:nth-child(9),
  table.data th:nth-child(11), table.data td:nth-child(11) { display: none; }
  table.data td:nth-child(2) a { font-size: 11px; }
}
.countdown-grande.texto .countdown { font-size: 15px; }
.txt-ok { color: var(--good-ink); }
.txt-warn { color: var(--warning-ink); }
.leaflet-container .cluster-neutro { background: rgb(28 92 171 / 30%); }
.leaflet-container .cluster-neutro div { background: rgb(28 92 171 / 88%); color: #fff; font-weight: 700; }

.veredicto { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 14px; }
.veredicto-col h4 { margin: 0 0 6px; font-size: 13px; }
.veredicto-col ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 5px; font-size: 13px; }
.veredicto-col li { display: flex; gap: 8px; align-items: flex-start; }
.veredicto-col li.r-alto { font-weight: 600; }
.panel.chart.ancho { grid-column: 1 / -1; }
.prov-tabla td.num, .prov-tabla th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
/* las tablas dentro de los paneles de estadísticas se desplazan en horizontal en vez de ensanchar la página */
.charts > * { min-width: 0; }
.panel.chart .tablewrap { overflow-x: auto; }
.encaje-form { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; font-size: 14px; }
.encaje-form select, .encaje-form input[type=number] { margin-left: 4px; }
.encaje-form input[type=number] { width: 120px; }
.leyenda-tasacion { background: var(--surface); color: var(--text); padding: 6px 8px; border-radius: 8px; font-size: 12px; box-shadow: 0 1px 4px rgb(0 0 0 / 25%); line-height: 1.5; }
.leyenda-tasacion i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 6px; vertical-align: -2px; }
#mapaLista h3 select { margin-left: 8px; font-size: 13px; font-weight: 400; }

/* Ficha a página completa y «Fichas de favoritas» */
.pagina-barra { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.detail-inner.pagina { background: var(--bg); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; }
.detail-inner.pagina .d-head { position: static; }
.detail-inner.pagina .d-head h2 { display: block; -webkit-line-clamp: unset; overflow: visible; font-size: 22px; }
.detail-inner.pagina .solo-flotante { display: none; }
#fichasBody .d-head .close { display: none; }
.d-cd .solo-flotante { margin-top: 6px; }
.card .media .a-pagina { position: absolute; top: 78px; right: 6px; font-size: 14px; z-index: 1; opacity: .75; }
.card .media .a-pagina:hover { opacity: 1; }
.fichas-fav { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: start; }
.fichas-lista { position: sticky; top: 8px; max-height: calc(100vh - 16px); overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.fichas-lista > p { margin: 0 0 4px; }
.fichas-lista button { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 10px; padding: 8px 10px; cursor: pointer; display: flex; flex-direction: column; gap: 3px; font: inherit; }
.fichas-lista button:hover { border-color: var(--accent, #1c5cab); }
.fichas-lista button.activa { border-color: var(--accent, #1c5cab); box-shadow: 0 0 0 2px var(--accent, #1c5cab) inset; }
.fichas-lista small { color: var(--text-2); }
.fichas-lista .fl-pie { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
@media (max-width: 900px) {
  .fichas-fav { grid-template-columns: 1fr; }
  .fichas-lista { position: static; max-height: 40vh; }
}
body.sin-filtros .layout { grid-template-columns: minmax(0, 1fr); }
body.sin-filtros .layout > .filters { display: none; }
/* en las fichas de favoritas, «1 / 27» sería la posición en Explorar: se pasa de una a otra con la lista */
#fichasBody .nav-ficha { display: none; }

@media (max-width: 900px) {
  .top { gap: 8px 12px; }
  .top-actions #btnRefresh { padding-inline: 10px; }
}
@media (max-width: 700px) {
  /* en el móvil, las acciones de la barra solo con su icono (el texto, en la ayuda) */
  .top .txt-largo { display: none; }
}

/* menú «⋯» de acciones secundarias */
.menu-mas { position: relative; }
.menu-mas > summary { list-style: none; cursor: pointer; min-width: 38px; justify-content: center; font-weight: 700; }
.menu-mas > summary::-webkit-details-marker { display: none; }
.menu-mas-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgb(0 0 0 / .12); padding: 8px; display: flex; flex-direction: column; gap: 6px; min-width: 220px; }
.menu-mas-panel .btn, .menu-mas-panel select { width: 100%; justify-content: flex-start; text-align: left; }
@media (max-width: 700px) { .toolbar .txt-largo { display: none; } }

/* grupos de filtros plegables (como los paneles de filtros de los portales): separadores finos y una flecha */
#filters details.facet, #filters details.grupo { border-top: 1px solid var(--border); padding: 10px 0 2px; margin: 0; }
#filters details.facet > summary, #filters details.grupo > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; padding-bottom: 8px; }
#filters details > summary::-webkit-details-marker { display: none; }
#filters details.facet > summary h3, #filters details.grupo > summary h3 { margin: 0; flex: 1; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); font-weight: 600; }
#filters details.facet > summary::after, #filters details.grupo > summary::after { content: ''; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); margin: -3px 4px 0 0; transition: transform .15s; }
#filters details[open].facet > summary::after, #filters details[open].grupo > summary::after { transform: rotate(-135deg); margin-top: 3px; }
#filters details > summary .pill { background: var(--accent); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 7px; line-height: 18px; }
#filters details.grupo > .field, #filters details.grupo > .checks, #filters details.grupo > details { margin-bottom: 10px; }
#filters details.facet .opts { padding-bottom: 8px; }

/* Tarjeta limpia (como las de los portales inmobiliarios): foto, valor destacado, título, una línea de datos,
   pocas etiquetas, la puja en una línea y el cierre al pie */
.card { box-shadow: none; transition: box-shadow .15s, border-color .15s, transform .15s; }
.card:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: 0 6px 24px rgb(0 0 0 / .08); transform: translateY(-1px); }
.card .media { height: 170px; }
.card .body { padding: 12px 16px 14px; gap: 6px; }
.card .ref { font-family: inherit; font-size: inherit; align-items: center; }
.card .precio { display: inline-flex; align-items: baseline; gap: 6px; color: var(--text); }
.card .precio b { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.card .precio small { font-size: 12px; color: var(--muted); }
.card h3 { font-size: 14.5px; line-height: 1.35; }
.card .loc { font-size: 13px; color: var(--text-2); }
.card .badges { gap: 5px; margin-top: 2px; }
.card .badges .badge { font-size: 11.5px; padding: 2px 8px; }
.card .puja-linea { margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--text-2); display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; }
.card .puja-linea .par { white-space: nowrap; }
.card .puja-linea .par > span { color: var(--muted); }
.card .puja-linea b { color: var(--text); font-size: 13.5px; }
.card .puja-linea b.known { color: var(--accent); }
.card .puja-linea .sep { color: var(--border); margin: 0 2px; }
.foot-card { background: transparent; border-top: 1px solid var(--border); padding: 9px 16px; color: var(--text-2); }
/* botones sobre la foto: la estrella marcada siempre; el resto, al pasar el ratón (en pantallas táctiles, siempre) */
@media (hover: hover) {
  .card .media .star:not(.on) { opacity: 0; transition: opacity .15s; }
  .card:hover .media .star:not(.on), .card:focus-within .media .star:not(.on) { opacity: .9; }
}
.card .media:not(:has(img)) { height: 96px; font-size: 30px; }

/* acciones de la ficha: a la vista las principales; el resto tras «⋯ Más acciones» */
.d-body > .links:not(.ver-todo) > .sec { display: none; }
.pill:empty { display: none; }

/* ---------- acceso: página de entrada y panel de cuenta/usuarios (login.html, admin.html) */
body.acceso { background: var(--bg); color: var(--text); margin: 0; min-height: 100vh; }
.acceso-caja { max-width: 360px; margin: 12vh auto 0; padding: 28px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); box-sizing: border-box; }
@media (max-width: 420px) { .acceso-caja { margin: 8vh 16px 0; } }
.acceso-marca { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.acceso-marca h1 { font-size: 20px; margin: 0; }
.acceso-entrar { width: 100%; padding: 10px; font-size: 15px; margin-top: 4px; }
.acceso-error { color: var(--critical-ink); font-size: 13px; margin: 0 0 10px; }
.acceso-ok { color: var(--good-ink); font-size: 13px; margin: 0 0 10px; }
.acceso-alterna { text-align: center; font-size: 13px; color: var(--muted); margin: 16px 0 0; }
.acceso-sub { font-size: 16px; margin: 0 0 6px; }
.acceso-nota { font-size: 13px; margin: 0 0 14px; }
button.enlace { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.rol-pendiente { color: var(--warning-ink); font-weight: 600; }
.admin-solicitud-nota { font-size: 12px; color: var(--muted); display: block; max-width: 320px; }
.acceso input { box-sizing: border-box; font: inherit; color: var(--text); }
.admin-main { max-width: 900px; margin: 0 auto; padding: 20px 16px 60px; display: grid; gap: 16px; }
.admin-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.admin-card h2 { font-size: 17px; margin: 0 0 14px; }
.admin-card h3 { font-size: 14px; margin: 18px 0 10px; }
.admin-form { max-width: 420px; }
.admin-form.fila { max-width: none; display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.admin-form.fila .field { flex: 1 1 180px; }
.admin-form .check { display: flex; gap: 6px; align-items: center; margin-bottom: 12px; font-size: 14px; }
.admin-check { display: flex; gap: 8px; align-items: center; margin: 12px 0; font-size: 14px; }
.admin-acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.admin-nota { font-size: 13px; margin: 4px 0 0; }
.admin-tabla-wrap { overflow-x: auto; }
.admin-tabla { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-tabla th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.admin-tabla td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.admin-botones { display: flex; flex-wrap: wrap; gap: 4px; justify-content: flex-end; }
.admin-agente { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn.peligro { color: var(--critical-ink); border-color: var(--critical); }
.aviso-acceso { margin: 0; padding: 10px 14px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--warning); color: var(--text); font-weight: 600; }
.aviso-txt { color: var(--warning-ink); }
body.admin .top { position: static; }
.acceso .muted { color: var(--muted); }
a.btn { text-decoration: none; display: inline-block; }
@media (max-width: 640px) { body.admin .top-actions { flex-wrap: wrap; white-space: normal; } body.admin #quien { width: 100%; } }

/* ---------- finalizadas: histórico con su propio mapa */
#mapaFin { height: calc(100vh - 290px); min-height: 420px; border-radius: var(--radius); border: 1px solid var(--border); }
.fin-res .kpi.activo { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.fin-tabla tr[data-id] { cursor: pointer; }
.fin-tabla td { vertical-align: top; }
.fin-tabla td.tnum { white-space: nowrap; }

/* Usuarios sin permiso de administrador: sin sesión del BOE, actualización general ni avisos del servidor */
body.no-admin #sesion,
body.no-admin #btnRefresh,
body.no-admin #btnProbarAviso,
body.no-admin .solo-admin { display: none !important; }
.sync .sin-sesion { color: var(--warning-ink); }
.sync [data-avisar-admin] { margin-left: 4px; white-space: nowrap; }
body.no-admin .sync { max-width: none; }
/* en el móvil los usuarios (sin «Actualizar» ni sesión del BOE) sí ven cuándo se actualizó y el aviso */
@media (max-width: 900px) {
  body.no-admin .top-actions { flex-wrap: wrap; row-gap: 6px; }
  body.no-admin .sync { display: block; order: 9; flex-basis: 100%; max-width: none; text-align: right; line-height: 1.6; white-space: normal; }
}
