@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/barlow-semi-condensed-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Barlow Semi Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/fonts/barlow-semi-condensed-latin-500-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --red: #f20d0d;
  --red-solid: #d40c0c;
  --gold: #ffe500;
  --ink: #111111;
  --bg: #ffffff;
  --fg: oklch(0.2 0.02 260);
  --muted: oklch(0.52 0.015 260);
  --soft: oklch(0.975 0.003 260);
  --line: oklch(0.93 0.004 260);
  --line-strong: oklch(0.88 0.006 260);
  --up: oklch(0.6 0.13 155);
  --up-bg: oklch(0.965 0.03 155);
  --up-fg: oklch(0.45 0.11 155);
  --down: var(--red);
  --down-bg: oklch(0.96 0.03 27);
  --down-fg: oklch(0.5 0.2 27);
  --unknown: oklch(0.88 0.006 260);
  --unknown-bg: oklch(0.965 0.003 260);
  --unknown-fg: oklch(0.48 0.015 260);
  --focus: #f20d0d66;
  --radius: 12px;
  --sans: 'Barlow Semi Condensed', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}

:root[data-theme='dark'] {
    color-scheme: dark;
    --bg: #131313;
    --fg: oklch(0.96 0 0);
    --muted: oklch(0.72 0 0);
    --soft: oklch(0.2 0 0);
    --line: oklch(1 0 0 / 9%);
    --line-strong: oklch(1 0 0 / 16%);
    --up: oklch(0.68 0.13 155);
    --up-bg: oklch(0.68 0.13 155 / 14%);
    --up-fg: oklch(0.8 0.12 155);
    --down: #ff3b3b;
    --down-bg: oklch(0.65 0.2 27 / 16%);
    --down-fg: oklch(0.78 0.14 27);
    --unknown: oklch(0.36 0 0);
    --unknown-bg: oklch(1 0 0 / 7%);
    --unknown-fg: oklch(0.75 0 0);
    --focus: #ff3b3b88;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--sans);
  font-feature-settings: 'tnum' 0;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
h1, h2, p, dl, dd { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 60; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { top: 12px; }
.shell { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 640px) { .shell { padding: 0 24px; } }
.num { font-variant-numeric: tabular-nums; }

/* Marca */
.mark { display: block; background: currentColor; mask: url("/assets/icon.svg") center / contain no-repeat; color: var(--red); aspect-ratio: 1437 / 1548; }
.wordmark { font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; line-height: 1; }
.wordmark .t { color: var(--red); }

/* Cabecera */
.topbar { position: sticky; top: 0; z-index: 30; background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 64px; }
.logo { display: flex; align-items: center; gap: 12px; text-decoration: none; min-width: 0; }
.logo .mark { height: 38px; width: auto; }
.logo-text { display: flex; flex-direction: column; gap: 4px; }
.logo .wordmark { font-size: 22px; }
.sync { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.icon-button { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--bg); cursor: pointer; color: var(--fg); transition: background .15s; }
.icon-button:hover { background: var(--soft); }
.icon-button[aria-disabled='true'] svg { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 420px) {
  .logo .mark { height: 30px; }
  .logo .wordmark { font-size: 18px; }
  .updated { max-width: 9ch; font-size: 11px; text-align: center; }
}

/* Resumen */
.summary { display: grid; gap: 20px; padding: 28px 0 24px; border-bottom: 1px solid var(--line); }
@media (min-width: 860px) { .summary { grid-template-columns: 1fr auto; align-items: center; gap: 32px; padding: 36px 0 30px; } }
.summary-status { display: flex; align-items: flex-start; gap: 14px; }
.summary h1 { font-weight: 500; font-size: clamp(22px, 4vw, 30px); line-height: 1.15; letter-spacing: -0.005em; }
.summary-status p { color: var(--muted); margin-top: 4px; font-size: 14px; }
.status-dot { flex: none; width: 14px; height: 14px; margin-top: 8px; border-radius: 50%; background: var(--unknown); }
[data-state='up'] > .summary-status .status-dot { background: var(--up); }
[data-state='down'] > .summary-status .status-dot { background: var(--down); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.kpi { padding: 12px 16px; min-width: 0; }
.kpis .kpi + .kpi { border-left: 1px solid var(--line); }
.kpi dt { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi dd { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.25; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi small { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-lifetime { background: var(--soft); }
@media (max-width: 560px) {
  .kpi { padding: 10px 12px; }
  .kpi dd { font-size: 19px; }
  .kpi dt, .kpi small { font-size: 11px; }
}

/* Tablero */
.board { padding: 24px 0 8px; }
.board-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.board-head h2 { font-size: 15px; font-weight: 500; }
.filters { display: flex; gap: 8px; flex: 1; justify-content: flex-end; min-width: 0; }
.filters[hidden] { display: none; }
@media (max-width: 560px) { .filters { flex-basis: 100%; } .search-field { flex: 1 1 auto; } }
.search-field, .select-field { display: flex; align-items: center; height: 36px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--bg); }
.search-field { gap: 6px; padding: 0 12px; color: var(--muted); flex: 0 1 240px; min-width: 0; }
.search-field input { border: 0; background: none; outline: none; width: 100%; color: var(--fg); font-size: 14px; }
.select-field select { border: 0; background: none; height: 100%; padding: 0 12px; border-radius: 999px; font-size: 14px; cursor: pointer; }
.search-field:focus-within, .select-field:focus-within { outline: 3px solid var(--focus); outline-offset: 1px; }
.select-field select:focus-visible { outline: none; }

.table { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.cols, .row { display: grid; grid-template-columns: minmax(0, 1fr) 112px minmax(0, 330px) 132px 20px; align-items: center; gap: 20px; }
.cols { padding: 9px 16px; background: var(--soft); border-bottom: 1px solid var(--line); font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.cols .col-lifetime { text-align: right; }
.cols span:last-child { grid-column: span 2; }

.sites, .services { list-style: none; margin: 0; padding: 0; }
.sites > li + li { border-top: 1px solid var(--line); }
.site > summary { list-style: none; cursor: pointer; }
.site > summary::-webkit-details-marker { display: none; }
.row { padding: 14px 16px; transition: background .15s; }
.row:hover { background: color-mix(in oklab, var(--soft) 70%, transparent); }
.chev { width: 20px; height: 20px; color: var(--muted); transition: transform .2s; }
.site[open] > summary .chev { transform: rotate(90deg); }

.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.site-logo { position: relative; flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; overflow: hidden; font-size: 11px; font-weight: 500; color: var(--ink); }
.site-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 4px; background: #fff; }
.who-text { display: flex; flex-direction: column; min-width: 0; }
.who-text strong { font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lifetime { text-align: right; line-height: 1.2; }
.lifetime strong { display: block; font-size: 17px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.lifetime small { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.lifetime .label { display: none; }

.recent { min-width: 0; padding-left: 20px; border-left: 1px solid var(--line); }
.bars { display: grid; grid-template-columns: repeat(30, minmax(0, 1fr)); height: 34px; }
.bar { display: grid; justify-items: center; color: var(--unknown); }
.bar::before { content: ""; width: 3px; height: 23px; align-self: center; border-radius: 2px; background: currentColor; }
.bar[data-state='up'] { color: var(--up); }
.bar[data-state='down'] { color: var(--down); }
.bar:hover { opacity: .7; }
.axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.axis strong { color: var(--fg); font-weight: 500; }

.pill { justify-self: start; display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; background: var(--unknown-bg); color: var(--unknown-fg); }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill[data-state='up'] { background: var(--up-bg); color: var(--up-fg); }
.pill[data-state='down'] { background: var(--down-bg); color: var(--down-fg); }

/* Servicios dentro de una web */
.services { background: var(--soft); border-top: 1px solid var(--line); }
.services > li + li { border-top: 1px dashed var(--line-strong); }
.service { width: 100%; border: 0; background: none; text-align: left; cursor: pointer; }
.service .who { padding-left: 48px; }
.service .who-text strong { font-weight: 500; font-size: 14px; }
.service .lifetime strong { font-size: 15px; }
.service .bars { height: 28px; }
.service:hover { background: color-mix(in oklab, var(--bg) 60%, transparent); }
.service .chev { transform: none; }

.board-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; padding: 12px 2px; font-size: 12.5px; color: var(--muted); }
.legend { display: flex; gap: 14px; list-style: none; margin: 0; padding: 0; }
.legend li { display: flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 2px; background: var(--unknown); }
.swatch[data-state='up'] { background: var(--up); }
.swatch[data-state='down'] { background: var(--down); }
.empty, .notice { padding: 28px 16px; text-align: center; color: var(--muted); }
.notice { padding: 10px 16px; background: var(--down-bg); color: var(--down-fg); font-size: 13.5px; border-bottom: 1px solid var(--line); }

/* Móvil: el histórico y los 30 días quedan como dos bloques separados bajo el nombre */
@media (max-width: 820px) {
  .cols { display: none; }
  .row { grid-template-columns: minmax(0, 1fr) auto 16px; grid-template-areas: 'who state chev' 'life life life' 'recent recent recent'; gap: 10px 12px; }
  .row .who { grid-area: who; }
  .row .pill { grid-area: state; justify-self: end; }
  .row .chev { grid-area: chev; }
  .row .lifetime { grid-area: life; display: flex; align-items: baseline; gap: 8px; text-align: left; }
  .row .lifetime .label { display: inline; font-size: 12px; color: var(--muted); }
  .row .lifetime strong { display: inline; font-size: 15px; }
  .row .recent { grid-area: recent; padding: 0; border: 0; }
  .service .who { padding-left: 0; }
  .site-logo { width: 32px; height: 32px; }
}

/* Metodología */
.method { margin: 8px 0 40px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; color: var(--muted); }
.method summary { cursor: pointer; font-weight: 500; color: var(--fg); width: fit-content; }
.method ul { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 6px; max-width: 72ch; }
.method strong { color: var(--fg); font-weight: 500; }

/* Pie: como en OrientaT, rojo con el escudo en amarillo */
.footer { border-top: 2px dotted var(--line); }
.footer-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; padding-block: 24px; }
.footer-brand { display: flex; align-items: center; gap: 12px; }
.footer .mark { height: 36px; flex: none; color: inherit; }
.footer .wordmark { font-size: 24px; }
.footer .wordmark .t { color: inherit; }
.footer-note { margin-top: 4px; font-size: 14px; color: var(--muted); }
.footer-credit { color: inherit; font-size: 14px; text-underline-offset: 4px; }
.footer-credit:hover { color: var(--red); }

/* Detalle */
dialog { width: min(640px, calc(100% - 24px)); max-height: calc(100% - 32px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--fg); box-shadow: 0 24px 70px rgb(0 0 0 / 22%); }
dialog::backdrop { background: rgb(17 17 17 / 45%); backdrop-filter: blur(2px); }
.detail { position: relative; padding: 24px; display: grid; gap: 16px; }
@media (max-width: 480px) { .detail { padding: 18px 16px; } }
.close { position: absolute; top: 14px; right: 14px; font-size: 20px; line-height: 1; }
.detail h2 { font-weight: 500; font-size: 22px; line-height: 1.2; padding-right: 40px; }
.detail-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.detail-metrics .kpi + .kpi { border-left: 1px solid var(--line); }
.detail-metrics .kpi dd { font-size: 19px; }
@media (max-width: 480px) {
  .detail-metrics { grid-template-columns: 1fr 1fr; }
  .detail-metrics .kpi:last-child { grid-column: span 2; border-left: 0; border-top: 1px solid var(--line); }
}
.detail .bars { height: 44px; }
.detail .recent { padding: 0; border: 0; }
.detail-metrics .kpi small { white-space: normal; }
.detail-note { font-size: 13.5px; color: var(--muted); background: var(--soft); padding: 10px 12px; border-radius: 10px; }
.target { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13px; }
.target dt { color: var(--muted); }
.target dd { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.visit { justify-self: start; display: inline-flex; gap: 6px; padding: 8px 14px; border-radius: 999px; background: var(--ink); color: #fff; text-decoration: none; font-size: 14px; font-weight: 500; }
:root[data-theme='dark'] .visit { background: #fff; color: var(--ink); }
.daily summary { cursor: pointer; font-size: 14px; font-weight: 500; }
.daily ul { list-style: none; margin: 10px 0 0; padding: 0; font-size: 13px; }
.daily li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.daily li span { color: var(--muted); text-align: right; }

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

#theme-toggle .sun, [data-theme='dark'] #theme-toggle .moon { display: none; }
[data-theme='dark'] #theme-toggle .sun { display: inline; }
