:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #15171a;
  --muted: #6a717c;
  --line: #dde1e7;
  --subtle: #f0f2f5;
  --accent: #087f5b;
  --accent-strong: #06684a;
  --danger: #b42318;
  --warning: #946200;
  --shadow: 0 12px 30px rgba(18, 24, 31, 0.06);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101316;
  --panel: #171b20;
  --text: #eef2f5;
  --muted: #99a3af;
  --line: #2b333d;
  --subtle: #20262d;
  --accent: #2fb284;
  --accent-strong: #269871;
  --danger: #ff7b72;
  --warning: #f0b84a;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
* { box-sizing: border-box; }
html, body {
  min-height: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.shell {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  margin: 0;
  padding: 18px clamp(18px, 2vw, 34px) 28px;
}
.app {
  width: 100%;
}
.hidden { display: none !important; }
.login {
  max-width: 420px;
  margin: 18vh auto 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
}
h1, h2 { margin: 0; line-height: 1.2; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
p { margin: 6px 0 0; color: var(--muted); }
.notice {
  min-height: 20px;
  margin: -4px 0 12px;
  color: var(--muted);
  font-weight: 650;
}
header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 16px;
}
button {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 650;
  cursor: pointer;
}
button:hover { background: var(--accent-strong); }
button.danger {
  background: var(--danger);
}
button.danger:hover {
  background: #8f1d15;
}
button:disabled {
  cursor: wait;
  opacity: 0.68;
}
button.secondary {
  background: var(--subtle);
  color: var(--text);
  border: 1px solid var(--line);
}
button.secondary:hover { background: var(--line); }
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  min-height: 38px;
  padding: 8px 10px;
  font: inherit;
  background: var(--panel);
  color: var(--text);
}
label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 650; }
form { display: grid; gap: 12px; }
.actions { display: flex; gap: 8px; align-items: center; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 12, 16, 0.48);
}
.modal-panel {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  padding: 18px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.eyebrow {
  display: block;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}
.icon-btn {
  width: 34px;
  min-height: 34px;
  padding: 0;
  background: var(--subtle);
  color: var(--text);
  border: 1px solid var(--line);
}
.icon-btn:hover { background: var(--line); }
.news-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}
.news-list article {
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--subtle);
}
.news-list strong {
  color: var(--text);
  font-size: 14px;
}
.news-list span {
  color: var(--muted);
}
.tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  overflow: auto;
}
.tab {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--line);
}
.tab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.stat, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.stat { padding: 14px; }
.stat span { color: var(--muted); display: block; font-size: 12px; font-weight: 650; }
.stat strong { display: block; margin-top: 4px; font-size: 22px; }
.grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(280px, 0.8fr) minmax(620px, 2.4fr);
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
}
.panel { padding: 14px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.panel-head input { max-width: 260px; }
.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  margin-top: 10px;
}
#sevapeTab > .grid .panel:last-child .table-wrap {
  max-height: calc(100vh - 245px);
}
#nexTab > .panel .table-wrap,
#ledgerTab .table-wrap {
  max-height: calc(100vh - 235px);
}
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 8px 10px; }
th { background: var(--subtle); font-size: 12px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
tbody tr.click-row { cursor: pointer; }
tbody tr.click-row:hover td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.access-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 78px;
}
.access-cell strong {
  font-size: 12px;
  color: var(--text);
}
.access-cell.big {
  min-height: 38px;
  justify-content: flex-end;
}
.sub {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}
.link {
  min-height: 0;
  padding: 0;
  background: none;
  color: var(--accent);
  border: 0;
  font: inherit;
  font-weight: 750;
}
.link:hover { background: none; color: var(--accent-strong); text-decoration: underline; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
  background: var(--subtle);
  color: var(--muted);
}
.pill.ok { background: rgba(8, 127, 91, 0.12); color: var(--accent); }
.pill.off { background: rgba(180, 35, 24, 0.12); color: var(--danger); }
.switch {
  width: 48px;
  min-height: 26px;
  padding: 3px;
  border-radius: 999px;
  background: var(--line);
  border: 1px solid var(--line);
}
.switch:hover { background: var(--line); }
.switch span {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--panel);
  transition: transform 0.16s ease;
}
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on span { transform: translateX(20px); }
.detail {
  margin-bottom: 12px;
}
.detail h2 + .table-wrap { margin-bottom: 14px; }
.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.detail-actions {
  display: grid;
  justify-items: end;
  gap: 8px;
}
.balance {
  font-size: 24px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.mini-stat {
  border: 1px solid var(--line);
  background: var(--subtle);
  border-radius: 8px;
  padding: 10px;
}
.mini-stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}
.mini-stat strong {
  display: block;
  margin-top: 4px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.mini-stat strong + span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}
.balances-line {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.balance-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--subtle);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.address-list {
  display: grid;
  gap: 10px;
  margin: 10px 0 16px;
}
.address-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--subtle);
}
.address-card code {
  display: block;
  margin: 4px 0 6px;
  overflow-wrap: anywhere;
  white-space: normal;
}
.address-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}
.address-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}
code {
  font: 12px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--text);
}
pre {
  min-height: 42px;
  margin: 12px 0 0;
  padding: 10px;
  border-radius: 6px;
  background: var(--subtle);
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.error { color: var(--danger); }
@media (min-width: 1500px) {
  .shell {
    padding-left: 42px;
    padding-right: 42px;
  }
  .grid {
    grid-template-columns: minmax(320px, 0.65fr) minmax(320px, 0.65fr) minmax(760px, 2.7fr);
  }
}
@media (max-width: 1180px) {
  .grid {
    grid-template-columns: minmax(280px, 1fr) minmax(280px, 1fr);
  }
  #sevapeTab > .grid .panel:last-child {
    grid-column: 1 / -1;
  }
}
@media (max-width: 860px) {
  .shell { padding: 12px; }
  .stats, .grid, .mini-grid { grid-template-columns: 1fr; }
  #sevapeTab > .grid .panel:last-child { grid-column: auto; }
  .address-card { grid-template-columns: 1fr; }
  .address-actions { justify-content: flex-start; }
  header, .panel-head { align-items: stretch; flex-direction: column; }
  .actions, .detail-head { flex-direction: column; }
  .panel-head input { max-width: none; }
  #sevapeTab > .grid .panel:last-child .table-wrap,
  #nexTab > .panel .table-wrap,
  #ledgerTab .table-wrap {
    max-height: none;
  }
}
