/* Extension admin: Polaris-inspired layout. */
:root {
  --bg: #f1f1f1; --surface: #fff; --surface-2: #f7f7f7; --surface-hover: #fafafa;
  --text: #303030; --text-2: #616161; --text-3: #8a8a8a;
  --border: #e3e3e3; --border-strong: #c9c9c9;
  --primary: #303030; --primary-hover: #1a1a1a; --link: #005bd3;
  --success-bg: #cdfee1; --success: #0c5132; --info-bg: #e0f0ff; --info: #00527c;
  --warning-bg: #fff1e3; --warning: #5e4200; --critical-bg: #fee9e8; --critical: #8e0b21; --critical-solid: #c70a24;
  --topbar: #1a1a1a; --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(26,26,26,.07), 0 1px 0 0 rgba(204,204,204,.5) inset, 0 -1px 0 0 rgba(0,0,0,.17) inset, -1px 0 0 0 rgba(0,0,0,.13) inset, 1px 0 0 0 rgba(0,0,0,.13) inset;
  --nav-w: 232px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 13px; line-height: 1.45; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; color: var(--text); }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
img { max-width: 100%; }

/* top bar + navigation */
.topbar { position: sticky; top: 0; z-index: 30; height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--topbar); color: #e3e3e3; }
.brand { color: #fff; font-weight: 650; font-size: 14px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.grow { flex: 1; }
.who { color: #b5b5b5; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.topbar-link { color: #e3e3e3; font-size: 12px; padding: 6px 10px; border-radius: var(--radius-sm); background: #303030; }
.topbar-link:hover { background: #404040; text-decoration: none; }
.nav-toggle { display: none; background: none; border: 0; color: #fff; font-size: 18px; padding: 6px; cursor: pointer; }
.nav { position: fixed; top: 56px; bottom: 0; left: 0; width: var(--nav-w); padding: 12px 8px; background: #ebebeb; border-right: 1px solid var(--border); overflow-y: auto; z-index: 20; }
.nav-item { display: block; padding: 7px 12px; margin-bottom: 2px; border-radius: var(--radius-sm); color: var(--text); font-weight: 550; }
.nav-item:hover { background: #e0e0e0; text-decoration: none; }
.nav-item.is-active { background: var(--surface); box-shadow: var(--shadow); }
.main { margin-left: var(--nav-w); padding: 20px 24px 48px; }
.page { max-width: 1200px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }

/* page header */
.page-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.section-title { font-size: 14px; font-weight: 650; margin-top: 8px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* cards */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px 0; }
.card-header + .card-body { padding-top: 12px; }
.card-title { font-size: 14px; font-weight: 650; }
.card-body { padding: 16px; }
.card-body.is-flush { padding: 12px 0 0; }
.card.card-body { padding: 16px; }

/* grids and stacks */
.grid { display: grid; gap: 16px; align-items: start; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid.cols-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.grid.cols-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.stack-sm { display: flex; flex-direction: column; gap: 12px; }
.mt { margin-top: 8px; }

/* stats strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 14px 16px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.stat-label { color: var(--text-2); font-size: 12px; font-weight: 550; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-value.small-value { font-size: 16px; }
.stat-note { color: var(--text-3); font-size: 12px; margin-top: 2px; }

/* tables */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 550; color: var(--text-2); font-size: 12px; background: var(--surface-2); padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.is-link { cursor: pointer; }
.table tr.is-link:hover td, .table tr.is-selected td { background: var(--surface-hover); }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }

/* text helpers */
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.strong { font-weight: 600; }

/* badges */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 8px; font-size: 12px; font-weight: 550; background: #e3e3e3; color: var(--text); white-space: nowrap; }
.badge.is-success { background: var(--success-bg); color: var(--success); }
.badge.is-info { background: var(--info-bg); color: var(--info); }
.badge.is-warning { background: #ffd6a4; color: var(--warning); }
.badge.is-critical { background: #fed1d7; color: var(--critical); }

/* banners */
.banner { padding: 10px 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.banner.is-success { background: var(--success-bg); border-color: #8ef0b5; color: var(--success); }
.banner.is-info { background: var(--info-bg); border-color: #a8d8ff; color: var(--info); }
.banner.is-warning { background: var(--warning-bg); border-color: #ffd6a4; color: var(--warning); }
.banner.is-critical { background: var(--critical-bg); border-color: #fec1c7; color: var(--critical); }

/* forms */
.filters { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border-bottom: 1px solid var(--border); align-items: center; }
.filters .input { flex: 1 1 220px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 550; font-size: 12px; color: var(--text); min-width: 0; }
.field-label { display: block; font-weight: 550; font-size: 12px; margin-bottom: 6px; }
.input, .select { font: inherit; font-weight: 400; font-size: 13px; color: var(--text); background: var(--surface); border: 1px solid #8a8a8a; border-radius: var(--radius-sm); padding: 7px 10px; min-height: 34px; width: 100%; }
.filters .select { width: auto; }
textarea.input { resize: vertical; min-height: 72px; }
.input:focus, .select:focus { outline: 2px solid var(--link); outline-offset: 1px; border-color: var(--link); }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
form.inline { display: inline; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; font-size: 13px; padding: 6px 12px; min-height: 32px; border-radius: var(--radius-sm); border: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--surface-hover); text-decoration: none; }
.btn:active { box-shadow: inset 0 1px 2px rgba(0,0,0,.2); }
.btn:focus-visible { outline: 2px solid var(--link); outline-offset: 1px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 -1px 0 1px rgba(0,0,0,.8) inset, 0 0 0 1px #303030 inset, 0 .5px 0 1.5px rgba(255,255,255,.25) inset; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-critical { background: var(--critical-solid); color: #fff; box-shadow: none; }
.btn-critical:hover { background: #a3071c; }
.btn-tertiary { background: transparent; box-shadow: none; color: var(--text-2); }
.btn-tertiary:hover { background: #ebebeb; color: var(--critical); }
.btn-sm { padding: 3px 10px; min-height: 28px; font-size: 12px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }

/* pager */
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px; border-top: 1px solid var(--border); }

/* users */
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover; background: #e3e3e3; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; font-weight: 650; }
.avatar.lg { width: 48px; height: 48px; font-size: 18px; }

/* key/value list */
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; }
.kv .k { color: var(--text-2); }
.kv .v { min-width: 0; word-break: break-word; }

/* charts */
.chart-box { position: relative; height: 260px; }

/* ad preview */
.ad-preview { position: relative; display: flex; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ad-preview img { width: 64px; height: 64px; border-radius: var(--radius-sm); object-fit: cover; flex: none; }
.ad-preview img[hidden] { display: none; }
.sponsored { position: absolute; top: 8px; right: 10px; font-size: 11px; color: var(--text-3); font-weight: 550; }

/* sign-in */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.auth-card h1 { font-size: 18px; }
.auth-card p { margin: 0; }

/* responsive */
@media (max-width: 1000px) {
  .grid.cols-2-1, .grid.cols-1-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .nav-toggle { display: inline-block; }
  .nav { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 4px 0 16px rgba(0,0,0,.12); }
  body.nav-open .nav { transform: none; }
  .main { margin-left: 0; padding: 16px 16px 40px; }
  .who { display: none; }
  .grid.cols-2 { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-value { font-size: 18px; }
  .chart-box { height: 220px; }
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv .v { margin-bottom: 8px; }
}

/* public pages (privacy, terms) */
body.doc { background: var(--surface); }
.doc-wrap { max-width: 760px; margin: 0 auto; padding: 40px 16px 64px; font-size: 15px; line-height: 1.65; }
.doc-wrap h1 { font-size: 28px; margin-bottom: 4px; }
.doc-wrap h2 { font-size: 18px; margin: 28px 0 8px; }
.doc-wrap p, .doc-wrap ul { margin: 0 0 12px; }
.doc-wrap li { margin-bottom: 6px; }
.doc-wrap table { border-collapse: collapse; width: 100%; margin: 8px 0 16px; font-size: 14px; }
.doc-wrap th, .doc-wrap td { border: 1px solid var(--border); padding: 8px 10px; text-align: left; vertical-align: top; }
.doc-wrap th { background: var(--surface-2); }

/* ------------------------------------------------ intelligence & analytics */
.nav-group { margin: 14px 12px 4px; color: var(--text-3); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.delta { font-size: 12px; font-weight: 600; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.delta.is-up { color: #0c7a43; }
.delta.is-down { color: var(--critical-solid); }
.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; }
.bar-label { width: 190px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; background: #eef0f4; border-radius: 6px; height: 10px; overflow: hidden; min-width: 40px; }
.bar-fill { display: block; height: 100%; background: #2c6ecb; border-radius: 6px; }
.bar-fill.is-success { background: #29845a; } .bar-fill.is-warning { background: #b98900; } .bar-fill.is-critical { background: #d72c0d; } .bar-fill.is-info { background: #8051ff; }
.bar-note { width: 110px; flex: none; text-align: right; color: var(--text-2); font-size: 12px; font-variant-numeric: tabular-nums; }
.src-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 6px; background: #ececec; color: var(--text-2); vertical-align: middle; white-space: nowrap; }
.src-tag.is-success { background: var(--success-bg); color: var(--success); } .src-tag.is-info { background: var(--info-bg); color: var(--info); } .src-tag.is-warning { background: var(--warning-bg); color: var(--warning); }
.range-picker { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.range-custom { display: inline-flex; gap: 6px; }
.range-custom[hidden] { display: none; }
.insights { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.insight { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; border-left: 4px solid #2c6ecb; display: flex; flex-direction: column; gap: 6px; }
.insight.is-success { border-left-color: #29845a; } .insight.is-warning { border-left-color: #b98900; } .insight.is-critical { border-left-color: #d72c0d; }
.insight-area { font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; }
.insight-title { font-weight: 650; font-size: 14px; }
.insight-detail { color: var(--text-2); }
.insight a { margin-top: auto; font-weight: 550; }
.cohort td.heat { text-align: center; font-variant-numeric: tabular-nums; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text); }
a.chip:hover { text-decoration: none; background: #ececec; }
.chip.is-active { background: var(--primary); color: #fff; border-color: var(--primary); }
.evidence { margin: 4px 0 0; padding-left: 18px; color: var(--text-2); }
.evidence li { margin: 2px 0; }
.legend-note { color: var(--text-3); font-size: 12px; margin-top: 8px; }
.kpi-sub { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; margin-top: 2px; }
.score { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 6px; font-weight: 650; font-size: 12px; background: #eef0f4; }
.score.is-high { background: var(--success-bg); color: var(--success); } .score.is-mid { background: var(--warning-bg); color: var(--warning); }
.feedback-msg { white-space: pre-wrap; word-break: break-word; }
.inline { display: inline; }
textarea.input { width: 100%; }
@media (max-width: 700px) { .bar-label { width: 110px; } .bar-note { width: 80px; } }
.bar-label:empty { display: none; }
.crumbs { font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.crumbs a { color: var(--text-2); }
.crumbs span { color: var(--text); font-weight: 550; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Rows kept for history (e.g. stores removed from the watchlist) */
.table tr.is-muted td { opacity: .6; }

/* Plans & billing: plan card preview (same data the extension shows) */
.plan-preview-wrap { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan-preview { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.plan-preview.is-highlight { border: 2px solid #4a37f0; }
.plan-preview-flag { position: absolute; top: -10px; left: 14px; background: #4a37f0; color: #fff; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.plan-preview-name { font-weight: 700; font-size: 15px; }
.plan-preview-price { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; }
.plan-preview-price span { font-size: 12px; font-weight: 500; color: var(--text-2); }
.plan-preview-desc { color: var(--text-2); font-size: 12px; }
.plan-preview ul { margin: 0; padding-left: 18px; font-size: 13px; display: grid; gap: 4px; }
.plan-preview-btn { margin-top: 4px; text-align: center; padding: 7px; border-radius: 999px; background: #4a37f0; color: #fff; font-weight: 600; font-size: 13px; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; margin: 6px 0 0; max-width: 560px; }
