:root {
  --bg: #0b0f14;
  --panel: #121820;
  --panel-2: #151c25;
  --line: #27313d;
  --line-soft: #1b242e;
  --text: #d7dde5;
  --muted: #7f8a97;
  --bright: #ffffff;
  --accent: #ff6b00;
  --accent-soft: rgba(255, 107, 0, .12);
  --ok: #36d399;
  --bad: #fb7185;
  --mono: "JetBrains Mono", Consolas, "Liberation Mono", monospace;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --max: 1600px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
}

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

.wrap {
  width: min(var(--max), calc(100% - 72px));
  margin: 0 auto;
}

.site-header .wrap {
  width: calc(100% - 48px);
  max-width: none;
}

.site-header {
  flex-shrink: 0;
  border-bottom: 1px solid var(--line-soft);
  background: #0d1218;
}

.header-wrap {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 28px;
  min-height: 62px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--bright);
}

.logo-word {
  position: relative;
  font-size: 23px;
  font-weight: 850;
  line-height: 1;
}

.logo-word::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -7px;
  height: 2px;
  background: var(--accent);
}

.logo-sub {
  padding: 3px 7px;
  border: 1px solid rgba(255, 107, 0, .35);
  border-radius: 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.nav,
.nav-sep,
.nav-icon { display: none; }

.top-nav {
  display: flex;
  align-items: stretch;
  justify-content: center;
  min-width: 0;
  height: 100%;
}

.top-nav button {
  flex: 0 0 auto;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 21px 18px 19px;
  cursor: pointer;
  font: 850 12px var(--font);
  text-transform: uppercase;
}

.top-nav button.active {
  color: var(--bright);
  border-bottom-color: var(--accent);
}

.top-nav button:hover {
  color: var(--bright);
}

.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
}

.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 9px;
  font: 700 11px var(--font);
  cursor: pointer;
}

.lang-switch button.on {
  background: var(--accent);
  color: #111;
}

.site-main.wrap {
  flex: 1;
  padding: 28px 0 42px;
}

.page { display: none; }
.page.active { display: block; }

.pool-shell {
  border: 1px solid var(--line);
  background: var(--panel);
}

.dashboard-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.wallet-form input,
.settings-fields input,
.threshold-row input,
.pager select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #0d1218;
  color: var(--bright);
  outline: none;
  font: 13px var(--mono);
}

.wallet-form input {
  min-width: 0;
  padding: 13px 14px;
}

.wallet-form input:focus,
.settings-fields input:focus,
.threshold-row input:focus {
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px 18px;
  background: #0d1218;
  color: var(--text);
  cursor: pointer;
  font: 800 12px var(--font);
  text-transform: uppercase;
}

.btn-primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #111;
}

.btn-ghost:disabled {
  color: #586371;
  cursor: default;
}

.wallet-context {
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #10161d;
}

.miner-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
}

.miner-tabs button {
  flex: 0 0 auto;
  border: 0;
  border-right: 1px solid var(--line-soft);
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 15px 18px 13px;
  cursor: pointer;
  font: 800 12px var(--font);
  text-transform: uppercase;
}

.miner-tabs button:first-child { border-left: 1px solid var(--line-soft); }

.miner-tabs button.active {
  color: var(--bright);
  border-bottom-color: var(--accent);
  background: rgba(255, 255, 255, .02);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.kpi {
  min-width: 0;
  padding: 20px 22px;
  border-right: 1px solid var(--line);
}

.kpi:last-child { border-right: 0; }

.kpi-label,
.card-title,
.chart-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.kpi-label { margin-bottom: 7px; }

.kpi-value {
  color: var(--bright);
  font: 700 22px/1.15 var(--mono);
  overflow-wrap: anywhere;
}

.kpi-balance .kpi-value { font-size: 24px; }
#miner-hashrate { color: var(--ok); }

.miner-tab { display: none; }
.miner-tab.active { display: block; }

body:not(.section-main) .general-only {
  display: none;
}

.chart-card,
.workers-panel,
.card {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.chart-card {
  padding-left: 10px;
  padding-right: 10px;
}

.hashrate-layout .chart-card {
  padding-left: 4px;
  padding-right: 4px;
}

.payments-overview {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--line);
}

.payment-stat {
  min-width: 0;
  padding: 18px 22px;
  border-right: 1px solid var(--line);
}

.payment-stat:last-child { border-right: 0; }

.payment-stat span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.payment-stat b {
  display: block;
  color: var(--bright);
  font: 700 20px/1.15 var(--mono);
  overflow-wrap: anywhere;
}

.payments-chart {
  background: var(--panel);
  padding-left: 4px;
  padding-right: 4px;
}

.chart-canvas-payments {
  height: 220px;
}

.chart-card { background: var(--panel); }

.hashrate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

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

.chart-now {
  color: var(--ok);
  font: 800 12px var(--mono);
}

.chart-actions button {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  cursor: pointer;
  font: 800 11px var(--font);
}

.chart-actions button.active {
  border-color: var(--accent);
  color: var(--accent);
}

.chart-legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chart-mode-switch button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  cursor: pointer;
  font: 800 12px var(--font);
}

.chart-mode-switch button::before {
  content: "";
  display: inline-block;
  width: 28px;
  height: 8px;
  border: 2px solid var(--accent);
  border-radius: 2px;
}

.chart-mode-switch button.active {
  color: var(--bright);
}

.chart-mode-switch button.active::before {
  background: var(--accent);
}

.chart-canvas {
  display: block;
  width: 100%;
  height: 190px;
}

.chart-canvas-lg { height: 368px; }

.workers-panel { background: var(--panel-2); }

.card-title {
  margin: 0 0 12px;
}

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

.data-table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  font-size: 13px;
}

.workers-table { min-width: 0; }

.workers-table th,
.workers-table td {
  white-space: normal;
}

.data-table th {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
}

.data-table td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--text);
  font: 12px var(--mono);
  overflow-wrap: anywhere;
}

.data-table tr:last-child td { border-bottom: 0; }

.miner-table { min-width: 880px; }

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.pager select {
  width: auto;
  margin-left: 8px;
  padding: 7px 26px 7px 9px;
  color: var(--text);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--line);
}

.settings-grid > div {
  padding: 18px;
  border-right: 1px solid var(--line);
}

.settings-grid > div:last-child { border-right: 0; }

.settings-grid h2 {
  margin: 0 0 16px;
  color: var(--bright);
  font-size: 18px;
}

.threshold-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 12px;
}

.threshold-action-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.threshold-action-row .btn {
  width: 100%;
}

.threshold-action-row p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.threshold-row input,
.settings-fields input {
  padding: 11px;
  font: 13px var(--font);
}

.settings-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px;
  gap: 10px;
}

.mode-row {
  display: inline-flex;
  margin-bottom: 14px;
  border: 1px solid var(--line);
}

.mode-row button {
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  padding: 10px 18px;
  cursor: pointer;
  font: 850 12px var(--font);
  text-transform: uppercase;
}

.mode-row button:last-child { border-right: 0; }

.mode-row button.active {
  background: var(--accent);
  color: #111;
}

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

.config-mode-row {
  margin-bottom: 0;
}

.config-mode-row button {
  padding: 8px 16px;
}

.ports-table {
  width: 100%;
  margin-bottom: 0;
  border-collapse: collapse;
}

.ports-table th,
.ports-table td {
  padding: 10px;
  border: 1px solid var(--line);
  text-align: left;
}

.ports-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.ports-table td {
  color: var(--text);
  font-size: 12px;
}

.connect-command {
  border: 1px solid var(--line);
  background: #0d1218;
}

.mining-command-card {
  margin: 18px;
}

.command-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.connect-command code {
  display: block;
  padding: 12px;
  color: var(--bright);
  overflow-x: auto;
  white-space: nowrap;
}

.reward-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line-soft);
}

.reward-row:last-child { border-bottom: 0; }

.reward-row b {
  display: block;
  color: var(--bright);
  font: 700 13px var(--mono);
}

.reward-row span,
.reward-row em,
.muted {
  color: var(--muted);
  font-size: 12px;
}

.muted { margin: 12px 0 0; }
.muted.tight { margin: 0; }

.mono { font-family: var(--mono); }
.status-ok { color: var(--ok); }
.status-bad { color: var(--bad); }

.site-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 18px 0 26px;
  border-top: 1px solid var(--line-soft);
  color: var(--muted);
  text-align: center;
  font-size: 12px;
}

/* Explorer and fallback utility styles. */
.page-static { padding-top: 28px; }
.explorer-strip { margin-bottom: 14px; }
.explorer-result { min-height: 120px; overflow-wrap: anywhere; }
.result-grid { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px 14px; }
.result-grid span { color: var(--muted); font-size: 12px; }
.result-grid b { color: var(--bright); font-weight: 600; overflow-wrap: anywhere; }
.result-json { max-height: 320px; overflow: auto; margin: 14px 0 0; padding: 12px; border: 1px solid var(--line); background: #0d1218; color: var(--text); font: 12px/1.45 var(--mono); }
.link-button { border: 0; background: transparent; color: var(--accent); padding: 0; cursor: pointer; font: inherit; text-align: left; }
.endpoint-grid, .dl-grid, .start-panel, .pool-strip, .cmd-hidden { display: none; }

@media (max-width: 760px) {
  .wrap { width: min(100% - 24px, var(--max)); }
  .site-header .wrap { width: min(100% - 24px, var(--max)); }
  .header-wrap {
    grid-template-columns: 1fr auto;
    gap: 10px 14px;
    min-height: 58px;
    padding-top: 10px;
    padding-bottom: 0;
  }
  .top-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    order: 3;
    overflow-x: auto;
    border-top: 1px solid var(--line-soft);
  }
  .top-nav button {
    padding: 12px 14px 10px;
  }
  .dashboard-form { grid-template-columns: 1fr; }
  .btn { width: 100%; }
  .kpi-row,
  .payments-overview,
  .settings-grid,
  .threshold-row,
  .threshold-action-row,
  .settings-fields {
    grid-template-columns: 1fr;
  }
  .kpi,
  .payment-stat,
  .settings-grid > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .kpi:last-child,
  .settings-grid > div:last-child { border-bottom: 0; }
  .chart-head {
    align-items: flex-start;
    flex-direction: column;
  }
  .chart-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .miner-tabs button { padding: 13px 14px 11px; }
  .chart-canvas-lg { height: 290px; }
  .pager {
    align-items: flex-start;
    flex-direction: column;
  }
}
