:root {
  --navy: #0B1B32;
  --navy-2: #1B3A63;
  --accent: #F2A93B;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --error: #dc2626;
  --error-bg: #fef2f2;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --radius: 16px;
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; background: #f4f6fa; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 16px 48px;
}

.loading { flex: 1; display: grid; place-items: center; min-height: 60vh; }

.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--navy);
  animation: spin .8s linear infinite; display: inline-block;
}
.btn .spinner { width: 18px; height: 18px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: #fff; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- marca ---------- */
.brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 8px 0 24px; }
.brand-mark {
  width: 64px; height: 64px; border-radius: 18px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  white-space: nowrap; font-weight: 700; font-size: 20px; letter-spacing: -.5px;
  box-shadow: 0 8px 24px rgba(11, 27, 50, .18);
}
.brand-mark span { color: var(--accent); }
.brand-name { font-weight: 700; font-size: 20px; color: var(--navy); }

/* ---------- cartão ---------- */
.card {
  width: 100%; max-width: 420px;
  background: var(--card); border-radius: var(--radius);
  padding: 28px 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06);
}

.card h1 { margin: 0 0 6px; font-size: 22px; color: var(--navy); }
.card .subtitle { margin: 0 0 22px; color: var(--muted); line-height: 21px; }

.back {
  background: none; border: 0; padding: 0; margin: 0 0 16px;
  color: var(--navy-2); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- formulário ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 6px; }

.input-wrap { position: relative; }
.field input {
  width: 100%; height: 48px; padding: 0 14px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font: inherit; color: var(--text); background: #fff; outline: none;
  transition: border-color .15s;
}
.field input:focus { border-color: var(--navy-2); }
.field.has-error input { border-color: var(--error); }
.field .error { color: var(--error); font-size: 13px; margin-top: 6px; }
.field .hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

.toggle-pass {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: 0; padding: 8px; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 13px; font-weight: 600;
}
.input-wrap input[type="password"], .input-wrap input.pass { padding-right: 70px; }

.code-input {
  text-align: center; font-size: 26px !important; font-weight: 700;
  letter-spacing: 10px; font-family: "Courier New", monospace;
}

.link-row { display: flex; justify-content: flex-end; margin: -6px 0 18px; }
.link {
  background: none; border: 0; padding: 0; cursor: pointer;
  color: var(--navy-2); font: inherit; font-weight: 600; text-decoration: none;
}
.link:hover { text-decoration: underline; }

/* ---------- botões ---------- */
.btn {
  width: 100%; height: 50px; border-radius: 12px; border: 0;
  font: inherit; font-weight: 700; font-size: 15px; letter-spacing: .3px;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-outline { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.btn-ghost { background: var(--bg); color: var(--text); }
.btn-danger { background: #fff; color: var(--error); border: 1.5px solid #fecaca; }
.btn + .btn { margin-top: 12px; }

.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- avisos ---------- */
.alert { border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; line-height: 20px; }
.alert-error { background: var(--error-bg); color: var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); }

.dev-banner {
  position: sticky; top: 0; z-index: 10;
  background: #fff7e6; color: #92400e; border-bottom: 1px solid #fde3b0;
  text-align: center; padding: 8px 12px; font-size: 13px;
}
.dev-banner b { font-family: "Courier New", monospace; font-size: 15px; letter-spacing: 2px; }

.center { text-align: center; }
.muted { color: var(--muted); }
.footer-note { margin-top: 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- home ---------- */
.topbar {
  width: 100%; max-width: 720px;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: #fff; border-radius: var(--radius); padding: 22px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px;
}
.topbar .hello { font-size: 20px; font-weight: 700; }
.topbar .sub { opacity: .8; font-size: 14px; margin-top: 2px; }
.badge {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  background: rgba(242, 169, 59, .18); color: var(--accent); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px;
}

.home-grid { width: 100%; max-width: 720px; display: grid; gap: 16px; }
.home-grid .card { max-width: none; }
.card h2 { margin: 0 0 14px; font-size: 16px; color: var(--navy); }

.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f2f4; }
.info-row:last-child { border-bottom: 0; }
.info-row span:first-child { color: var(--muted); }
.info-row span:last-child { font-weight: 600; text-align: right; word-break: break-word; }
.ok { color: var(--success); }
.pending { color: #b45309; }

.placeholder {
  border: 2px dashed var(--border); border-radius: 12px; padding: 22px;
  text-align: center; color: var(--muted); line-height: 21px;
}

/* ---------- diálogo ---------- */
.dialog {
  position: fixed; inset: 0; z-index: 20; background: rgba(11, 27, 50, .45);
  display: grid; place-items: center; padding: 16px;
}
.dialog[hidden] { display: none; }
.dialog-card { background: #fff; border-radius: var(--radius); padding: 24px; width: 100%; max-width: 360px; }
.dialog-card h2 { margin: 0 0 8px; font-size: 18px; color: var(--navy); }
.dialog-card p { margin: 0 0 20px; color: var(--muted); line-height: 21px; }
.dialog-actions { display: flex; gap: 10px; }
.dialog-actions .btn { margin: 0; height: 44px; }

@media (max-width: 480px) {
  .app { padding-top: 20px; }
  .card { padding: 24px 18px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

/* ---------- versão PHP ---------- */
.field select {
  width: 100%; height: 48px; padding: 0 12px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font: inherit; color: var(--text); background: #fff; outline: none;
}
.field select:focus { border-color: var(--navy-2); }
.field.has-error select { border-color: var(--error); }
a.btn { text-decoration: none; }
a.back { display: inline-block; text-decoration: none; }
form > .btn + .btn, .card > .btn + .btn { margin-top: 12px; }
.home-grid > form { margin: 0; }
