:root {
  --plum: #483850;
  --plum-deep: #342838;
  --plum-soft: #6d5c76;
  --ink: #241c2b;
  --text: #2b2232;
  --muted: #6e6478;
  --muted-2: #948ba0;
  --text-dim: #6e6478;
  --line: #e6e0ea;
  --line-strong: #d5ccdc;
  --bg: #f4f1f6;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-solid: #ffffff;
  --panel-2: #f7f4f8;
  --border: #e4dde8;
  --border-soft: #eee8f1;
  --green: #14a37a;
  --green-deep: #0d7d5e;
  --blue: #3d8fc4;
  --gold: #e2b12e;
  --accent: #483850;
  --accent-2: #3a2c42;
  --violet: #6d4f86;
  --public: #b26a00;
  --public-bg: #fff7ea;
  --private: #0e8a66;
  --private-bg: #eef8f4;
  --high: #c43838;
  --medium: #a56b08;
  --low: #2d7eae;
  --high-bg: #fdeeee;
  --medium-bg: #fff6e6;
  --low-bg: #eef6fb;
  --shadow: 0 1px 2px rgba(48, 24, 48, 0.04), 0 14px 36px rgba(48, 24, 48, 0.06);
  --shadow-sm: 0 1px 2px rgba(48, 24, 48, 0.05);
  --ring: 0 0 0 4px rgba(72, 56, 80, 0.12);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "Outfit", "Segoe UI", sans-serif;
  --header-h: 72px;
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { color-scheme: light; }

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(980px 420px at 100% -12%, rgba(128, 184, 224, 0.22), transparent 58%),
    radial-gradient(760px 380px at -8% -18%, rgba(32, 176, 136, 0.12), transparent 52%),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font-family: inherit; letter-spacing: inherit; }
code, .mono { font-family: var(--mono); letter-spacing: -0.01em; }

::selection { background: #eadcf3; color: var(--ink); }

:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 2px;
}

/* ------------------------------------------------------------------ */
/* Header                                                              */
/* ------------------------------------------------------------------ */
.appbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: var(--header-h);
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-logo {
  display: block;
  height: 120px;
  width: 120px;
  object-fit: contain;
  flex: none;
}

.brand-rule {
  width: 1px;
  height: 48px;
  background: var(--line);
  flex: none;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--ink);
}

.env-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--plum);
  border: 1px solid #ddd0e4;
  border-radius: 999px;
  padding: 2px 7px 1px;
  background: #f6f0f8;
  line-height: 1.4;
}

.tagline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.3;
}

.appbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.monitor-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 280px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.engine-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(20, 163, 122, 0.14);
  flex: none;
}

#engine-pill-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topstats { display: flex; gap: 8px; }

.stat {
  min-width: 86px;
  padding: 7px 14px 6px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.stat:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(48, 24, 48, 0.06); }
.stat.public { background: var(--public-bg); border-color: #f3e0b6; }
.stat.private { background: var(--private-bg); border-color: #c9eadc; }
.stat.data { background: #f4f8fc; border-color: #d3e4f2; }
.stat.data .stat-num { font-size: 16px; letter-spacing: -0.03em; }

.stat-num {
  display: block;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--plum);
}

.stat.public .stat-num { color: var(--public); }
.stat.private .stat-num { color: var(--private); }

.stat-num.pop { animation: statPop 0.38s var(--ease); }

.stat-label {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.brand-stripe {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1fr;
  height: 3px;
  flex: none;
}
.brand-stripe span:nth-child(1) { background: #20b088; }
.brand-stripe span:nth-child(2) { background: #80b8e0; }
.brand-stripe span:nth-child(3) { background: #f8d060; }

/* ------------------------------------------------------------------ */
/* Risk ribbon                                                         */
/* ------------------------------------------------------------------ */
.risk-ribbon {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  min-height: 42px;
  padding: 8px 24px;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease), border-color 0.35s var(--ease);
}

.risk-ribbon .risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
  transition: background-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.risk-ribbon.neutral { background: rgba(255, 255, 255, 0.72); color: var(--muted); border-bottom-color: var(--line); }
.risk-ribbon.neutral .risk-dot { background: #c4b9ce; }
.risk-ribbon.safe { background: #e7f6f0; color: #0c6d50; border-bottom-color: #c6eadc; }
.risk-ribbon.safe .risk-dot { background: var(--green); box-shadow: 0 0 0 4px rgba(20, 163, 122, 0.16); }
.risk-ribbon.warn { background: #fff6e4; color: #8a5600; border-bottom-color: #f3e0b4; }
.risk-ribbon.warn .risk-dot { background: #e0a000; box-shadow: 0 0 0 4px rgba(224, 160, 0, 0.16); }
.risk-ribbon.danger { background: #fdeeee; color: #9d2424; border-bottom-color: #f4cccc; }
.risk-ribbon.danger .risk-dot {
  background: #e23b3b;
  animation: pulse-red 1.7s var(--ease) infinite;
}

#risk-text b { font-weight: 700; }

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px 24px 20px;
}

.panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(72, 56, 80, 0.08);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border-soft);
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.panel-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.panel-actions { display: flex; align-items: center; gap: 8px; }

.count-pill {
  display: inline-flex;
  align-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #f3eef6;
  color: var(--plum);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.count-pill[hidden] { display: none; }

.sync-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--plum-soft);
}
.sync-note[hidden] { display: none; }
.sync-note .spinner { width: 12px; height: 12px; margin: 0; }

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s var(--ease);
}

.btn:hover:not(:disabled) {
  border-color: #cbbfd4;
  background: #faf7fb;
  transform: translateY(-1px);
}

.btn:active:not(:disabled) { transform: translateY(0); box-shadow: none; }

.btn.primary {
  background: var(--plum);
  border-color: var(--plum);
  color: #fff;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.16) inset, 0 8px 18px rgba(72, 56, 80, 0.18);
}

.btn.primary:hover:not(:disabled) {
  background: var(--plum-deep);
  border-color: var(--plum-deep);
  color: #fff;
}

.btn.small { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn.icon-only { width: 32px; padding: 0; }
.icon-btn { gap: 6px; }
.ic { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn:disabled,
.btn.primary:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  filter: none;
}

.btn.danger {
  color: var(--high);
  border-color: #f0c9c9;
  background: #fff;
}

.btn.danger:hover:not(:disabled) {
  background: var(--high-bg);
  border-color: #e7b0b0;
  color: #a32020;
}

.btn.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  box-shadow: none;
}

.btn.ghost:hover:not(:disabled) {
  background: var(--panel-2);
  color: var(--ink);
  border-color: #d4cadc;
}

.hidden { display: none !important; }

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.engine-tag {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  vertical-align: middle;
}

.engine-tag.ai { background: #f3eaf8; color: #6a3f86; border: 1px solid #e0ccea; }
.engine-tag.regex { background: #e8f3fb; color: #1d6f9a; border: 1px solid #c9e2f3; }
.engine-tag.compare { background: #e7f7f1; color: #0d7a5c; border: 1px solid #bfe6d6; }
.engine-tag.images { background: #f3eaf8; color: #6a3f86; border: 1px solid #e0ccea; }

/* ------------------------------------------------------------------ */
/* Inventory                                                           */
/* ------------------------------------------------------------------ */
.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 12px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.search-field:focus-within {
  border-color: var(--plum);
  box-shadow: var(--ring);
}

.search-ic {
  width: 16px;
  height: 16px;
  flex: none;
  stroke: var(--muted-2);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-field input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 13.5px;
  padding: 0;
}

.search-field input[type="search"]:focus-visible { outline: none; }
.search-field input::placeholder { color: #a79eaf; }

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: #f3eef4;
  border: 1px solid var(--border-soft);
}

.segmented button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  min-height: 46px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.18s var(--ease);
}

.segmented button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.7); }

.segmented button.active {
  background: #fff;
  color: var(--plum);
  box-shadow: 0 1px 2px rgba(48, 24, 48, 0.06), 0 4px 12px rgba(48, 24, 48, 0.05);
}

.seg-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.seg-count {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.bucket-list-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bucket-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 4px 8px 8px;
}

.discover-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(3px);
  color: var(--plum);
  font-size: 14px;
  font-weight: 600;
}

.discover-overlay[hidden] { display: none !important; }
.discover-overlay .spinner { width: 22px; height: 22px; margin: 0; }
.discover-overlay p { margin: 0; letter-spacing: -0.02em; }

#btn-refresh.is-busy .ic { animation: spin 0.7s linear infinite; }
#btn-refresh.is-busy { cursor: progress; }

.bucket-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 2px 0;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.16s var(--ease);
  animation: rowIn 0.22s var(--ease) both;
}

.bucket-row:nth-child(1) { animation-delay: 0.01s; }
.bucket-row:nth-child(2) { animation-delay: 0.03s; }
.bucket-row:nth-child(3) { animation-delay: 0.05s; }
.bucket-row:nth-child(4) { animation-delay: 0.07s; }
.bucket-row:nth-child(5) { animation-delay: 0.09s; }
.bucket-row:nth-child(6) { animation-delay: 0.11s; }
.bucket-row:nth-child(7) { animation-delay: 0.13s; }
.bucket-row:nth-child(8) { animation-delay: 0.15s; }
.bucket-row:nth-child(n + 16) { animation: none; }

.bucket-row:hover {
  background: #faf7fb;
  border-color: var(--border-soft);
}

.bucket-row.is-selected {
  background: #f6f1f8;
  border-color: #e0d3e8;
}

.bucket-row:has(input:disabled) { cursor: default; opacity: 0.58; }
.bucket-row:has(input:disabled):hover { opacity: 0.78; background: transparent; border-color: transparent; }

.bucket-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--plum);
  flex: none;
}

.bucket-row input:disabled { cursor: not-allowed; }
.bucket-main { flex: 1; min-width: 0; }

.bucket-name {
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bucket-meta {
  margin-top: 1px;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  flex: none;
}

.badge.public { color: var(--public); background: var(--public-bg); border: 1px solid #f0d7a4; }
.badge.private { color: var(--private); background: var(--private-bg); border: 1px solid #c5e8d8; }

.bucket-size {
  flex: none;
  min-width: 58px;
  text-align: right;
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.bucket-size.is-unknown { color: var(--muted-2); }

.scan-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 16px 16px;
  border-top: 1px solid var(--border-soft);
  background: linear-gradient(180deg, #fbf9fc, #fff);
}

.mini {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

.mini input { width: 15px; height: 15px; margin: 0; accent-color: var(--plum); }

.scan-controls { display: flex; flex-direction: column; gap: 8px; }
#btn-scan { width: 100%; height: 40px; font-size: 13.5px; }

.job-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.job-actions:not(:has(.btn:not(.hidden))) { display: none; }
.job-actions .btn { flex: 1 1 0; }

#btn-pause { color: #8a5600; border-color: #ead7a6; background: #fffaf0; }
#btn-pause:hover:not(:disabled) { background: #fff3d8; }
#btn-stop { color: var(--high); border-color: #f0c9c9; }
#btn-stop:hover:not(:disabled) { background: var(--high-bg); }

/* ------------------------------------------------------------------ */
/* Reports header                                                      */
/* ------------------------------------------------------------------ */
.reports-head {
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  padding: 14px 16px 12px;
}

.reports-titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  flex-wrap: wrap;
}

.reports-titlebar h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.proof-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-deep);
  background: var(--private-bg);
  border: 1px solid #c5e8d8;
  border-radius: 999px;
  padding: 3px 8px 2px;
}

.proof-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.scan-status { font-size: 12.5px; color: var(--muted); font-weight: 600; min-width: 0; }
.scan-status:empty { display: none; }

.scan-status:not(:empty) {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: min(560px, 100%);
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--plum-soft);
}

.scan-status:not(:empty):not(:has(.scan-prog)) {
  margin-left: auto;
  max-width: min(480px, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scan-status:has(.scan-prog) {
  flex: 0 1 440px;
  max-width: min(440px, 100%);
  margin-left: auto;
  border-radius: 12px;
  padding: 8px 12px;
}

.reports-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  container-type: inline-size;
}

.tool-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: #f6f3f8;
  border: 1px solid var(--border-soft);
}

.tool-cluster .btn,
.tool-cluster select.btn { box-shadow: none; background-color: #fff; }

select.btn { line-height: 1.2; }

.tool-cluster-danger { margin-left: auto; background: #fff; }

@container (max-width: 820px) {
  .tool-cluster-danger { margin-left: 0; }
}

#history-select { width: 210px; max-width: 100%; }

select.btn {
  appearance: none;
  padding-right: 30px;
  text-align: left;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' stroke='%236e6478' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m4 6 3 3 3-3'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px;
  cursor: pointer;
}

.pattern-bar {
  margin: 12px 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfafc;
  flex: none;
}

.pattern-bar > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.pattern-bar > summary::-webkit-details-marker { display: none; }
.pattern-bar > summary:hover { background: rgba(72, 56, 80, 0.03); }

.pb-caret {
  width: 7px;
  height: 7px;
  border-right: 1.7px solid var(--muted);
  border-bottom: 1.7px solid var(--muted);
  transform: rotate(-45deg);
  transition: transform 0.18s var(--ease);
  margin: 0 2px 0 3px;
  flex: none;
}

.pattern-bar[open] .pb-caret { transform: rotate(45deg); }
.pb-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.pb-hint { font-size: 12px; color: var(--muted); margin-left: auto; }
.pb-actions { display: flex; gap: 8px; padding: 0 12px 8px; }

.pattern-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 2px 12px 12px;
}

.pat-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s var(--ease);
}

.pat-chip.on { background: #eef8f4; color: #0d7a5c; border-color: #bfe6d6; }
.pat-chip.off { background: #f6f4f7; color: #9a91a4; border-color: var(--line); text-decoration: line-through; }
.pat-chip:hover { transform: translateY(-1px); }

.reports {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 20px;
}

/* ------------------------------------------------------------------ */
/* Report cards                                                        */
/* ------------------------------------------------------------------ */
.report-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.report-metrics > span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.report-metrics b {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.report-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
  animation: rowIn 0.32s var(--ease) both;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.report-card:hover { border-color: #d9cfe2; box-shadow: 0 10px 24px rgba(48, 24, 48, 0.05); }
.report-card:nth-child(n + 12) { animation: none; }

.report-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, #fcfbfd, #fff);
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.report-title {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.015em;
}

.report-title .gs,
.cmp-obj-path .gs,
.imgcount-row .gs { color: var(--muted-2); font-weight: 500; }

.where-head { line-height: 1.45; word-break: break-word; }
.where-head .where-k,
.where-k {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-right: 4px;
}

.where-head .sep,
.cmp-obj-path .sep { color: #c8bed0; margin: 0 6px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--plum-soft);
}

.chip.mini { font-size: 11px; padding: 2px 7px; }
.chip.high { color: #a32020; background: var(--high-bg); border-color: #f3c7c7; }
.chip.medium { color: var(--medium); background: var(--medium-bg); border-color: #f0ddb0; }
.chip.low { color: var(--low); background: var(--low-bg); border-color: #c9e2f2; }

.report-body { padding: 14px; }
.report-body code,
.hit code,
.cmp-row code,
.sugg-rx {
  background: #f6f3f8;
  border: 1px solid var(--border-soft);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink);
}

.finding-list { display: flex; flex-direction: column; gap: 8px; }

.finding-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.finding-card[open] {
  border-color: #d4c4de;
  box-shadow: 0 8px 20px rgba(72, 56, 80, 0.05);
}

.finding-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.finding-summary::-webkit-details-marker { display: none; }
.finding-summary:hover { background: #fbf9fc; }

.fc-caret {
  color: var(--muted-2);
  font-size: 11px;
  transition: transform 0.18s var(--ease);
  flex: none;
}

.finding-card[open] .fc-caret { transform: rotate(90deg); color: var(--plum); }
.fc-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; flex: 1; }
.fc-file { font-weight: 600; font-size: 13.5px; letter-spacing: -0.015em; word-break: break-all; color: var(--ink); }
.fc-folder { font-size: 11.5px; color: var(--muted); word-break: break-all; }

.fc-ext {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--violet);
  border: 1px solid #e3d3ea;
  background: #f7f1f9;
  border-radius: 999px;
  padding: 1px 6px;
}

.fc-ext.alt { color: var(--blue); border-color: #c9e2f2; background: var(--low-bg); }
.fc-right { margin-left: auto; flex: none; }

.hit-count {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #a32020;
  background: var(--high-bg);
  border-radius: 999px;
  padding: 2px 8px;
  font-variant-numeric: tabular-nums;
}

.finding-body { padding: 12px 14px 14px; border-top: 1px solid var(--border-soft); background: #fcfbfd; }
.finding-where { min-width: 0; margin-bottom: 10px; }
.where-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 8px; align-items: baseline; margin-bottom: 4px; }
.where-v { font-size: 12.5px; word-break: break-all; color: var(--ink); }

.loc-copy,
.loc-full {
  display: inline-flex;
  align-items: center;
  margin-top: 8px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--plum);
  cursor: pointer;
  border: 1px solid #e0d3e8;
  background: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.15s var(--ease);
}

.loc-copy:hover { background: #f6f1f8; border-color: #cbb8d8; transform: translateY(-1px); }

.fc-typechips { margin-bottom: 12px; }

.hit-groups { display: flex; flex-direction: column; gap: 8px; }

.hit-group {
  border: 1px solid var(--border-soft);
  border-left-width: 3px;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.hit-group:has(.sev.high) { border-left-color: var(--high); }
.hit-group:has(.sev.medium) { border-left-color: #e0a000; }
.hit-group:has(.sev.low) { border-left-color: var(--low); }

.hit-group-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 12.5px;
  background: #fbfafc;
  border-bottom: 1px solid var(--border-soft);
}

.hit-group-n {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 7px;
  font-variant-numeric: tabular-nums;
}

.hit-group-body { padding: 6px 10px 8px; display: flex; flex-direction: column; gap: 4px; }
.hit-group-body .hit { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hit-group-body .hit code { word-break: break-all; }
.hit-group-body .suppress-btn { margin-left: auto; }

.hit { padding: 2px 0; }
.hit .ctag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--low-bg);
  color: var(--low);
  border: 1px solid #c9e2f2;
}

.hit .at { color: var(--muted); font-size: 11.5px; }
.hit .at.img { color: var(--violet); font-weight: 600; }

code.reveal { cursor: help; border-bottom: 1px dashed #c4b8ce; }
code.reveal:hover { color: var(--plum); border-bottom-color: var(--plum); }

.reveal-tip {
  position: fixed;
  z-index: 120;
  max-width: min(480px, calc(100vw - 24px));
  width: max-content;
  background: var(--plum-deep);
  color: #f7f3f8;
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 12px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 12px 32px rgba(36, 20, 42, 0.28);
  pointer-events: none;
  animation: tipIn 0.14s var(--ease);
}

.hit .conf { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px; }
.conf-high { color: var(--private); background: var(--private-bg); }
.conf-medium { color: var(--medium); background: var(--medium-bg); }
.conf-low { color: var(--muted); background: #f1eef3; }

.suppress-btn {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  font-family: inherit;
  padding: 2px 7px;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.suppress-btn:hover { color: var(--plum); background: #f6f1f8; border-color: #e4d7ea; }

.sev { font-weight: 700; }
.sev.high { color: var(--high); }
.sev.medium { color: var(--medium); }
.sev.low { color: var(--low); }

.more { color: var(--muted); font-size: 12px; margin-top: 4px; }
td.num { font-weight: 700; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.skip { color: var(--muted); font-style: italic; }
.type-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.type-tag { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11px; }

.loc-cell { max-width: 340px; }
.loc { word-break: break-all; line-height: 1.5; }
.loc-folder { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.loc-root { color: var(--muted-2); font-style: italic; font-size: 11.5px; }
.loc-file { color: var(--low); font-weight: 700; font-family: var(--mono); }
.loc-ext {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: var(--violet);
  border: 1px solid #e3d3ea;
  background: #f7f1f9;
  border-radius: 999px;
  padding: 0 6px;
}

/* Mitigation */
.mitigation {
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  background: #fff;
}

.mitigation.ok { border-left-color: var(--green); background: #f7fcfa; }
.mitigation.warn { border-left-color: #e0a000; background: #fffaf1; }
.mitigation.bad { border-left-color: var(--high); background: #fff8f8; }
.mit-head { font-size: 13.5px; margin-bottom: 8px; color: var(--ink); }
.mit-head small { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.mit-counts { display: flex; flex-wrap: wrap; gap: 8px 14px; font-size: 12.5px; font-weight: 600; }
.mit-counts .ok { color: var(--private); }
.mit-counts .warn { color: var(--medium); }
.mit-counts .bad { color: var(--high); }
.mit-note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.mitigation details { margin-top: 8px; font-size: 12.5px; }
.mitigation summary { cursor: pointer; color: var(--plum-soft); font-weight: 600; }
.mitigation ul { margin: 6px 0 0; padding-left: 18px; }
.mitigation li { margin: 3px 0; }
.mitigation code { background: #fff; }

/* Risk pills */
.risk-pill {
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  padding: 2px 7px;
  border-radius: 7px;
  flex: none;
  min-width: 24px;
  text-align: center;
  border: 1px solid;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

.risk-inline { padding: 1px 6px; border-radius: 6px; border: 1px solid; font-weight: 700; }
.risk-pill.lvl-critical, .risk-inline.lvl-critical { color: #fff; background: var(--high); border-color: var(--high); }
.risk-pill.lvl-high, .risk-inline.lvl-high { color: var(--high); background: var(--high-bg); border-color: #f0c4c4; }
.risk-pill.lvl-medium, .risk-inline.lvl-medium { color: var(--medium); background: var(--medium-bg); border-color: #f0ddb0; }
.risk-pill.lvl-low, .risk-inline.lvl-low { color: var(--private); background: var(--private-bg); border-color: #c5e8d8; }

.ai-error-banner {
  background: var(--high-bg);
  color: #9d2424;
  border: 1px solid #f0c4c4;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-weight: 600;
}

.ai-error-banner small {
  display: block;
  margin-top: 4px;
  font-weight: 500;
  color: #7d3a3a;
  word-break: break-word;
}

/* ------------------------------------------------------------------ */
/* Progress                                                            */
/* ------------------------------------------------------------------ */
.progress {
  position: relative;
  height: 6px;
  width: 100%;
  background: #efeaf2;
  border-radius: 999px;
  overflow: hidden;
  flex: none;
}

.progress .bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: linear-gradient(90deg, #20b088, #0e8a66);
  border-radius: 999px;
  transition: width 0.35s var(--ease);
}

.progress.indeterminate .bar { width: 38%; animation: indet 1.15s ease-in-out infinite; }

.scan-prog {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.scan-prog .progress { width: 140px; flex: 1; min-width: 88px; }

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e4dce8;
  border-top-color: var(--plum);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  flex: none;
}

/* ------------------------------------------------------------------ */
/* Empty states                                                        */
/* ------------------------------------------------------------------ */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 4px;
  color: var(--muted);
  padding: 48px 24px;
}

.bucket-list > .empty,
.reports > .empty {
  min-height: 100%;
}

.empty-title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.empty-copy {
  margin: 0;
  max-width: 36ch;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

.empty .spinner { width: 18px; height: 18px; margin-bottom: 8px; }
.empty.small { padding: 18px 12px; }
.empty.small .empty-title { font-size: 13.5px; }
.empty-icon { font-size: 28px; margin-bottom: 6px; }

/* ------------------------------------------------------------------ */
/* Modals                                                              */
/* ------------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(36, 24, 42, 0.42);
  backdrop-filter: blur(6px);
}

.modal.hidden { display: none !important; }
.modal:not(.hidden) { animation: fadeIn 0.18s ease; }
.modal:not(.hidden) .modal-box { animation: popIn 0.26s var(--ease); }

.modal-box {
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 18px;
  width: min(720px, 100%);
  max-height: min(86vh, 860px);
  overflow: auto;
  box-shadow: 0 24px 64px rgba(36, 20, 42, 0.22);
}

#cmp-hist-modal .modal-box { width: min(1080px, 100%); }
.engine-box { width: min(560px, 100%); }
.imgcount-box { width: min(560px, 100%); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  position: sticky;
  top: 0;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  z-index: 1;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.modal-body { padding: 18px 20px 20px; }
.modal-body h3 {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 18px 0 10px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  background: #fbfafc;
}

.engine-lead { margin: 0 0 14px; color: var(--muted); font-size: 13.5px; }
.engine-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.engine-choice {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
  padding: 16px;
  border-radius: 14px;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.16s ease, transform 0.16s var(--ease), box-shadow 0.16s ease;
}

.engine-choice:hover:not(:disabled) {
  border-color: #cbb8d8;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(72, 56, 80, 0.08);
}

.engine-choice:disabled { opacity: 0.45; cursor: not-allowed; }
.ec-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 999px; }
.ec-badge.ai { background: #f3eaf8; color: #6a3f86; border: 1px solid #e0ccea; }
.ec-badge.regex { background: #e8f3fb; color: #1d6f9a; border: 1px solid #c9e2f3; }
.ec-title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); }
.ec-desc { font-size: 12.5px; line-height: 1.45; color: var(--muted); }
.engine-note { margin-top: 14px; font-size: 12.5px; color: var(--muted); }

.imgcount-loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 8px 0 12px; }
.imgcount-big { font-size: 15px; margin-bottom: 6px; color: var(--ink); }
.imgcount-num {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--violet);
  font-variant-numeric: tabular-nums;
  margin-right: 6px;
  vertical-align: -2px;
}
.imgcount-sub { font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
.imgcount-warn {
  background: var(--high-bg);
  color: #9d2424;
  border: 1px solid #f0c4c4;
  border-radius: 10px;
  padding: 10px 12px;
  margin: 8px 0;
  font-size: 12.5px;
  font-weight: 600;
}
.imgcount-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 10px 0;
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
}
.imgcount-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
  padding: 6px 8px;
  border-radius: 8px;
}
.imgcount-row:hover { background: var(--panel-2); }
.imgcount-row .ic-b { color: var(--ink); word-break: break-all; }
.imgcount-row .ic-n { color: var(--violet); font-weight: 700; }
.imgcount-row .ic-c { color: var(--muted); }
.imgcount-note { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Compare */
.cmp-pick { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin: 4px 0 16px; }
.cmp-pick label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.cmp-pick select { min-width: min(280px, 100%); }

.cmp-summary {
  background: #fbfafc;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin: 4px 0 16px;
}

.cmp-scan-cards { display: grid; grid-template-columns: 1fr auto 1fr; gap: 14px; align-items: center; }
.cmp-scan-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; text-align: center; background: #fff; }
.cmp-scan-card.side-a { border-color: #e0ccea; background: #fbf7fd; }
.cmp-scan-card.side-b { border-color: #c9e2f3; background: #f5fafd; }
.cmp-sc-eng { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.cmp-sc-total { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--ink); }
.cmp-sc-sub { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.cmp-scan-mid { text-align: center; padding: 0 6px; }
.cmp-sim { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; color: var(--green-deep); line-height: 1; font-variant-numeric: tabular-nums; }
.cmp-sim-sub { font-size: 11.5px; color: var(--muted); }
.cmp-shared {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 8px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  display: inline-block;
  background: #fff;
}

.cmp-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; margin: 16px 0 12px; background: #efeaf2; }
.cmp-seg { display: block; height: 100%; transition: width 0.4s var(--ease); }
.cmp-seg.both { background: #20b088; }
.cmp-seg.a { background: #7a5ea3; }
.cmp-seg.b { background: #3d8fc4; }

.cmp-legend { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; font-size: 12.5px; color: var(--muted); }
.cmp-legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.cmp-legend .dot.both { background: #20b088; }
.cmp-legend .dot.a { background: #7a5ea3; }
.cmp-legend .dot.b { background: #3d8fc4; }
.cmp-toggle { margin-left: auto; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }

.cmp-objects { display: flex; flex-direction: column; gap: 10px; }
.cmp-obj { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cmp-obj.same { opacity: 0.78; }
.cmp-obj-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: #fbfafc;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}
.cmp-obj-path { font-size: 13px; word-break: break-all; }
.cmp-obj-chips { display: flex; gap: 6px; flex: none; }
.cmp-chip { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); }
.cmp-chip.both { background: #e7f7f1; color: #0d7a5c; border-color: #bfe6d6; }
.cmp-chip.a { background: #f3eaf8; color: #6a3f86; border-color: #e0ccea; }
.cmp-chip.b { background: #e8f3fb; color: #1d6f9a; border-color: #c9e2f3; }
.cmp-obj-cols { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; padding: 12px; }
.cmp-col { background: #fbfafc; border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px; }
.cmp-col.both { border-top: 2px solid #20b088; }
.cmp-col.a { border-top: 2px solid #7a5ea3; }
.cmp-col.b { border-top: 2px solid #3d8fc4; }
.cmp-col-h { font-size: 12px; font-weight: 700; margin-bottom: 8px; color: var(--muted); }
.cmp-row {
  font-size: 12px;
  padding: 5px 0;
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
}
.cmp-row:last-child { border-bottom: none; }
.cmp-row code { word-break: break-all; text-align: right; }
.cmp-lbl { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.cmp-empty { color: var(--muted-2); }
.cmp-ai { color: #6a3f86; }
.cmp-rx { color: #1d6f9a; }

/* Trends */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding: 12px;
  background: #fbfafc;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  overflow-x: auto;
}

.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-width: 36px; height: 100%; }
.bar-chart .bar {
  width: 18px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, #80b8e0, #483850);
  animation: grow 0.45s var(--ease) both;
}
.bar-val { font-size: 11px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; color: var(--ink); }
.bar-lbl { font-size: 10px; color: var(--muted); }

.exp-cards { display: flex; gap: 12px; }
.exp-card {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
  background: #fff;
}
.exp-card.danger { border-color: #f0c4c4; background: #fff8f8; }
.exp-card.safe { border-color: #c5e8d8; background: #f7fcfa; }
.exp-num { font-size: 32px; font-weight: 700; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; color: var(--ink); }
.exp-card.danger .exp-num { color: var(--high); }
.exp-card.safe .exp-num { color: var(--private); }

/* Suggestions (kept for any injected markup) */
.suggestions { display: flex; flex-direction: column; gap: 10px; }
.sugg { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sugg-main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sugg-meta { font-size: 12px; color: var(--muted); margin: 6px 0; }

/* ------------------------------------------------------------------ */
/* Toast + scrollbars                                                  */
/* ------------------------------------------------------------------ */
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  left: auto;
  max-width: min(420px, calc(100vw - 32px));
  background: var(--plum-deep);
  color: #f6f2f7;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(36, 20, 42, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s var(--ease);
  z-index: 110;
  font-weight: 500;
  font-size: 13.5px;
}

.toast.show { opacity: 1; transform: none; }
.toast.err { background: #7c2430; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #d9d0e0; border-radius: 99px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #c9bdD2; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: thin; scrollbar-color: #d9d0e0 transparent; }

/* ------------------------------------------------------------------ */
/* Motion                                                              */
/* ------------------------------------------------------------------ */
@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes rowIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes statPop {
  from { opacity: 0.35; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@keyframes popIn {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes tipIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

@keyframes grow {
  from { transform: scaleY(0.4); transform-origin: bottom; opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes indet {
  0% { left: -40%; }
  100% { left: 100%; }
}

@keyframes pulse-red {
  0% { box-shadow: 0 0 0 0 rgba(226, 59, 59, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(226, 59, 59, 0); }
  100% { box-shadow: 0 0 0 0 rgba(226, 59, 59, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 1180px) {
  .layout { grid-template-columns: 320px minmax(0, 1fr); padding: 14px; gap: 12px; }
  .tool-cluster-danger { margin-left: 0; }
  .appbar { padding: 12px 16px; }
  .risk-ribbon { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 960px) {
  body { overflow: auto; height: auto; }
  .layout { display: flex; flex-direction: column; height: auto; }
  .panel { min-height: 520px; }
  .bucket-list { min-height: 240px; }
  .appbar { flex-wrap: wrap; }
  .appbar-right { width: 100%; justify-content: space-between; }
  .monitor-pill { max-width: 46%; }
  .cmp-scan-cards, .cmp-obj-cols, .engine-choices, .exp-cards { grid-template-columns: 1fr; }
  .exp-cards { flex-direction: column; }
  .pb-hint { display: none; }
}

@media (max-width: 640px) {
  .brand-logo { height: 88px; width: 88px; }
  .brand-text h1 { font-size: 16px; }
  .tagline { display: none; }
  .topstats { width: 100%; }
  .stat { flex: 1; min-width: 0; padding-left: 10px; padding-right: 10px; }
  .appbar-right { flex-wrap: wrap; }
  .monitor-pill { max-width: none; width: 100%; }
  .reports-tools { width: 100%; }
  .tool-cluster {
    width: auto;
    max-width: 100%;
    background: transparent;
    border: 0;
    padding: 0;
  }
  .tool-cluster-danger { margin-left: 0; background: transparent; }
  #history-select { width: min(100%, 240px); }
  .modal { padding: 12px; }
  .where-row { grid-template-columns: 1fr; gap: 0; }
}

.signout-form { margin: 0; display: flex; }

.login-body {
  min-height: 100%;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
}

.login-card {
  width: min(400px, 100%);
  padding: 28px 28px 24px;
  background: #fff;
  border: 1px solid rgba(72, 56, 80, 0.08);
  border-radius: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo { width: 148px; height: 148px; object-fit: contain; }
.login-card h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; color: var(--ink); }
.login-lead { margin: 6px 0 18px; color: var(--muted); font-size: 14px; }
.login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--high-bg);
  color: #9d2424;
  font-size: 13px;
  font-weight: 600;
}
.login-form { display: flex; flex-direction: column; gap: 12px; text-align: left; }
.login-form label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.login-form input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fff;
}
.login-form input:focus { outline: none; border-color: var(--plum); box-shadow: var(--ring); }
.login-form .btn.primary { height: 42px; margin-top: 4px; }
