/* Color tokens shared by Mapa, CRM and Perfil. theme.js sets data-theme on <html> before first paint:
   the stored choice from the toggle, or the system setting when there is none. */
:root {
  color-scheme: light;
  --bg: #fff; --surface: #fff; --band: #f5f5f7; --col: #ebebef; --col-over: #dcdce1; --hover: #e8e8ed;
  --ink: #1d1d1f; --on-ink: #fff; --ink-hover: #000; --muted: #6e6e73; --line: #d2d2d7; --rule: #f0f0f2;
  --hot: #1d1d1f; --warn: #b3261e; --warn-bg: #fbeaea; --ok: #1f4d3f; --ok-bg: #e7f1ea; --link: #0078a8;
  --ring: rgba(29,29,31,.12); --scrim: rgba(0,0,0,.18); --glass: rgba(255,255,255,.86); --live: #1f7a4d;
  --pop-shadow: 0 12px 40px rgba(0,0,0,.16), 0 2px 8px rgba(0,0,0,.06);
  --float-shadow: 0 6px 24px rgba(0,0,0,.14);
  --logo-filter: none;
  /* Map: tiles in grayscale (MapLibre raster paint), hot leads as ink dots. */
  --tile-saturation: -1; --tile-contrast: -.08; --tile-low: .03; --tile-high: 1;
  --dot-hot: #1d1d1f; --dot-hot-edge: #000; --dot: #fff; --dot-edge: #8e8e93; --dot-idle: #c7c7cc; --dot-idle-edge: #8e8e93;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}
/* Dark keeps the same grammar inverted: ink becomes mist, raised surfaces step up in tone. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111112; --surface: #2c2c2e; --band: #1c1c1e; --col: #141415; --col-over: #232325; --hover: #3a3a3c;
  --ink: #f5f5f7; --on-ink: #1d1d1f; --ink-hover: #fff; --muted: #98989d; --line: #3a3a3c; --rule: #1f1f21;
  --hot: #f5f5f7; --warn: #ff6961; --warn-bg: #3b1715; --ok: #7fd1a8; --ok-bg: #15302a; --link: #6cb4ee;
  --ring: rgba(245,245,247,.18); --scrim: rgba(0,0,0,.5); --glass: rgba(28,28,30,.82); --live: #4cc38a;
  --pop-shadow: 0 12px 40px rgba(0,0,0,.6), 0 0 0 1px #3a3a3c;
  --float-shadow: 0 6px 24px rgba(0,0,0,.5), 0 0 0 1px #2c2c2e;
  --logo-filter: invert(1);
  /* Low above high inverts the tiles. */
  --tile-saturation: -1; --tile-contrast: -.08; --tile-low: .7; --tile-high: 0;
  --dot-hot: #f5f5f7; --dot-hot-edge: #fff; --dot: #2c2c2e; --dot-edge: #8e8e93; --dot-idle: #48484a; --dot-idle-edge: #636366;
}

.theme-btn { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: var(--band); color: var(--ink); display: grid; place-items: center; cursor: pointer; transition: background-color .15s; }
.theme-btn:hover { background: var(--hover); }
.theme-btn svg { width: 18px; height: 18px; }
.theme-btn[hidden] { display: none; }
a.theme-btn { text-decoration: none; }

/* New plan limits (logout.js): once per change, under the top bar on the right, until OK. */
.plan-notice { position: fixed; z-index: 2500; top: 68px; right: 16px; width: min(400px, calc(100vw - 32px)); display: flex; gap: 12px; align-items: center; padding: 14px 14px 14px 18px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--pop-shadow); font: 400 13px/1.45 var(--sans); letter-spacing: -0.01em; animation: err-in .25s cubic-bezier(.16, 1, .3, 1); }
.plan-notice div { flex: 1; min-width: 0; }
.plan-notice b { font-weight: 600; }
.plan-notice p { margin: 2px 0 0; color: var(--muted); }
.plan-notice .theme-btn { width: auto; height: 32px; padding: 0 14px; border-radius: 999px; font: 500 13px var(--sans); }
@media (prefers-reduced-motion: reduce) { .plan-notice { animation: none; } }
/* notices.js: the account's next step and logout.js's notices share one column, newest on top. */
.notice-stack { position: fixed; z-index: 2500; top: 68px; right: 16px; width: min(400px, calc(100vw - 32px)); display: grid; gap: 10px; }
.notice-stack:empty { display: none; }
.notice-stack.on-map { top: 64px; right: auto; left: 16px; }
.notice-stack .plan-notice { position: static; width: auto; }
.sys-notice .go { background: var(--ink); color: var(--on-ink); text-decoration: none; display: inline-flex; align-items: center; white-space: nowrap; }
.sys-notice .go:hover { background: var(--ink-hover); }
.sys-notice .go[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.sys-notice .later { width: 32px; height: 32px; padding: 0; flex: none; display: grid; place-items: center; }
@media (max-width: 560px) { .sys-notice { flex-wrap: wrap; } .sys-notice > div { flex-basis: 100%; } .sys-notice .later { margin-left: auto; order: -1; position: absolute; top: 10px; right: 10px; } .sys-notice > div { padding-right: 36px; } .notice-stack .sys-notice { position: relative; } }

/* Perfil da empresa opens as a sheet: it rises from the bottom over the current page, which
   sinks back a little, and drops away on the way out. Brand and tabs ride with their page. */
@view-transition { navigation: auto; }
html:active-view-transition-type(sheet-up, sheet-down) :is(.brand, .tabs, .tabs a) { view-transition-name: none; }
html:active-view-transition-type(sheet-up, sheet-down)::view-transition { background: #000; }
html:active-view-transition-type(sheet-up)::view-transition-old(root) { animation: vt-sink .55s cubic-bezier(.32, .72, 0, 1) both; }
html:active-view-transition-type(sheet-up)::view-transition-new(root) { animation: vt-rise .55s cubic-bezier(.32, .72, 0, 1) both; }
html:active-view-transition-type(sheet-down)::view-transition-old(root) { z-index: 1; animation: vt-rise .45s cubic-bezier(.32, .72, 0, 1) reverse both; }
html:active-view-transition-type(sheet-down)::view-transition-new(root) { animation: vt-sink .45s cubic-bezier(.32, .72, 0, 1) reverse both; }
@keyframes vt-rise { from { transform: translateY(100%); border-radius: 20px 20px 0 0; } to { transform: none; border-radius: 0; } }
@keyframes vt-sink { from { transform: none; opacity: 1; } to { transform: scale(.94); opacity: .55; } }
@media (prefers-reduced-motion: reduce) { @view-transition { navigation: none; } }

/* Field errors (validate.js), in place of the browser's bubble: the field turns red and shakes once,
   and a note under it says what to fix. !important so it wins over each page's own focus ring. */
:is(input, select, textarea)[aria-invalid="true"] { border-color: var(--warn) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 16%, transparent) !important; }
.field-tip { position: fixed; inset: auto; z-index: 3000; display: none; align-items: flex-start; gap: 8px; width: max-content; max-width: min(320px, calc(100vw - 24px)); margin: 0; padding: 9px 12px 9px 10px; border: 0; border-radius: 12px; overflow: visible; background: var(--surface); color: var(--ink); box-shadow: var(--pop-shadow); font: 400 13px/1.4 var(--sans); letter-spacing: -0.01em; pointer-events: none; }
.field-tip:popover-open, .field-tip.on { display: flex; animation: err-in .25s cubic-bezier(.16, 1, .3, 1); }
.field-tip svg { flex: none; margin-top: 1px; color: var(--warn); }
@keyframes err-in { from { opacity: 0; transform: translateY(-4px); } }
.shake { animation: shake .36s cubic-bezier(.36, .07, .19, .97); }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .field-tip:popover-open, .field-tip.on, .shake { animation: none; } }

/* Primeiros passos (onboarding.js): "?" button with a dot while a required step is missing,
   the checklist panel under it, and the spotlight tour. Sits above the map (z-index 1000). */
.onb-trigger { position: relative; }
.onb-trigger[hidden] { display: none; }
.onb-trigger.onb-due::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--band); }
.onb-panel { position: fixed; z-index: 2000; top: 64px; right: 16px; width: min(380px, calc(100vw - 32px)); max-height: calc(100vh - 80px); overflow-y: auto; padding: 18px 18px 16px; border-radius: 18px; background: var(--surface); color: var(--ink); box-shadow: var(--pop-shadow); font: 400 13px/1.45 var(--sans); letter-spacing: -0.01em; }
.onb-head { display: flex; align-items: center; gap: 10px; }
.onb-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.02em; margin-right: auto; }
.onb-count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.onb-x { width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--band); color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.onb-x:hover { background: var(--hover); }
.onb-lede { margin: 8px 0 12px; color: var(--muted); }
.onb-track { height: 3px; border-radius: 3px; background: var(--band); overflow: hidden; margin-bottom: 6px; }
.onb-fill { height: 100%; width: 0; background: var(--ink); transition: width .4s cubic-bezier(.16, 1, .3, 1); }
.onb-list { list-style: none; margin: 0; padding: 0; }
.onb-step { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: start; padding: 11px 0; }
.onb-step + .onb-step { box-shadow: inset 0 1px 0 var(--rule); }
.onb-step b { font-weight: 500; }
.onb-step p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.onb-step.is-done b { color: var(--muted); font-weight: 400; }
.onb-mark { width: 20px; height: 20px; margin-top: 0; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line); display: grid; place-items: center; }
.onb-step.is-done .onb-mark { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.onb-req { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: var(--warn-bg); color: var(--warn); font-size: 11px; vertical-align: 1px; }
.onb-link { align-self: center; height: 28px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--band); color: var(--ink); font: 500 12px/28px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap; }
.onb-link:hover { background: var(--hover); }
.onb-ready { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; margin: 12px 0 4px; }
.onb-ready[hidden] { display: none; }
.onb-ready b { font-weight: 500; }
.onb-ready p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.onb-ready .onb-mark { background: var(--ink); color: var(--on-ink); box-shadow: none; }
.onb-ready + .onb-list:not(:empty) { margin-top: 6px; box-shadow: inset 0 1px 0 var(--rule); }
.onb-note { margin: 6px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--band); font-size: 12px; }
.onb-foot { display: flex; justify-content: flex-end; margin-top: 12px; }
.onb-btn { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--ink); color: var(--on-ink); font: 500 13px var(--sans); cursor: pointer; white-space: nowrap; }
.onb-btn:hover { background: var(--ink-hover); }
.onb-btn--ghost { background: var(--band); color: var(--ink); }
.onb-btn--ghost:hover { background: var(--hover); }

.onb-block { position: fixed; inset: 0; z-index: 2001; }
.onb-spot { position: fixed; z-index: 2002; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 200vmax rgba(0,0,0,.42); transition: left .35s cubic-bezier(.16, 1, .3, 1), top .35s cubic-bezier(.16, 1, .3, 1), width .35s cubic-bezier(.16, 1, .3, 1), height .35s cubic-bezier(.16, 1, .3, 1); }
:root[data-theme="dark"] .onb-spot { box-shadow: 0 0 0 2px var(--ink), 0 0 0 200vmax rgba(0,0,0,.62); }
.onb-tip { position: fixed; z-index: 2003; width: min(320px, calc(100vw - 24px)); padding: 16px 16px 14px; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: var(--pop-shadow); font: 400 13px/1.45 var(--sans); letter-spacing: -0.01em; outline: none; transition: left .35s cubic-bezier(.16, 1, .3, 1), top .35s cubic-bezier(.16, 1, .3, 1); }
.onb-tip h3 { margin: 2px 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
.onb-tip p { margin: 0; }
.onb-tip .onb-step-n { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.onb-tip-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.onb-skip { margin-right: auto; padding: 0; border: 0; background: none; color: var(--muted); font: 400 12px var(--sans); cursor: pointer; }
.onb-skip:hover { color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .onb-spot, .onb-tip, .onb-fill { transition: none; } }
/* Links from the checklist (/perfil#addrField) land below the sticky header. */
:target { scroll-margin-top: 88px; }
@media (max-width: 480px) { .onb-trigger { width: 32px; height: 32px; } .onb-trigger.onb-due::after { top: 4px; right: 4px; } .onb-panel { top: 56px; right: 12px; width: calc(100vw - 24px); } }

/* Phone top bar (topmenu.js): Mapa, CRM and IA fold their right-hand buttons into a menu under one
   round button. Each round button becomes a row with its icon and its aria-label as the text. */
.nav-btn { display: none; }
.nav-btn svg path { transition: transform .25s cubic-bezier(.16, 1, .3, 1); }
.nav-open .nav-btn svg .nb1 { transform-origin: 12px 8px; transform: translateY(4px) rotate(45deg); }
.nav-open .nav-btn svg .nb2 { transform-origin: 12px 16px; transform: translateY(-4px) rotate(-45deg); }
@keyframes nav-pop { from { opacity: 0; transform: scale(.96) translateY(-4px); } }
@media (max-width: 640px) {
  body :is(.top, .head):has(> .nav-btn) { position: relative; }
  body .nav-btn { display: grid; margin-left: auto; }
  body :is(.top, .head) > .right { display: none; position: absolute; z-index: 40; top: calc(100% - 4px); right: 12px; width: min(280px, calc(100vw - 24px)); margin: 0; padding: 6px; flex-direction: column; align-items: stretch; gap: 2px; border-radius: 16px; background: var(--surface); box-shadow: var(--pop-shadow); transform-origin: top right; animation: nav-pop .18s cubic-bezier(.16, 1, .3, 1); }
  body .nav-open > .right { display: flex; }
  body .right > .btn { justify-content: center; height: 40px; margin-bottom: 4px; }
  body .right > :is(.theme-btn, .profile-btn), body .right > .share > .icon-btn { width: 100%; height: 44px; padding: 0 10px; gap: 12px; border-radius: 10px; display: flex; align-items: center; justify-content: flex-start; background: transparent; color: var(--ink); font: 400 14px var(--sans); letter-spacing: -0.01em; text-align: left; }
  body .right > :is(.theme-btn, .profile-btn):hover, body .right > .share > .icon-btn:is(:hover, [aria-expanded="true"]) { background: var(--band); }
  body .right > :is(.theme-btn, .profile-btn)[hidden] { display: none; }
  body .right > :is(.theme-btn, .profile-btn) svg, body .right > .share > .icon-btn svg { flex: none; width: 18px; height: 18px; }
  body .right > :is(.theme-btn, .profile-btn)::before, body .right > .share > .icon-btn::before { content: attr(aria-label); order: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  body .right > .onb-trigger.onb-due::after { top: 10px; right: auto; left: 22px; box-shadow: 0 0 0 2px var(--surface); }
  body .right > .share .menu { position: static; width: auto; padding: 0 0 4px 30px; background: none; box-shadow: none; animation: none; }
  body .right > .share .menu-title { display: none; }
}
@media (max-width: 640px) and (prefers-reduced-motion: reduce) { body :is(.top, .head) > .right, .nav-btn svg path { animation: none; transition: none; } }
