/* =====================================================================
   3Design · Biblioteca STL
   ===================================================================== */
:root {
  --bg: #F3F5F8;
  --surface: #FFFFFF;
  --surface-2: #EEF1F5;
  --ink: #0F1728;
  --ink-2: #344054;
  --muted: #667085;
  --line: #E3E7ED;
  --line-2: #CFD5DE;
  --accent: #1B5FE3;
  --accent-hover: #164FC0;
  --accent-ink: #FFFFFF;
  --accent-soft: #E7EFFE;
  --accent-text: #1849B8;
  --ok: #0F7A55;
  --ok-soft: #E1F4EA;
  --danger: #C1352B;
  --danger-soft: #FCEBE9;
  --premium: #8A5800;
  --premium-soft: #FFF3D6;
  --premium-line: #F2D48A;
  --backdrop: rgba(15, 23, 40, .42);
  --shadow: 0 1px 2px rgba(15, 23, 40, .05), 0 10px 28px -14px rgba(15, 23, 40, .18);
  --shadow-lg: 0 24px 60px -20px rgba(15, 23, 40, .35);
  --filament: linear-gradient(90deg, #1B5FE3 0%, #6D3FE0 28%, #E0357A 52%, #F59E0B 76%, #2BAA5B 100%);

  --font-display: 'Sora', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-body: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --r: 14px;
  --r-sm: 10px;
  --side-w: 272px;
  --gutter: 40px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A0D13; --surface: #11151D; --surface-2: #181D27; --ink: #EEF1F6; --ink-2: #C5CBD6; --muted: #8B94A5;
    --line: #1F2531; --line-2: #2C3442; --accent: #4B8BFF; --accent-hover: #6A9FFF; --accent-ink: #061024;
    --accent-soft: rgba(75, 139, 255, .13); --accent-text: #8DB5FF; --ok: #3FCB8C; --ok-soft: rgba(63, 203, 140, .13);
    --danger: #FF6F63; --danger-soft: rgba(255, 111, 99, .13); --premium: #F4C35A; --premium-soft: rgba(244, 195, 90, .12);
    --premium-line: rgba(244, 195, 90, .35); --backdrop: rgba(0, 0, 0, .6);
    --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 14px 34px -18px rgba(0, 0, 0, .7);
    --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A0D13; --surface: #11151D; --surface-2: #181D27; --ink: #EEF1F6; --ink-2: #C5CBD6; --muted: #8B94A5;
  --line: #1F2531; --line-2: #2C3442; --accent: #4B8BFF; --accent-hover: #6A9FFF; --accent-ink: #061024;
  --accent-soft: rgba(75, 139, 255, .13); --accent-text: #8DB5FF; --ok: #3FCB8C; --ok-soft: rgba(63, 203, 140, .13);
  --danger: #FF6F63; --danger-soft: rgba(255, 111, 99, .13); --premium: #F4C35A; --premium-soft: rgba(244, 195, 90, .12);
  --premium-line: rgba(244, 195, 90, .35); --backdrop: rgba(0, 0, 0, .6);
  --shadow: 0 1px 0 rgba(255, 255, 255, .02) inset, 0 14px 34px -18px rgba(0, 0, 0, .7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, .8);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
body.no-scroll { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: var(--accent-text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
code, .mono { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }
[hidden] { display: none !important; }

.i { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }

/* ---------------------------------------------------------------- marca */
.brand-mark { width: 38px; height: 38px; border-radius: 11px; background: #fff; display: grid; place-items: center; overflow: hidden; box-shadow: 0 0 0 1px var(--line); flex: none; }
.brand-mark img { width: 34px; height: 34px; }
.side-brand, .auth-brand { display: flex; align-items: center; gap: 12px; }
.side-brand strong, .auth-brand strong { display: block; font: 700 17px/1.1 var(--font-display); letter-spacing: -.02em; }
.side-brand span, .auth-brand span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; letter-spacing: .02em; }
.filament { height: 3px; width: 44px; border-radius: 3px; background: var(--filament); }

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .1s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .7; cursor: default; }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink); }
.btn.ghost:hover { border-color: var(--ink-2); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 50px; font-size: 15px; }
.btn.block { width: 100%; }

.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: .3; pointer-events: none; }
.icon-btn.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn.sm .i { width: 16px; height: 16px; }
.icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.pill {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2); font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pill .i { width: 14px; height: 14px; }
.pill.premium { background: var(--premium-soft); color: var(--premium); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.danger { background: var(--danger-soft); color: var(--danger); }
.pill.sm { height: 20px; padding: 0 8px; font-size: 11px; vertical-align: 2px; }

/* ---------------------------------------------------------------- formulários */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 4px; }
.field input, .field textarea, .redeem input, .search input {
  width: 100%; min-width: 0; height: 44px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field input:focus, .field textarea:focus, .redeem input:focus, .search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { margin: -6px 0 0; font-size: 12.5px; color: var(--muted); }
.form-error { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 13.5px; font-weight: 600; }
.muted { color: var(--muted); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; font-size: 14px; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track { width: 38px; height: 22px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- login */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.auth-card .filament { margin: 2px 0 14px; }
.auth-card h1 { margin: 0; font: 700 28px/1.15 var(--font-display); letter-spacing: -.03em; text-wrap: balance; }
.auth-card > .muted { margin: -6px 0 10px; }
.auth-card > .eyebrow { margin: 0 0 -8px; }
.auth-help { margin: 8px 0 0; font-size: 13.5px; color: var(--muted); text-align: center; }

/* ---------------------------------------------------------------- shell */
.shell { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; gap: 18px;
  padding: 26px 16px 18px; border-right: 1px solid var(--line); background: var(--surface);
}
.side .side-brand { padding: 0 6px; }
.side .filament { margin: -4px 0 6px 56px; }
.side-nav { display: grid; gap: 2px; }
.nav-item {
  white-space: nowrap;
  display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14.5px; text-align: left; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-text); }
.nav-count { margin-left: auto; font: 600 12px var(--font-mono); color: var(--muted); }
.nav-item.active .nav-count { color: var(--accent-text); }
.side-foot { margin-top: auto; padding: 14px; border: 1px solid var(--line); border-radius: var(--r); display: grid; gap: 12px; background: var(--bg); }
.account { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); color: var(--muted); display: grid; place-items: center; flex: none; }
.avatar .i { width: 18px; height: 18px; }
.account-text { min-width: 0; }
.account-text strong { display: block; font-size: 14px; }
.account-text span { display: block; font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.row-actions { display: flex; align-items: center; gap: 4px; }

.topbar, .tabbar { display: none; }

.main { min-width: 0; }
.page { max-width: 1180px; margin: 0 auto; padding: 44px var(--gutter) 64px; }

.page-head { margin-bottom: 26px; }
.page-head.row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.eyebrow { margin: 0 0 8px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.eyebrow .i { width: 15px; height: 15px; }
.eyebrow.gold { color: var(--premium); }
.page-head h1 { margin: 0; font: 700 clamp(28px, 3.4vw, 38px)/1.1 var(--font-display); letter-spacing: -.035em; }
.lede { margin: 10px 0 0; color: var(--muted); max-width: 62ch; }

/* ---------------------------------------------------------------- upsell */
.upsell {
  position: relative; display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
  padding: 20px 22px; margin-bottom: 26px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--premium-line); overflow: hidden;
}
.upsell::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--filament); }
.upsell-text { min-width: 0; flex: 1 1 320px; }
.upsell-text .eyebrow { margin-bottom: 4px; }
.upsell h2 { margin: 0; font: 700 19px/1.25 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.upsell p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.upsell-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 280px; display: block; }
.search .i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; width: 18px; height: 18px; }
.search input { padding-left: 42px; height: 44px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }

.seg, .tier { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button, .tier button {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 0;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 13.5px; white-space: nowrap; transition: background .15s, color .15s;
}
.seg button .i, .tier button .i { width: 15px; height: 15px; }
.seg button:hover, .tier button:hover { color: var(--ink); }
.seg button[aria-selected="true"], .tier button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); }
.tier button { height: 30px; padding: 0 10px; font-size: 12.5px; }
.tier button[data-v="premium"][aria-pressed="true"] { background: var(--premium-soft); color: var(--premium); box-shadow: 0 0 0 1px var(--premium-line); }
.tier.big button { height: 38px; padding: 0 14px; font-size: 13.5px; flex: 1; justify-content: center; }
.tier.big { display: flex; }

.count { margin: 0 0 14px; font: 600 12.5px var(--font-mono); color: var(--muted); letter-spacing: .02em; }

/* ---------------------------------------------------------------- cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card {
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "icon chip" "body body" "foot foot";
  gap: 14px; align-content: start; padding: 18px; min-width: 0; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; text-align: left;
  transition: border-color .15s, box-shadow .2s, transform .2s;
}
.card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.card-icon { grid-area: icon; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.card-icon .i { width: 22px; height: 22px; stroke-width: 1.6; }
.card-chip { grid-area: chip; justify-self: end; align-self: start; }
.card-body { grid-area: body; display: grid; gap: 4px; min-width: 0; }
.card-title { font: 650 16px/1.3 var(--font-display); letter-spacing: -.015em; font-weight: 600; }
.card-desc { font-size: 13.5px; line-height: 1.45; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { grid-area: foot; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px dashed var(--line); }
.meta { font: 600 12px var(--font-mono); color: var(--muted); white-space: nowrap; }
.go { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--accent-text); }
.go .i { width: 15px; height: 15px; }
.card-arrow { display: none; }

.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; background: var(--premium-soft); color: var(--premium); }
.chip .i { width: 13px; height: 13px; stroke-width: 2; }

.card.locked { cursor: pointer; background: var(--surface); }
.card.locked .card-icon { background: var(--surface-2); color: var(--muted); }
.card.locked .card-title { color: var(--ink-2); }
.card.locked .go { color: var(--premium); }
.card.locked:hover { border-color: var(--premium-line); }

.empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; padding: 48px 16px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--muted); text-align: center; }
.empty .i { width: 28px; height: 28px; }
.empty p { margin: 0; }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; }

/* ---------------------------------------------------------------- modal */
.modal-wrap { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px 16px; }
.modal-backdrop { position: absolute; inset: 0; background: var(--backdrop); opacity: 0; transition: opacity .18s; }
.modal {
  position: relative; width: 100%; max-width: 460px; max-height: calc(100dvh - 48px); overflow: auto;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .18s, transform .18s;
}
.modal.wide { max-width: 620px; }
.modal-wrap.in .modal-backdrop { opacity: 1; }
.modal-wrap.in .modal { opacity: 1; transform: none; }
.modal-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 18px 10px 22px; background: var(--surface); }
.modal-head h2 { margin: 0; font: 700 19px/1.2 var(--font-display); letter-spacing: -.02em; }
.modal-body { padding: 4px 22px 22px; display: grid; gap: 16px; }
.modal-body > p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.modal-actions.start { justify-content: flex-start; }

.unlock-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.unlock-list li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--surface-2); font-size: 13px; font-weight: 600; min-width: 0; }
.unlock-list li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unlock-list li .i { width: 16px; height: 16px; color: var(--premium); }
.unlock-list em { font: 600 11px var(--font-mono); font-style: normal; color: var(--muted); }

.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.steps > li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); }
.steps > li > div { display: grid; gap: 8px; min-width: 0; }
.steps p { margin: -4px 0 2px; color: var(--muted); font-size: 13.5px; }
.step-n { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font: 700 13px var(--font-display); }
.redeem { display: flex; gap: 8px; }
.redeem input { flex: 1; letter-spacing: .06em; text-transform: uppercase; }
.redeem input::placeholder { text-transform: none; letter-spacing: .04em; }

.kv { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-block: 1px solid var(--line); font-weight: 600; }
.account.big .avatar { width: 44px; height: 44px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 80; display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-lg); animation: toast-in .2s ease-out;
}
.toast .i { width: 18px; height: 18px; color: #3FCB8C; }
.toast.error .i { color: #FF8A80; }
.toast.out { opacity: 0; transform: translateY(6px); transition: .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- admin */
.rows { display: grid; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); overflow: hidden; }
.row-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; min-width: 0; }
.row-item + .row-item { border-top: 1px solid var(--line); }
.row-item.is-hidden > :not(.row-tools):not(.order) { opacity: .55; }
.row-item .card-icon { width: 40px; height: 40px; border-radius: 10px; }
.row-item .card-icon .i { width: 20px; height: 20px; }
.order { display: grid; gap: 2px; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.row-main strong { font-size: 14.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main .sub-inline { font-weight: 500; color: var(--muted); font-size: 13px; }
.row-main .sub a.wa { color: var(--ok); font-weight: 700; text-decoration: none; }
.row-main .sub a.wa:hover { text-decoration: underline; }
.row-main .sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-item.tok .row-main { display: flex; align-items: center; gap: 10px; }
.link-sm { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--muted); text-decoration: none; min-width: 0; overflow: hidden; }
.link-sm:hover { color: var(--accent-text); }
.link-sm .i { width: 13px; height: 13px; }
.row-item .meta { min-width: 96px; text-align: right; }
.row-item.cust .meta { min-width: 150px; }
.row-tools { display: flex; gap: 2px; }
.token { font: 700 14px var(--font-mono); letter-spacing: .06em; background: var(--surface-2); padding: 6px 10px; border-radius: 8px; white-space: nowrap; }

.gen { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 18px; margin-bottom: 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.gen .field:first-child { width: 120px; }
.gen .grow { flex: 1 1 260px; }

.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; }
.icon-picker button { height: 44px; display: grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); }
.icon-picker button:hover { border-color: var(--line-2); }
.icon-picker button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); box-shadow: 0 0 0 1px var(--accent); }

.panel { padding: 22px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); margin-bottom: 18px; }
.panel.note h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font: 700 16px var(--font-display); }
.panel.note h2 .i { color: var(--accent-text); }
.panel.note p { margin: 0 0 12px; color: var(--ink-2); font-size: 14px; }
.panel.note .hint { margin: 10px 0 0; }
.copy-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.copy-line code { flex: 1 1 240px; padding: 10px 12px; border-radius: 9px; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- tablet */
@media (max-width: 1080px) {
  :root { --gutter: 28px; }
  .row-item .meta { display: none; }
}

/* ---------------------------------------------------------------- mobile / tablet estreito */
@media (max-width: 900px) {
  :root { --gutter: 16px; }
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { display: none; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
    padding: 10px var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
  }
  .side-brand.compact .brand-mark { width: 34px; height: 34px; border-radius: 10px; }
  .side-brand.compact .brand-mark img { width: 30px; height: 30px; }
  .side-brand.compact strong { font-size: 16px; }
  .side-brand.compact span { font-size: 11.5px; margin-top: 1px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 4px;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .tabbar > * {
    flex: 1; display: grid; justify-items: center; gap: 3px; padding: 7px 4px; border: 0; border-radius: 10px; background: transparent;
    color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none;
  }
  .tabbar > * .i { width: 22px; height: 22px; }
  .tabbar > .active { color: var(--accent-text); }
  .tabbar > .active .i { stroke-width: 2.1; }
  .page { padding: 22px var(--gutter) calc(96px + env(safe-area-inset-bottom, 0px)); }
  .toasts { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
}

@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .page-head { margin-bottom: 18px; }
  .page-head h1 { font-size: 27px; }
  .lede { font-size: 14px; margin-top: 6px; }
  .topbar .pill { display: none; }

  .upsell { padding: 16px; gap: 14px; margin-bottom: 18px; }
  .upsell h2 { font-size: 17px; }
  .upsell-actions { width: 100%; display: grid; grid-template-columns: 1fr; }

  .toolbar { gap: 10px; }
  .search { flex-basis: 100%; }
  .toolbar .seg { width: 100%; }
  .toolbar .seg button { flex: 1; justify-content: center; padding: 0 8px; }

  /* cards viram lista compacta */
  .grid { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .card {
    grid-template-columns: 44px auto minmax(0, 1fr) 20px;
    grid-template-areas: "icon body body arrow" "icon chip foot arrow";
    column-gap: 12px; row-gap: 4px; align-items: center; padding: 12px 14px;
  }
  .card:hover { transform: none; }
  .card-icon { align-self: center; }
  .card-desc { display: none; }
  .card-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .card-chip { justify-self: start; align-self: center; }
  .card-chip:empty { display: none; }
  .chip { height: 20px; padding: 0 7px; font-size: 10.5px; }
  .card-foot { padding: 0; border: 0; justify-content: flex-start; }
  .card-foot .go { display: none; }
  .card-arrow { grid-area: arrow; display: grid; place-items: center; color: var(--muted); }
  .card-arrow .i { width: 18px; height: 18px; }
  .card.locked .card-arrow { color: var(--premium); }
  .card:not(:has(.chip)) { grid-template-areas: "icon body body arrow" "icon foot foot arrow"; }

  .modal-wrap { place-items: end stretch; padding: 0; }
  .modal, .modal.wide { max-width: none; max-height: 92dvh; border-radius: 20px 20px 0 0; border-bottom: 0; transform: translateY(24px); padding-bottom: env(safe-area-inset-bottom, 0px); }
  .modal-head { padding: 16px 12px 8px 18px; }
  .modal-body { padding: 4px 18px 20px; }
  .modal-actions > .btn { flex: 1; }
  .unlock-list { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .steps > li { padding: 14px; gap: 10px; }

  /* admin */
  .page-head.row > .btn { width: 100%; }
  .row-item { flex-wrap: wrap; gap: 10px 12px; padding: 12px; }
  .row-item::after { content: ''; flex-basis: 100%; order: 5; }
  .row-item > .card-icon, .row-item > .avatar { order: 1; }
  .row-item .row-main { flex: 1 1 0; order: 2; }
  .row-item .order { order: 3; display: flex; }
  .row-item .tier { order: 9; }
  .row-item .row-tools { order: 11; margin-left: auto; }
  .row-item.tok .token { order: 1; }
  .row-item.tok .row-tools { order: 2; }
  .row-item.tok .row-main { order: 9; flex-basis: 100%; }
  .row-item.tok::after { display: none; }
  .gen .field:first-child { width: 90px; }
  .gen .grow { flex: 1 1 160px; }
  .gen .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* =====================================================================
   Calculadora de custos
   ===================================================================== */
.nav-lock { margin-left: auto; color: var(--premium); display: inline-flex; }
.nav-lock .i { width: 15px; height: 15px; }
.unlock-list li.feat { grid-column: 1 / -1; background: var(--premium-soft); color: var(--premium); }
.unlock-list li.feat em { color: var(--premium); opacity: .8; }

.calc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.calc-form { display: grid; gap: 12px; min-width: 0; }
.calc-section { padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface); }
.calc-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; font: 600 15px var(--font-display); letter-spacing: -.01em; }
.calc-section h3 .i { width: 18px; height: 18px; color: var(--accent-text); }
.calc-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.calc-grid .span2 { grid-column: 1 / -1; }
.calc-grid .hint { margin: 0; font-size: 12px; line-height: 1.4; }
.time-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; max-width: 360px; }

.affix { position: relative; display: block; }
.affix input {
  width: 100%; min-width: 0; height: 44px; padding: 0 64px 0 14px; border-radius: var(--r-sm); border: 1px solid var(--line-2);
  background: var(--surface); outline: none; font: 600 15px var(--font-mono); font-variant-numeric: tabular-nums; transition: border-color .15s, box-shadow .15s;
}
.affix input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.affix b { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font: 600 12px var(--font-mono); color: var(--muted); pointer-events: none; }
.affix.pre input { padding: 0 14px 0 42px; }
.affix.pre b { left: 14px; right: auto; }

.calc-how { padding: 14px 18px; border: 1px dashed var(--line-2); border-radius: var(--r); color: var(--ink-2); font-size: 13.5px; }
.calc-how summary { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; list-style: none; }
.calc-how summary::-webkit-details-marker { display: none; }
.calc-how summary .i { width: 16px; height: 16px; color: var(--muted); }
.calc-how ol { margin: 12px 0 0; padding-left: 20px; display: grid; gap: 4px; }

.calc-result { position: sticky; top: 24px; min-width: 0; }
.calc-card { padding: 22px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); display: grid; gap: 14px; }
.k-label { margin: 0; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.k-price { margin: -8px 0 0; font: 700 40px/1.1 var(--font-display); letter-spacing: -.03em; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.k-sub { margin: -8px 0 0; font-size: 13px; color: var(--muted); }
.k-sub strong { color: var(--ink); }
.k-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 14px 0; border-block: 1px solid var(--line); }
.k-val { margin: 2px 0 0; font: 700 22px/1.2 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.k-val.ok, b.ok { color: var(--ok); }
.k-mini { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.stack-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.stack-bar span { display: block; min-width: 3px; }
.stack-bar .profit { background: var(--ok); }
.breakdown { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13.5px; }
.breakdown li { display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px; }
.breakdown i { width: 10px; height: 10px; border-radius: 3px; }
.breakdown b { font: 600 13px var(--font-mono); font-variant-numeric: tabular-nums; }
.breakdown li.lucro { padding-top: 7px; border-top: 1px dashed var(--line); font-weight: 700; }
.breakdown li.lucro i { background: var(--ok); }
.breakdown li.lucro b { color: var(--ok); }
.k-foot { margin: 0; font-size: 11.5px; color: var(--muted); }
.calc-actions { display: grid; gap: 8px; }

.calc-history { margin-top: 36px; }
.page-head.sm { margin-bottom: 14px; }
.page-head h2 { margin: 0; font: 700 22px var(--font-display); letter-spacing: -.02em; }
.page-head.sm .lede { margin-top: 4px; font-size: 14px; }
.row-item.hist { gap: 16px; }
.hist-main { flex: 1; min-width: 0; display: grid; gap: 2px; text-align: left; border: 0; background: none; padding: 4px 0; color: inherit; }
.hist-main strong { font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-main .sub { font-size: 12.5px; color: var(--muted); }
.hist-main:hover strong { color: var(--accent-text); }
.hist-nums { display: flex; gap: 22px; font: 600 13.5px var(--font-mono); font-variant-numeric: tabular-nums; }
.hist-nums span { display: grid; gap: 1px; text-align: right; }
.hist-nums small { font: 700 10.5px var(--font-body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.icon-btn.confirm { width: auto; padding: 0 10px; gap: 6px; display: inline-flex; background: var(--danger-soft); color: var(--danger); font-size: 12.5px; font-weight: 700; }

.calc-mobilebar { display: none; }

.calc-lock { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: center; padding: 28px; border-radius: 18px; border: 1px solid var(--premium-line); background: var(--surface); position: relative; overflow: hidden; }
.calc-lock::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: var(--filament); }
.calc-lock h2 { margin: 0 0 14px; font: 700 24px/1.2 var(--font-display); letter-spacing: -.02em; }
.checks { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; }
.checks li { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); }
.checks .i { width: 18px; height: 18px; color: var(--ok); margin-top: 2px; stroke-width: 2.2; }
.calc-preview { position: relative; }
.calc-preview .calc-card { filter: saturate(.9); }
.calc-preview::after { content: ''; position: absolute; inset: 0; border-radius: 18px; background: linear-gradient(180deg, transparent 40%, var(--surface) 100%); pointer-events: none; }

@media (max-width: 1180px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr) 320px; }
  .hist-nums { gap: 14px; }
}
@media (max-width: 900px) {
  .calc-layout { grid-template-columns: minmax(0, 1fr); }
  .calc-result { position: static; scroll-margin-top: 80px; }
  .calc-lock { grid-template-columns: 1fr; padding: 22px; }
  .shell.on-calc .page { padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }
  .calc-mobilebar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 12px; right: 12px; z-index: 25;
    bottom: calc(74px + env(safe-area-inset-bottom, 0px)); padding: 10px 14px; border-radius: 14px; background: var(--ink); color: var(--bg);
    box-shadow: var(--shadow-lg); cursor: pointer;
  }
  .calc-mobilebar span { display: grid; gap: 1px; }
  .calc-mobilebar small { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; opacity: .65; }
  .calc-mobilebar strong { font: 700 17px var(--font-display); font-variant-numeric: tabular-nums; }
  .calc-mobilebar strong.ok { color: #3FCB8C; }
  .calc-mobilebar .i { width: 18px; height: 18px; opacity: .7; }
  .shell.on-calc .toasts { bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 640px) {
  .calc-section { padding: 14px; }
  .calc-grid { grid-template-columns: 1fr; gap: 12px; }
  .time-row { max-width: none; }
  .k-price { font-size: 34px; }
  .row-item.hist { flex-wrap: wrap; }
  .row-item.hist::after { display: none; }
  .hist-main { flex: 1 1 calc(100% - 60px); order: 1; }
  .row-item.hist .row-tools { order: 2; margin-left: auto; }
  .hist-nums { order: 3; flex-basis: 100%; justify-content: space-between; }
  .hist-nums span { text-align: left; }
}

/* =====================================================================
   Bônus PDF
   ===================================================================== */
.bonus-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.bonus-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; min-width: 0; border-radius: var(--r);
  background: var(--surface); border: 1px solid var(--line); color: inherit; text-decoration: none; text-align: left;
  transition: border-color .15s, box-shadow .2s, transform .2s;
}
a.bonus-card:hover { border-color: var(--accent); box-shadow: var(--shadow); transform: translateY(-2px); }
.bonus-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.bonus-icon { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.bonus-icon .i { width: 20px; height: 20px; }
.bonus-title { font: 600 17px/1.3 var(--font-display); letter-spacing: -.015em; text-wrap: balance; }
.bonus-desc { font-size: 14px; line-height: 1.5; color: var(--muted); }
.bonus-foot { margin-top: auto; padding-top: 12px; border-top: 1px dashed var(--line); }
.chip.free { background: var(--ok-soft); color: var(--ok); }
.go.gold { color: var(--premium); }
.go.muted { color: var(--muted); }
.bonus-card.locked { cursor: pointer; }
.bonus-card.locked .bonus-icon, .bonus-card.soon .bonus-icon { background: var(--surface-2); color: var(--muted); }
.bonus-card.locked:hover { border-color: var(--premium-line); }
.bonus-card.soon { border-style: dashed; }
.row-main .sub.warn { color: var(--premium); font-weight: 600; }
@media (max-width: 640px) {
  .bonus-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .bonus-card { padding: 16px; gap: 8px; }
  .bonus-title { font-size: 16px; }
  .bonus-desc { font-size: 13.5px; }
}

/* ---------- destaque (fogo) */
.chip.hot { background: linear-gradient(90deg, #FF6A3D, #F0457F); color: #fff; }
.chip.hot .i { stroke-width: 2.2; }
.card-chip { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.card.is-hot { border-color: color-mix(in srgb, #FF6A3D 45%, var(--line)); }
.card.is-hot .card-icon { background: linear-gradient(135deg, rgba(255,106,61,.16), rgba(240,69,127,.16)); color: #E0452E; }
.pill.hot { background: linear-gradient(90deg, #FF6A3D, #F0457F); color: #fff; }
.pill.hot .i { width: 12px; height: 12px; }
.icon-btn.hot-btn { color: var(--muted); }
.icon-btn.hot-btn.on { color: #fff; background: linear-gradient(135deg, #FF6A3D, #F0457F); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .card.is-hot .card-icon { color: #FF8A5C; } }
:root[data-theme="dark"] .card.is-hot .card-icon { color: #FF8A5C; }
@media (max-width: 640px) { .card-chip { justify-content: flex-start; gap: 4px; } .card:not(:has(.chip)) { grid-template-areas: "icon body body arrow" "icon foot foot arrow"; } }
