:root {
  --bg: #000;
  --card: #161616;
  --card-border: #2a2a2a;
  --input: #070707;
  --input-border: #3a3a3a;
  --text: #f2f2f2;
  --muted: #a3a3a3;
  --label: #cfcfcf;
  --btn: #3a3a3a;
  --btn-border: #4a4a4a;
  --green: #22c55e;
  --line: linear-gradient(90deg, #22c55e 0 210px, #2563eb 46%, #7c3aed 100%);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
}

button, input, textarea { font: inherit; color: inherit; }

.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 16px;
}

.welcome {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f5f5f5;
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  padding: 0;
}

.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: #1a1a1a; }

.avatar {
  border: 1.5px solid #e8e8e8;
}

.status-pill {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
}

.status-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #6b7280;
  box-shadow: 0 0 0 3px rgba(107, 114, 128, 0.18);
}

.status-pill.online .status-dot {
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

.badge {
  position: absolute;
  top: 1px;
  right: 0;
  min-width: 15px;
  height: 15px;
  padding: 0 4px;
  border-radius: 99px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  line-height: 15px;
  font-weight: 700;
}

.accent {
  height: 3px;
  background: var(--line);
}

.page {
  padding: 22px 22px 48px;
}

h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

.subtitle {
  margin: 4px 0 18px;
  color: #d0d0d0;
  font-size: 13px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 16px 18px 18px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.4px solid #9a9a9a;
  background: transparent;
  color: #cfcfcf;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: 13px;
  color: var(--label);
}

.field input {
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--input-border);
  background: var(--input);
  padding: 0 16px;
  outline: none;
}

.field input::placeholder { color: #6f6f6f; }

.field input:focus {
  border-color: #5b6ea8;
}

.btn {
  margin-top: 16px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--btn-border);
  background: var(--btn);
  color: #e6e6e6;
  font-size: 13px;
  cursor: pointer;
}

.btn:hover { background: #474747; }
.btn:disabled { opacity: 0.65; cursor: progress; }

.btn-quiet {
  background: transparent;
}

.result { margin-top: 16px; }

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.result-head h2 { margin: 0; }

.ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
}

.result-body {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 22px;
  align-items: start;
}

.qr-box {
  background: #fff;
  border-radius: 12px;
  padding: 10px;
  width: 220px;
  height: 220px;
  display: grid;
  place-items: center;
}

.qr-box img {
  width: 200px;
  height: 200px;
  display: block;
}

.qr-box img[hidden] { display: none; }

.qr-vencido {
  margin: 0;
  padding: 0 12px;
  color: #b3261e;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  line-height: 1.4;
}

.valor-grande {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.desc-resultado {
  margin: 4px 0 10px;
  color: var(--muted);
  min-height: 1.2em;
}

.status-linha { margin: 0 0 4px; color: var(--label); font-size: 14px; }
.expira { margin: 0 0 12px; color: var(--muted); font-size: 13px; }

.tempo-restante { margin: 0 0 4px; color: var(--label); font-size: 14px; }
.tempo-restante strong {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--green);
}
.tempo-restante.pouco strong { color: #f5c451; }
.tempo-restante.acabou strong { color: #f07167; }

.status-linha strong { font-weight: 700; }
.status-linha.aguardando strong { color: #f5c451; }
.status-linha.pago strong { color: var(--green); }
.status-linha.expirado strong { color: #f07167; }

.copia {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--muted);
}

textarea {
  width: 100%;
  resize: none;
  border-radius: 10px;
  border: 1px solid var(--input-border);
  background: var(--input);
  padding: 10px 12px;
  outline: none;
}

.result-actions { display: flex; gap: 8px; }

.popover {
  position: fixed;
  z-index: 20;
  width: min(340px, calc(100vw - 24px));
  background: #1b1b1b;
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  font-size: 13px;
  color: #ddd;
}

.popover p { margin: 0 0 8px; }
.popover p:last-child { margin-bottom: 0; }
.mono { font-family: Consolas, monospace; font-size: 12px; color: #b7c3ff; word-break: break-all; }

.popover-list { width: min(360px, calc(100vw - 24px)); }
.popover-list ul { list-style: none; margin: 0; padding: 0; }
.popover-list li {
  padding: 8px 0;
  border-top: 1px solid #2c2c2c;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.pagos { margin-top: 16px; }
.pagos-acoes { display: flex; align-items: center; gap: 10px; }
.filtro-pagos {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  background: var(--input);
}
.filtro-pagos button {
  height: 26px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
}
.filtro-pagos button:hover { color: var(--text); }
.filtro-pagos button[aria-pressed="true"] { background: var(--btn); color: #e6e6e6; }
.pagos-resumo { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.tabela-wrap { margin-top: 14px; overflow-x: auto; }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding: 0 12px 8px 0;
}
.tabela td {
  padding: 10px 12px 10px 0;
  border-top: 1px solid #2a2a2a;
  vertical-align: middle;
}
.tabela .valor { font-weight: 700; white-space: nowrap; }
.selo {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.15);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}
.pagos .empty { margin: 12px 0 0; }

.empty { color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.62);
  display: grid;
  place-items: center;
  padding: 18px;
}

.modal[hidden] { display: none; }

.modal-card {
  width: min(480px, 100%);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 16px 18px 18px;
}

.chave-atual {
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.chave-atual strong {
  color: var(--text);
  font-family: Consolas, monospace;
  font-weight: 600;
}

.modal .field + .field { margin-top: 14px; }

.chave-linha {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chave-linha input { flex: 1; min-width: 0; }

.btn-mostrar {
  margin-top: 0;
  height: 36px;
  flex: 0 0 auto;
}

.dica {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  background: #1a1a1a;
  border: 1px solid #3a3a3a;
  border-left: 3px solid #f5c451;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

@media (max-width: 800px) {
  .fields, .result-body { grid-template-columns: 1fr; }
  .qr-box { margin: 0 auto; }
}
