/* DR Explorer – light SaaS dashboard */
:root {
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --ink: #171A2E;
  --ink-2: #464B66;
  --muted: #6B7089;
  --faint: #9AA0B8;
  --line: #E7E9F1;
  --line-2: #F0F1F6;
  --indigo: #4F46E5;
  --indigo-d: #4338CA;
  --indigo-50: #EEF0FF;
  --indigo-100: #E0E4FF;
  --focus: rgba(79, 70, 229, .35);
  --r-lg: 14px;
  --r-md: 10px;
  --r-sm: 7px;
  --shadow-1: 0 1px 2px rgba(23, 26, 46, .04);
  --shadow-pop: 0 12px 32px -8px rgba(23, 26, 46, .22), 0 0 0 1px rgba(23, 26, 46, .06);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --side-w: 320px;
  --top-h: 64px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 var(--font);
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
.num, .stat-value, .counter b, td.c-dr, .page-now, .check-count, .tld-count { font-variant-numeric: tabular-nums; }

.ic { width: 18px; height: 18px; flex: none; }
.ic-sm { width: 14px; height: 14px; }
.ic-xl { width: 34px; height: 34px; color: var(--indigo); }
.only-narrow { display: none !important; }

/* ---------- Layout ---------- */
.app {
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: var(--top-h) minmax(0, 1fr);
}

.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 24px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.logo { display: flex; }
.brand-text { min-width: 0; }
.brand h1 { white-space: nowrap; font-size: 16px; font-weight: 650; letter-spacing: -.01em; line-height: 1.2; }
.brand p { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  height: 36px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid #DCDFEC; border-radius: var(--r-md);
  font-weight: 500; font-size: 13.5px; color: var(--ink); box-shadow: var(--shadow-1);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: #F7F8FC; border-color: #CDD1E3; }
.btn:active { background: #F0F1F8; }
.btn-primary { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn-primary:hover { background: var(--indigo-d); border-color: var(--indigo-d); }
.btn-primary:active { background: #3B32B8; }
.btn-ghost { box-shadow: none; }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--indigo); color: #fff; font-size: 11px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn {
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--ink-2);
  transition: background .15s, color .15s;
}
.icon-btn:hover:not(:disabled) { background: #EEF0F7; color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.link-btn {
  background: none; border: 0; padding: 4px 6px; margin-right: -6px; border-radius: 6px;
  color: var(--indigo); font-weight: 500; font-size: 13px;
}
.link-btn:hover:not(:disabled) { background: var(--indigo-50); }
.link-btn:disabled { color: var(--faint); cursor: default; }
.chip-btn {
  height: 28px; padding: 0 10px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2);
}
.chip-btn:hover { background: #F7F8FC; border-color: #D6D9E8; color: var(--ink); }

/* Export menu */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 244px; padding: 6px;
  background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-pop); z-index: 50;
}
.menu-head { padding: 8px 10px 6px; font-size: 12.5px; color: var(--muted); }
.menu button {
  display: block; width: 100%; text-align: left; border: 0; background: none;
  padding: 9px 10px; border-radius: 8px; font-size: 13.5px;
}
.menu button:hover { background: var(--indigo-50); color: var(--indigo-d); }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface); border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain; min-height: 0;
}
.side-head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 6px; }
.side-head .link-btn { margin-left: auto; }
.side-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.fsec { padding: 16px 20px 18px; border-bottom: 1px solid var(--line-2); }
.fsec:last-child { border-bottom: 0; }
.fsec-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.fsec-head h3 { font-size: 13px; font-weight: 600; }
.fsec-meta { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* Dual range with histogram */
.range { position: relative; height: 76px; margin: 0 -2px; }
.hist {
  position: absolute; left: 11px; right: 11px; top: 0; height: 54px;
  display: flex; align-items: flex-end; gap: 1px;
}
.hist i {
  flex: 1; min-height: 2px; border-radius: 2px 2px 0 0; background: #DDE0EE;
  transform-origin: bottom; transition: background .12s, height .2s ease;
}
.hist i.on { background: #6D6FEA; }
.hist.intro i { animation: rise .6s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes rise { from { transform: scaleY(0); } }
.track {
  position: absolute; left: 11px; right: 11px; bottom: 16px; height: 4px;
  background: #E3E5F0; border-radius: 2px;
}
.fill {
  position: absolute; top: 0; bottom: 0; background: var(--indigo); border-radius: 2px;
  left: calc(var(--lo, 0) * 1%); right: calc((100 - var(--hi, 100)) * 1%);
}
.range input[type=range] {
  position: absolute; left: 0; right: 0; bottom: 7px; width: 100%; height: 22px; margin: 0;
  background: none; pointer-events: none; -webkit-appearance: none; appearance: none;
}
.range input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.range input[type=range]::-moz-range-track { background: transparent; height: 22px; }
.range input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; cursor: grab;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 2px solid var(--indigo); box-shadow: 0 1px 4px rgba(23, 26, 46, .25);
  transition: transform .12s, box-shadow .12s;
}
.range input[type=range]::-moz-range-thumb {
  pointer-events: auto; cursor: grab; box-sizing: border-box;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  border: 2px solid var(--indigo); box-shadow: 0 1px 4px rgba(23, 26, 46, .25);
}
.range input[type=range]:active::-webkit-slider-thumb { cursor: grabbing; transform: scale(1.08); }
.range input[type=range]:focus-visible { outline: none; }
.range input[type=range]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--focus); }
.range input[type=range]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--focus); }
#rMin { z-index: 3; }
#rMax { z-index: 2; }
.range-scale { display: flex; justify-content: space-between; padding: 0 4px; margin-top: 2px; font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }
.range-inputs { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.range-inputs .dash { padding-bottom: 9px; color: var(--faint); }
.field { flex: 1; display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid #DCDFEC; border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font-size: 14px; font-variant-numeric: tabular-nums;
}
.field input:focus, .search input:focus, .rows-select select:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 3px var(--focus); }

/* Checkbox */
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.check input { position: absolute; opacity: 0; width: 16px; height: 16px; margin: 0; }
.check .box {
  width: 16px; height: 16px; flex: none; border: 1.5px solid #C5C9DC; border-radius: 5px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: #fff;
  transition: background .12s, border-color .12s;
}
.check .box .ic { width: 12px; height: 12px; opacity: 0; transform: scale(.6); transition: opacity .12s, transform .12s; }
.check input:checked + .box { background: var(--indigo); border-color: var(--indigo); }
.check input:checked + .box .ic { opacity: 1; transform: none; }
.check input:focus-visible + .box { box-shadow: 0 0 0 3px var(--focus); }
.check-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-count { color: var(--muted); font-size: 12.5px; }
.check-inline { margin-top: 14px; font-size: 13px; color: var(--ink-2); }

/* Extension list */
.tld-tools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.tld-buttons { display: flex; gap: 6px; }
.tld-list, .src-list { margin: 0 -8px; }
.tld-list { max-height: 292px; overflow-y: auto; padding: 0 8px; scrollbar-width: thin; scrollbar-color: #D6D9E8 transparent; }
.row-opt {
  display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin: 0 -8px; border-radius: var(--r-sm);
  font-size: 13.5px; position: relative;
}
.src-list .row-opt { margin: 0; }
.row-opt:hover { background: #F6F7FC; }
.row-opt.zero { opacity: .45; }
.row-opt .check { flex: 1; min-width: 0; }
.row-opt .only {
  border: 0; background: none; color: var(--indigo); font-size: 12px; font-weight: 500; padding: 2px 6px;
  border-radius: 5px; opacity: 0; position: absolute; right: 52px;
}
.row-opt:hover .only, .row-opt:focus-within .only { opacity: 1; }
.row-opt .only:hover { background: var(--indigo-100); }
.row-opt .rm {
  border: 0; background: none; color: var(--faint); width: 22px; height: 22px; border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center;
}
.row-opt .rm:hover { background: #FDECE9; color: #D9503F; }
.row-opt .rm .ic { width: 14px; height: 14px; }
.tld-empty { padding: 10px 0; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--sc, var(--indigo)); flex: none; }

/* ---------- Main ---------- */
.main {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 16px;
  padding: 20px 24px 20px; overflow: hidden;
}
.stats {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px; flex: none;
  background: var(--line); border: 1px solid var(--line); border-radius: var(--r-lg);
  overflow: hidden; box-shadow: var(--shadow-1);
}
.stat {
  background: var(--surface); padding: 15px 18px 14px; display: flex; flex-direction: column; gap: 3px;
  text-align: left; border: 0; min-width: 0;
}
.stat-link { cursor: pointer; transition: background .15s; }
.stat-link:hover { background: #FAFAFF; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat-value { font-size: 27px; font-weight: 600; letter-spacing: -.025em; line-height: 1.15; }
.stat-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.panel {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  overflow: hidden;
}
.toolbar { display: flex; align-items: center; gap: 16px; padding: 14px 16px; }
.search { position: relative; flex: 1; max-width: 460px; display: block; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input {
  width: 100%; height: 40px; padding: 0 12px 0 38px; border: 1px solid #DCDFEC; border-radius: var(--r-md);
  background: #FBFBFD; font-size: 14px; transition: background .15s, border-color .15s;
}
.search input::placeholder { color: var(--faint); }
.search input:hover { border-color: #CDD1E3; }
.search input:focus { background: #fff; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search-sm input { height: 34px; font-size: 13.5px; padding-left: 34px; }
.search-sm .ic { left: 10px; width: 16px; height: 16px; }
.counter { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }
.counter b { color: var(--ink); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 12px; }
.tags:empty { display: none; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--indigo-50); color: var(--indigo-d); font-size: 12.5px; font-weight: 500;
  animation: pop .18s ease-out;
}
.tag span { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag button {
  width: 18px; height: 18px; border: 0; border-radius: 50%; background: transparent; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; opacity: .7;
}
.tag button:hover { background: rgba(79, 70, 229, .16); opacity: 1; }
.tag button .ic { width: 12px; height: 12px; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }

/* ---------- Table ---------- */
.tablewrap { flex: 1; min-height: 0; overflow: auto; border-top: 1px solid var(--line); position: relative; scrollbar-width: thin; scrollbar-color: #D6D9E8 transparent; }
.grid { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.grid th {
  position: sticky; top: 0; z-index: 2; background: #FAFAFD; text-align: left; padding: 0;
  font-size: 12.5px; font-weight: 600; color: var(--muted); box-shadow: inset 0 -1px 0 var(--line);
}
.grid th button {
  width: 100%; display: flex; align-items: center; gap: 8px; padding: 11px 16px; border: 0; background: none;
  font-size: inherit; font-weight: inherit; color: inherit; text-align: left; transition: color .15s, background .15s;
}
.grid th button:hover { color: var(--ink); background: #F3F4FA; }
.grid th[aria-sort="ascending"] button, .grid th[aria-sort="descending"] button { color: var(--indigo-d); }
.sort { position: relative; width: 8px; height: 12px; flex: none; }
.sort::before, .sort::after { content: ''; position: absolute; left: 0; border: 4px solid transparent; opacity: .3; }
.sort::before { top: 0; border-bottom-color: currentColor; border-top-width: 0; }
.sort::after { bottom: 0; border-top-color: currentColor; border-bottom-width: 0; }
th[aria-sort="ascending"] .sort::before, th[aria-sort="descending"] .sort::after { opacity: 1; }
.c-domain { width: auto; }
.c-dr { width: 210px; }
.c-tld { width: 120px; }
.c-src { width: 210px; }
.grid td {
  height: 46px; padding: 0 16px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.grid tbody tr { transition: background .1s; }
.grid tbody tr:hover { background: #F8F9FE; }
.dom { display: flex; align-items: center; gap: 4px; min-width: 0; }
.dom-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.dom-name mark { background: #FFF1B8; color: inherit; border-radius: 3px; padding: 0 1px; }
.row-actions { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; margin-left: 4px; }
tr:hover .row-actions, tr:focus-within .row-actions { opacity: 1; }
.row-actions .icon-btn { width: 28px; height: 28px; }
.row-actions .icon-btn .ic { width: 16px; height: 16px; }
.row-actions .copied { color: #12805C; }
@media (hover: none) { .row-actions { opacity: .75; } }

.dr { display: flex; align-items: center; gap: 12px; }
.dr-pill {
  min-width: 46px; text-align: center; padding: 3px 9px; border-radius: 8px; font-weight: 600; font-size: 13px;
  color: var(--c); background: var(--cbg);
}
.dr-bar { flex: 1; max-width: 90px; height: 6px; border-radius: 3px; background: #EEF0F6; overflow: hidden; }
.dr-bar i { display: block; height: 100%; width: var(--w); background: var(--cb); border-radius: 3px; }
.b0 { --c: #C2402F; --cbg: #FDECE9; --cb: #E5604D; }
.b1 { --c: #965A06; --cbg: #FEF3E0; --cb: #EDA33A; }
.b2 { --c: #0F7A58; --cbg: #E3F5EE; --cb: #2FA67A; }
.b3 { --c: #4338CA; --cbg: #EAECFF; --cb: #5B5BEA; }
.bn { --c: #8A90A8; --cbg: #F1F2F7; --cb: #D6D9E8; }
.tld {
  display: inline-block; padding: 2px 8px; border-radius: 6px; background: #F1F2F8; color: var(--ink-2);
  font-size: 12.5px; font-weight: 500;
}
.srcs { display: flex; align-items: center; gap: 8px; min-width: 0; }
.src { display: inline-flex; align-items: center; gap: 7px; min-width: 0; color: var(--ink-2); font-size: 13px; }
.src span:last-child { overflow: hidden; text-overflow: ellipsis; }
.src-more { font-size: 11.5px; color: var(--muted); background: #F1F2F8; border-radius: 6px; padding: 1px 6px; font-weight: 500; }

.empty { padding: 64px 24px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty strong { font-size: 15px; font-weight: 600; }
.empty p { color: var(--muted); margin-bottom: 12px; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.pager-info b { color: var(--ink); font-weight: 600; }
.pager-ctrl { display: flex; align-items: center; gap: 18px; }
.rows-select { display: flex; align-items: center; gap: 8px; }
.rows-select select {
  height: 32px; padding: 0 28px 0 10px; border: 1px solid #DCDFEC; border-radius: 8px; background: #fff;
  appearance: none; -webkit-appearance: none; font-size: 13px; color: var(--ink); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M6 8l4 4 4-4' fill='none' stroke='%236B7089' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center; background-size: 16px;
}
.pager-btns { display: flex; align-items: center; gap: 2px; }
.page-now { min-width: 96px; text-align: center; color: var(--ink-2); }

/* ---------- Overlays ---------- */
.dropzone {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  background: rgba(245, 246, 250, .86); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.dropzone-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
  padding: 44px 56px; border: 2px dashed var(--indigo); border-radius: 20px; background: #fff;
  box-shadow: var(--shadow-pop); max-width: 90vw;
}
.dropzone-card strong { font-size: 16px; }
.dropzone-card span { color: var(--muted); }

.dialog {
  width: min(760px, 94vw); max-height: 86vh; padding: 0; border: 0; border-radius: 16px;
  box-shadow: var(--shadow-pop); color: var(--ink); background: var(--surface); overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgba(23, 26, 46, .35); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 16px; font-weight: 650; }
.dialog-body { padding: 18px 20px 22px; overflow: auto; }
.dialog-body p { color: var(--ink-2); margin-bottom: 14px; }
.dtable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dtable th, .dtable td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dtable th:first-child, .dtable td:first-child { text-align: left; }
.dtable th { font-size: 12.5px; font-weight: 600; color: var(--muted); background: #FAFAFD; }
.dtable tfoot td { font-weight: 600; border-bottom: 0; background: #FAFAFD; }
.dtable-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
.dnote { margin-top: 14px; font-size: 13px; color: var(--muted); }
.dnote code { background: #F1F2F8; border-radius: 5px; padding: 1px 5px; font-size: 12.5px; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 200;
  max-width: min(520px, 92vw); padding: 11px 16px; border-radius: 11px;
  background: #171A2E; color: #fff; font-size: 13.5px; box-shadow: 0 10px 30px rgba(23, 26, 46, .35);
  animation: toast-in .22s ease-out;
}
.toast.err { background: #A32A1B; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.backdrop { position: fixed; inset: 0; background: rgba(23, 26, 46, .38); z-index: 35; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .c-dr { width: 180px; }
  .c-src { width: 170px; }
  .stat-value { font-size: 24px; }
}

@media (max-width: 1000px) {
  .app { display: block; height: auto; }
  .only-narrow { display: inline-flex !important; }
  .topbar { position: sticky; top: 0; padding: 0 16px; }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: min(360px, 92vw); z-index: 40;
    transform: translateX(-102%); transition: transform .25s ease; box-shadow: var(--shadow-pop);
  }
  .sidebar.open { transform: none; }
  .main { padding: 16px; overflow: visible; }
  .panel { overflow: visible; }
  .tablewrap { max-height: 72vh; }
  .brand p { display: none; }
}

@media (max-width: 760px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats .stat:last-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .top-actions { gap: 6px; }
  .top-actions .btn { padding: 0 11px; }
  #uploadBtn span, #exportBtn span { display: none; }
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 12px; }
  .search { max-width: none; }
  .counter { margin-left: 0; }
  .tags { padding: 0 12px 10px; }
  .grid { min-width: 620px; }
  .grid th button, .grid td { padding-left: 12px; padding-right: 12px; }
  .c-dr { width: 150px; }
  .c-tld { width: 96px; }
  .c-src { width: 150px; }
  .pager { flex-direction: column; align-items: stretch; }
  .pager-ctrl { justify-content: space-between; }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 22px; }
  .menu { right: -4px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
