:root {
  --bg: #f5f6f4;
  --panel: #ffffff;
  --panel-2: #f0f2ef;
  --line: #e2e5e0;
  --line-2: #d3d8d1;
  --text: #1c211e;
  --text-2: #4d5650;
  --muted: #7a837d;
  --accent: #165d4f;
  --accent-2: #1f7a68;
  --accent-soft: #e3f0ec;
  --good: #19794b;
  --good-soft: #e2f3e9;
  --warn: #9a5b00;
  --warn-soft: #fbf0dc;
  --bad: #b3261e;
  --bad-soft: #fbe7e5;
  --info: #2c5a9e;
  --info-soft: #e6eef9;
  --star: #c98a00;
  --shadow: 0 1px 2px rgba(20, 30, 25, .06), 0 2px 8px rgba(20, 30, 25, .04);
  --radius: 12px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111513;
    --panel: #181d1a;
    --panel-2: #1f2521;
    --line: #2a312d;
    --line-2: #364039;
    --text: #e8ece9;
    --text-2: #b8c0bb;
    --muted: #87918b;
    --accent: #5cc2a8;
    --accent-2: #7fd6bf;
    --accent-soft: #19332c;
    --good: #5fcf92;
    --good-soft: #17301f;
    --warn: #e8b259;
    --warn-soft: #33281a;
    --bad: #ff8a80;
    --bad-soft: #3a1d1b;
    --info: #8fb4ec;
    --info-soft: #1b2638;
    --star: #f0bf45;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
.link { color: var(--accent); text-decoration: none; }
.link:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.ic { flex: none; vertical-align: -2px; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 16px; text-decoration: none; letter-spacing: -.01em; }
.brand-lg { font-size: 22px; margin-bottom: 4px; }
.logo { width: 26px; height: 26px; border-radius: 7px; background: var(--accent); position: relative; flex: none; }
.logo::after { content: ""; position: absolute; inset: 7px 6px 9px; border-bottom: 2.5px solid #fff; border-right: 2.5px solid #fff; transform: skewX(-20deg); border-radius: 1px; }
.tabs { display: flex; gap: 2px; }
.tabs a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--text-2); font-weight: 500; }
.tabs a:hover { background: var(--panel-2); }
.tabs a.on { background: var(--accent-soft); color: var(--accent); }
.search { flex: 1; max-width: 560px; display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 38px;
  border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); color: var(--muted); }
.search-go { border: 0; border-radius: 6px; padding: 5px 12px; background: var(--accent); color: #04130e; font-weight: 600; cursor: pointer; flex: none; }
.search-go:hover { filter: brightness(1.1); }
.search:focus-within { border-color: var(--accent); background: var(--panel); }
.search input { flex: 1; border: 0; outline: 0; background: transparent; height: 100%; min-width: 0; color: var(--text); }
.me { margin-left: 0; display: flex; align-items: center; gap: 6px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px;
  font-weight: 700; background: var(--accent-soft); color: var(--accent); flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.btn-icon { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: inline-grid;
  place-items: center; cursor: pointer; color: var(--text-2); }
.btn-icon:hover { background: var(--panel-2); }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; padding: 16px 20px 40px; max-width: 1560px; margin: 0 auto; }
.sidebar { position: sticky; top: 72px; align-self: start; max-height: calc(100vh - 88px); overflow-y: auto;
  scrollbar-width: thin; padding-right: 4px; }
.single { max-width: 1180px; margin: 0 auto; padding: 16px 20px 60px; }

/* ---------- filters ---------- */
.filters { display: flex; flex-direction: column; gap: 4px; }
.filters-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 8px; }
.fgroup { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.fgroup + .fgroup { margin-top: 4px; }
.fgroup summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 6px; font-size: 13px; }
.fgroup summary::-webkit-details-marker { display: none; }
.fgroup summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.fgroup[open] summary::after { transform: rotate(-135deg); }
.fgroup[open] summary { margin-bottom: 8px; }
.count { font-size: 11px; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: 0 7px; border-radius: 10px;
  max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.flabel { font-weight: 600; font-size: 13px; margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.flabel.sub { font-weight: 500; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.filters input:not([type=checkbox]), .filters select, .tag-form input, textarea {
  width: 100%; height: 34px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); padding: 0 10px; outline: 0; }
.filters input:focus, .filters select:focus, textarea:focus, .tag-form input:focus { border-color: var(--accent); }
.range { display: flex; align-items: center; gap: 6px; }
.range input { min-width: 0; flex: 1 1 0; }
.range input[type=date] { padding: 0 6px; font-size: 12.5px; }
.range + .range, select + .range { margin-top: 6px; }
.range span { color: var(--muted); font-size: 12px; }
.quick { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pill { border: 1px solid var(--line-2); background: var(--panel); border-radius: 20px; padding: 2px 9px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.pill:hover { border-color: var(--accent); color: var(--accent); }
.checks { display: flex; flex-direction: column; gap: 1px; }
.checks-long { max-height: 220px; overflow-y: auto; scrollbar-width: thin; }
.check { display: flex; align-items: center; gap: 8px; padding: 3px 2px; cursor: pointer; border-radius: 6px; font-size: 13px; }
.check:hover { background: var(--panel-2); }
.check input { accent-color: var(--accent); margin: 0; width: 15px; height: 15px; flex: none; }
.check-label { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; }
.check.strong { font-weight: 600; }
.n { color: var(--muted); font-size: 11.5px; }
.toggles { display: flex; flex-direction: column; gap: 2px; }
.ufs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.uf input { display: none; }
.uf span { display: inline-block; padding: 2px 7px; border: 1px solid var(--line-2); border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.uf input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.users { display: flex; flex-wrap: wrap; gap: 6px; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border: 1px solid var(--line-2); border-radius: 20px; cursor: pointer; font-size: 13px; }
.user-chip input { display: none; }
.user-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sev { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.sev.sev1 { background: var(--warn); } .sev.sev2 { background: #d9822b; } .sev.sev3 { background: var(--bad); }

.help { display: inline-grid; place-items: center; width: 15px; height: 15px; border-radius: 50%; font-size: 10px; font-weight: 700;
  color: var(--muted); border: 1px solid var(--line-2); cursor: help; flex: none; line-height: 1; }
.help:hover, .help:focus { color: var(--accent); border-color: var(--accent); outline: 0; }
#tip { position: fixed; z-index: 100; max-width: 300px; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px;
  font-size: 12.5px; line-height: 1.4; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.2); }

/* ---------- results ---------- */
.results { min-height: 60vh; transition: opacity .15s; }
.results.htmx-request { opacity: .45; }
.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.summary { font-size: 15px; }
.summary strong { font-size: 18px; }
.sorters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.sel { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.sel select { height: 32px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); padding: 0 8px; color: var(--text); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line-2);
  font-size: 12.5px; text-decoration: none; color: var(--text-2); }
.chip:hover { border-color: var(--bad); color: var(--bad); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; display: inline-grid; }
.chip-clear { border-style: dashed; }
.resume { display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 12px; border-radius: 10px;
  background: var(--info-soft); color: var(--info); font-weight: 500; }
.resume .btn { margin-left: auto; }

/* ---------- card ---------- */
.cards { display: flex; flex-direction: column; gap: 12px; }
.card { display: grid; grid-template-columns: 320px minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; scroll-margin-top: 70px; }
.card.is-seen .gal { opacity: .72; }
.card.is-seen .title { color: var(--text-2); }
.card.is-closed { opacity: .7; }
.gal { position: relative; background: var(--panel-2); min-height: 230px; transition: opacity .2s; }
.gal-track { position: absolute; inset: 0; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; outline: 0; }
.gal-track::-webkit-scrollbar { display: none; }
.gal-track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; cursor: zoom-in; background: var(--panel-2); }
.gal-track img.broken { object-fit: contain; opacity: .25; }
.gal-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.9); color: #222; display: grid; place-items: center; opacity: 0; transition: opacity .15s; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.gal-prev { left: 8px; } .gal-next { right: 8px; }
.gal:hover .gal-nav, .gal-nav:focus-visible { opacity: 1; }
.gal-count { position: absolute; right: 8px; bottom: 8px; background: rgba(0,0,0,.6); color: #fff; font-size: 11.5px; padding: 2px 8px; border-radius: 10px;
  display: flex; align-items: center; gap: 4px; pointer-events: none; }
.gal-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--muted); font-size: 12px; }
.ribbon { position: absolute; left: 8px; top: 8px; background: var(--good); color: #fff; font-weight: 700; font-size: 12.5px; padding: 2px 8px; border-radius: 6px; }
.ribbon-strong { background: #0f6b3c; box-shadow: 0 0 0 2px rgba(255,255,255,.7); }

.body { padding: 12px 16px 12px; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.tags-row { display: flex; flex-wrap: wrap; gap: 4px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
  background: var(--panel-2); color: var(--text-2); white-space: nowrap; }
.badge-type { background: var(--text); color: var(--panel); }
.badge-info { background: var(--info-soft); color: var(--info); }
.badge-warn { background: var(--warn-soft); color: var(--warn); }
.badge-muted { background: var(--panel-2); color: var(--muted); }
.badge-new { background: var(--accent-soft); color: var(--accent); }
.badge-risk.sev1 { background: var(--warn-soft); color: var(--warn); }
.badge-risk.sev2 { background: #fde9d7; color: #a1520f; }
.badge-risk.sev3 { background: var(--bad-soft); color: var(--bad); }
@media (prefers-color-scheme: dark) { .badge-risk.sev2 { background: #3a2716; color: #f0a560; } }
.badge-seen { display: none; background: var(--panel-2); color: var(--muted); }
.card.is-seen .badge-seen { display: inline-flex; }
.title { margin: 0; font-size: 15.5px; font-weight: 650; line-height: 1.3; letter-spacing: -.005em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.where { display: flex; align-items: center; gap: 5px; color: var(--text-2); font-size: 13px; flex-wrap: wrap; }
.where .sep { color: var(--line-2); }

.metrics { display: grid; grid-template-columns: 1.3fr 1fr 1fr .85fr .95fr 1.15fr; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-top: 2px; }
.m { padding: 7px 10px; display: flex; flex-direction: column; min-width: 0; }
.m + .m { border-left: 1px solid var(--line); }
.m .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.m .v { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m .s { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m .s.good { color: var(--good); font-weight: 600; }
.m-main { background: var(--accent-soft); }
.m-main .v { font-size: 17px; color: var(--accent); }
.m-date.soon .v { color: var(--warn); }
.m-date.urgent { background: var(--bad-soft); }
.m-date.urgent .v, .m-date.urgent .s { color: var(--bad); font-weight: 650; }

.rounds { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.rounds li.cur { color: var(--text); font-weight: 600; }
.rounds li.cur b { color: var(--accent); }
.summary-ai { margin: 0; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 6px; font-size: 12px; }
.fact { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--line); border-radius: 5px; color: var(--text-2); }
.fact.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, transparent); }
.fact.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.fact.tag { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.fact.favs { color: var(--star); font-weight: 600; }
.fact.note { color: var(--accent); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.actions .btn-primary { margin-left: auto; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 550; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--text-2); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0b1512; } }
.btn-ghost { border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--panel-2); border-color: transparent; }
.btn-fav.on { color: var(--star); border-color: color-mix(in srgb, var(--star) 50%, transparent); background: color-mix(in srgb, var(--star) 10%, transparent); }
.btn-block { width: 100%; }
[data-expand][aria-expanded=true] .ic { transform: rotate(180deg); }

.card-archived { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--muted); font-size: 13px; }
.card-archived b { color: var(--text-2); font-weight: 600; }
.card-archived .btn { margin-left: auto; }

/* ---------- details ---------- */
.details { grid-column: 1 / -1; border-top: 1px solid var(--line); background: var(--panel-2); padding: 14px 16px 16px; }
.details.open-static { border: 1px solid var(--line); border-radius: var(--radius); margin-top: 12px; }
.det-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.det-grid-2 { margin-top: 12px; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.det-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; min-width: 0; }
.det-box h4, .det-text h4 { margin: 0 0 8px; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.det-risk { border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.kv { width: 100%; border-collapse: collapse; font-size: 13px; }
.kv td { padding: 4px 0; vertical-align: top; border-bottom: 1px solid var(--line); }
.kv td:first-child { color: var(--muted); padding-right: 12px; }
.kv td:last-child { text-align: right; font-weight: 550; white-space: nowrap; }
.kv td.wrap { white-space: normal; }
.kv tr:last-child td { border-bottom: 0; }
.kv tr.total td { font-weight: 700; color: var(--text); border-top: 1.5px solid var(--line-2); }
.kv tr.cur td { color: var(--accent); }
.kv + .kv { margin-top: 8px; }
.risks { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.risks li.sev3::marker { color: var(--bad); } .risks li.sev2::marker { color: #d9822b; } .risks li.sev1::marker { color: var(--warn); }
.docs, .events { margin: 0; padding-left: 18px; font-size: 13px; display: flex; flex-direction: column; gap: 3px; }
.docs a { color: var(--accent); }
.det-text { margin-top: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.det-text h4 + .pre { margin-top: 0; }
.pre { white-space: pre-wrap; font-size: 13.5px; line-height: 1.55; margin: 0 0 12px; max-height: 360px; overflow-y: auto; color: var(--text-2); }
.tag-editor { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 10px; }
.tag-form { display: flex; gap: 6px; flex: 1 1 100%; }
.tag-form input { height: 30px; }
.note-form textarea { height: auto; padding: 8px 10px; resize: vertical; }
.note-form .row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.note-form .push { margin-left: auto; }
.saved { color: var(--good); font-size: 12px; }

/* ---------- pager ---------- */
.pager { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px; margin: 22px 0 8px; }
.pager a { min-width: 36px; height: 36px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 8px; text-decoration: none;
  border: 1px solid var(--line); background: var(--panel); font-weight: 550; }
.pager a:hover { border-color: var(--accent); }
.pager a.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager .gap { align-self: center; color: var(--muted); padding: 0 4px; }
.foot { text-align: center; margin-top: 10px; }
.empty { background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px; text-align: center; }
.empty p { margin: 4px 0; }

/* ---------- lightbox ---------- */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(8, 10, 9, .94); color: #fff; }
.lightbox::backdrop { background: rgba(0,0,0,.6); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { margin: 0; max-width: 92vw; max-height: 90vh; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.lightbox img { max-width: 92vw; max-height: 84vh; object-fit: contain; border-radius: 4px; }
.lightbox figcaption { font-size: 13px; opacity: .8; }
.lb-close, .lb-nav { position: fixed; border: 0; background: rgba(255,255,255,.12); color: #fff; border-radius: 50%; width: 46px; height: 46px; display: grid; place-items: center; cursor: pointer; }
.lb-close:hover, .lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-close { top: 16px; right: 16px; }
.lb-prev { left: 16px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 16px; top: 50%; transform: translateY(-50%); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-box { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px; }
.login-box label { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 13px; }
.login-box input { height: 42px; border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; background: var(--panel); outline: 0; font-weight: 400; }
.login-box input:focus { border-color: var(--accent); }
.login-box .pin { letter-spacing: .6em; font-size: 20px; text-align: center; font-family: var(--mono); }
.login-box p { margin: 0; }
.alert { background: var(--bad-soft); color: var(--bad); padding: 8px 12px; border-radius: 8px; font-weight: 500; }

/* ---------- guide ---------- */
.guide h1 { font-size: 24px; margin: 8px 0; letter-spacing: -.01em; }
.guide h2 { font-size: 16px; margin: 28px 0 10px; }
.lead { color: var(--text-2); font-size: 15px; max-width: 760px; }
.glossary { display: grid; grid-template-columns: 220px 1fr; gap: 8px 20px; margin: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.glossary dt { font-weight: 600; display: flex; align-items: flex-start; gap: 4px; }
.glossary dd { margin: 0; color: var(--text-2); }

/* ---------- responsive ---------- */
.fab-filters, .only-mobile { display: none; }
@media (max-width: 1280px) {
  .metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .m:nth-child(4) { border-left: 0; }
  .m:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 1000px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 80px; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(340px, 90vw); height: 100vh; height: 100dvh; max-height: none; top: 0; z-index: 50; background: var(--bg);
    overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y;
    padding: 14px 14px 110px; transform: translateX(-105%); transition: transform .2s; box-shadow: 4px 0 24px rgba(0,0,0,.2); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open { overflow: hidden; }
  .fab-filters { display: inline-flex; align-items: center; gap: 8px; position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
    background: var(--text); color: var(--bg); border: 0; border-radius: 24px; padding: 11px 20px; font-weight: 600; box-shadow: 0 4px 16px rgba(0,0,0,.25); cursor: pointer; }
  .only-mobile { display: inline-grid; }
  .card { grid-template-columns: 260px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; padding: 8px 16px; gap: 8px 12px; }
  .brand-name { display: none; }
  .search { order: 5; flex: 1 1 100%; max-width: none; }
  .tabs a { padding: 6px 9px; font-size: 13px; white-space: nowrap; flex: none; }
  .tabs { order: 4; flex: 1 1 100%; overflow-x: auto; scrollbar-width: none; }
  .card { grid-template-columns: minmax(0, 1fr); }
  .gal { min-height: 0; aspect-ratio: 4 / 3; }
  .gal-nav { opacity: 1; width: 30px; height: 30px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .m:nth-child(odd) { border-left: 0; }
  .m:nth-child(4) { border-left: 1px solid var(--line); }
  .m:nth-child(n+3) { border-top: 1px solid var(--line); }
  .actions .btn-primary { margin-left: 0; flex: 1 1 100%; }
  .glossary { grid-template-columns: 1fr; }
  .results-head { flex-direction: column; align-items: flex-start; }
  .sel select { max-width: 60vw; }
}

/* ---------- densidade ---------- */
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; height: 32px; }
.seg button { border: 0; background: var(--panel); padding: 0 10px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
body:not(.dense) .seg [data-density="0"], body.dense .seg [data-density="1"] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
body.dense .cards { gap: 8px; }
body.dense .card { grid-template-columns: 210px minmax(0, 1fr); }
body.dense .gal { min-height: 150px; }
body.dense .body { padding: 8px 12px; gap: 5px; }
body.dense .title { font-size: 14.5px; -webkit-line-clamp: 3; }
body.dense .rounds, body.dense .summary-ai { display: none; }
body.dense .facts .fact:not(.warn):not(.ok):not(.favs):not(.tag):not(.note) { display: none; }
body.dense .m { padding: 4px 9px; }
body.dense .m .v { font-size: 14px; }
body.dense .m-main .v { font-size: 15px; }
body.dense .actions { padding-top: 0; }
body.dense .actions .btn-sm { height: 27px; font-size: 12.5px; }
@media (max-width: 760px) { body.dense .card { grid-template-columns: 120px minmax(0, 1fr); } body.dense .gal { aspect-ratio: auto; min-height: 120px; }
  body.dense .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } body.dense .gal-nav { display: none; } }

/* ---------- mapa ---------- */
.mapbox { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 14px; }
.map-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
#map { height: min(46vh, 440px); min-height: 280px; background: var(--panel-2); z-index: 0; }
.map-n { display: grid; place-items: center; pointer-events: none; }
.map-n span { color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 1px 2px rgba(0,0,0,.6); }
.leaflet-container { font: inherit; }
@media (prefers-color-scheme: dark) {
  .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9); }
}

/* ---------- botão de busca manual ---------- */
.scan { display: flex; align-items: center; gap: 8px; margin-left: auto; margin-right: 6px; }
.scan .btn svg { vertical-align: -2px; }
.scan-note { white-space: nowrap; }
.scan .bad { color: var(--bad); }
@media (max-width: 1200px) { .scan-note { display: none; } }

/* ---- Leiloeiros ---- */
.auctioneers h1 { font-size: 24px; margin: 8px 0 2px; letter-spacing: -.01em; }
.aq-bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.aq-bar input[type=search] { flex: 1 1 260px; height: 36px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); color: var(--text); }
.aq-bar select { height: 36px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--panel); color: var(--text); padding: 0 8px; }
.aq-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.aq-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.aq-table th, .aq-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.aq-table tbody tr:last-child td { border-bottom: 0; }
.aq-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.aq-table th a { color: inherit; text-decoration: none; }
.aq-table th a.on { color: var(--accent); }
.aq-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.aq-table tr.off td { opacity: .65; }
.aq-st { display: inline-block; padding: 1px 8px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.aq-st.on { background: var(--good-soft); color: var(--good); }
.aq-st.off { background: var(--bad-soft); color: var(--bad); }

/* filtros que não valem para a classe escolhida (Imóveis / Veículos) ficam escondidos; o servidor também os ignora */
#filters[data-scope="imovel"] .for-veiculo, #filters[data-scope="veiculo"] .for-imovel { display: none; }
/* botão "Filtrar" fixo no fim da barra lateral */
.filter-apply { position: sticky; bottom: 0; z-index: 2; display: flex; flex-direction: column; gap: 4px; padding: 10px 0 6px;
  background: linear-gradient(to bottom, transparent, var(--bg) 30%); }
.filter-apply .btn { width: 100%; }
.filter-apply.dirty .btn { box-shadow: 0 0 0 2px var(--accent); }
.filter-pending { font-size: 12px; color: var(--muted, #9aa); text-align: center; }
/* Imóveis / Veículos / Tudo: deixa claro qual está escolhido */
.scope-seg { display: flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; margin-bottom: 4px; }
.scope-seg button { flex: 1; height: 34px; border: 0; background: var(--panel); color: var(--text-2); font: inherit; font-size: 13px; cursor: pointer; }
.scope-seg button + button { border-left: 1px solid var(--line-2); }
.scope-seg button:hover { color: var(--text); }
.scope-seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* ---------- arquivar em massa ---------- */
.bulk { margin-bottom: 10px; }
.bulk > summary { list-style: none; display: inline-flex; cursor: pointer; }
.bulk > summary::-webkit-details-marker { display: none; }
.bulk[open] > summary { border-color: var(--line-2); }
.bulk-body { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin-top: 8px; padding: 12px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; max-width: 520px; }
.bulk-body input[type=text] { height: 34px; width: 100%; border: 1px solid var(--line-2); border-radius: 8px; padding: 0 10px;
  background: var(--panel); color: var(--text); font-size: 14px; }
.bulk-prev { min-height: 0; }
.bulk-msg { margin: 0; }
.bulk-msg.ok { color: var(--good, inherit); }
.bulk-samples { margin: 4px 0 8px; padding-left: 18px; }
.bulk-auction-status { margin-left: 8px; }

/* selo vermelho na aba do menu */
.av-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 18px; text-align: center; }


/* lote sem foto: some a área da imagem e o cartão ocupa só o texto */
.card.no-photo, body.dense .card.no-photo { grid-template-columns: minmax(0, 1fr); }
.badge-disc { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.badge-disc.strong { background: var(--accent); color: #fff; }

/* arrastar o cartão para a direita arquiva */
.card .body { touch-action: pan-y; }
.card.swiping { user-select: none; -webkit-user-select: none; transition: none; cursor: grabbing; position: relative; z-index: 1;
  box-shadow: -100vw 0 0 0 var(--accent-soft), var(--shadow); }
.card.swiping.ready { box-shadow: -100vw 0 0 0 var(--accent), var(--shadow); }
.card.swipe-out { transition: transform .18s ease-in, opacity .18s; transform: translateX(110%); opacity: 0; }
.card.swipe-back { transition: transform .18s ease-out; transform: none; }
body.swiping-cards .cards { overflow-x: clip; }
