/* husherleak — dark data-tool. One theme, borders instead of shadows, 8px rhythm.
   No web fonts: the stacks below fall back to whatever the machine has. */

:root {
  --bg: #0B0D10;
  --panel: #12151A;
  --panel-head: #0F1216;
  --row-hover: #161B21;
  --line: #1E2329;
  --line-2: #2A313A;

  --text: #E6E9EE;
  --text-2: #8B949E;  /* 6.0:1 on --bg — the floor for any glyph */
  --text-3: #A9B2BC;
  --text-off: #5C646E; /* disabled controls only */

  --accent: #39C0D8;
  --accent-hi: #7ADDEC;
  --accent-dim: #2CA9BF;
  --accent-ink: #06212A;
  --accent-bg: #0E2A31;

  --green: #4FD164;
  --green-bg: #12301A;
  --green-line: #235C2C;

  --amber: #E0A33E;
  --amber-text: #E0C58E;
  --amber-line: #4E3C1C;
  --amber-bg: #2A1F0B;

  --font-ui: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

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

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

.mono { font-family: var(--font-mono); }
.nums { font-variant-numeric: tabular-nums; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px;
  padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; height: 56px; padding: 0 24px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 32px; min-width: 0; }
.brand {
  font: 500 16px var(--font-mono); letter-spacing: -0.2px;
  color: var(--text); white-space: nowrap;
}
.brand:hover { color: var(--text); }
.nav { display: flex; gap: 20px; font-size: 14px; }
.nav a { color: var(--text-2); padding-bottom: 2px; border-bottom: 1px solid transparent; }
.nav a:hover { color: var(--text); }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }

.freshness {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  font: 400 12px var(--font-mono); color: var(--text-2); white-space: nowrap;
}
.freshness .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.freshness.is-stale { border-color: var(--amber-line); background: var(--amber-bg); color: var(--amber); }
.freshness.is-stale .dot { background: var(--amber); }

/* ---------- layout ---------- */

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 600; }
.lede { margin: 0; font-size: 13px; color: var(--text-2); }

.stale-banner {
  margin-bottom: 16px; padding: 12px 14px;
  border: 1px solid var(--amber-line); background: #1C1608; border-radius: var(--radius);
  font-size: 13px; line-height: 20px; color: var(--amber-text);
}

.site-footer {
  border-top: 1px solid var(--line); background: var(--panel);
  margin-top: 40px;
}
.site-footer .inner {
  max-width: 1280px; margin: 0 auto; padding: 16px 24px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 12px; color: var(--text-2);
}

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

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line);
  font-size: 15px; font-weight: 600;
}
.panel-head .link { font-size: 13px; font-weight: 400; }

/* ---------- counters (overview) ---------- */

.counters {
  display: grid; grid-template-columns: 1fr 24px 1fr 24px 1fr; align-items: center;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; margin-bottom: 32px;
}
.counter { display: flex; flex-direction: column; gap: 6px; padding: 0 24px; }
.counter + .arrow + .counter, .counters .counter:not(:first-child) { border-left: 1px solid var(--line); }
.counter .value { font: 500 34px var(--font-mono); font-variant-numeric: tabular-nums; }
.counter .label { font-size: 14px; color: var(--text); }
.counter .sub { font-size: 12px; color: var(--text-2); }
.counter.gone .value { color: var(--amber); }
.counter.funded .value { color: var(--green); }
.arrow { text-align: center; color: var(--text-2); }

/* ---------- toolbar ---------- */

.toolbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
  padding: 12px 16px; margin-bottom: 16px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.search {
  flex: 1 1 260px; min-width: 0; display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
}
.search:focus-within { border-color: var(--accent); }
.search .icon { color: var(--text-2); font-size: 13px; }
.search input {
  flex: 1; min-width: 0; height: 100%;
  background: none; border: 0; outline: none; color: var(--text);
  font: 400 13px var(--font-mono);
}
.search input::placeholder { color: var(--text-2); font-family: var(--font-ui); }
/* У type=search свой крестик — он дублировал бы наш. */
.search input::-webkit-search-cancel-button,
.search input::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.search .clear {
  border: 0; background: none; cursor: pointer; padding: 0 2px;
  color: var(--text-2); font-size: 13px; line-height: 1;
}
.search .clear:hover { color: var(--text); }

.rowcount { font: 400 12px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); white-space: nowrap; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 7px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font: 400 13px var(--font-ui); cursor: pointer;
}
.chip:hover { border-color: var(--line-2); }
.chip[aria-expanded="true"], .chip.is-active {
  border-color: var(--accent); background: var(--accent-bg); color: var(--accent-hi);
}

.menu-anchor { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; min-width: 212px;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 6px; display: flex; flex-direction: column; gap: 2px; font-size: 13px;
}
.menu[hidden] { display: none; }
.menu.to-right { left: auto; right: 0; }
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: 4px; background: none;
  color: var(--text); font: 400 13px var(--font-ui); text-align: left; cursor: pointer;
}
.menu button:hover:not(:disabled) { background: var(--row-hover); }
.menu button[aria-checked="true"] { background: var(--row-hover); color: var(--accent-hi); }
.menu button:disabled { color: var(--text-off); cursor: default; }
.menu .box {
  width: 14px; height: 14px; border: 1px solid var(--line-2); border-radius: 3px;
  display: flex; align-items: center; justify-content: center; font-size: 10px; flex: none;
}
.menu button[aria-checked="true"] .box { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.menu .count { margin-left: auto; font: 400 11px var(--font-mono); color: var(--text-2); }
.menu .sep { height: 1px; background: var(--line); margin: 4px 0; }
.menu .hint { padding: 2px 10px 4px; font-size: 11px; line-height: 16px; color: var(--text-2); }

.actions { display: flex; gap: 8px; margin-left: auto; }

.btn {
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--line-2); background: none; color: var(--text);
  font: 400 13px var(--font-ui); cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--text-2); }
.btn.primary { border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hi); }
.btn:disabled { color: var(--text-off); cursor: default; }
.btn:disabled:hover { border-color: var(--line-2); }
.btn.primary:disabled, .btn.primary:disabled:hover { background: #1B2027; color: var(--text-off); }
.split:has(.btn.primary:disabled) .split-toggle { background: #1B2027; color: var(--text-off); border-left-color: var(--line); }
.btn.done { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); font-weight: 600; }

.split { display: flex; border-radius: var(--radius); overflow: hidden; }
.split .btn.primary { border-radius: 0; }
.split .split-toggle {
  display: flex; align-items: center; padding: 0 9px; border: 0;
  background: var(--accent-dim); color: var(--accent-ink);
  border-left: 1px solid #1E8296; font-size: 11px; cursor: pointer;
}
.split .split-toggle:hover { background: var(--accent-hi); }

/* ---------- table ---------- */

.thead, .row {
  display: grid; gap: 12px; padding: 0 16px; align-items: center;
}
.thead {
  height: 34px; background: var(--panel-head); border-bottom: 1px solid var(--line);
  font-size: 11px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-2);
}
.thead .th {
  display: flex; align-items: center; gap: 6px; min-width: 0;
  background: none; border: 0; padding: 0; cursor: default;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit;
}
.thead .th[data-sortable] { cursor: pointer; }
.thead .th[data-sortable]:hover { color: var(--text); }
.thead .th.right { justify-content: flex-end; }
.thead .th .caret { color: var(--accent); }

.row {
  height: 42px; border-bottom: 1px solid var(--line); font-size: 13px;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--row-hover); }

.cell { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell.right { text-align: right; }
.unit { display: none; color: var(--text-2); }

.c-address { display: flex; align-items: center; gap: 10px; min-width: 0; }
.c-address .addr { font: 400 13px var(--font-mono); }
.c-address mark { background: #2A3A1E; color: #C6E59B; border-radius: 2px; }
.c-tier { font: 400 11px var(--font-mono); letter-spacing: 0.4px; color: var(--text-2); }
.c-txs, .c-days { font: 400 13px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--text-2); }
.c-gone, .c-observed { font: 400 12px var(--font-mono); color: var(--text-2); }
.c-gone { color: var(--amber); }
.c-deposit { font: 500 15px var(--font-mono); font-variant-numeric: tabular-nums; color: var(--green); text-align: right; }

.rowbtn {
  border: 0; background: none; padding: 0 2px; cursor: pointer;
  color: var(--text-2); font-size: 12px; line-height: 1; flex: none;
}
.rowbtn:hover { color: var(--accent); }
.rowbtn.ok { color: var(--green); }
.row a.rowbtn { display: inline-flex; align-items: center; }

.badge {
  font: 500 11px var(--font-mono); padding: 2px 7px; border-radius: 4px;
  border: 1px solid var(--line-2); color: var(--text-3); white-space: nowrap;
}
.badge.listed { color: var(--text-3); }
.badge.gone { color: var(--amber); border-color: var(--amber-line); }
.badge.funded { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.badge.untouched { color: var(--text-3); }
.badge.moved { color: var(--text-2); border-color: #23282F; }
.dash { color: var(--text-2); }

.tablefoot {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; padding: 14px 16px; font-size: 13px; color: var(--text-2);
}
.pager { display: flex; align-items: center; gap: 6px; font-family: var(--font-mono); }
.pager button {
  padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px;
  background: none; color: var(--text); font: 400 13px var(--font-mono); cursor: pointer;
}
.pager button:hover:not(:disabled) { border-color: var(--line-2); }
.pager button[aria-current="true"] { border-color: var(--accent); color: var(--accent); }
.pager button:disabled { color: var(--text-2); cursor: default; }
.pager .gap { padding: 4px 4px; color: var(--text-2); }

.note { margin: 16px 0 0; font-size: 12px; line-height: 20px; color: var(--text-2); }
.note .term { font-family: var(--font-mono); color: #C9D1D9; }

/* ---------- empty / loading ---------- */

.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 64px 24px; text-align: center;
}
.state .title { font-size: 15px; color: var(--text); }
.state .body { font-size: 13px; color: var(--text-2); max-width: 400px; line-height: 20px; }

.skeleton .row { pointer-events: none; }
.skeleton .bar { display: block; height: 8px; border-radius: 2px; background: #1B2027; }
.skeleton .bar.wide { background: #22282F; }

/* ---------- prose (about) ---------- */

.prose { max-width: 680px; margin: 32px auto 0; display: flex; flex-direction: column; gap: 28px; }
.prose h1 { margin: 0; font-size: 28px; font-weight: 600; }
.prose h2 { margin: 0 0 12px; font-size: 20px; font-weight: 600; }
.prose p { margin: 0; font-size: 16px; line-height: 28px; color: #C9D1D9; }
.prose p + p { margin-top: 16px; }
.prose .card { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.prose .meta {
  display: flex; flex-wrap: wrap; gap: 40px; padding-top: 8px;
  border-top: 1px solid var(--line); font: 400 13px var(--font-mono); color: var(--text-2);
}
.prose dl { margin: 0; display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 15px; line-height: 24px; }
.prose dt { font-family: var(--font-mono); font-size: 13px; color: var(--text); padding-top: 3px; }
.prose dd { margin: 0; color: #C9D1D9; }

/* ---------- column layouts ---------- */

/* Последняя дорожка — пустой добор: без неё адрес растянулся бы на полстола
   и оторвал бы колонки друг от друга. Ячейка в неё не рендерится. */

body[data-page="overview"] .thead,
body[data-page="overview"] .row { grid-template-columns: 120px minmax(0, 380px) 150px 96px 1fr; }

body[data-page="catalog"] .thead,
body[data-page="catalog"] .row { grid-template-columns: minmax(0, 380px) 110px 100px 120px 1fr; }

body[data-page="gone"] .thead,
body[data-page="gone"] .row { grid-template-columns: minmax(0, 340px) 110px 130px 140px 150px 1fr; }

body[data-page="funded"] .thead,
body[data-page="funded"] .row { grid-template-columns: 140px minmax(0, 340px) 170px 110px 1fr; }

/* ---------- mobile: rows become cards ---------- */

@media (max-width: 760px) {
  .wrap { padding: 16px; }
  .topbar { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .topbar-left { width: 100%; flex-direction: column; align-items: flex-start; gap: 8px; }
  .nav { gap: 4px; flex-wrap: wrap; margin-left: -10px; }
  .nav a { padding: 6px 10px; border-radius: var(--radius); border-bottom: 0; }
  .nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent-hi); }

  .counters { grid-template-columns: 1fr; padding: 8px 0; }
  .counters .arrow { display: none; }
  .counter { padding: 16px 20px; }
  .counters .counter:not(:first-child) { border-left: 0; border-top: 1px solid var(--line); }

  /* Липкой панель на телефоне не делаем: развёрнутая, она съедает треть экрана. */
  .search { flex-basis: 100%; height: 44px; }
  .actions { margin-left: 0; width: 100%; }
  .actions .split { flex: 1; }
  .actions .btn { flex: 1; text-align: center; }

  .panel { background: none; border: 0; overflow: visible; }
  .thead { display: none; }
  .tablefoot { padding: 14px 0; }

  #rows { display: flex; flex-direction: column; gap: 8px; }
  .row {
    display: grid; height: auto; gap: 8px 12px; padding: 12px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  }
  .row:hover { background: var(--panel); }
  .cell { white-space: normal; }
  .unit { display: inline; }
  .c-address { gap: 8px; }
  .c-address .addr { font-size: 14px; }
  .rowbtn {
    width: 38px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line-2); border-radius: var(--radius); color: var(--text-3);
  }
  .c-tier, .c-txs, .c-days, .c-gone, .c-observed { font-size: 13px; }
  .c-deposit { font-size: 18px; text-align: left; }
  .cell.right { text-align: left; }

  body[data-page="overview"] .row { grid-template-columns: 1fr auto; }
  body[data-page="overview"] .c-observed { grid-area: 2 / 2; text-align: right; }
  body[data-page="overview"] .c-address { grid-area: 1 / 1 / 1 / 3; }
  body[data-page="overview"] .c-deposit { grid-area: 2 / 1; }
  body[data-page="overview"] .c-tier { grid-area: 3 / 1 / 3 / 3; }

  body[data-page="catalog"] .row { grid-template-columns: 1fr auto; }
  body[data-page="catalog"] .c-address { grid-area: 1 / 1; }
  body[data-page="catalog"] .c-status { grid-area: 1 / 2; justify-self: end; }
  body[data-page="catalog"] .c-tier { grid-area: 2 / 1; }
  body[data-page="catalog"] .c-txs { grid-area: 2 / 2; justify-self: end; }

  body[data-page="gone"] .row { grid-template-columns: 1fr auto; }
  body[data-page="gone"] .c-address { grid-area: 1 / 1; }
  body[data-page="gone"] .c-state { grid-area: 1 / 2; justify-self: end; }
  body[data-page="gone"] .c-gone { grid-area: 2 / 1; }
  body[data-page="gone"] .c-days { grid-area: 2 / 2; justify-self: end; }
  body[data-page="gone"] .c-tier { grid-area: 3 / 1 / 3 / 3; }

  body[data-page="funded"] .row { grid-template-columns: 1fr auto; }
  body[data-page="funded"] .c-address { grid-area: 1 / 1; }
  body[data-page="funded"] .c-tier { grid-area: 1 / 2; justify-self: end; }
  body[data-page="funded"] .c-deposit { grid-area: 2 / 1; }
  body[data-page="funded"] .c-observed { grid-area: 2 / 2; justify-self: end; align-self: center; }

  .prose dl { grid-template-columns: 1fr; gap: 4px; }
  .prose dt { padding-top: 12px; }
}
