/* MinerVill admin panel. Phone first (Phantom in-app browser), then desktop. System font, light + dark, no external resources. */
:root {
  --bg: #f4f5f7; --card: #ffffff; --text: #16181d; --muted: #5b6270; --line: #d9dde4;
  --accent: #2455d6; --accent-text: #ffffff; --ok: #12713f; --ok-bg: #e2f5ea;
  --warn: #8a5a00; --warn-bg: #fff3d6; --bad: #b3261e; --bad-bg: #fde8e6; --info-bg: #e8eefc;
  --bar-in: #2455d6; --bar-out: #d9822b;
  --gutter: 16px; --tabbar-h: 64px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101216; --card: #1a1d23; --text: #eceef2; --muted: #9aa2b1; --line: #2d323c;
    --accent: #6d94ff; --accent-text: #0b1220; --ok: #5fd694; --ok-bg: #12301f;
    --warn: #f0c260; --warn-bg: #332708; --bad: #ff8b82; --bad-bg: #3a1613; --info-bg: #18233f;
    --bar-in: #6d94ff; --bar-out: #f0a35a;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow-x: clip;
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 8px; }
h1 { font-size: 22px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small-text { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
a { color: var(--accent); }
strong { font-weight: 650; }
* { min-width: 0; }
p, li, td, th, dd, dt, label, .card, .item, .hint, .line, .warning { overflow-wrap: anywhere; }

/* banner and top bar */
.banner { position: sticky; top: 0; z-index: 30; text-align: center; font-weight: 700; letter-spacing: .04em; padding: 6px var(--gutter); font-size: 14px; }
.banner.devnet { background: #f5c542; color: #2a2000; }
.banner.mainnet { background: #b3261e; color: #fff; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px var(--gutter); background: var(--card); border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; }
.who { flex: 1; color: var(--muted); font-size: 13px; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* layout */
.screen { padding: 14px var(--gutter) calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom)); max-width: 980px; margin: 0 auto; }
.view > * + * { margin-top: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-top: 1px solid var(--line); }
.kv:first-of-type { border-top: 0; }
.kv > :first-child { color: var(--muted); }
.kv > :last-child { text-align: right; font-weight: 600; }
.big { font-size: 26px; font-weight: 700; line-height: 1.15; }
.stack > * + * { margin-top: 10px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; }

/* tab bar: bottom on the phone, top on wide screens */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
.tabbar::-webkit-scrollbar { display: none; }
.tab { flex: 1 0 64px; min-height: var(--tabbar-h); min-width: 64px; padding: 6px 2px; border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; }
.tab .ic { font-size: 20px; line-height: 1; }
.tab .lbl.full { display: none; }
.tab[aria-current="page"] { color: var(--accent); font-weight: 700; box-shadow: inset 0 3px 0 var(--accent); }
.tab:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 10px 18px; border: 1px solid var(--accent); border-radius: 10px; background: var(--accent); color: var(--accent-text); font: inherit; font-weight: 650; cursor: pointer; width: 100%; text-align: center; }
.btn.secondary { background: transparent; color: var(--accent); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger-outline { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.small { min-height: 44px; width: auto; padding: 6px 14px; font-size: 14px; }
.btn.big-btn { min-height: 56px; font-size: 18px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btnrow { display: flex; flex-direction: column; gap: 10px; }
label.field { display: block; font-weight: 600; margin-bottom: 4px; }
input[type="text"], input[type="search"], input[type="number"], textarea, select {
  width: 100%; min-height: 48px; padding: 10px 12px; font: inherit; font-size: 16px; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
textarea { min-height: 84px; resize: vertical; }
.hint { color: var(--muted); font-size: 13px; margin-top: 4px; }
.field-block { margin-bottom: 12px; }
.code-input { text-align: center; letter-spacing: .4em; font-size: 26px; font-variant-numeric: tabular-nums; }
.linklike { background: none; border: 0; color: var(--accent); text-decoration: underline; font: inherit; padding: 12px 0; min-height: 44px; cursor: pointer; }

/* Phase 3B screens */
select { appearance: auto; }
.pill.big-pill { font-size: 16px; padding: 4px 16px; }
.state-row { align-items: center; }
.state-row > * { flex: 0 1 auto; }
ul.blockers { margin: 0 0 12px; padding-left: 20px; }
ul.blockers li { margin: 4px 0; color: var(--bad); font-weight: 600; }
.btn.danger-outline { font-size: 17px; }
.confirm #confirm-code-box { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
table.rtable { width: 100%; border-collapse: collapse; }
table.rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
table.rtable tr { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; margin-bottom: 10px; }
table.rtable td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); text-align: right; }
table.rtable td:first-child { border-top: 0; }
table.rtable td::before { content: attr(data-label); color: var(--muted); text-align: left; flex: 0 0 auto; max-width: 55%; }

/* pills, notices */
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--info-bg); color: var(--accent); }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.notice { border-radius: 10px; padding: 10px 12px; background: var(--info-bg); }
.notice.bad { background: var(--bad-bg); color: var(--bad); font-weight: 600; }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
progress { width: 100%; height: 12px; accent-color: var(--accent); }

/* lists */
.item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); }
.item + .item { margin-top: 10px; }
.item .head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.seg .btn { width: auto; flex: 0 0 auto; min-height: 44px; padding: 8px 14px; font-weight: 600; }
.alert-item { border-left: 5px solid var(--warn); }
.alert-item.critical { border-left-color: var(--bad); }
.alert-item.info { border-left-color: var(--accent); }
details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; color: var(--accent); }
pre.json { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg); border-radius: 8px; padding: 8px; font-size: 12px; max-height: 260px; overflow: auto; }

/* 7-day chart */
.chart { width: 100%; height: auto; display: block; }
.chart .bar-in { fill: var(--bar-in); } .chart .bar-out { fill: var(--bar-out); }
.chart text { fill: var(--muted); font-size: 9px; }
.chart line { stroke: var(--line); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.dot.in { background: var(--bar-in); } .dot.out { background: var(--bar-out); }

/* second confirmation */
.confirm .conf + .conf { margin-top: 14px; padding-top: 14px; border-top: 2px solid var(--line); }
.lines { list-style: none; margin: 8px 0; padding: 0; }
.line { padding: 8px 0; border-top: 1px solid var(--line); font-size: 17px; }
.line:first-child { border-top: 0; }
.line.danger { color: var(--bad); background: var(--bad-bg); border-radius: 8px; padding: 8px 10px; margin: 4px 0; border-top: 0; font-weight: 600; }
.warning { background: var(--warn-bg); color: var(--warn); border: 2px solid var(--warn); border-radius: 10px; padding: 10px 12px; font-weight: 650; margin: 8px 0; }
.effective { margin: 8px 0 0; }
.confirm .btnrow { margin-top: 18px; }

/* toast */
.toast { position: fixed; left: var(--gutter); right: var(--gutter); bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom)); z-index: 40; padding: 12px 14px; border-radius: 10px; background: var(--text); color: var(--bg); font-weight: 600; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; }

@media (min-width: 700px) {
  :root { --tabbar-h: 0px; }
  .tabbar { position: static; max-width: 980px; margin: 0 auto; border: 0; background: transparent; padding: 10px var(--gutter) 0; gap: 6px; }
  .tabbar { flex-wrap: wrap; overflow-x: visible; }
  .tab { flex: 1 1 auto; min-width: 0; white-space: nowrap; padding: 6px 12px; flex-direction: row; justify-content: center; min-height: 48px; font-size: 15px; gap: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
  .tab[aria-current="page"] { box-shadow: none; border-color: var(--accent); }
  .tab .lbl.full { display: inline; } .tab .lbl.short { display: none; }
  .tab .ic { font-size: 18px; }
  .screen { padding-bottom: 40px; }
  .grid { grid-template-columns: 1fr 1fr; }
  table.rtable thead { position: static; width: auto; height: auto; clip-path: none; }
  table.rtable tr { display: table-row; background: transparent; border: 0; padding: 0; margin: 0; }
  table.rtable th, table.rtable td { display: table-cell; padding: 8px 10px; border-top: 1px solid var(--line); text-align: left; }
  table.rtable th { color: var(--muted); font-size: 13px; }
  table.rtable td::before { content: none; }
  .btnrow { flex-direction: row; }
  .btnrow .btn { flex: 1; }
  .toast { left: 50%; right: auto; transform: translateX(-50%); bottom: 24px; max-width: 520px; }
  .topbar { padding-left: max(var(--gutter), calc((100vw - 980px) / 2 + var(--gutter))); padding-right: max(var(--gutter), calc((100vw - 980px) / 2 + var(--gutter))); }
}
@media (prefers-reduced-motion: no-preference) { .btn { transition: opacity .15s; } }

/* Cadastro (Refer): the pause switch row */
.check-row { display: flex; gap: 12px; align-items: flex-start; }
.check-row input[type="checkbox"] { flex: 0 0 auto; width: 26px; height: 26px; margin-top: 2px; accent-color: var(--accent); }
.check-row label { display: block; flex: 1 1 auto; cursor: pointer; }
.check-row label .hint { display: block; font-weight: 400; }
