/* Cairn Pool dashboard. Builds on style.css (shared CRT base + explorer tokens).
   Visual system matches the canonical cairn explorer (references/csd-indexer/
   public/explorer.html): rounded gradient panels, amber uppercase section
   headings, green/amber stat tiles, pill badges, phosphor charts.
   All class names are owned by index.html + pool.js. */

/* ── page column: centered like the explorer, 26px gutters when narrow ────── */
.hero, .grid2, #app > .panel, .foot {
  width: min(1240px, calc(100% - 52px));
  margin: 16px auto 0;
}

/* ── live signal ──────────────────────────────────────────────────────────── */
.live-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 8px var(--green); margin-right: 6px; vertical-align: middle;
  animation: pulse 2s infinite;
}
@keyframes pulse { 50% { opacity: .4; } }
.live-dot.syncing { background: var(--amber); box-shadow: 0 0 8px rgba(255,210,74,.6); }

/* ── hero stat tiles (explorer .pulse/.pu) ────────────────────────────────── */
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(152px, 1fr)); gap: 10px; margin-top: 20px; }
.tile {
  background: linear-gradient(180deg, var(--panel), #080a09);
  border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  transition: border-color .15s;
}
.tile:hover { border-color: var(--line2); }
.tile .t-val { font-size: 22px; color: var(--text); letter-spacing: -.5px; line-height: 1.25; font-variant-numeric: tabular-nums; }
.t-unit { font-size: 12px; color: var(--dim2); letter-spacing: 0; font-weight: 400; }
.tile .t-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1.2px; margin-top: 3px; }
.tile .t-sub { font-size: 11px; color: var(--dim); margin-top: 6px; min-height: 14px; overflow-wrap: anywhere; }
.tile.hot .t-val { color: var(--green); }
.tile.gold .t-val { color: var(--amber); }

/* ── panels (explorer .panel) ─────────────────────────────────────────────── */
.panel {
  background: linear-gradient(180deg, var(--panel), #080a09);
  border: 1px solid var(--line); border-radius: 12px; padding: 18px;
  position: relative; transition: border-color .15s;
}
.panel:hover { border-color: var(--line2); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2 > .panel { margin: 0; width: auto; min-width: 0; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; min-width: 0; }
.panel-head h2, .panel h2 {
  margin: .2em 0; font-size: 12px; color: var(--amber); font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.5px;
}
.panel-sub { font-size: 11.5px; color: var(--dim); overflow-wrap: anywhere; min-width: 0; }
.panel-head.inner { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }

/* ── range selector (explorer .tab) ───────────────────────────────────────── */
.range-btns { display: inline-flex; gap: 5px; }
.range-btn {
  background: var(--panel2); border: 1px solid var(--line); color: var(--dim2);
  font: inherit; font-size: 11px; padding: 2px 10px; border-radius: 6px; cursor: pointer;
}
.range-btn:hover { color: var(--text); }
.range-btn.on { color: var(--green); border-color: #1f4d2e; background: #0b1a10; }

/* ── status badges (explorer .badge) ──────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; border: 1px solid; white-space: nowrap; }
.badge.ok { color: var(--green); border-color: #1f4d2e; background: #0b1a10; }
.badge.bad { color: var(--red); border-color: #4d1f1f; background: #1a0b0b; }
.badge.pend { color: var(--amber); border-color: #4d421f; background: #1a160b; }

/* ── leaderboard / list rows (explorer table rows) ────────────────────────── */
.lb { display: flex; flex-direction: column; }
.lb-row {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) repeat(4, auto); gap: 10px; align-items: baseline;
  padding: 7px 6px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--text);
  text-decoration: none; transition: background .12s;
}
.lb-row:hover { background: #0d0d0d; }
.lb-row:last-of-type { border-bottom: none; }
.lb-rank { color: var(--dim); font-size: 11px; }
.lb-addr { color: var(--green); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-addr a { color: var(--green); }
.lb-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.lb-num .t-unit { font-size: 11px; }
.lb-num.ok { color: var(--green); }
.lb-num.bad { color: var(--red); }
.lb-num.pend { color: var(--amber); }
.lookup-link { text-decoration: none; cursor: pointer; }
.lookup-link:hover { text-decoration: underline; }
.feed-empty { padding: 14px 2px; font-size: 12.5px; }

/* ── connect + deal panels ────────────────────────────────────────────────── */
.connect-body { position: relative; }
.connect-code {
  margin: 0 0 10px; padding: 12px 14px; background: #070908; border: 1px solid var(--line);
  border-radius: 8px; color: var(--green); font-size: 12.5px; line-height: 1.7; overflow-x: auto;
  text-shadow: 0 0 6px rgba(87,217,119,.25);
}
.connect-note { font-size: 12px; line-height: 1.7; margin: 0; }
.copy-btn { position: absolute; top: 6px; right: 6px; font-size: 10.5px; padding: 3px 10px; }

.deal-row { display: flex; justify-content: space-between; gap: 14px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.deal-row:last-child { border-bottom: none; }
.deal-k { color: var(--dim); text-transform: uppercase; letter-spacing: 1px; font-size: 10.5px; align-self: center; white-space: nowrap; }
.deal-v { color: var(--text); text-align: right; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }

/* ── miner lookup ─────────────────────────────────────────────────────────── */
.miner-lookup { display: flex; gap: 8px; padding: 0 0 4px; }
.miner-input {
  flex: 1; min-width: 0; background: var(--panel2); border: 1px solid var(--line); color: var(--text);
  font: inherit; font-size: 13px; padding: 8px 11px; letter-spacing: .3px; border-radius: 6px;
}
.miner-input:focus { outline: none; border-color: var(--green); }
.miner-input::placeholder { color: #555; }
#miner-result { padding-top: 6px; }
.miner-err { color: var(--red); font-size: 12.5px; margin: 8px 0 0; }
.miner-none { font-size: 12px; padding: 8px 2px; }
.miner-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.mini-tile { background: #080a09; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.mini-tile .t-label { font-size: 10px; color: var(--dim); text-transform: uppercase; letter-spacing: 1.2px; }
.t-val.small { font-size: 19px; margin-top: 4px; color: var(--text); letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
#miner-chart { margin: 10px 0 4px; }
#miner-chart:empty { display: none; }

/* ── per-worker status cards (connection diagnostics) ─────────────────────── */
.wk {
  display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel2);
  padding: 9px 12px; margin: 0 0 8px; font-size: 12px; color: var(--dim);
}
.wk-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center;
  background: var(--green); box-shadow: 0 0 6px var(--green);
}
.wk.idle .wk-dot { background: var(--amber); box-shadow: 0 0 6px rgba(255,210,74,.6); }
.wk.off .wk-dot { background: var(--dim); box-shadow: none; }
.wk-name { color: var(--text); font-weight: 700; font-size: 13px; }
.wk-state { color: var(--dim2); }
.wk.idle .wk-state { color: var(--amber); }
.wk-kv { white-space: nowrap; }
.wk-kv b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.wk-kv b.ok { color: var(--green); }
.wk-kv b.warn { color: var(--amber); }
.wk-kv b.bad { color: var(--red); }

/* ── terminal log feed (miner activity + pool share pulse) ────────────────── */
.mlog {
  background: #070908; border: 1px solid var(--line); border-radius: 8px;
  padding: 8px 12px; max-height: 280px; overflow-y: auto;
  font-size: 12px; line-height: 2; font-variant-numeric: tabular-nums;
}
.mlog.pulse { max-height: 176px; }
.mlog-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.mlog-t { color: var(--dim); }
.mlog-w { color: var(--dim2); }
.mlog-d { color: var(--dim); }
.mlog-a { color: var(--green); }
.ev-ok { color: var(--green); }
.ev-bad { color: var(--red); }
.ev-warn { color: var(--amber); }
/* new-row flash - explorer .feed-row */
.feed-row { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: #13241a; } to { background: transparent; } }

/* ── blocks / payouts feeds ───────────────────────────────────────────────── */
.blockfeed { max-height: 360px; overflow-y: auto; }
.blk {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 8px 6px; border-bottom: 1px solid var(--line); font-size: 12.5px;
}
.blk:hover { background: #0d0d0d; }
.blk:last-child { border-bottom: none; }
.blk-h { color: var(--green); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.blk-mid { color: var(--dim2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.blk-mid a { color: var(--green); }
.blk-right { text-align: right; color: var(--dim); white-space: nowrap; font-size: 11px; }

/* ── footer ───────────────────────────────────────────────────────────────── */
.foot { margin-top: 22px; margin-bottom: 26px; max-width: none; font-size: 11.5px; border-top: 1px solid var(--line); padding: 14px 0 0; }

/* ── charts (chart.js) - explorer chart grammar ───────────────────────────── */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; }
.chart-line { fill: none; stroke: var(--green); stroke-width: 1.6; }
.chart-fill { fill: rgba(87, 217, 119, .1); stroke: none; }
.chart-grid { stroke: #1b1f1d; stroke-width: 1; shape-rendering: crispEdges; }
.chart-ref { stroke: var(--amber); stroke-dasharray: 4 3; opacity: .85; }
.chart-ref-lab { fill: var(--amber); font-size: 9px; font-family: inherit; }
.chart-cross { stroke: var(--green); stroke-width: 1; stroke-dasharray: 2 3; }
.chart-dot { fill: var(--green); stroke: none; }
.chart-hint, .chart-empty, .chart-ylab { fill: var(--dim); font-size: 10px; font-family: inherit; }
.chart-tip {
  position: absolute; top: 2px; pointer-events: none;
  background: #000; border: 1px solid var(--green); border-radius: 4px;
  padding: 4px 9px; font-size: 11px; display: flex; flex-direction: column; gap: 1px;
  font-variant-numeric: tabular-nums; white-space: nowrap; z-index: 6;
}
.chart-tip b { color: var(--text); font-weight: 700; }
.chart-tip span { color: var(--dim); }

/* ── motion + mobile ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .live-dot, .feed-row, .wk-dot { animation: none; }
  .tile, .panel, .range-btn { transition: none; }
}
@media (max-width: 760px) {
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .hero, .grid2, #app > .panel, .foot { width: calc(100% - 24px); }
  .panel { padding: 12px; border-radius: 8px; }
  .tile { border-radius: 8px; padding: 12px 13px; }
  .lb-row { grid-template-columns: 22px minmax(0, 1fr) auto auto; }
  .lb-row .lb-num:nth-of-type(5), .lb-row .lb-num:nth-of-type(6) { display: none; }
  .miner-lookup { flex-direction: column; }
  .wk { gap: 3px 12px; }
}
