:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1d1d1b;
  --muted: #6b6a66;
  --line: #e4e2dc;
  --accent: #c4521f;
  --accent-deep: #8e3714;
  --accent-soft: #fbece4;
  --ok: #2f7d32;
  --ok-soft: #e8f4e8;
  --warn: #9a6700;
  --warn-soft: #fff6d6;
  --bad: #c62828;
  --bad-soft: #fdecec;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161614;
    --surface: #1f1f1c;
    --text: #ecebe6;
    --muted: #9c9a93;
    --line: #34332f;
    --accent: #e0672f;
    --accent-deep: #b44a1b;
    --accent-soft: #3a2418;
    --ok: #7cc97f;
    --ok-soft: #1d2e1d;
    --warn: #e6b84a;
    --warn-soft: #33290f;
    --bad: #ff8a80;
    --bad-soft: #3a1c1c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
header {
  display: flex; align-items: center; gap: 24px;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 2;
}
header .brand {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none;
  font-family: "Bricolage Grotesque", system-ui, sans-serif; font-weight: 800; font-size: 20px; letter-spacing: -0.03em;
}
header .brand .mark { width: 20px; height: 23px; fill: var(--accent); }
header .brand .mark .stud { fill: var(--accent-deep); }
header nav { display: flex; gap: 4px; flex: 1; }
header nav a {
  text-decoration: none; padding: 6px 12px; border-radius: 8px; color: var(--muted);
}
header nav a.on, header nav a:hover { background: var(--accent-soft); color: var(--accent); }
main { max-width: 1280px; margin: 0 auto; padding: 24px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 15px; margin: 0 0 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 900px) { .cols-4, .cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols-4, .cols-2 { grid-template-columns: 1fr; } main { padding: 16px; } header { flex-wrap: wrap; } }
.stack > * + * { margin-top: 16px; }

.stat .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat a { text-decoration: none; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--line); color: var(--muted); white-space: nowrap;
}
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.new { background: var(--accent-soft); color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  padding: 6px 12px; border-radius: 8px; text-decoration: none; display: inline-block;
}
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.link { border: 0; background: none; padding: 0; color: var(--muted); text-decoration: underline; }
button:disabled { opacity: .6; cursor: default; }
form.inline { display: inline; }

label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
input, select {
  font: inherit; width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text);
}
input[type=checkbox] { width: auto; }
.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.form-grid .wide { grid-column: span 2; }
@media (max-width: 900px) { .form-grid { grid-template-columns: 1fr 1fr; } }
.checks { display: flex; gap: 12px; padding: 6px 0; }
.checks label { display: flex; gap: 6px; align-items: center; color: var(--text); font-size: 14px; margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filters > div { min-width: 140px; }
.filters > div.grow { flex: 1; min-width: 200px; }

.thumb { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; background: var(--line); display: block; }
.title-cell a { text-decoration: none; font-weight: 500; }
.title-cell a:hover { color: var(--accent); }
td.num { white-space: nowrap; }
.price-old { text-decoration: line-through; color: var(--muted); font-size: 12px; margin-right: 4px; }
.price-drop { color: var(--ok); font-weight: 600; }

.running { display: inline-flex; gap: 8px; align-items: center; color: var(--accent); font-weight: 600; }
.running::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
  animation: pulse 1s infinite alternate;
}
@keyframes pulse { from { opacity: .3; } to { opacity: 1; } }

.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.detail { display: grid; grid-template-columns: 280px 1fr; gap: 24px; }
.detail img { width: 100%; border-radius: var(--radius); }
@media (max-width: 700px) { .detail { grid-template-columns: 1fr; } }
dl { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; }

header.admin { border-bottom: 2px solid var(--accent); }
header .brand small { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-left: 4px; }

/* LEGO classification badges */
.badge.kind-set { background: var(--ok-soft); color: var(--ok); font-variant-numeric: tabular-nums; }
.badge.kind-set-unknown, .badge.kind-lote { background: var(--warn-soft); color: var(--warn); }
.badge.kind-minifig { background: var(--accent-soft); color: var(--accent); }
.badge.kind-avulso, .badge.kind-parte, .badge.kind-outro, .badge.kind-produto { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.badge.kind-jogo, .badge.kind-nao_lego { background: var(--bad-soft); color: var(--bad); }
.badge.state-lacrado { background: var(--accent-soft); color: var(--accent-deep); }
.badge.state-quase_novo { background: var(--ok-soft); color: var(--ok); }
.badge.state-incompleto { background: var(--bad-soft); color: var(--bad); }
.badge.state-usado { background: var(--warn-soft); color: var(--warn); }
.badge.state-novo_indef { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); }
.badge.state-usado_indef { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); }
.badge.state-indef { background: var(--bg); color: var(--muted); border: 1px dashed var(--line); }
.set-card { display: flex; gap: 12px; align-items: center; }
.set-card img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: 6px; }

/* market view: BrickEconomy popularity cell and the member-interest sparkline */
.pop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spark { display: block; overflow: visible; }
.spark-base { stroke: var(--line); stroke-width: 1; }
.spark-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark-end { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.be-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.be-form { display: inline-flex; align-items: center; gap: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.tabs a { padding: 8px 14px; border-radius: 8px 8px 0 0; color: var(--muted); text-decoration: none; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--text); background: var(--surface); border-color: var(--line); font-weight: 600; }
.badge.great { background: var(--ok); color: var(--surface); }
.cols-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
@media (max-width: 900px) { .cols-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .cols-5 { grid-template-columns: 1fr; } }

/* "Favoritar" and "Reportar erro" */
.actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px; margin-top: 6px; }
.actions.column { flex-direction: column; align-items: stretch; margin-top: 0; min-width: 132px; }
.actions form { margin: 0; }
.act { display: block; width: 100%; padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 13px; line-height: 1.3; white-space: nowrap; cursor: pointer; text-align: left; }
.act:hover { border-color: var(--accent); color: var(--accent); }
.cond-actions { display: contents; }
button.cond.on { border-color: var(--bad); background: var(--bad-soft); color: var(--bad); font-weight: 600; }
button.hide.on { border-color: var(--muted); background: var(--bg); font-weight: 600; }
button.star.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
details.report summary { list-style: none; }
details.report summary::-webkit-details-marker { display: none; }
details.report[open] summary { border-color: var(--accent); color: var(--accent); }
details.report form { margin-top: 6px; }
details.report textarea { width: 100%; min-width: 240px; font: inherit; padding: 6px 8px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--surface); color: var(--text); }
tr[id], div[id^="l"] { scroll-margin-top: 80px; }

/* minifigures of a set (listing page) */
.figs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.fig { display: flex; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px; }
.fig img { width: 40px; height: 48px; object-fit: contain; flex: none; }

/* multiple-choice select (Anúncios: Condição): looks like a select, opens a list of checkboxes */
details.multi { position: relative; }
details.multi summary {
  list-style: none; cursor: pointer; padding: 7px 28px 7px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 190px; position: relative;
}
details.multi summary::-webkit-details-marker { display: none; }
details.multi summary::after { content: "▾"; position: absolute; right: 10px; color: var(--muted); }
details.multi[open] summary { border-color: var(--accent); }
.multi-panel {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; padding: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .12);
}
.multi-panel label {
  display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px 8px; border-radius: 6px;
  font-size: 14px; color: var(--text); white-space: nowrap; cursor: pointer;
}
.multi-panel label:hover { background: var(--accent-soft); }
