:root {
  --bg: #f6f3ee; --panel: #fffdf9; --fg: #1d1b18; --muted: #6f6a62; --line: #e4ded4;
  --accent: #c2410c; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --dropi: #2563eb; --dropea: #ea580c;
  --radius: 14px; --shadow: 0 1px 2px rgb(0 0 0 / .04), 0 6px 20px rgb(0 0 0 / .04);
  --serif: 'Fraunces', Georgia, serif; --sans: 'Inter', system-ui, -apple-system, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412; --panel: #1e1c19; --fg: #f1ede6; --muted: #a39d93; --line: #34312c;
    --accent: #fb923c; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --dropi: #60a5fa; --dropea: #fb923c;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #151412; --panel: #1e1c19; --fg: #f1ede6; --muted: #a39d93; --line: #34312c;
  --accent: #fb923c; --ok: #4ade80; --warn: #fbbf24; --bad: #f87171; --dropi: #60a5fa; --dropea: #fb923c; --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; }
h1 { font-family: var(--serif); font-weight: 400; font-size: clamp(28px, 5vw, 42px); letter-spacing: -.01em; text-wrap: balance; }
h2 { font-size: 17px; }
a { color: inherit; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.mt { margin-top: 22px; }
[hidden] { display: none !important; }

/* botones y formularios */
.btn { appearance: none; font: inherit; font-weight: 500; border-radius: 10px; padding: 10px 16px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); cursor: pointer; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn:focus-visible, .lens:focus-visible, .pcard:focus-visible, .new:focus-visible, th button:focus-visible, tbody tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input, select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; min-width: 0; }
input:focus, select:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }

/* acceso */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-box { width: min(100%, 420px); display: flex; flex-direction: column; gap: 16px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; }
.form-msg { margin: 0; min-height: 1.4em; font-size: 13px; color: var(--muted); }
.logo { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: -.01em; }
.logo-dot { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle, #fff 22%, var(--accent) 25%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.loading { text-align: center; padding: 30vh 16px; color: var(--muted); }

/* estructura */
.app { max-width: 1200px; margin: 0 auto; padding: 0 16px 48px; display: flex; flex-direction: column; gap: 20px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); }
.top-right { display: flex; align-items: center; gap: 12px; }
.hero { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.lead { margin: 0; font-size: 17px; max-width: 70ch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.sec-title { margin-bottom: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.notice { margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--warn); border-radius: 10px; background: var(--panel); font-size: 13px; color: var(--muted); }
.foot { text-align: center; padding-top: 8px; }

/* resumen */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.tile b { display: block; font-family: var(--serif); font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span { font-size: 12px; color: var(--muted); }

/* insignias */
.legend { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.badge, .both, .phase, .chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px 1px 7px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge { background: color-mix(in srgb, var(--c, var(--muted)) 15%, transparent); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); }
.badge[data-prov="Dropi PRO"] { --c: var(--dropi); }
.badge[data-prov="Dropea"] { --c: var(--dropea); }
.both { background: color-mix(in srgb, var(--fg) 9%, transparent); }
.both::before { content: ""; width: 13px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--dropi) 50%, var(--dropea) 50%); }
.phase { background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--fg); }
.phase::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--c); }
.chip { background: color-mix(in srgb, var(--fg) 7%, transparent); padding: 1px 8px; border-radius: 6px; }
.pill { display: inline-flex; justify-content: center; min-width: 2.4em; padding: 1px 8px; border-radius: 999px; font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; background: color-mix(in srgb, var(--l, var(--muted)) 20%, transparent); }
.hi { --l: var(--ok); } .mid { --l: var(--warn); } .lo { --l: var(--muted); }
.warn-txt { color: var(--warn); font-weight: 600; }

/* novedades */
.alert { border-left: 4px solid var(--warn); }
.alert-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.alert-count { font-family: var(--serif); font-size: 36px; line-height: 1; color: var(--warn); font-variant-numeric: tabular-nums; }
.alert-text { margin: 0; white-space: pre-line; font-size: 14px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--warn) 10%, transparent); }
.news { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 10px; }
.new { appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg); min-width: 0; }
.new:hover, .pcard:hover { border-color: var(--muted); }
.new-top { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.new-when { font-size: 12px; color: var(--warn); font-weight: 600; white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-weight: 500; line-height: 1.3; }

/* vistas */
.lenses { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; margin: 0 -4px; padding-inline: 4px; }
.lens { appearance: none; flex: 0 0 auto; font: inherit; font-size: 13px; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--fg); cursor: pointer; display: inline-flex; gap: 6px; }
.lens:hover { border-color: var(--muted); }
.lens[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.lens-n { opacity: .6; font-variant-numeric: tabular-nums; }
.lens-desc { font-size: 14px; max-width: 90ch; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 140px; gap: 8px; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } .f-q { grid-column: 1 / -1; } }

/* top 6 */
.cards6 { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; }
.pcard { appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; display: grid; grid-template-columns: 72px 1fr; gap: 12px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.pcard img, .thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: color-mix(in srgb, var(--fg) 6%, transparent); }
.pcard-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pcard-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.pcard-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; font-size: 12px; color: var(--muted); }
.pcard-stats b { display: block; color: var(--fg); font-size: 15px; font-variant-numeric: tabular-nums; }
.rank { position: absolute; }
.empty { color: var(--muted); padding: 16px 0; margin: 0; }

/* tabla */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.table th { text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th:first-child, .table td:first-child { text-align: left; }
.table th button { all: unset; cursor: pointer; }
.table th[aria-sort="ascending"] button::after { content: " ↑"; }
.table th[aria-sort="descending"] button::after { content: " ↓"; }
.table td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.t-prod { display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; white-space: normal; }
.t-prod .thumb { width: 40px; height: 40px; border-radius: 8px; flex: 0 0 auto; }
.t-prod-txt { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
@media (max-width: 760px) {
  .col-opt { display: none; }
  .t-prod { min-width: 180px; }
}

/* barras */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; font-size: 13px; }
.bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--fg) 7%, transparent); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.days { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 10px; overflow-x: auto; }
.day { flex: 1 0 44px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; height: 100%; font-size: 11px; color: var(--muted); }
.day-stack { width: 100%; max-width: 48px; display: flex; flex-direction: column-reverse; border-radius: 6px; overflow: hidden; }
.day-stack i { display: block; }
.fotos { list-style: none; margin: 0; padding: 0; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.fotos li { display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }

/* ficha */
.sheet { border: none; padding: 0; background: var(--panel); color: var(--fg); width: min(640px, 100vw); max-height: 92dvh; border-radius: 18px; box-shadow: 0 20px 60px rgb(0 0 0 / .3); }
.sheet::backdrop { background: rgb(0 0 0 / .45); }
@media (max-width: 640px) { .sheet { margin: auto 0 0; max-width: 100vw; width: 100vw; border-radius: 18px 18px 0 0; } }
.sheet-inner { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.sheet-head { display: flex; gap: 14px; align-items: flex-start; }
.sheet-head img { width: 88px; height: 88px; object-fit: cover; border-radius: 12px; flex: 0 0 auto; }
.sheet-head h3 { font-family: var(--serif); font-weight: 400; font-size: 22px; }
.close { margin-left: auto; flex: 0 0 auto; }
.score { display: flex; gap: 16px; align-items: center; }
.ring { width: 84px; height: 84px; flex: 0 0 auto; }
.parts { flex: 1; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.why { margin: 0; padding-left: 18px; font-size: 14px; }
.chart { width: 100%; height: 150px; }
.chart text { fill: var(--muted); font-size: 10px; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; }
.dl div { background: var(--bg); border-radius: 10px; padding: 8px 10px; }
.dl dt { font-size: 12px; color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.logo { white-space: nowrap; }
@media (max-width: 480px) { #actualizado { font-size: 11px; text-align: right; line-height: 1.25; } .top { gap: 8px; } }
