/* bitcoinwallet · estilo minimalista, cantos retos */

:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #6b6b6b;
  --faint: #a8a8a8;
  --line: #e8e8e8;
  --line-2: #cccccc;
  --hover: #f4f4f4;
  --accent: #f7931a;
  --chart: #d97706;
  --ok: #15803d;
  --err: #c42b1c;
  --warn: #a16207;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b0b; --fg: #ededed; --muted: #9a9a9a; --faint: #5e5e5e;
    --line: #222222; --line-2: #3a3a3a; --hover: #161616;
    --ok: #4ade80; --err: #f87171; --warn: #fbbf24;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b0b; --fg: #ededed; --muted: #9a9a9a; --faint: #5e5e5e;
  --line: #222222; --line-2: #3a3a3a; --hover: #161616;
  --ok: #4ade80; --err: #f87171; --warn: #fbbf24;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-underline-offset: 3px; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, p { margin: 0; }
svg { display: block; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hide { display: none !important; }
.mono { font-family: var(--mono); font-size: .9em; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.up { color: var(--ok); }
.down { color: var(--err); }
.amount { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- topo ---------- */
.top { border-bottom: 1px solid var(--line); }
.top-in { max-width: 680px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 6px; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; font-weight: 600; letter-spacing: -.01em; }
.brand-mark { width: 24px; height: 24px; display: grid; place-items: center; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border: 1px solid var(--line-2); background: transparent;
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--hover); border-color: var(--fg); }
.btn:disabled { opacity: .35; cursor: default; background: transparent; border-color: var(--line-2); }
.btn-primary { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.btn-primary:hover { background: var(--fg); opacity: .85; }
.btn-primary:disabled { background: var(--fg); border-color: var(--fg); }
.btn-ghost { border-color: transparent; }
.btn-ghost:hover { border-color: transparent; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; height: 42px; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.sel { border: 0; background: transparent; padding: 4px 2px; font-size: 13px; color: var(--fg); cursor: pointer; }
.sel:hover { color: var(--fg); }
.btn svg { width: 16px; height: 16px; }
.icon-btn {
  width: 36px; height: 36px; flex: none; display: inline-grid; place-items: center;
  border: 0; background: transparent; color: var(--muted); transition: background .15s, color .15s;
}
.icon-btn:hover { color: var(--fg); background: var(--hover); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn svg { width: 18px; height: 18px; }
.link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--fg); }
.link.danger:hover { color: var(--err); }

/* abas de texto (moeda, período, nº de palavras) */
.seg { display: inline-flex; }
.seg button { border: 0; border-bottom: 1px solid transparent; background: none; padding: 4px 7px; font-size: 13px; color: var(--muted); }
.seg button:hover { color: var(--fg); }
.seg button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); font-weight: 600; }

/* ---------- página e seções ---------- */
.page { max-width: 680px; margin: 0 auto; padding: 0 16px 40px; }
.sec { padding: 28px 0; }
.sec + .sec, .sec + div > .sec:first-child { border-top: 1px solid var(--line); }
.sec-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: 36px; margin-bottom: 14px; }
.sec-head > :first-child { margin-right: auto; }
.label { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 16px; }
.sec-foot > :first-child { margin-right: auto; }
.title { font-size: 26px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.page-head { padding: 32px 0 4px; display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }

/* ---------- saldo ---------- */
.total { font-size: clamp(36px, 10vw, 52px); font-weight: 600; letter-spacing: -.03em; line-height: 1.1; transition: opacity .2s; }
.total-sub { margin-top: 6px; color: var(--muted); }
.stale { opacity: .5; }

/* ---------- gráfico ---------- */
.chart-wrap { margin-top: 28px; }
.chart-head { display: flex; align-items: baseline; gap: 8px 12px; flex-wrap: wrap; margin-bottom: 14px; }
.readout { margin-right: auto; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.readout b { font-size: 17px; font-weight: 600; }
.chart { position: relative; height: 150px; touch-action: pan-y; cursor: crosshair; outline-offset: 6px; transition: opacity .2s; }
.chart.loading { opacity: .4; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .line { fill: none; stroke: var(--chart); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: var(--chart); opacity: .1; }
.chart .base { stroke: var(--line-2); stroke-width: 1; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.chart .dot { fill: var(--chart); stroke: var(--bg); stroke-width: 2; }
.chart-msg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 13px; border: 1px solid var(--line); }

/* ---------- campos e status ---------- */
.field { width: 100%; border: 1px solid var(--line-2); background: var(--bg); padding: 9px 12px; outline: none; transition: border-color .15s; }
.field:focus { border-color: var(--fg); }
.field::placeholder { color: var(--faint); }
textarea.field { display: block; resize: vertical; min-height: 84px; font-family: var(--mono); font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.add { display: flex; gap: 8px; }
.add .field { flex: 1; min-width: 0; height: 36px; font-family: var(--mono); font-size: 13px; }
.status { display: flex; align-items: flex-start; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.status:empty { display: none; }
.status svg { width: 15px; height: 15px; flex: none; margin-top: 2px; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.status.warn { color: var(--warn); }
.note { display: flex; align-items: flex-start; gap: 8px; margin-top: 14px; font-size: 13px; color: var(--muted); }
.note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--warn); }
.note.err { color: var(--err); }
.note.err svg { color: var(--err); }
.spin { width: 11px; height: 11px; flex: none; margin-top: 4px; border: 1.5px solid var(--line-2); border-top-color: var(--fg); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- caixa de chave/endereço ---------- */
.kbox { display: flex; align-items: center; gap: 2px; border: 1px solid var(--line); padding: 4px 4px 4px 12px; }
.kbox .mono { flex: 1; min-width: 0; font-size: 13px; line-height: 1.5; padding: 4px 0; }
.kbox.tall .mono { max-height: 120px; overflow: auto; }
.det-label { font-size: 12px; color: var(--muted); margin: 0 0 6px; }

/* ---------- contas ---------- */
.accts:not(:empty) { border-top: 1px solid var(--line); margin-bottom: 20px; }
.acct { border-bottom: 1px solid var(--line); }
.acct-row { display: flex; align-items: center; gap: 12px; margin: 0 -10px; padding: 14px 10px; cursor: pointer; transition: background .15s; }
.acct-row:hover { background: var(--hover); }
.acct-main { flex: 1; min-width: 0; }
.acct-name { font-weight: 500; }
.acct-sub { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-bal { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acct-bal small { display: block; color: var(--muted); font-size: 12px; }
.chev { color: var(--faint); flex: none; transition: transform .15s; }
.chev svg { width: 16px; height: 16px; }
.acct.open .chev, details[open] > summary .chev { transform: rotate(90deg); }
.acct-bal .down { color: var(--err); }
.acct-det { padding: 4px 0 20px; }
.acct-det .note { margin: 0 0 12px; }
.links { display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; margin-top: 14px; }
.hint { margin-top: 10px; font-size: 13px; color: var(--muted); }
#bal.hide + .chart-wrap { margin-top: 0; }

/* ---------- gerador ---------- */
.net { display: flex; align-items: flex-start; gap: 10px; width: 100%; margin-top: 14px; padding: 10px 12px; border: 1px solid currentColor; font-size: 13px; }
.net::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; background: currentColor; }
.net.on { color: var(--err); }
.net.off { color: var(--ok); }
.rows { border-top: 1px solid var(--line); }
.xkey { border-left: 2px solid var(--accent); }
.mini { border-top: 1px solid var(--line); }
.mini-row { display: grid; grid-template-columns: auto 1fr auto; align-items: baseline; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini-tag { min-width: 58px; font-size: 12px; color: var(--muted); }
.mini-row a { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-decoration: none; }
.mini-row a:hover { text-decoration: underline; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.row-idx { width: 22px; flex: none; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.row .mono { flex: 1; min-width: 0; font-size: 13px; }

/* seção que abre e fecha */
details.fold > summary { list-style: none; display: flex; align-items: center; gap: 8px; min-height: 36px; cursor: pointer; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary .label { margin-right: auto; }
details.fold > summary:hover .label { color: var(--fg); }
.fold-body { padding-top: 14px; }

/* PSBT */
.outs { margin-top: 14px; border-top: 1px solid var(--line); }
#fee-warn .note { margin: 0 0 14px; }
.tx-out { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tx-out .mono { font-size: 13px; }
.tag { grid-column: 1 / -1; display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.tag svg { width: 13px; height: 13px; }
.tag.mine { color: var(--ok); }
.tx-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.tx-sum span { display: block; font-size: 12px; color: var(--muted); }
.tx-sum b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- janela (QR e tutorial) ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; padding: 16px; background: rgba(0, 0, 0, .55); }
.modal.show { display: flex; }
.modal-box { width: 100%; max-width: 380px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px; background: var(--bg); border: 1px solid var(--line-2); }
.modal-box.wide { max-width: 440px; }
.modal-title { font-weight: 600; margin-bottom: 16px; }
.modal canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.modal-text { margin: 12px 0 16px; font-size: 12px; color: var(--muted); word-break: break-all; }
.modal .btn { width: 100%; }
.modal-btns { display: flex; gap: 8px; }
.modal-btns .btn { flex: 1; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: 0 0 14px 36px; font-size: 14px; color: var(--muted); }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 1px; width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid var(--line-2); font-size: 12px; color: var(--fg); }
.steps b { display: block; color: var(--fg); font-weight: 600; }
.modal .note { margin: 4px 0 20px; }

/* ---------- aviso flutuante ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px);
  padding: 10px 16px; background: var(--fg); color: var(--bg); font-size: 14px;
  opacity: 0; pointer-events: none; transform: translate(-50%, 8px); transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { background: var(--warn); color: var(--bg); }

/* ---------- enviar (tela própria dentro da carteira) ---------- */
main.sending .view { display: none; }
#send { border-top: 0; }
.fld { margin-bottom: 20px; }
.fld .det-label { display: block; }
.mono-in { font-family: var(--mono); font-size: 13px; }
select.field { height: 38px; padding: 0 8px; font-size: 13px; cursor: pointer; }
.field.bad { border-color: var(--err); }
.secret { -webkit-text-security: disc; }
.keys { margin: 14px 0 0 32px; }
.keys .note { margin: 0 0 16px; }
.keys .fld { margin-bottom: 12px; }
#s-unit { min-width: 64px; }
.sum { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 14px; }
.sum dt { color: var(--muted); }
.sum dd { margin: 0; min-width: 0; font-variant-numeric: tabular-nums; }
.sum dd small { color: var(--muted); font-size: 12px; }
.step-h { display: flex; align-items: center; gap: 10px; margin: 26px 0 6px; font-weight: 600; }
.num { width: 22px; height: 22px; flex: none; display: grid; place-items: center; border: 1px solid var(--line-2); font-size: 12px; font-weight: 400; }
.step-h + .hint { margin: 0 0 4px 32px; }
.done { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; font-size: 18px; font-weight: 600; color: var(--ok); }
.done svg { width: 22px; height: 22px; }

/* ---------- rodapé ---------- */
.foot { max-width: 680px; margin: 0 auto; padding: 0 16px 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.foot .sel { font-size: 12px; color: var(--muted); }

/* ---------- telas pequenas ---------- */
.narrow-only { display: none; }
@media (max-width: 480px) {
  .wide-only { display: none; }
  .narrow-only { display: inline; }
  .sec { padding: 24px 0; }
}
@media (max-width: 360px) {
  .brand-name { display: none; }
}
