:root {
  --brand: #0d9488;
  --brand-dark: #0f766e;
  --brand-soft: #ccfbf1;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px calc(14px + env(safe-area-inset-top));
  background: var(--brand); color: #fff;
  box-shadow: 0 2px 12px rgba(13, 148, 136, .25);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #fff; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.18); font-weight: 800; letter-spacing: .5px; font-size: 14px;
}
.brand-name { font-weight: 700; font-size: 18px; }
.auth-slot {
  margin-left: auto; color: #fff; text-decoration: none;
  font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,.18); padding: 7px 12px; border-radius: 999px;
  white-space: nowrap;
}
.auth-slot:hover { background: rgba(255,255,255,.28); }

/* ---------- Conta / carteira ---------- */
.balance-box { text-align: center; padding: 8px 0 4px; }
.balance-box .label { color: var(--muted); font-size: 13px; }
.balance-box .value { font-size: 34px; font-weight: 800; color: var(--brand-dark); margin-top: 2px; }

.amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.amounts button {
  padding: 12px 6px; border-radius: 10px; border: 1px solid var(--line);
  background: #fff; font: inherit; font-weight: 700; cursor: pointer; color: var(--ink);
}
.amounts button:hover { border-color: var(--brand); color: var(--brand-dark); }
.amounts button[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

.txn { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0;
       border-bottom: 1px solid var(--line); font-size: 14px; }
.txn:last-child { border-bottom: 0; }
.txn .desc { color: var(--ink); }
.txn .when { color: var(--muted); font-size: 12px; }
.txn .amt { font-weight: 700; white-space: nowrap; }
.txn .amt.credit { color: var(--ok); }
.txn .amt.debit { color: var(--danger); }

.code-input input { text-align: center; font-size: 24px; letter-spacing: 8px; font-weight: 700; }

/* ---------- Layout ---------- */
.app { max-width: 720px; margin: 0 auto; padding: 18px 16px 40px; }
.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 0 16px 28px; }
.loading { text-align: center; color: var(--muted); padding: 40px 0; }

h1 { font-size: 22px; margin: 4px 0 2px; }
h2 { font-size: 16px; margin: 26px 0 10px; color: var(--muted); font-weight: 600;
     text-transform: uppercase; letter-spacing: .6px; }
.sub { color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}

/* ---------- Combo ---------- */
.combo {
  position: relative; border: 2px solid var(--brand); background: var(--brand-soft);
  border-radius: 12px; padding: 14px; margin: 14px 0 4px;
}
.combo strong { color: var(--brand-dark); font-size: 15px; }
.combo .hint { color: #115e59; }
.combo s { color: var(--muted); }
.combo .btn { margin-top: 12px; }
.combo-tag {
  position: absolute; top: -10px; right: 12px;
  background: var(--warn); color: #fff; font-size: 11px; font-weight: 800;
  padding: 3px 10px; border-radius: 999px; letter-spacing: .3px;
}

.retomar {
  display: flex; align-items: center; gap: 14px; width: 100%;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--brand); background: var(--brand-soft);
}
.retomar:hover { background: #b8f5ea; }
.retomar-icone { font-size: 28px; line-height: 1; }
.retomar strong { color: var(--brand-dark); }

.machines { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }

.machine {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; text-align: left; cursor: pointer; font: inherit; color: inherit;
  box-shadow: var(--shadow); transition: transform .12s ease, border-color .12s ease;
  display: flex; flex-direction: column; gap: 6px;
}
.machine:hover:not(:disabled) { transform: translateY(-2px); border-color: var(--brand); }
.machine:disabled { opacity: .55; cursor: not-allowed; }
.machine .code { font-weight: 700; font-size: 17px; }
.machine .type { color: var(--muted); font-size: 13px; }
.machine .price { font-weight: 700; color: var(--brand-dark); font-size: 16px; margin-top: 2px; }
.machine .tariff { font-size: 11px; color: var(--warn); }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: .3px;
}
.badge.idle { background: var(--brand-soft); color: var(--brand-dark); }
.badge.running { background: #fef3c7; color: #92400e; }
.badge.busy { background: #e2e8f0; color: #475569; }
.badge.done { background: #dcfce7; color: #166534; }

/* ---------- Rows ---------- */
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px;
       padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .label { color: var(--muted); font-size: 14px; }
.row .value { font-weight: 600; text-align: right; }
.total { font-size: 20px; color: var(--brand-dark); }

/* ---------- Buttons ---------- */
.btn {
  display: block; width: 100%; padding: 14px 16px; border-radius: 12px;
  border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer;
  background: var(--brand); color: #fff; margin-top: 10px;
}
.btn:hover:not(:disabled) { background: var(--brand-dark); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.ghost { background: transparent; color: var(--muted); border-color: var(--line); font-weight: 600; }
.btn.dev { background: #fff; color: var(--muted); border: 1px dashed #cbd5e1; font-size: 13px; font-weight: 600; }

.field { margin-top: 12px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); font: inherit; background: #fff;
}
.field input:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------- Pix ---------- */
.pix-box { text-align: center; padding: 18px; background: #f1f5f9;
           border-radius: 12px; border: 1px dashed #cbd5e1; }
.pix-code { font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
            font-size: 13px; word-break: break-all; color: var(--ink); margin-top: 8px; }

/* ---------- Progress / status ---------- */
.status-hero { text-align: center; padding: 22px 12px; }
.status-hero .icon { font-size: 44px; line-height: 1; }
.status-hero .title { font-size: 20px; font-weight: 700; margin-top: 10px; }
.status-hero .desc { color: var(--muted); font-size: 14px; margin-top: 6px; }

.progress { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 18px 0 6px; }
.progress > i { display: block; height: 100%; background: var(--brand); transition: width .6s ease; }

.alert { border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.alert.warn { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert.ok { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert.error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

.devbar { margin-top: 22px; padding-top: 14px; border-top: 1px dashed var(--line); }
.devbar p { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 0 0 8px; }

.back { display: inline-block; margin-bottom: 12px; color: var(--muted);
        text-decoration: none; font-size: 14px; }
.back:hover { color: var(--brand-dark); }
