/* Precios Shopping · estilos. Sin dependencias ni fuentes externas. */
:root {
  --bg: #f5f6f8; --card: #fff; --ink: #0f172a; --ink-2: #334155; --muted: #64748b; --line: #e2e8f0; --line-2: #eef1f5;
  --accent: #0f766e; --accent-ink: #fff; --accent-soft: #e6f4f1; --warn: #92400e; --warn-bg: #fef3c7; --bad: #b91c1c; --bad-bg: #fee2e2; --ok: #15803d; --ok-bg: #dcfce7;
  --radius: 12px; --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1017; --card: #131a24; --ink: #e8edf4; --ink-2: #c3cdd9; --muted: #8b98a9; --line: #243040; --line-2: #1b2532; --accent: #2dd4bf; --accent-ink: #04201c; --accent-soft: #10302c;
          --warn: #fcd34d; --warn-bg: #3a2c0a; --bad: #fca5a5; --bad-bg: #3b1414; --ok: #86efac; --ok-bg: #12301c; --shadow: none; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 var(--font); font-variant-numeric: tabular-nums; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; border-radius: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* cabecera */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.top-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); text-decoration: none; font-size: 17px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); display: inline-grid; place-items: center; font-weight: 800; font-size: 17px; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { border: 0; background: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; }
.tab:hover { background: var(--line-2); color: var(--ink); }
.tab[aria-current=page] { background: var(--accent-soft); color: var(--accent); }
.who { display: flex; align-items: center; gap: 12px; margin-left: auto; font-size: 13px; color: var(--muted); }
.quota { background: var(--line-2); padding: 3px 10px; border-radius: 99px; font-weight: 600; color: var(--ink-2); }
.quota.is-low { background: var(--warn-bg); color: var(--warn); }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 4px; font-weight: 600; }

main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 40px; outline: none; }
.view[hidden], [hidden] { display: none !important; }
.foot { max-width: 1100px; margin: 0 auto; padding: 0 16px 32px; font-size: 12px; color: var(--muted); }
.notice { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.notice.is-error { background: var(--bad-bg); color: var(--bad); }

/* búsqueda */
.hero { text-align: center; padding: 18px 0 8px; }
.hero h1 { font-size: clamp(24px, 4.5vw, 36px); }
.hero p { color: var(--muted); margin: 8px auto 20px; max-width: 560px; }
.search-form { display: flex; gap: 8px; max-width: 720px; margin: 0 auto; }
.search-form input[type=search] { flex: 1; min-width: 0; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-size: 16px; box-shadow: var(--shadow); }
.search-form input[type=search]:focus { border-color: var(--accent); outline: none; }
.btn { border: 1px solid var(--line); background: var(--card); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.danger { color: var(--bad); }
.opts { display: flex; gap: 8px 22px; justify-content: center; flex-wrap: wrap; margin-top: 14px; font-size: 13px; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.examples { margin-top: 14px; font-size: 13px; color: var(--muted); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; align-items: center; }
.chip-btn { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 3px 11px; cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent); }

/* resultados */
#result { margin-top: 26px; }
.res-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 8px; }
.res-head h2 { font-size: 20px; word-break: break-word; }
.kind { font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 3px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
.res-meta { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.res-actions { margin-left: auto; display: flex; gap: 8px; }
.warn { margin: 8px 0; padding: 9px 13px; border-radius: 10px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }
.section-title { margin: 22px 0 10px; font-size: 14px; font-weight: 700; color: var(--ink-2); display: flex; align-items: baseline; gap: 8px; }
.section-title small { font-weight: 400; color: var(--muted); }
.best { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.offer { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.offer.is-first { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.rank { position: absolute; top: -10px; left: 14px; font-size: 11px; font-weight: 800; letter-spacing: .4px; padding: 2px 9px; border-radius: 99px; background: var(--line); color: var(--ink-2); }
.is-first .rank { background: var(--accent); color: var(--accent-ink); }
.offer-main { display: flex; gap: 12px; align-items: flex-start; }
.thumb { width: 72px; height: 72px; flex: none; border-radius: 10px; background: #fff; display: grid; place-items: center; overflow: hidden; border: 1px solid var(--line-2); }
.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.offer-text { min-width: 0; }
.field.mt { margin-top: 8px; }
.price { font-size: 26px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.seller { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title { font-size: 13px; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; flex-wrap: wrap; gap: 3px 8px; font-size: 12px; color: var(--muted); align-items: center; }
.old { text-decoration: line-through; }
.tag { font-weight: 700; font-size: 10.5px; letter-spacing: .3px; background: var(--ok-bg); color: var(--ok); padding: 1px 6px; border-radius: 4px; }
.flag { font-size: 12px; color: var(--warn); }
.match { font-size: 11px; font-weight: 700; color: var(--ok); }
.go { margin-top: auto; align-self: flex-start; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 10px; }
.g { display: flex; flex-direction: column; gap: 4px; padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; min-width: 0; position: relative; }
a.g:hover { border-color: var(--muted); }
.g.is-best { border-color: var(--accent); }
.g-img { height: 120px; display: grid; place-items: center; background: #fff; border-radius: 8px; overflow: hidden; }
.g-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.g-badge { position: absolute; top: 14px; left: 14px; font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); }
.g .price { font-size: 17px; }
.g .title { -webkit-line-clamp: 3; }
.g .seller { font-weight: 500; font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; border: 1.5px dashed var(--line); border-radius: var(--radius); }
.loading { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 40px; color: var(--muted); }
.spin { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation-duration: 3s; } }

/* tablas y formularios */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.sub { color: var(--muted); font-size: 13px; }
.table-wrap { overflow-x: auto; margin-top: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.bad { background: var(--bad-bg); color: var(--bad); }
.history-row { cursor: pointer; } .history-row:hover td { background: var(--line-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; align-items: end; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea { padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); font-weight: 400; color: var(--ink); width: 100%; }
.field small { font-weight: 400; }
.field.wide { grid-column: 1 / -1; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 12px; }
.msg { font-size: 13px; } .msg.is-error { color: var(--bad); } .msg.is-ok { color: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi b { display: block; font-size: 26px; letter-spacing: -.5px; }
.kpi span { font-size: 12px; color: var(--muted); }
.provider { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-top: 10px; }
.provider.selected { border-color: var(--accent); background: var(--accent-soft); }
.provider label.pick { display: flex; gap: 8px; align-items: center; font-weight: 700; cursor: pointer; }
.provider p { margin: 6px 0 0; font-size: 13px; color: var(--muted); }
.inline-input { width: 90px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }

/* acceso */
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: min(380px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin: 14px 0 4px; } .login-card p { color: var(--muted); margin: 0 0 12px; font-size: 14px; }
.login-card label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 12px 0 4px; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); }
.login-card button { margin-top: 18px; width: 100%; padding: 12px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; cursor: pointer; }
.login-error { color: var(--bad); font-weight: 600; margin: 12px 0 0; font-size: 14px; }

@media (max-width: 640px) {
  .search-form { flex-direction: column; } .res-actions { margin-left: 0; width: 100%; }
  .who { width: 100%; justify-content: space-between; margin-left: 0; } .tabs { order: 3; width: 100%; overflow-x: auto; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); }
}
@media print { .top, .foot, .search-form, .opts, .examples, .res-actions { display: none; } body { background: #fff; } }
progress { width: 220px; height: 10px; accent-color: var(--accent); }
.res-head .badge { align-self: center; }
#semrush-result { margin-top: 16px; }
