:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #162033;
  --muted: #667085;
  --primary: #4b2bbf;
  --primary-dark: #37208d;
  --success: #10b981;
  --danger: #dc2626;
  --border: #d9e0ec;
  --soft: #f1f5ff;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.10);
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(75, 43, 191, 0.18) 0, transparent 34%),
    radial-gradient(circle at top right, rgba(16, 185, 129, 0.13) 0, transparent 30%),
    var(--bg);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 26px 0 42px;
}

.site-header { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin-bottom: 26px; }
.brand { display: inline-flex; align-items: center; gap: 28px; color: inherit; text-decoration: none; }
.brand img { width: 58px; height: 58px; object-fit: contain; border-radius: 16px; background: #fff; box-shadow: 0 12px 26px rgba(15, 23, 42, 0.12); }
.brand strong { display: block; font-size: 1.22rem; letter-spacing: -0.03em; }
.brand small { display: block; color: var(--muted); font-weight: 600; margin-top: 2px; }
.app-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 8px 12px; background: rgba(75, 43, 191, 0.08); border: 1px solid rgba(75, 43, 191, 0.18); color: var(--primary-dark); font-size: 0.84rem; font-weight: 850; }

.layout { display: grid; grid-template-columns: minmax(0, 1.04fr) minmax(360px, 0.96fr); gap: 26px; align-items: start; }
.card { background: rgba(255, 255, 255, 0.94); border: 1px solid rgba(217, 224, 236, 0.86); border-radius: var(--radius); box-shadow: var(--shadow); }

.hero-card { padding: 32px; margin-bottom: 22px; background: linear-gradient(135deg, #ffffff, #f1f5ff); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 190px; height: 190px; right: -72px; top: -72px; border-radius: 999px; background: rgba(75, 43, 191, 0.10); }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; border: 1px solid rgba(75, 43, 191, 0.22); background: rgba(75, 43, 191, 0.08); color: var(--primary-dark); border-radius: 999px; padding: 7px 12px; font-size: 0.82rem; font-weight: 850; margin-bottom: 18px; }
.eyebrow.compact { margin-bottom: 10px; }
h1 { margin: 0 0 14px; font-size: clamp(2rem, 4vw, 3.35rem); line-height: 1.02; letter-spacing: -0.058em; }
h2 { margin: 0 0 8px; font-size: clamp(1.4rem, 2vw, 1.85rem); letter-spacing: -0.04em; }
.hero-card p, .quick-header p { margin: 0; color: var(--muted); font-size: 1.05rem; line-height: 1.56; max-width: 720px; }
.quick-header p { font-size: 0.95rem; }
.security-note { margin-top: 18px; padding: 14px 16px; border: 1px solid #ddd6fe; border-radius: 16px; background: #f5f3ff; color: #3b247d; font-size: 0.94rem; line-height: 1.45; }

.form-card { padding: 24px; display: grid; gap: 17px; }
.quick-card { margin-bottom: 22px; }
.quick-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.profile-indicator { white-space: nowrap; border-radius: 999px; padding: 8px 12px; font-weight: 850; font-size: 0.82rem; border: 1px solid #fed7aa; color: #9a3412; background: #fff7ed; }
.profile-indicator.on { border-color: #bbf7d0; color: #047857; background: #ecfdf5; }

.settings-card { padding: 0; overflow: hidden; }
.settings-card summary { cursor: pointer; list-style: none; padding: 22px 24px; display: flex; align-items: center; justify-content: space-between; gap: 14px; font-weight: 900; }
.settings-card summary::-webkit-details-marker { display: none; }
.settings-card summary small { color: var(--muted); font-weight: 700; }
.profile-form { padding: 0 24px 24px; display: grid; gap: 17px; }

.grid.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field label, .copy-area label { display: block; font-size: 0.88rem; font-weight: 850; margin-bottom: 8px; color: #344054; }
input, textarea { width: 100%; border: 1px solid var(--border); border-radius: 14px; padding: 12px 13px; font: inherit; color: var(--text); outline: none; background: #fff; transition: 0.2s border, 0.2s box-shadow; }
input[type="color"] { min-height: 47px; padding: 6px; }
textarea { resize: vertical; min-height: 118px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace; font-size: 0.82rem; background: #fbfdff; }
input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(75, 43, 191, 0.12); }
.field small, .preview-box small { display: block; margin-top: 6px; color: var(--muted); font-size: 0.78rem; line-height: 1.35; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
.actions.compact { margin-top: 12px; }
.btn { border: 0; border-radius: 14px; padding: 12px 16px; font: inherit; font-weight: 850; cursor: pointer; transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease; }
.btn:hover { transform: translateY(-1px); }
.btn.primary { background: var(--primary); color: white; box-shadow: 0 13px 22px rgba(75, 43, 191, 0.22); }
.btn.primary:hover { background: var(--primary-dark); }
.btn.ghost { background: #eef2f7; color: #243047; }
.btn.danger { background: #fee2e2; color: #991b1b; }
.status { color: var(--muted); font-size: 0.91rem; min-height: 23px; }
.status.ok { color: #047857; }
.status.err { color: var(--danger); }

.result-card { padding: 24px; }
.preview-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 20px; padding: 18px; text-align: center; }
#qrCanvas { width: min(100%, 320px); height: auto; background: white; border-radius: 18px; padding: 12px; display: block; margin: 0 auto 14px; border: 1px solid #e5e7eb; }
.pix-data-preview { margin-top: 14px; padding: 12px 13px; border: 1px solid var(--border); border-radius: 14px; background: #ffffff; text-align: left; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.pix-data-preview p { margin: 0; line-height: 1.42; }
.pix-data-preview p + p { margin-top: 5px; }
.pix-data-preview strong { color: #344054; }
.copy-area { margin-top: 18px; }
#plateCanvas { width: 100%; height: auto; background: white; border-radius: 18px; border: 1px solid #e5e7eb; margin-top: 18px; display: block; }
.safe-list { margin-top: 20px; display: grid; gap: 8px; color: var(--muted); font-size: 0.92rem; }
.safe-list p { margin: 0; }
.safe-list strong { color: #344054; }
.site-footer { margin-top: 28px; color: var(--muted); text-align: center; font-size: 0.9rem; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }

@media (max-width: 940px) { .layout { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .page-shell { width: min(100% - 20px, 1180px); padding-top: 18px; }
  .site-header { align-items: flex-start; flex-direction: column; }
  .grid.two { grid-template-columns: 1fr; }
  .hero-card, .form-card, .result-card { padding: 18px; }
  .profile-form { padding: 0 18px 18px; }
  .settings-card summary { padding: 18px; align-items: flex-start; flex-direction: column; }
  .quick-header { align-items: flex-start; flex-direction: column; }
  .actions .btn { width: 100%; }
  .brand img { width: 50px; height: 50px; }
}

body.modal-open { overflow: hidden; }
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(7px);
}
.modal-overlay.hidden { display: none !important; }
.modal-overlay.is-open { display: flex !important; opacity: 1; visibility: visible; pointer-events: auto; }
.modal-card {
  width: min(520px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  border-radius: 26px;
  background: #ffffff;
  border: 1px solid rgba(217, 224, 236, 0.95);
  box-shadow: 0 28px 90px rgba(15, 23, 42, 0.28);
  padding: 24px;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: #eef2f7;
  color: #243047;
  font-size: 1.7rem;
  line-height: 1;
  padding: 0;
}
.modal-card h2 { margin-top: 2px; }
.modal-subtitle {
  margin: 0 auto 16px;
  max-width: 420px;
  color: var(--muted);
  line-height: 1.45;
}
.modal-qr {
  width: min(300px, 86vw);
  height: auto;
  border-radius: 20px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 10px;
}
.modal-pix-data {
  margin: 16px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
  color: var(--muted);
  text-align: left;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}
.modal-pix-data p { margin: 0; line-height: 1.45; }
.modal-pix-data p + p { margin-top: 6px; }
.modal-pix-data strong { color: #344054; }
.modal-actions { justify-content: center; margin-top: 16px; }

@media (max-width: 640px) {
  .modal-card { padding: 18px; }
  .modal-actions .btn { width: 100%; }
}
