/* IA Status v3 - tema escuro. Sem fonte externa (CSP): pilha de sistema. */
:root {
  --bg: #0e1012;
  --surface: #161a1d;
  --line: #2a2f35;
  --line-input: #30343a;
  --text: #e7e9ec;
  --muted: #9aa3ad;
  --accent: #ff8a3d;
  --on-accent: #1a0d04;
  --off: #ff6b63;
  --off-bg: #3a1414;
  --ok: #3ddc84;
  --warn: #ffb020;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, Menlo, Consolas, "SFMono-Regular", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; }
a { color: var(--accent); }
a:hover { color: #ffb07a; }
button, input { font-family: var(--sans); }
h1, h2, p { margin: 0; }

.page {
  min-height: 100vh; min-height: 100dvh;
  width: 100%; max-width: 480px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 28px) 20px calc(env(safe-area-inset-bottom, 0px) + 28px);
  display: flex; flex-direction: column; gap: 16px;
}
.grow { flex-grow: 1; }

/* ---------- botoes e campos ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 50px; border-radius: 12px; font-size: 16px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line-input); background: transparent; color: var(--text); text-decoration: none;
}
.btn-primary { min-height: 56px; border-radius: 14px; border: 0; background: var(--accent); color: var(--on-accent); font-size: 17px; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-danger { min-height: 52px; border-radius: 14px; border-color: var(--off); color: var(--off); }
.btn-small { min-height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14px; font-weight: 500; }
.link-btn { min-height: 44px; display: flex; align-items: center; justify-content: center; background: none; border: 0; font-size: 16px; color: var(--muted); text-decoration: none; cursor: pointer; }
.field { display: flex; flex-direction: column; gap: 10px; }
.field label { font-size: 14px; color: var(--muted); }
.field input {
  height: 50px; border-radius: 12px; border: 1px solid var(--line-input); background: var(--surface);
  color: var(--text); padding: 0 14px; font-size: 16px; width: 100%;
}
.field input:focus-visible, .btn:focus-visible, .link-btn:focus-visible, .icon-btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.hint { font-size: 13px; color: var(--muted); text-align: center; }
.error { font-size: 14px; color: var(--off); text-align: center; min-height: 0; }
.error:empty { display: none; }
.sep { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.sep::before, .sep::after { content: ""; flex-grow: 1; height: 1px; background: var(--line); }
svg { flex: none; }

/* ---------- login ---------- */
.page-login { padding-top: calc(env(safe-area-inset-top, 0px) + 72px); gap: 28px; }
.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.logo {
  width: 72px; height: 72px; border-radius: 18px; border: 2px solid var(--accent); background: var(--surface);
  display: flex; flex-direction: column; justify-content: center; gap: 7px; padding: 0 14px;
}
.logo i { display: block; height: 8px; border-radius: 4px; background: var(--line); }
.logo b { display: block; height: 8px; border-radius: 4px; background: var(--accent); }
.logo i:first-child b { width: 80%; }
.logo i:last-child b { width: 35%; }
.brand h1 { font-family: var(--mono); font-size: 22px; letter-spacing: .08em; color: var(--accent); }
.brand p { font-size: 15px; color: var(--muted); }
.form { display: flex; flex-direction: column; gap: 10px; }

/* ---------- cabecalho das telas ---------- */
.top { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 12px; }
.top-title { font-family: var(--mono); font-size: 13px; letter-spacing: .08em; color: var(--muted); }
.top-title b { color: var(--accent); font-weight: 700; }
.top-right { display: flex; align-items: center; gap: 16px; }
.top-link { min-height: 44px; display: none; align-items: center; font-size: 15px; text-decoration: none; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.badge {
  font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: .06em;
  padding: 4px 9px; border-radius: 6px; background: var(--accent); color: var(--on-accent); white-space: nowrap;
}
.badge-off { padding: 5px 10px; background: var(--off-bg); color: var(--off); border: 1px solid var(--off); }

/* ---------- cartoes ---------- */
.cards { display: flex; flex-direction: column; gap: 16px; }
.card {
  border: 2px solid var(--accent); border-radius: 18px; background: var(--surface);
  padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 10px;
}
.card.double { gap: 14px; }
.sp { flex: 1 1 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.card-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.plan { font-size: 24px; font-weight: 700; overflow-wrap: anywhere; }
.acct { font-size: 14px; color: var(--muted); }
.win-label { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.big { font-family: var(--mono); display: flex; align-items: baseline; gap: 2px; margin-top: -6px; }
.big .num { font-size: 72px; font-weight: 700; line-height: 1; }
.big .pct { font-size: 30px; font-weight: 700; color: var(--muted); }
.bar { position: relative; height: 18px; border-radius: 9px; background: var(--line); margin-top: 4px; }
.bar .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: inherit; background: var(--accent); }
.bar .tick { position: absolute; top: -4px; bottom: -4px; width: 2px; background: #fff; margin-left: -1px; }
.renew { font-family: var(--mono); font-size: 14px; color: var(--muted); }
.win { display: flex; flex-direction: column; gap: 8px; }
.win-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--mono); }
.win-head .win-label { font-size: 14px; }
.win-num { font-size: 30px; font-weight: 700; }
.win-num .pct { font-size: 18px; color: var(--muted); font-weight: 400; }
.win .bar { height: 12px; border-radius: 6px; margin-top: 0; }
.win .renew { font-size: 13px; }
.rule { height: 1px; background: var(--line); }

/* dado antigo (sem rede): tudo cinza, sem selo nem marca de ritmo */
.card.off { border-color: #3a4048; background: #131619; }
.off .plan { color: #c3cad2; }
.off .big, .off .win-head { color: var(--muted); }
.off .bar { background: #23272c; }
.off .fill { background: #59626d; }
.off .tick { display: none; }

.note { padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; color: #c3cad2; }
.note b { color: var(--text); }
.empty { padding: 28px 14px; text-align: center; color: var(--muted); font-size: 15px; }

.foot { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--muted); }
.foot-l { display: flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.dot.stale { background: var(--warn); }
.dot.off { background: var(--off); }
.foot a { min-height: 44px; display: flex; align-items: center; text-decoration: none; font-size: 13px; }

/* ---------- bloqueado ---------- */
.skel { border: 2px solid var(--line); border-radius: 18px; background: var(--surface); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.skel div { background: var(--line); }
.skel .s1 { width: 90px; height: 20px; border-radius: 6px; }
.skel .s2 { width: 140px; height: 56px; border-radius: 10px; }
.skel .s3 { height: 18px; border-radius: 9px; }
.skel .s4 { width: 70px; height: 20px; border-radius: 6px; }
.skel .s5 { height: 12px; border-radius: 6px; }
.lock-msg { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: 15px; text-align: center; }

/* ---------- aparelhos ---------- */
.page-sub { gap: 18px; }
.sub-head { display: flex; align-items: center; gap: 6px; min-height: 44px; }
.sub-head h1 { font-size: 20px; font-weight: 700; }
.back { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.sect { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.list { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.item-main { flex-grow: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.item-name { font-size: 16px; font-weight: 600; }
.item-name small { font-size: 12px; font-weight: 600; color: var(--accent); margin-left: 4px; }
.item-sub { font-size: 13px; color: var(--muted); }
.list-empty { padding: 14px 16px; font-size: 14px; color: var(--muted); }
.add-key { min-height: 44px; display: flex; align-items: center; font-size: 15px; text-decoration: none; }

/* ---------- ativar digital ---------- */
.page-act { padding-top: calc(env(safe-area-inset-top, 0px) + 72px); gap: 22px; }
.act-icon { width: 96px; height: 96px; border-radius: 24px; background: var(--surface); border: 2px solid var(--accent); display: flex; align-items: center; justify-content: center; color: var(--accent); align-self: center; }
.act-h { font-size: 26px; font-weight: 700; text-align: center; }
.act-p { font-size: 16px; line-height: 1.5; color: var(--muted); text-align: center; }
.panel { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.panel .field input { background: var(--bg); }

/* ---------- iPad / desktop: cartoes lado a lado ---------- */
@media (min-width: 760px) {
  .page { max-width: 1180px; padding: calc(env(safe-area-inset-top, 0px) + 40px) 48px 32px; gap: 24px; }
  .page-login, .page-act, .page-sub, .page-lock { max-width: 480px; }
  .page-lock { max-width: 720px; }
  .page-login { padding-top: 96px; }
  .page-act { padding-top: 96px; }
  .top-title { font-size: 15px; }
  .top-link { display: flex; }
  .foot a { display: none; }
  .cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; flex-grow: 1; }
  .card { border-radius: 24px; padding: 28px 30px; gap: 14px; }
  .card.double { gap: 22px; }
  .plan { font-size: 32px; }
  .acct { font-size: 17px; }
  .card-title { gap: 12px; }
  .badge { font-size: 14px; padding: 5px 11px; border-radius: 7px; }
  .win-label { font-size: 18px; }
  .big { gap: 4px; margin-top: -8px; }
  .big .num { font-size: 132px; }
  .big .pct { font-size: 48px; }
  .bar { height: 26px; border-radius: 13px; margin-top: 8px; }
  .bar .tick { width: 3px; top: -5px; bottom: -5px; margin-left: -1.5px; }
  .renew { font-size: 18px; }
  .win { gap: 10px; }
  .win-head .win-label { font-size: 18px; }
  .win-num { font-size: 56px; line-height: 1; }
  .win-num .pct { font-size: 28px; }
  .win .bar { height: 18px; border-radius: 9px; }
  .win .renew { font-size: 16px; }
}
@media (min-width: 760px) { #v-main > .grow { display: none; } }
