/* ==========================================================================
   CRM Revendedores — mobile-first. Tokens no :root, dark mode automático.
   ========================================================================== */
:root {
  --bg: #f3f1ec;
  --surface: #ffffff;
  --surface-2: #f8f6f1;
  --ink: #16211f;
  --muted: #66736f;
  --line: #e4e0d6;
  --brand: #2e7d32;
  --brand-2: #4caf50;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4e1;
  --accent: #f5a623;
  --danger: #c0392b;
  --danger-soft: #fbe9e6;
  --ok: #1f8a4c;
  --ok-soft: #e0f3e8;
  --warn: #b7791f;
  --warn-soft: #fbf0d9;
  --info: #2b6cb0;
  --info-soft: #e4eefa;
  --violet: #6b46c1;
  --violet-soft: #ece6f8;
  --shadow: 0 1px 2px rgba(22, 33, 31, .05), 0 6px 18px rgba(22, 33, 31, .06);
  --shadow-lg: 0 18px 50px rgba(22, 33, 31, .22);
  --r: 16px;
  --r-sm: 12px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --tabbar-h: 64px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513;
    --surface: #17211e;
    --surface-2: #1c2825;
    --ink: #e9efec;
    --muted: #90a09a;
    --line: #26342f;
    --brand: #6cc24a;
    --brand-2: #8ad66a;
    --brand-ink: #0b2208;
    --brand-soft: #1d3418;
    --danger: #ef7d6e;
    --danger-soft: #3a1f1b;
    --ok: #52c987;
    --ok-soft: #173424;
    --warn: #e6b155;
    --warn-soft: #3a2f16;
    --info: #6fa8e8;
    --info-soft: #172a40;
    --violet: #a68bea;
    --violet-soft: #2a2145;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 18px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 15px/1.45 var(--font); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
svg.i { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Shell ---------- */
.app { min-height: 100dvh; display: flex; }
.main { flex: 1; min-width: 0; }
.side { display: none; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 16px 10px; min-height: 58px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar .grow { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--brand-ink);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 40%, transparent);
}
.brand-mark svg { width: 19px; height: 19px; }
.logo { width: 34px; height: 34px; border-radius: 22.5%; display: block; flex: none; box-shadow: 0 4px 12px rgba(22, 33, 31, .18); }
.logo.lg { width: 68px; height: 68px; margin-bottom: 18px; box-shadow: 0 10px 26px rgba(22, 33, 31, .22); }
.icon-btn {
  width: 42px; height: 42px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  display: inline-grid; place-items: center; transition: transform .12s, background .12s;
}
.icon-btn:active { transform: scale(.94); }
.avatar-btn { font-weight: 700; font-size: 13px; color: var(--brand); background: var(--brand-soft); border-color: transparent; }

.content { padding: 6px 16px calc(var(--tabbar-h) + var(--safe-b) + 92px); max-width: 1120px; margin: 0 auto; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b); display: grid; grid-template-columns: repeat(4, 1fr);
  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 a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--muted); position: relative; transition: color .15s;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--brand); }
.tabbar a.on::before {
  content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand);
}

.fab {
  position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 25;
  width: 58px; height: 58px; border-radius: 20px; border: 0; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--brand-ink);
  box-shadow: 0 10px 26px color-mix(in srgb, var(--brand) 45%, transparent);
  transition: transform .15s;
}
.fab:active { transform: scale(.92); }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }

/* ---------- Page ---------- */
.view { animation: rise .28s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 8px 0 14px; }
.page-head h1 { font-size: 26px; font-weight: 800; }
.page-head p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.desk-only { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface); font-weight: 700; font-size: 15px;
  transition: transform .12s, background .15s, opacity .15s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn.primary { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border-color: transparent; }
.btn.ok { background: var(--ok); color: #fff; border-color: transparent; }
.btn.danger { color: var(--danger); background: var(--danger-soft); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; }
.spin { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid currentColor; border-right-color: transparent; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.search {
  display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 0 14px; min-height: 48px; color: var(--muted); transition: border-color .15s, box-shadow .15s;
}
.search:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.search input { flex: 1; border: 0; background: transparent; outline: 0; font: inherit; font-size: 16px; color: var(--ink); min-width: 0; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 6px; margin: 0 -16px; padding-inline: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line); font-weight: 700; font-size: 13.5px; color: var(--muted);
  transition: all .15s; white-space: nowrap;
}
.chip b { font-weight: 800; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.chip.on { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.chip.on b { background: rgba(255, 255, 255, .22); color: inherit; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; min-width: 0; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field label i { color: var(--danger); font-style: normal; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 11px 14px; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1.5px solid var(--line); border-radius: 12px; outline: 0; transition: border-color .15s, box-shadow .15s;
  appearance: none; -webkit-appearance: none;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2366736f' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 38px;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 15%, transparent); }
.field.err input, .field.err select, .field.err textarea { border-color: var(--danger); }
.field .msg { color: var(--danger); font-size: 12.5px; font-weight: 600; }
.row2 { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.quick button { border: 1px solid var(--line); background: var(--surface-2); border-radius: 99px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; color: var(--muted); margin-bottom: 16px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- Cards & lists ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin-top: 10px; }
.item { display: flex; gap: 12px; padding: 14px; align-items: flex-start; transition: transform .12s, border-color .15s; }
.item:active { transform: scale(.985); }
.item .body { flex: 1; min-width: 0; }
.item .title { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { color: var(--muted); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.item .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.item .end { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.item .amount { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }

.avatar { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex: none; }
.avatar.lg { width: 64px; height: 64px; border-radius: 20px; font-size: 22px; }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.tag svg { width: 13px; height: 13px; }
.tone-info { background: var(--info-soft); color: var(--info); }
.tone-ok { background: var(--ok-soft); color: var(--ok); }
.tone-warn { background: var(--warn-soft); color: var(--warn); }
.tone-bad { background: var(--danger-soft); color: var(--danger); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-muted { background: var(--surface-2); color: var(--muted); }
.tone-brand { background: var(--brand-soft); color: var(--brand); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .ring { width: 72px; height: 72px; border-radius: 24px; display: grid; place-items: center; margin: 0 auto 14px; background: var(--brand-soft); color: var(--brand); }
.empty .ring svg { width: 32px; height: 32px; }
.empty h3 { color: var(--ink); font-size: 17px; margin-bottom: 4px; }
.empty p { margin: 0 0 16px; }

.skel { height: 78px; border-radius: var(--r); background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%); background-size: 200% 100%; animation: sh 1.2s infinite linear; border: 1px solid var(--line); }
@keyframes sh { to { background-position: -200% 0; } }

/* ---------- Dashboard ---------- */
.hello h1 { font-size: 28px; font-weight: 800; }
.hello p { margin: 3px 0 0; color: var(--muted); }
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 16px 0; }
.kpi.hero { grid-column: 1 / -1; }
.kpi { padding: 14px 16px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12.5px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 26px; font-weight: 800; letter-spacing: -.03em; margin-top: 6px; }
.kpi .val small { font-size: 13px; font-weight: 700; color: var(--muted); letter-spacing: 0; }
.kpi.hero { background: linear-gradient(140deg, var(--brand), var(--brand-2)); color: var(--brand-ink); border: 0; }
.kpi.hero .lbl { color: color-mix(in srgb, var(--brand-ink) 75%, transparent); }
.kpi.hero .val small { color: inherit; opacity: .75; }
.section { margin: 22px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.section h2 { font-size: 17px; font-weight: 800; }
.section a { color: var(--brand); font-weight: 700; font-size: 13.5px; }
.pipe { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.pipe i { display: block; min-width: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend em { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.panel { padding: 16px; }

/* ---------- Detail ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; color: var(--muted); padding: 6px 8px 6px 0; }
.hero-card { padding: 18px; }
.hero-top { display: flex; gap: 14px; align-items: center; }
.hero-top h1 { font-size: 21px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.hero-top .badge { margin-top: 6px; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; transition: transform .12s; }
.act:active { transform: scale(.95); }
.act svg { width: 22px; height: 22px; color: var(--brand); }
.act.off { opacity: .4; pointer-events: none; }
.steps { display: flex; gap: 8px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 4px; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.step { flex: none; padding: 8px 13px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 700; color: var(--muted); transition: all .15s; }
.step.on { border-color: transparent; color: #fff; background: var(--brand); }
.step.done { color: var(--brand); border-color: color-mix(in srgb, var(--brand) 35%, transparent); background: var(--brand-soft); }
.kv { display: grid; }
.kv > div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; font-weight: 600; flex: none; }
.kv dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.kv a { color: var(--brand); }
.notes { white-space: pre-wrap; font-size: 14px; line-height: 1.6; color: var(--ink); background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; margin-top: 12px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.btn-row { display: grid; gap: 10px; }
.callout { padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: flex-start; }
.timeline { display: grid; gap: 0; }
.timeline .t { display: flex; gap: 12px; align-items: center; padding: 8px 0; color: var(--muted); font-weight: 600; font-size: 14px; position: relative; }
.timeline .t::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); flex: none; z-index: 1; }
.timeline .t:not(:last-child)::after { content: ""; position: absolute; left: 6px; top: 26px; bottom: -8px; width: 2px; background: var(--line); }
.timeline .t.done { color: var(--ink); }
.timeline .t.done::before { background: var(--brand); border-color: var(--brand); }
.timeline .t.now { color: var(--brand); font-weight: 800; }
.timeline .t.now::before { background: var(--brand); border-color: var(--brand-soft); box-shadow: 0 0 0 4px var(--brand-soft); }

/* ---------- Orçamento / instalador / fotos ---------- */
.quote + .quote { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.quote-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.inst { display: flex; align-items: center; gap: 12px; }
.inst + .inst { margin-top: 12px; }
.inst .body { flex: 1; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.ph { position: relative; aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); display: block; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.ph:active img { transform: scale(1.04); }
.ph .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(10, 18, 16, .65); color: #fff; backdrop-filter: blur(4px); }
.ph.file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.ph.file svg { width: 26px; height: 26px; color: var(--brand); }
.ph.file span:not(.tag) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lightbox { position: fixed; inset: 0; z-index: 80; background: rgba(6, 10, 9, .94); display: grid; place-items: center; animation: fade .2s both; }
.lightbox figure { margin: 0; max-width: 100vw; max-height: 100dvh; display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 64px 12px 24px; }
.lightbox img { max-width: 100%; max-height: calc(100dvh - 130px); border-radius: 10px; object-fit: contain; }
.lightbox figcaption { color: #d7dfdc; font-size: 14px; font-weight: 600; text-align: center; max-width: 560px; }
.lb-x { position: absolute; top: calc(12px + var(--safe-t)); right: 12px; z-index: 2; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.lb-nav { position: absolute; top: 50%; margin-top: -21px; z-index: 2; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }
.lb-nav.prev { left: 10px; } .lb-nav.next { right: 10px; }

/* ---------- Sheet (modal) ---------- */
.backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(10, 18, 16, .5); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s both; }
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-height: 92dvh; display: flex; flex-direction: column; background: var(--bg);
  border-radius: 24px 24px 0 0; box-shadow: var(--shadow-lg); animation: up .3s cubic-bezier(.2, .9, .25, 1) both;
}
@keyframes up { from { transform: translateY(100%); } }
.backdrop.closing { animation: fadeout .18s both; }
.backdrop.closing .sheet { animation: down .18s ease-in both; }
@keyframes fadeout { to { opacity: 0; } }
@keyframes down { to { transform: translateY(100%); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px 6px; }
.sheet-head::before { content: ""; position: absolute; left: 50%; top: 8px; width: 38px; height: 4px; margin-left: -19px; border-radius: 4px; background: var(--line); }
.sheet-head h2 { font-size: 18px; font-weight: 800; padding-top: 8px; }
.sheet-body { padding: 12px 18px calc(20px + var(--safe-b)); overflow-y: auto; overscroll-behavior: contain; }
.sheet-foot { display: grid; gap: 10px; margin-top: 8px; }
.sheet { position: relative; }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 24px 18px; position: relative; overflow: hidden; }
.auth::before, .auth::after { content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5; pointer-events: none; }
.auth::before { width: 340px; height: 340px; background: var(--brand-soft); top: -90px; left: -90px; }
.auth::after { width: 300px; height: 300px; background: color-mix(in srgb, var(--accent) 35%, transparent); bottom: -100px; right: -80px; }
.auth-card { width: 100%; max-width: 410px; padding: 28px 22px 24px; position: relative; z-index: 1; animation: rise .4s both; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 17px; margin-bottom: 18px; }
.auth-card .brand-mark svg { width: 28px; height: 28px; }
.auth-card h1 { font-size: 26px; font-weight: 800; }
.auth-card p { color: var(--muted); margin: 6px 0 22px; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 90; left: 0; right: 0; bottom: calc(var(--tabbar-h) + var(--safe-b) + 84px); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast { background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: rise .25s both; max-width: 420px; }
.toast.bad { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }

/* ==========================================================================
   Tablet / Desktop
   ========================================================================== */
@media (min-width: 620px) {
  .gallery { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .row2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .list { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); }
  .backdrop { align-items: center; padding: 24px; }
  .sheet { max-width: 580px; border-radius: 24px; max-height: 88dvh; }
  .sheet-head::before { display: none; }
  .sheet-foot { grid-template-columns: 1fr 1fr; }
  .sheet-foot .btn:only-child { grid-column: 1 / -1; }
  @keyframes up { from { transform: translateY(24px) scale(.97); opacity: 0; } }
  @keyframes down { to { transform: translateY(16px) scale(.97); opacity: 0; } }
}

@media (min-width: 940px) {
  :root { --tabbar-h: 0px; }
  .tabbar, .fab, .topbar, .mob-only { display: none !important; }
  .kpis { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .kpi.hero { grid-column: auto; }
  .desk-only { display: inline-flex !important; }
  .side {
    display: flex; flex-direction: column; width: 256px; flex: none; position: sticky; top: 0; height: 100dvh;
    padding: 22px 16px; background: var(--surface); border-right: 1px solid var(--line);
  }
  .side .brand { padding: 0 8px 22px; font-size: 18px; }
  .side nav { display: grid; gap: 4px; }
  .side nav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 14px;
    font-weight: 700; color: var(--muted); transition: background .15s, color .15s;
  }
  .side nav a:hover { background: var(--surface-2); color: var(--ink); }
  .side nav a.on { background: var(--brand-soft); color: var(--brand); }
  .side .me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
  .side .me .who { flex: 1; min-width: 0; font-weight: 700; font-size: 14px; }
  .side .me .who small { display: block; color: var(--muted); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar { padding: 14px 32px 0; background: transparent; backdrop-filter: none; justify-content: flex-end; min-height: 0; }
  .topbar .avatar-btn { display: none; }
  .content { padding: 8px 32px 48px; }
  .page-head h1 { font-size: 30px; }
  .toasts { bottom: 28px; }
  .detail-grid { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); align-items: start; gap: 18px; }
  .hello h1 { font-size: 32px; }
  .dash-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .chips { margin: 0; padding-inline: 0; flex-wrap: wrap; overflow: visible; }
  .item:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); transform: translateY(-1px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Ajustes das páginas Blade + Turbo
   ========================================================================== */
[hidden] { display: none !important; }                 /* "hidden" esconde mesmo quando a classe define display */
turbo-frame { display: block; }                        /* zona da lista que se atualiza sozinha */
.steps form, .btn-row form { display: contents; }     /* os botões dentro de formulários mantêm o desenho */
.btn-row form .btn { width: 100%; }
.toast { animation: rise .25s both, toast-out .3s 3.2s forwards; }   /* a mensagem desaparece sozinha */
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
.turbo-progress-bar { background: linear-gradient(90deg, var(--brand), var(--accent)); height: 3px; }

/* Recuperar palavra-passe / perfil */
.form-ok { background: var(--brand-soft, #e8f5e9); color: var(--brand, #2e7d32); padding: 10px 14px; border-radius: 12px; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.auth-link { text-align: center; margin: 16px 0 0 !important; font-size: 14px; }
.auth-link a { color: var(--brand, #2e7d32); font-weight: 700; text-decoration: none; }
