/* QR Mist — interface baseada no design system Mist (superfícies suaves + vidro) */
:root {
  --ground: #f0f0f0; --surface: #ffffff; --surface-soft: #f7f8fa; --surface-sunken: #e9ebee; --line: #dfe2e6;
  --ink: #0f1115; --ink-muted: #656b74; --ink-subtle: #9aa0a8;
  --accent: #2563eb; --accent-strong: #1d4fd1; --accent-text: #2563eb; --on-accent: #ffffff; --accent-glow: rgba(37, 99, 235, .38);
  --aqua-100: #e2f3f6; --aqua-200: #bfe6ee; --success: #16a34a; --danger: #d92d20; --danger-soft: #fdecea;
  --glass-fill: rgba(255, 255, 255, .55); --glass-fill-tint: rgba(214, 240, 245, .62); --glass-stroke: rgba(255, 255, 255, .92);
  --shadow-card: 0 40px 80px -30px rgba(16, 24, 40, .22), 0 2px 6px rgba(16, 24, 40, .04);
  --shadow-float: 0 12px 28px rgba(16, 24, 40, .10), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-glow: 0 14px 32px rgba(37, 99, 235, .42);
  --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 24px 48px -16px rgba(16, 24, 40, .16);
  --glass-blur: 24px;
  --radius-sm: 12px; --radius-md: 20px; --radius-lg: 28px; --radius-xl: 40px; --radius-full: 9999px;
  --font: "Figtree", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0d1013; --surface: #171b20; --surface-soft: #1d2228; --surface-sunken: #262c34; --line: #2e353e;
    --ink: #f3f5f7; --ink-muted: #9aa1ab; --ink-subtle: #6b737d;
    --accent: #2f66ea; --accent-strong: #2457d6; --accent-text: #8aaefa; --accent-glow: rgba(64, 120, 245, .45);
    --aqua-100: #14252a; --aqua-200: #1d3b42; --success: #3ccf72; --danger: #ff6b5f; --danger-soft: #3a1d1b;
    --glass-fill: rgba(30, 36, 44, .55); --glass-fill-tint: rgba(60, 120, 135, .28); --glass-stroke: rgba(255, 255, 255, .14);
    --shadow-card: 0 40px 80px -30px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
    --shadow-float: 0 12px 28px rgba(0, 0, 0, .5), 0 1px 3px rgba(0, 0, 0, .3);
    --glass-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 24px 48px -16px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font); background: var(--ground); color: var(--ink); -webkit-font-smoothing: antialiased; font-size: 16px; line-height: 24px; }
a { color: var(--accent-text); text-decoration: none; font-weight: 500; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.015em; font-weight: 600; }
h1 { font-size: 32px; line-height: 38px; }
h2 { font-size: 22px; line-height: 28px; }
h3 { font-size: 18px; line-height: 24px; font-weight: 500; }
p { margin: 0; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; line-height: 20px; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* fundo com manchas para o vidro */
.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blobs i { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .55; }
.blobs i:nth-child(1) { width: 420px; height: 420px; background: var(--aqua-200); left: -120px; top: -80px; }
.blobs i:nth-child(2) { width: 360px; height: 360px; background: var(--accent); right: -140px; top: 30%; opacity: .22; }
.blobs i:nth-child(3) { width: 380px; height: 380px; background: var(--aqua-200); left: 30%; bottom: -200px; }

/* ---------- superfícies ---------- */
.card { position: relative; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-card); padding: 32px; }
.card--aqua { background: linear-gradient(180deg, var(--surface-soft) 0%, var(--aqua-100) 58%, var(--aqua-200) 100%); border: 1.5px solid var(--glass-stroke); }
.card--soft { background: var(--surface-soft); box-shadow: none; border-radius: var(--radius-lg); padding: 20px 24px; }
.glass {
  background: var(--glass-fill); border: 1.5px solid var(--glass-stroke); box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(170%); backdrop-filter: blur(var(--glass-blur)) saturate(170%);
}
.card.glass { background: var(--glass-fill); }
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass { background: var(--surface-soft); } }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 48px; padding: 0 24px;
  font: inherit; font-size: 16px; font-weight: 600; border-radius: var(--radius-full); border: 1.5px solid transparent;
  cursor: pointer; color: var(--ink); background: transparent; white-space: nowrap; text-decoration: none !important;
  transition: transform .15s ease, background-color .2s ease, box-shadow .2s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow-glow); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--soft { background: var(--surface); box-shadow: var(--shadow-float); }
.btn--glass { background: var(--glass-fill-tint); border-color: var(--glass-stroke); box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px); }
.btn--ghost:hover { background: var(--surface-sunken); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--sm { height: 38px; padding: 0 16px; font-size: 14px; }
.btn--lg { height: 60px; padding: 0 32px; font-size: 17px; }
.btn--block { width: 100%; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); cursor: pointer; padding: 0; flex: none; }
.iconbtn:hover { background: var(--surface-sunken); }
.iconbtn--danger { color: var(--danger); }
.btn:focus-visible, .iconbtn:focus-visible, .tab:focus-visible, .seg button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .navlink:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
svg.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- formulários ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 500; color: var(--ink); }
label.field > span.hint { font-weight: 400; color: var(--ink-muted); font-size: 13px; }
input, select, textarea {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 16px; height: 50px; padding: 0 16px; width: 100%; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; min-height: 90px; padding: 12px 16px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
input[type="color"] { padding: 4px; width: 64px; cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 16px; padding: 12px 16px; font-size: 14px; font-weight: 500; }

/* segmented control (tipos) */
.seg { display: flex; flex-wrap: wrap; gap: 4px; padding: 6px; border-radius: 28px; background: var(--surface-sunken); }
.seg button { flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 44px; padding: 0 13px; border: 0; background: transparent; font: inherit; font-size: 15px; font-weight: 600; color: var(--ink-muted); border-radius: var(--radius-full); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }

/* ---------- layout do app ---------- */
.topbar {
  position: sticky; top: 16px; z-index: 20; margin: 16px auto 0; max-width: 1180px; width: calc(100% - 32px);
  display: flex; align-items: center; gap: 16px; padding: 10px 12px 10px 22px; border-radius: var(--radius-full);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 19px; color: var(--ink); text-decoration: none !important; letter-spacing: -0.02em; }
.brand-mark { width: 34px; height: 34px; border-radius: 11px; background: var(--accent); display: grid; place-items: center; color: #fff; box-shadow: var(--shadow-glow); }
.brand-mark svg { width: 20px; height: 20px; }
.nav { display: flex; gap: 4px; margin: 0 auto; }
.navlink { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: var(--radius-full); color: var(--ink-muted); font-weight: 600; font-size: 15px; text-decoration: none !important; }
.navlink:hover { background: var(--surface-sunken); color: var(--ink); }
.navlink.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
.user { display: flex; align-items: center; gap: 8px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--aqua-200); display: grid; place-items: center; font-weight: 600; font-size: 14px; flex: none; }

main.page { max-width: 1180px; margin: 0 auto; padding: 40px 16px 140px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin-top: 6px; color: var(--ink-muted); font-size: 17px; }

.grid-gen { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 28px; align-items: start; }
.sticky { position: sticky; top: 112px; }

/* tab bar mobile */
.tabbar { position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 30; display: none; align-items: center; justify-content: space-between; padding: 6px 10px; border-radius: var(--radius-full); min-height: 78px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--ink-muted); text-decoration: none !important; padding: 6px 0; border-radius: var(--radius-md); }
.tab svg.ic { width: 26px; height: 26px; }
.tab.on { color: var(--accent-text); }
.tab.on svg.ic { color: var(--accent); }
.tab-fab { flex: none; width: 66px; height: 66px; margin: -18px 4px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 3px solid var(--surface); box-shadow: var(--shadow-glow); }
.tab-fab svg.ic { width: 28px; height: 28px; }

/* ---------- QR preview ---------- */
.qr-preview { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.qr-box { width: 100%; max-width: 300px; aspect-ratio: 1; background: #fff; border-radius: 0; padding: 6px; box-shadow: var(--shadow-float); display: grid; place-items: center; }
.qr-box svg { width: 100%; height: 100%; display: block; }
.qr-empty { color: #9aa0a8; font-size: 14px; text-align: center; padding: 20px; }
.dl { display: flex; gap: 8px; width: 100%; }
.dl .btn { flex: 1; padding: 0 10px; }
.payload { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 18px; color: var(--ink-muted); background: var(--surface-soft); border-radius: 16px; padding: 10px 14px; word-break: break-all; max-height: 92px; overflow: auto; }

/* ---------- listas de QR ---------- */
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.qr-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; border-radius: var(--radius-lg); }
.qr-card .thumb { background: #fff; border-radius: 18px; padding: 4px; aspect-ratio: 1; width: 100%; box-shadow: var(--shadow-float); }
.qr-card .thumb svg { width: 100%; height: 100%; display: block; }
.qr-card .meta { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.qr-card .name { font-weight: 600; font-size: 17px; line-height: 22px; word-break: break-word; }
.qr-card .sub { color: var(--ink-muted); font-size: 13px; line-height: 18px; word-break: break-all; margin-top: 2px; }
.qr-card .actions { display: flex; gap: 2px; justify-content: flex-end; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--radius-full); background: var(--surface-sunken); color: var(--ink-muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.chip--accent { background: var(--aqua-100); color: var(--ink); }
.chip--dyn { background: var(--accent); color: #fff; }

.list { display: flex; flex-direction: column; gap: 12px; }
.list-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 18px; align-items: center; padding: 14px 18px 14px 14px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-float); }
.list-row .mini { width: 64px; height: 64px; background: #fff; border-radius: 14px; padding: 6px; border: 1px solid var(--line); }
.list-row .mini svg { width: 100%; height: 100%; display: block; }
.list-row .title { font-weight: 600; font-size: 16px; line-height: 22px; }
.list-row .desc { color: var(--ink-muted); font-size: 13px; line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar input[type="search"] { max-width: 320px; }
.toolbar .seg { flex: 0 1 auto; }

/* ---------- biblioteca ---------- */
.lib { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 28px; align-items: start; }
.groups { padding: 16px; border-radius: var(--radius-lg); display: flex; flex-direction: column; gap: 4px; }
.group-item { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 8px 0 16px; border-radius: var(--radius-full); cursor: pointer; font-weight: 500; color: var(--ink-muted); border: 0; background: none; font: inherit; width: 100%; text-align: left; }
.group-item:hover { background: var(--surface-sunken); color: var(--ink); }
.group-item.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-float); }
.group-item .count { margin-left: auto; font-size: 13px; color: var(--ink-muted); min-width: 22px; text-align: right; }
.group-item .g-actions { display: none; gap: 0; }
.group-item.on .g-actions { display: flex; }
.group-item .g-actions .iconbtn { width: 32px; height: 32px; }
.group-item .g-actions svg.ic { width: 16px; height: 16px; }

/* ---------- métricas ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 28px; }
.stat { padding: 22px 24px; border-radius: var(--radius-lg); }
.stat .v { font-size: 30px; line-height: 36px; font-weight: 600; letter-spacing: -0.02em; }
.stat .l { color: var(--ink-muted); font-size: 14px; }
.chart { width: 100%; height: 240px; display: block; }
.chart .bar { fill: var(--accent); }
.chart .bar-zero { fill: var(--line); }
.chart text { fill: var(--ink-muted); font-size: 11px; font-family: var(--font); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.bars-list { display: flex; flex-direction: column; gap: 10px; }
.bl-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 14px; }
.bl-row .track { grid-column: 1 / -1; height: 8px; border-radius: 99px; background: var(--surface-sunken); overflow: hidden; }
.bl-row .fill { height: 100%; background: var(--accent); border-radius: 99px; }
.metrics-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }

/* ---------- auth ---------- */
.pw { position: relative; }
.pw .iconbtn { position: absolute; right: 6px; top: 5px; }

/* ---------- modal e toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(15, 17, 21, .32); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fade .15s ease; }
.modal { width: 100%; max-width: 520px; max-height: calc(100vh - 32px); overflow: auto; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; flex-wrap: wrap; }
.toasts { position: fixed; z-index: 80; left: 50%; transform: translateX(-50%); top: 100px; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 14px 22px; border-radius: var(--radius-full); font-weight: 500; font-size: 15px; animation: drop .2s ease; display: flex; gap: 10px; align-items: center; }
.toast.ok svg { color: var(--success); }
.toast.bad svg { color: var(--danger); }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px); } }

.empty { text-align: center; padding: 48px 24px; color: var(--ink-muted); }
.empty h3 { color: var(--ink); margin-bottom: 6px; }
.empty .btn { margin-top: 18px; }
.note { display: flex; gap: 12px; align-items: flex-start; padding: 16px 20px; border-radius: var(--radius-lg); font-size: 14px; line-height: 20px; color: var(--ink-muted); }
.note svg.ic { color: var(--accent); margin-top: 1px; }
.share-page { min-height: 100vh; display: grid; place-items: center; padding: 32px 16px; }

/* ---------- responsivo ---------- */
@media (max-width: 960px) {
  .nav { display: none; }
  .topbar { justify-content: space-between; }
  .tabbar { display: flex; }
  .grid-gen, .metrics-grid, .lib { grid-template-columns: minmax(0, 1fr); }
  .sticky { position: static; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  main.page { padding-top: 28px; }
}
@media (max-width: 560px) {
  .card { padding: 24px; border-radius: 32px; }
  .row2 { grid-template-columns: 1fr; }
  .list-row { grid-template-columns: 56px minmax(0, 1fr) auto; }
  .list-row .mini { width: 56px; height: 56px; }
  .list-row .chip { display: none; }
  h1 { font-size: 27px; line-height: 32px; }
  .user .uname { display: none; }
  .seg button svg.ic { display: none; }
  .seg button { padding: 0 12px; }
}

/* ---------- login / cadastro ---------- */
.auth { min-height: 100vh; max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; display: flex; flex-direction: column; gap: 28px; }
.auth-top { padding: 4px 6px; }
.auth-grid { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 24px; align-items: stretch; }
.auth-hero { display: flex; flex-direction: column; justify-content: space-between; gap: 32px; padding: 40px; }
.auth-hero-title { font-size: 34px; line-height: 40px; letter-spacing: -0.025em; margin: 18px 0 28px; max-width: 520px; }
.auth-feats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.auth-feats li { display: flex; gap: 14px; align-items: flex-start; }
.auth-feats strong { font-weight: 600; display: block; }
.auth-feats p { color: var(--ink-muted); font-size: 14px; line-height: 20px; }
.auth-feat-ic { width: 40px; height: 40px; flex: none; border-radius: 14px; display: grid; place-items: center; background: var(--surface); color: var(--accent-text); box-shadow: var(--shadow-float); }
.auth-sample { display: flex; align-items: center; gap: 18px; }
.auth-sample .qr-box { width: 112px; max-width: none; padding: 6px; flex: none; }
.auth-sample p { max-width: 260px; }
.auth-card { display: flex; flex-direction: column; gap: 18px; padding: 32px; }
.auth-seg button { height: 42px; }
.auth-head h1 { font-size: 28px; line-height: 34px; margin-bottom: 4px; }
.auth-or { display: flex; align-items: center; gap: 12px; color: var(--ink-subtle); font-size: 13px; font-weight: 500; }
.auth-or::before, .auth-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-google { gap: 12px; border-color: var(--line); }
.auth-card .form .btn--primary { margin-top: 4px; }
.auth-legal { color: var(--ink-subtle); font-size: 13px; line-height: 18px; text-align: center; }
@media (max-width: 960px) {
  .auth-grid { grid-template-columns: 1fr; max-width: 520px; width: 100%; margin: 0 auto; }
  .auth-hero { order: 2; padding: 28px; }
  .auth-hero-title { font-size: 26px; line-height: 32px; }
}
@media (max-width: 560px) {
  .auth { padding-top: 16px; gap: 18px; }
  .auth-card { padding: 22px; }
  .auth-card .row2 { grid-template-columns: 1fr; }
  .auth-sample .qr-box { width: 88px; }
}
