/* Scrapers admin: neutral, dense, light/dark. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --hover: #f3f5f8;
  --border: #e3e6ea;
  --border-strong: #cfd4da;
  --text: #1f2328;
  --muted: #656d76;
  --faint: #9aa1a9;
  --accent: #2f6feb;
  --accent-weak: #e8f0fe;
  --accent-text: #1f5ad1;
  --topbar: #24292f;
  --topbar-text: #e6e8eb;
  --ok: #1a7f37;
  --warn: #bf8700;
  --danger: #cf222e;
  --danger-weak: #ffebe9;
  --warn-weak: #fff8c5;
  --badge-l: 94%;
  --badge-text-l: 32%;
  --shadow: 0 1px 2px rgba(31, 35, 40, 0.06);
  --shadow-lg: 0 8px 24px rgba(31, 35, 40, 0.16);
  --radius: 8px;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1117;
    --surface: #161b22;
    --surface-2: #1c2129;
    --hover: #1f252e;
    --border: #2a313b;
    --border-strong: #3d444d;
    --text: #e6edf3;
    --muted: #8d96a0;
    --faint: #6e7681;
    --accent: #4493f8;
    --accent-weak: rgba(56, 139, 253, 0.15);
    --accent-text: #79b0fb;
    --topbar: #010409;
    --ok: #3fb950;
    --warn: #d29922;
    --danger: #f85149;
    --danger-weak: rgba(248, 81, 73, 0.12);
    --warn-weak: rgba(187, 128, 9, 0.15);
    --badge-l: 22%;
    --badge-text-l: 78%;
    --shadow: none;
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

*,
*::before,
*::after {
  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;
}

a {
  color: var(--accent-text);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  font-weight: 600;
}

code {
  font: 12px var(--mono);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  word-break: break-all;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px;
}

.muted {
  color: var(--muted);
}
.nil {
  color: var(--faint);
}
.tnum {
  font-variant-numeric: tabular-nums;
}
.nowrap {
  white-space: nowrap;
}

/* ---- shell ------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  background: var(--topbar);
  color: var(--topbar-text);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 650;
  font-size: 16px;
}
.logo:hover {
  text-decoration: none;
}
.logo-mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--accent);
  font-size: 14px;
  font-weight: 700;
}

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 13px;
  color: #b8bfc7;
}
.topbar-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3fb950;
  box-shadow: 0 0 0 3px rgba(63, 185, 80, 0.2);
}
.status-dot.off {
  background: #8d96a0;
  box-shadow: none;
}

.shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: calc(100vh - 52px);
}

.sidebar {
  position: sticky;
  top: 52px;
  height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.nav-group {
  margin: 14px 10px 6px;
  font-size: 12px;
  color: var(--muted);
}
.nav-group:first-child {
  margin-top: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  margin-bottom: 2px;
  border-radius: 6px;
  color: var(--text);
}
.nav-item .icon {
  width: 18px;
  height: 18px;
  color: var(--muted);
}
.nav-item:hover {
  background: var(--hover);
  text-decoration: none;
}
.nav-item.on {
  background: var(--accent-weak);
  color: var(--accent-text);
  font-weight: 500;
}
.nav-item.on .icon {
  color: var(--accent-text);
}
.nav-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}
.sidebar-foot p {
  margin: 0 0 2px;
}
.sidebar-foot strong {
  color: var(--text);
  font-weight: 500;
}

.content {
  min-width: 0;
  padding: 28px 32px 48px;
  max-width: 1480px;
}

/* ---- page head & kpis ---------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head h1 {
  font-size: 24px;
  letter-spacing: -0.01em;
}
.page-sub {
  margin: 4px 0 0;
  color: var(--muted);
}
.page-actions {
  display: flex;
  gap: 8px;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi-label {
  font-size: 13px;
  color: var(--muted);
}
.kpi-value {
  font-size: 28px;
  line-height: 1.1;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-value small {
  margin-left: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--muted);
}

/* ---- panels -------------------------------------------------------------- */

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.panel-head h2 {
  font-size: 15px;
}
.panel-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  text-align: right;
}
.panel-body {
  padding: 16px;
}

.count {
  display: inline-block;
  min-width: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--hover);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 500;
  line-height: 18px;
  text-align: center;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  align-items: start;
}

.hint {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---- controls ------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn:hover {
  background: var(--hover);
  text-decoration: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  cursor: pointer;
  flex: none;
}
.icon-btn:hover {
  background: var(--hover);
  color: var(--text);
}
.icon-btn .icon {
  width: 18px;
  height: 18px;
}

.select,
.search input {
  height: 32px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.select {
  padding: 0 28px 0 10px;
  max-width: 240px;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.search {
  position: relative;
  flex: 1 1 240px;
  max-width: 340px;
}
.search .icon {
  position: absolute;
  left: 10px;
  top: 8px;
  color: var(--muted);
}
.search input {
  width: 100%;
  padding: 0 30px 0 32px;
}
.search input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: transparent;
}
.search kbd {
  position: absolute;
  right: 8px;
  top: 7px;
  padding: 0 5px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  font: 11px/16px var(--mono);
  color: var(--muted);
}
.search input:focus + kbd,
.search input:not(:placeholder-shown) + kbd {
  display: none;
}

.checks {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.checks legend {
  float: left;
  margin-right: 4px;
  font-size: 13px;
  color: var(--muted);
}
.check {
  position: relative;
}
.check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.check span {
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.check span:hover {
  background: var(--hover);
}
.check input:checked + span {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent-text);
}
.check input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Source filter: <details> multi-select with a text filter (see app.js). */
.combo {
  position: relative;
}
.combo-trigger {
  display: inline-flex;
  align-items: center;
  min-width: 150px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.combo-trigger::-webkit-details-marker {
  display: none;
}
.combo-trigger span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.combo-trigger::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 12px;
  width: 6px;
  height: 6px;
  border: solid var(--muted);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.combo[open] .combo-trigger::after {
  top: 15px;
  transform: rotate(-135deg);
}
.combo:has(:checked) .combo-trigger {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-text);
}
.combo-panel {
  position: absolute;
  z-index: 25;
  top: calc(100% + 4px);
  left: 0;
  width: max(100%, 300px);
  max-width: calc(100vw - 32px);
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.combo-search {
  position: relative;
  display: block;
  margin-bottom: 4px;
}
.combo-search .icon {
  position: absolute;
  left: 9px;
  top: 8px;
  color: var(--muted);
}
.combo-search input {
  width: 100%;
  height: 32px;
  padding: 0 8px 0 30px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.combo-options {
  max-height: 260px;
  margin: 0;
  padding: 0;
  overflow: auto;
  border: 0;
}
.combo-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.combo-option:hover,
.combo-option:focus-within {
  background: var(--hover);
}
.combo-option input {
  flex: none;
  margin: 0;
  accent-color: var(--accent);
}
.combo-text {
  display: grid;
  min-width: 0;
  flex: 1;
}
.combo-text small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.combo-count {
  color: var(--muted);
  font-size: 12px;
}
.combo-empty {
  margin: 0;
  padding: 8px;
  color: var(--muted);
  font-size: 13px;
}
.combo-foot {
  display: flex;
  justify-content: flex-end;
  padding: 6px 8px 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.combo-foot .link {
  border: 0;
  padding: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- tables -------------------------------------------------------------- */

.results {
  transition: opacity 0.15s;
}
.results.htmx-request {
  opacity: 0.55;
}

.table-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table-meta strong {
  color: var(--text);
}
.link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.push {
  margin-left: auto;
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 9px 12px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
}
.table th.sorted {
  color: var(--text);
}
.table th .icon {
  width: 12px;
  height: 12px;
  margin: 0 2px;
  vertical-align: -1px;
}
.table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
.table th:first-child,
.table td:first-child {
  padding-left: 16px;
}
.table th:last-child,
.table td:last-child {
  padding-right: 16px;
}
.table .num {
  text-align: right;
}
.table tr[data-row] {
  cursor: pointer;
}
.table tr[data-row]:hover td {
  background: var(--hover);
}
.table td.pos {
  color: var(--ok);
}
.table td.neg {
  color: var(--danger);
}

.table.data td {
  font-size: 13px;
}
.table.data th,
.table.data td {
  padding-left: 10px;
  padding-right: 10px;
}
.table.data th:first-child,
.table.data td:first-child {
  padding-left: 16px;
}
.table td.ellipsis {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

tr.inactive td {
  color: var(--muted);
}
tr.inactive .avatar {
  filter: grayscale(1);
  opacity: 0.6;
}

.table.compact th,
.table.compact td {
  padding: 6px 10px;
  font-size: 12.5px;
  vertical-align: top;
}
.table.compact td:first-child,
.table.compact th:first-child {
  padding-left: 10px;
}
.table tr.dropped td {
  background: var(--warn-weak);
}

.empty-cell {
  padding: 32px 16px !important;
  text-align: center;
  color: var(--muted);
}

.biz {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.row-link {
  color: var(--text);
  font-weight: 500;
}
.table.data .row-link {
  display: block;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-link:hover {
  color: var(--accent-text);
}

.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  overflow: hidden;
  background: hsl(var(--h) 45% var(--badge-l));
  color: hsl(var(--h) 45% var(--badge-text-l));
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 600;
}
.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}
.avatar img.fit {
  object-fit: contain;
}
.avatar.sm {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  font-size: 10px;
}
.avatar.lg {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  font-size: 16px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: hsl(var(--h) 55% var(--badge-l));
  color: hsl(var(--h) 45% var(--badge-text-l));
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: hsl(var(--h) 60% 50%);
}

.more {
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}

.tag {
  display: inline-block;
  margin: 1px 4px 1px 0;
  padding: 0 6px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--muted);
}
.tag.danger {
  border-color: transparent;
  background: var(--danger-weak);
  color: var(--danger);
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.socials {
  display: inline-flex;
  gap: 6px;
  color: var(--border-strong);
}
.socials .on {
  color: var(--text);
}

.meter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  --c: var(--ok);
}
.meter.s-mid {
  --c: var(--warn);
}
.meter.s-low {
  --c: var(--danger);
}
.meter-bar {
  display: inline-flex;
  gap: 2px;
}
.meter-bar i {
  width: 6px;
  height: 12px;
  border-radius: 1.5px;
  background: var(--border);
}
.meter-bar i.lit {
  background: var(--c);
}
.meter-num {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.empty {
  padding: 56px 16px;
  text-align: center;
  color: var(--muted);
}
.empty .icon {
  width: 28px;
  height: 28px;
  margin-bottom: 8px;
}
.empty p {
  margin: 4px 0;
}
.empty strong {
  color: var(--text);
  font-weight: 500;
}

/* ---- quality charts ------------------------------------------------------ */

.bars {
  list-style: none;
  margin: 0;
  padding: 12px 16px 14px;
}
.bars li {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 44px 56px;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 13px;
}
.bar {
  height: 8px;
  border-radius: 4px;
  background: var(--hover);
  overflow: hidden;
}
.bar i {
  display: block;
  width: var(--pct);
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
}
.bar-value {
  text-align: right;
  font-weight: 500;
}
.bar-count {
  text-align: right;
  font-size: 12px;
  color: var(--muted);
}

.histogram {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 220px;
  padding: 16px 16px 8px;
}
.hist-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
  --c: var(--ok);
}
.hist-col.s-mid {
  --c: var(--warn);
}
.hist-col.s-low {
  --c: var(--danger);
}
.hist-col i {
  width: 100%;
  max-width: 44px;
  height: calc(var(--v) / var(--max) * 150px);
  min-height: 2px;
  background: var(--c);
  opacity: 0.85;
  border-radius: 3px 3px 0 0;
}
.hist-count {
  font-size: 12px;
  font-weight: 500;
}
.hist-label {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  width: 100%;
  text-align: center;
  padding-top: 4px;
}
.histogram + .hint {
  padding: 0 16px 14px;
  margin: 0;
}

/* ---- business page ------------------------------------------------------ */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.back-link:hover {
  color: var(--text);
  text-decoration: none;
}

.detail-head {
  align-items: center;
}
.detail-title {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.detail-title h1 {
  overflow-wrap: anywhere;
}
.detail-sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 6px;
}
.detail-sub a:hover {
  text-decoration: none;
  filter: brightness(0.96);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 0 20px;
  align-items: start;
}

.panel-head > .icon {
  color: var(--muted);
}
.panel.review .panel-head > .icon {
  color: var(--warn);
}
.panel.review {
  border-color: var(--warn);
}
.panel.review .panel-head {
  background: var(--warn-weak);
}
.table td.actions {
  white-space: nowrap;
  text-align: right;
}
.table td.actions .inline-form + .inline-form {
  margin-left: 6px;
}

.kv-value {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
}
.kv dd:has(.edited-note) {
  flex-direction: column;
  gap: 4px;
}
.edited-note {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12px;
}
.edited-note.stale .tag.edited {
  background: var(--warn-weak);
  color: var(--warn);
}
.panel-body > .edited-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}

.tag.edited {
  border-color: transparent;
  background: var(--accent-weak);
  color: var(--accent-text);
}
.tag.warn {
  border-color: transparent;
  background: var(--warn-weak);
  color: var(--warn);
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.btn.primary:hover {
  background: var(--accent-text);
}
.btn.sm {
  height: 24px;
  padding: 0 8px;
  gap: 4px;
  font-size: 12px;
}
.btn .icon {
  width: 14px;
  height: 14px;
}
.inline-form {
  display: inline;
  margin: 0;
}

.clamp {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}

/* diff of a value: removed / added */
.diff {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px 6px;
  min-width: 0;
}
.diff del,
.diff ins {
  padding: 0 4px;
  border-radius: 3px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.diff del {
  background: var(--danger-weak);
  color: var(--danger);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
}
.diff ins {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  color: var(--ok);
}

/* history */
.timeline {
  list-style: none;
  margin: 0;
  padding: 8px 16px 12px;
}
.ev {
  position: relative;
  padding: 8px 0 10px 20px;
  border-left: 2px solid var(--border);
  margin-left: 4px;
}
.ev::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 12px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--faint);
}
.ev-scrape::before {
  border-color: var(--warn);
}
.ev-edit::before,
.ev-keep::before {
  border-color: var(--accent);
}
.ev-revert::before {
  border-color: var(--muted);
}
.ev-first::before {
  border-color: var(--ok);
}
.ev-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 8px;
  font-size: 13px;
}
.ev-changes {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 12.5px;
}
.ev-changes li {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 8px;
}
.ev-field {
  color: var(--muted);
}

/* edit form */
.edit-fields {
  padding: 4px 16px;
}
.edit-field {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 6px 20px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.edit-field:last-child {
  border-bottom: 0;
}
.edit-field > label {
  padding-top: 6px;
  font-weight: 500;
}
.edit-field > label small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}
.edit-input input,
.edit-input textarea {
  width: 100%;
  max-width: 640px;
  padding: 6px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.edit-input input {
  height: 32px;
}
.edit-input textarea {
  resize: vertical;
  line-height: 1.5;
}
.edit-field.is-edited input,
.edit-field.is-edited textarea {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-weak);
}
.edit-hint {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.edit-hint .link {
  border: 0;
  padding: 0;
  background: none;
  color: var(--accent-text);
  font: inherit;
  cursor: pointer;
}
.form-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* ---- sorting & pagination ------------------------------------------------ */

.th-sort {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: inherit;
}
.th-sort:hover {
  color: var(--text);
  text-decoration: none;
}
.sort-hint {
  display: inline-flex;
  opacity: 0;
  transition: opacity 0.1s;
}
.th-sort:hover .sort-hint,
.th-sort:focus-visible .sort-hint {
  opacity: 0.6;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--muted);
}
.pager-per {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pager-per .select {
  height: 28px;
}
.pager-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pager-btn {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
a.pager-btn:hover {
  background: var(--hover);
  text-decoration: none;
}
.pager-btn.on {
  border-color: var(--accent);
  background: var(--accent-weak);
  color: var(--accent-text);
  font-weight: 600;
}
.pager-btn.off {
  color: var(--faint);
}
.pager-btn .icon {
  width: 14px;
  height: 14px;
}
.pager-gap {
  padding: 0 4px;
}

.kv {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 7px 12px;
  margin: 0;
  font-size: 13.5px;
}
.kv dt {
  color: var(--muted);
}
.kv dd {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.kv dd a .icon {
  width: 12px;
  height: 12px;
  margin-left: 3px;
}

.completeness {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 13px;
}
.missing {
  color: var(--muted);
}

.prose p {
  margin: 0 0 8px;
  font-size: 13.5px;
  line-height: 1.55;
}

.thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.thumbs a {
  display: block;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}
.thumbs img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumbs img.fit {
  object-fit: contain;
}

.alert {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--danger-weak);
  color: var(--danger);
  font-size: 13px;
}

/* ---- outreach: shared ---------------------------------------------------- */

.small {
  font-size: 12px;
}
.btn.danger {
  color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger-weak);
}
.btn.block {
  width: 100%;
  justify-content: center;
}
.btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.select.sm {
  height: 24px;
  padding: 0 22px 0 6px;
  font-size: 12px;
}
.inline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.stack {
  display: grid;
  gap: 14px;
}

/* Form fields (outreach forms; the business edit form has its own). */
.field {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}
.field > span,
.field > legend {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}
.field > span small,
.field > legend small {
  font-weight: 400;
}
.field input:not([type="checkbox"], [type="radio"]),
.field textarea,
.mini-form input,
.stage-table input[type="text"],
.num-input,
input.sm {
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field textarea {
  height: auto;
  padding: 6px 10px;
  resize: vertical;
  line-height: 1.5;
}
.field .select {
  max-width: none;
  width: 100%;
}
input.sm {
  width: auto;
  height: 24px;
  font-size: 12px;
}
.num-input {
  width: 80px;
}
.grid-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
}
.check-line input {
  margin-top: 3px;
}
.check-line small {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.form-panel {
  max-width: 720px;
}

/* Popover: <details data-popover> with a floating panel. */
.popover {
  position: relative;
  display: inline-block;
}
.popover > summary {
  list-style: none;
}
.popover > summary::-webkit-details-marker {
  display: none;
}
.popover-panel {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 10px;
  width: 300px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  text-align: left;
  white-space: normal;
}
.popover-panel .btn {
  justify-self: start;
}

.tag.merged {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-color: transparent;
  background: var(--accent-weak);
  color: var(--accent-text);
}
.tag.merged .icon {
  width: 12px;
  height: 12px;
}

.user-dot {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent-text);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  flex: none;
}
.topbar .user-dot {
  background: rgba(255, 255, 255, 0.14);
  color: var(--topbar-text);
}
.topbar-btn {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--topbar-text);
  cursor: pointer;
}
.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Follow-up dates. */
.due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  white-space: nowrap;
  color: var(--muted);
}
.due .icon {
  width: 12px;
  height: 12px;
}
.due-overdue {
  color: var(--danger);
  font-weight: 600;
}
.due-today {
  color: var(--warn);
  font-weight: 600;
}
.due-soon {
  color: var(--text);
}

/* Lists of records, people, rules. */
.records {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.records li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.records li:last-child {
  border-bottom: 0;
}
.records li.current {
  background: var(--surface-2);
}
.records .actions {
  display: inline-flex;
  gap: 6px;
}
.records .ellipsis {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.merge-search {
  border-top: 1px solid var(--border);
}
.merge-search .search {
  max-width: none;
}
#merge-results .records {
  margin-top: 8px;
}
#merge-results .records li {
  padding: 8px 0;
}

.people {
  list-style: none;
  margin: 0;
  padding: 0;
}
.people > li {
  border-bottom: 1px solid var(--border);
}
.person > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px 16px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
}
.person > summary::-webkit-details-marker {
  display: none;
}
.person[open] {
  background: var(--surface-2);
}
.person[open] > :not(summary) {
  margin: 0 16px 12px;
}
.person-notes {
  white-space: pre-line;
  font-size: 13px;
}
.add-person > summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  list-style: none;
}
.add-person[open] > summary {
  margin-bottom: 10px;
}
.mini-form {
  display: grid;
  gap: 10px;
}
.mini-form .btn {
  justify-self: start;
}

/* ---- projects list ------------------------------------------------------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.project-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  margin: 0;
  color: inherit;
  transition: border-color 0.1s;
}
.project-card:hover {
  text-decoration: none;
  border-color: var(--accent);
}
.project-card.archived {
  opacity: 0.7;
}
.project-card header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.project-card h2 {
  font-size: 16px;
}
.project-card p {
  margin: 0;
  font-size: 13px;
}
.strip {
  display: flex;
  gap: 2px;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: var(--hover);
}
.strip i {
  background: hsl(var(--h) 60% 55%);
}
.project-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 0;
}
.project-stats dt {
  font-size: 11.5px;
  color: var(--muted);
}
.project-stats dd {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.project-stats .hot dd {
  color: var(--danger);
}

/* ---- project page -------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 4px;
  margin: -4px 0 16px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.tab:hover {
  color: var(--text);
  text-decoration: none;
}
.tab.on {
  color: var(--text);
  border-bottom-color: var(--accent);
}
.proj-filters {
  border-bottom: 0;
  padding: 0 0 14px;
}
.panel > .proj-filters {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

/* Board */
.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(250px, 1fr);
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 12px;
  align-items: start;
}
.board.htmx-request {
  opacity: 0.7;
}
.board-col {
  display: flex;
  flex-direction: column;
  min-height: 160px;
  max-height: calc(100vh - 140px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: 3px solid hsl(var(--h) 60% 55%);
  border-radius: var(--radius);
  transition: background 0.1s, border-color 0.1s;
}
.board-col.kind-won,
.board-col.kind-lost,
.board-col.kind-skip {
  opacity: 0.92;
}
.board-col.over {
  background: var(--accent-weak);
  border-color: var(--accent);
}
.board-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
}
.board-col-head h2 {
  font-size: 13.5px;
}
.board-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: hsl(var(--h) 60% 55%);
}
.board-hint {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
}
.board-hint .icon {
  width: 12px;
  height: 12px;
}
.board-cards {
  display: grid;
  gap: 8px;
  padding: 0 8px 10px;
  overflow-y: auto;
  align-content: start;
  flex: 1;
}
.board-empty {
  margin: 0;
  padding: 18px 8px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}
.bcard {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow);
  cursor: grab;
}
.bcard:hover {
  border-color: var(--border-strong);
}
.bcard.dragging {
  opacity: 0.4;
}
.bcard.moving {
  opacity: 0.6;
}
.bcard.flagged {
  border-left: 3px solid var(--warn);
}
.bcard-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
}
.bcard-title span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.bcard-meta {
  font-size: 12px;
  min-width: 0;
}
.bcard-meta .ellipsis {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bcard-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.bcard-tags .badge,
.bcard-tags .tag {
  font-size: 11px;
  margin: 0;
}
.bcard-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}
.bcard-foot .muted {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}
.bcard-foot .icon {
  width: 12px;
  height: 12px;
}
.bcard-foot .user-dot {
  width: 20px;
  height: 20px;
  font-size: 9px;
}
/* Keyboard alternative to dragging: a transparent select shown on focus/hover. */
.bcard-move {
  position: absolute;
  top: 6px;
  right: 6px;
  opacity: 0;
}
.bcard:hover .bcard-move,
.bcard-move:focus-within {
  opacity: 1;
}
.bcard-move select {
  height: 22px;
  max-width: 110px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 11px;
}

/* Table with bulk actions */
.bulk-bar {
  flex-wrap: wrap;
  gap: 8px 14px;
}
.bulk-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.table th.sel,
.table td.sel {
  width: 36px;
  padding-right: 0;
}
.table tr.selected td {
  background: var(--accent-weak);
}

/* Stats */
.bars .bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bars li:has(.bar-label) {
  grid-template-columns: 120px minmax(0, 1fr) 44px;
}
.bar i.hue {
  background: hsl(var(--h) 60% 55%);
}
.weeks {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 180px;
}
.week {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 4px;
}
.week i {
  width: 100%;
  max-width: 36px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
}
.week-count {
  font-size: 11px;
  font-weight: 500;
  min-height: 15px;
}
.week-label {
  font-size: 10.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Settings */
.stage-table td {
  padding-top: 6px;
  padding-bottom: 6px;
}
.stage-table td.order {
  width: 72px;
}
.stage-table .icon-btn {
  width: 24px;
  height: 24px;
}
.stage-table .icon-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
.stage-table input[type="text"] {
  height: 28px;
  min-width: 140px;
}
.stage-table .num-input {
  height: 28px;
}
.table tr.add-row td {
  background: var(--surface-2);
}
.hue-select {
  border-left: 10px solid hsl(var(--h) 60% 55%);
}
.popover.right .popover-panel {
  right: 0;
  width: 260px;
}

/* ---- member page --------------------------------------------------------- */

.member-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.member-nav .back-link {
  margin-bottom: 0;
}
.member-grid {
  margin-top: 16px;
}
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.segmented label {
  position: relative;
}
.segmented input {
  position: absolute;
  opacity: 0;
}
.segmented span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}
.segmented span:hover {
  background: var(--hover);
}
.segmented input:checked + span {
  background: var(--accent-weak);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 500;
}
.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
.segmented .icon {
  width: 14px;
  height: 14px;
}
.quick-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.log-form .form-actions {
  align-items: center;
}
.log-form .form-actions .hint {
  margin: 0;
}
.followup {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}
.tag-picks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.tag-pick {
  position: relative;
}
.tag-pick input {
  position: absolute;
  opacity: 0;
}
.tag-pick span {
  display: inline-block;
  padding: 2px 10px;
  border: 1px dashed var(--border-strong);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
}
.tag-pick input:checked + span {
  border: 1px solid transparent;
  background: hsl(var(--h) 55% var(--badge-l));
  color: hsl(var(--h) 45% var(--badge-text-l));
  font-weight: 500;
}
.tag-pick input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* Activity timeline */
.ev.act::before {
  border-color: var(--accent);
}
.ev.act-stage::before {
  border-color: var(--faint);
}
.ev.act-note::before {
  border-color: var(--muted);
}
.ev.act .ev-head {
  align-items: center;
}
.ev.act .ev-head > .icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
}
.ev.act .ev-head .icon-btn {
  width: 22px;
  height: 22px;
  opacity: 0;
}
.ev.act:hover .ev-head .icon-btn,
.ev.act .ev-head .icon-btn:focus-visible {
  opacity: 1;
}
.ev.act .ev-head .icon-btn .icon {
  width: 13px;
  height: 13px;
}
.ev.act .tag {
  margin: 0;
}
.act-body {
  margin: 6px 0 0;
  font-size: 13px;
  white-space: pre-line;
}
.timeline.compact {
  border-top: 1px solid var(--border);
}
.timeline.compact .ev {
  padding-bottom: 6px;
}

/* Today */
.today-overdue {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
}
.today-overdue .panel-head {
  background: var(--danger-weak);
}

/* Duplicates */
.dup-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.dup-side {
  padding: 12px 16px;
  min-width: 0;
}
.dup-side + .dup-side {
  border-left: 1px solid var(--border);
}
.dup-side .kv {
  margin-top: 10px;
}
.dup-side dd > span {
  display: inline-block;
  margin-right: 8px;
}
.dup-side .same {
  background: color-mix(in srgb, var(--ok) 14%, transparent);
  border-radius: 3px;
  padding: 0 3px;
}
.dup .panel-head .tag {
  margin: 0;
}

/* Login */
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 16px;
}
.login {
  width: min(360px, 100%);
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 18px;
  font-size: 18px;
  font-weight: 600;
}
.login-form {
  display: grid;
  gap: 14px;
  padding: 24px;
}
.login-form h1 {
  font-size: 18px;
}
.login-form .alert {
  margin: 0;
  display: block;
}
.login-form code {
  display: block;
  margin-top: 6px;
}

@media (max-width: 860px) {
  .dup-pair {
    grid-template-columns: minmax(0, 1fr);
  }
  .dup-side + .dup-side {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .topbar-user {
    display: none;
  }
  .board {
    grid-auto-columns: minmax(240px, 85vw);
  }
  .popover-panel {
    position: fixed;
    left: 16px;
    right: 16px;
    top: auto;
    bottom: 16px;
    width: auto;
  }
}

/* ---- responsive ---------------------------------------------------------- */

@media (max-width: 1100px) {
  .detail-grid,
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 860px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    position: sticky;
    top: 52px;
    z-index: 10;
    height: auto;
    padding: 6px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
  }
  .sidebar nav {
    display: flex;
    gap: 4px;
  }
  .nav-group,
  .sidebar-foot,
  .nav-count {
    display: none;
  }
  .nav-item {
    margin: 0;
    white-space: nowrap;
  }
  .content {
    padding: 20px 16px 40px;
  }
  .topbar {
    padding: 0 16px;
  }
  .topbar-meta .topbar-item:first-child {
    display: none;
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .kpi-value {
    font-size: 22px;
  }
  .page-head {
    align-items: flex-start;
  }
  .search {
    max-width: none;
    flex-basis: 100%;
  }
  .bars li {
    grid-template-columns: 84px minmax(0, 1fr) 40px;
  }
  .bar-count {
    display: none;
  }
  .kv {
    grid-template-columns: 90px minmax(0, 1fr);
  }
  .edit-field {
    grid-template-columns: minmax(0, 1fr);
  }
  .edit-field > label {
    padding-top: 0;
  }
  .detail-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
