/* CGNI — mining pool UI */
:root {
  --bg: #0f0f10;
  --bg-elevated: #18181b;
  --bg-card: #1c1c1f;
  --bg-hover: #242428;
  --border: #2e2e33;
  --border-soft: #252529;
  --text: #c8c8cc;
  --text-muted: #9a9aa3;
  --text-bright: #f2f2f4;
  --orange: #e84700;
  --orange-hover: #ff5a14;
  --orange-dim: rgba(232, 71, 0, 0.14);
  --green: #5cb85c;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "Cascadia Code", Consolas, "Lucida Console", monospace;
  --max: 1040px;
  --radius: 6px;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.35);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-font-smoothing: antialiased; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--orange); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--orange-hover); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 20px 56px;
}

/* —— header —— */
.site-header {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.logo {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-bright);
  text-decoration: none;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.04em;
}

.logo:hover { color: #fff; }

.logo-sub {
  font-size: 11px;
  font-weight: 600;
  color: var(--orange);
  background: var(--orange-dim);
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav a {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 4px;
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}

.nav a:hover {
  color: var(--text-bright);
  background: var(--bg-hover);
}

.nav a.active {
  color: var(--text-bright);
  background: var(--bg-card);
}

.lang-switch {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}

.lang-switch button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.15s, background 0.15s;
}

.lang-switch button:hover { color: var(--text-bright); }

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

/* —— page head —— */
.page-head {
  padding: 28px 0 20px;
  margin-bottom: 20px;
}

.page-head h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
}

.meta-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 0 2px;
}

.meta-line .live {
  color: var(--green);
  font-weight: 600;
}

.meta-line .live::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 6px;
  vertical-align: middle;
  box-shadow: 0 0 8px rgba(92, 184, 92, 0.6);
}

.stale-warn {
  color: #e8a040;
  font-weight: 600;
  font-size: 12px;
}

/* —— tabs —— */
.pool-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  padding: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.pool-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.pool-tab:hover { color: var(--text-bright); background: var(--bg-hover); }

.pool-tab.active {
  color: var(--text-bright);
  background: var(--bg-card);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04);
}

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

#tab-blocks .blocks-summary {
  margin-bottom: 20px;
  padding: 0;
}

/* —— stats —— */
.stats-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 28px;
}

.stats-grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.stats-grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.miner-grid {
  margin: 16px 18px 20px;
  gap: 12px;
  margin-bottom: 0;
}

.miner-grid .stat-cell {
  background: var(--bg-elevated);
  padding: 16px 14px;
  min-height: 76px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.miner-grid .stat-value {
  font-size: 15px;
  line-height: 1.35;
}

.miner-grid .stat-cell:nth-child(3) .stat-value {
  font-size: 12px;
  word-break: break-word;
}

.stats-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.blocks-summary {
  margin: 0;
  padding: 12px 18px 16px;
}

.chart-panel {
  padding: 12px 16px 8px;
  background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
}

.hr-chart-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
  flex-shrink: 0;
}

.btn-ghost:hover {
  color: var(--orange);
  background: var(--orange-dim);
  border-color: transparent;
}

.line-chart {
  display: block;
  width: 100%;
  height: 180px;
}

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

.data-table th {
  padding: 10px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
}

.data-table td {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 12px;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table td:nth-child(4) { color: var(--orange); }

.stat-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color 0.2s, transform 0.2s;
}

.stat-cell:hover {
  border-color: #3a3a42;
}

.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-value {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 600;
  color: var(--text-bright);
  line-height: 1.2;
  word-break: break-word;
}

.stat-value.hl { color: var(--orange); }

/* —— sections —— */
.section { margin-bottom: 32px; }

.section-h {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
}

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 0;
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* config table */
.cfg-table { width: 100%; border-collapse: collapse; }

.cfg-table td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}

.cfg-table tr:last-child td { border-bottom: none; }

.cfg-table td:first-child {
  width: 120px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.cfg-table td:nth-child(2) {
  font-family: var(--mono);
  font-size: 14px;
  color: var(--text-bright);
  word-break: break-all;
}

.cfg-table td:last-child {
  width: 72px;
  text-align: right;
  padding-right: 16px;
}

.panel-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}

/* params table */
.params-table {
  width: 100%;
  border-collapse: collapse;
}

.params-table td {
  padding: 11px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}

.params-table tr:last-child td { border-bottom: none; }

.params-table tr:hover td { background: var(--bg-hover); }

.params-table td:first-child {
  width: 38%;
  color: var(--text-muted);
  font-weight: 500;
}

.params-table td:last-child {
  font-family: var(--mono);
  color: var(--text-bright);
  text-align: right;
}

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

.workers-table th {
  padding: 10px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-soft);
}

.workers-table td {
  padding: 10px 18px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono);
  font-size: 13px;
}

.workers-table tr:last-child td { border-bottom: none; }

.workers-table tr:hover td { background: var(--bg-hover); }

.workers-table td:nth-child(2) { color: var(--orange); }

.stats-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
  margin-bottom: 12px;
}

.wallet-bar {
  display: grid;
  gap: 8px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--border-soft);
}

.wallet-bar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.wallet-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wallet-chip {
  display: inline-flex;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.wallet-chip.active {
  border-color: var(--orange);
  box-shadow: 0 0 0 1px var(--orange-dim);
}

.chip-select {
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  padding: 6px 10px;
  cursor: pointer;
}

.chip-select:hover { color: var(--orange); }

.chip-remove {
  background: transparent;
  border: none;
  border-left: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px 9px;
  cursor: pointer;
}

.chip-remove:hover { color: #e55; }

.miner-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-elevated);
}

.miner-toolbar .btn-ghost {
  padding: 6px 12px;
  line-height: 1;
  height: auto;
  align-self: center;
}

.miner-addr {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.miner-empty {
  padding: 32px 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.miner-empty p { margin: 0; }

.payments-block {
  padding: 0 0 8px;
  border-top: 1px solid var(--border-soft);
}

.sub-h {
  margin: 16px 18px 8px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.chart-panel-inset {
  margin: 20px 18px 16px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px 16px 8px;
  background: var(--bg-elevated);
}

.addr-form {
  display: flex;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-soft);
}

.addr-input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text-bright);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.addr-input:focus {
  outline: none;
  border-color: var(--orange);
}

.miner-stats {
  padding: 0 0 4px;
}

.miner-stats .workers-table {
  margin: 0 18px 12px;
  width: calc(100% - 36px);
}

@media (max-width: 600px) {
  .stats-grid-3 { grid-template-columns: 1fr; }
  .addr-form { flex-direction: column; }
}

.workers-empty {
  text-align: center;
  color: var(--text-muted);
  font-family: var(--font);
}

/* wallet cards */
.cards-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}

.card-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, transform 0.15s;
}

.card-box:hover {
  border-color: #3a3a42;
  transform: translateY(-1px);
}

.card-box h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-bright);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.card-box h3 .ver {
  font-weight: 500;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--mono);
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1.2;
}

.btn:hover { text-decoration: none; }

.btn-main {
  background: var(--orange);
  color: #111;
  border-color: var(--orange);
}

.btn-main:hover {
  background: var(--orange-hover);
  border-color: var(--orange-hover);
  color: #111;
}

.btn-outline {
  background: var(--bg-elevated);
  color: var(--text);
  border-color: var(--border);
}

.btn-outline:hover {
  border-color: var(--orange);
  color: var(--orange);
  background: var(--orange-dim);
}

.btn-xs {
  padding: 5px 10px;
  font-size: 11px;
  min-width: 52px;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* footer */
.site-footer {
  margin-top: 40px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-muted);
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--orange); }

/* responsive */
@media (max-width: 860px) {
  .stats-grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cards-row { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .pool-tabs { flex-wrap: wrap; }
  .pool-tab { flex: 1 1 45%; }
  .stats-grid-6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .miner-grid { gap: 10px; margin: 14px 14px 16px; }
  .miner-grid .stat-cell { min-height: auto; padding: 14px 12px; }
  .stats-grid-3 { grid-template-columns: 1fr; }
  .site-header .wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .header-right {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .nav {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .lang-switch { align-self: flex-start; }

  .cfg-table td:first-child { width: 90px; }

  .params-table td:last-child { text-align: left; }
}
