/* Layout: barra superior com seletor de perfil; cliente e técnico em moldura de celular, painel J3 em largura total. */
:root {
  --navy: #10233F;
  --bg: #EEF2F6;
  --surface: #FFFFFF;
  --surface-2: #F6F8FB;
  --fg: #0E1B2C;
  --muted: #5B6B7E;
  --line: #DAE1EA;
  --air: #1689C4;
  --air-soft: #E2F1FA;
  --hot: #D9661F;
  --hot-soft: #FCEBDD;
  --ok: #1A8A5E;
  --ok-soft: #DDF3EA;
  --warn: #A97406;
  --warn-soft: #FBF0D6;
  --crit: #C23B33;
  --land: #E3E9E2;
  --water: #CFE3F0;
  --road: #FFFFFF;
  --header: #10233F;
  --header-fg: #FFFFFF;
  --f-display: "Sora", "Segoe UI", system-ui, sans-serif;
  --f-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --r: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #8FB4E0; --bg: #0A121D; --surface: #111C2A; --surface-2: #162334; --fg: #E5ECF4; --muted: #93A3B5;
    --line: #233448; --air: #4DB6EA; --air-soft: #12324A; --hot: #F08A47; --hot-soft: #3A2414; --ok: #3CC48B;
    --ok-soft: #10301F; --warn: #E0B04A; --warn-soft: #33290F; --crit: #F06A60; --land: #1A2633; --water: #0F2234;
    --road: #24364A; --header: #0D1B2C; --header-fg: #E5ECF4; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #8FB4E0; --bg: #0A121D; --surface: #111C2A; --surface-2: #162334; --fg: #E5ECF4; --muted: #93A3B5;
  --line: #233448; --air: #4DB6EA; --air-soft: #12324A; --hot: #F08A47; --hot-soft: #3A2414; --ok: #3CC48B;
  --ok-soft: #10301F; --warn: #E0B04A; --warn-soft: #33290F; --crit: #F06A60; --land: #1A2633; --water: #0F2234;
  --road: #24364A; --header: #0D1B2C; --header-fg: #E5ECF4; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 15px/1.5 var(--f-body); }
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--air); outline-offset: 2px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; }

/* Barra superior */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--header); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--header); color: var(--header-fg);
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px; }
.topbar-in { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.brand img { height: 34px; width: auto; filter: brightness(0) invert(1); }
.brand b { font-family: var(--f-display); font-size: 18px; display: block; line-height: 1.1; }
.brand span { font-size: 11px; opacity: .75; letter-spacing: .06em; text-transform: uppercase; }
.roles { display: flex; gap: 4px; background: rgba(255,255,255,.08); padding: 4px; border-radius: 999px; }
.roles a { color: var(--header-fg); text-decoration: none; padding: 6px 14px; border-radius: 999px; font-weight: 700; font-size: 14px; opacity: .8; }
.roles a.on { background: var(--header-fg); color: var(--header); opacity: 1; }
.devbtn { background: transparent; border: 1px solid rgba(255,255,255,.3); color: var(--header-fg); border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600; }

/* Roteiro da demo */
.guide { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 10px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.guide-in { max-width: 1240px; margin: 0 auto; display: flex; gap: 8px 18px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.guide ol { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; list-style: none; counter-reset: g; }
.guide li { counter-increment: g; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.guide li::before { content: counter(g); width: 20px; height: 20px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11px; font-weight: 800; background: var(--surface-2); border: 1px solid var(--line); }
.guide li.done { color: var(--fg); }
.guide li.done::before { content: "✓"; background: var(--ok); color: #fff; border-color: var(--ok); }
.guide li.now { color: var(--fg); font-weight: 700; }
.guide li.now::before { background: var(--air); color: #fff; border-color: var(--air); }
.linkbtn { background: none; border: 0; color: var(--air); font-weight: 700; padding: 0; text-decoration: underline; text-underline-offset: 3px; }

main { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 24px 48px; }
.wrap { max-width: 1240px; margin: 0 auto; }

/* Moldura de celular */
.stage { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 32px; align-items: start; }
.phone { width: 100%; max-width: 400px; height: 780px; background: var(--surface); border: 10px solid #0B1626; border-radius: 42px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 30px 60px -30px rgba(16,35,63,.45); position: relative; }
.phone-status { display: flex; justify-content: space-between; padding: 8px 22px 4px; font-size: 12px; font-weight: 700; }
.phone-body { flex: 1; overflow-y: auto; padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 14px; }
.phone-body > * { flex-shrink: 0; }
.phone-body > .map { width: 100%; }
.phone-nav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border-top: 1px solid var(--line); background: var(--surface); }
.phone-nav button { background: none; border: 0; padding: 10px 4px 14px; font-size: 12px; font-weight: 700; color: var(--muted); display: grid; justify-items: center; gap: 2px; }
.phone-nav button.on { color: var(--air); }
.phone-nav svg { width: 22px; height: 22px; }
.side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.side h2 { font-size: 26px; }
.side p { max-width: 60ch; margin: 0; }
.note { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; }
.note h4 { font-size: 14px; margin-bottom: 6px; }
.note ul { margin: 0; padding-left: 18px; }

/* Componentes */
.btn { border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 800; background: var(--air); color: #fff; width: 100%; font-size: 15px; }
.btn.alt { background: var(--surface-2); color: var(--fg); border: 1px solid var(--line); }
.btn.hot { background: var(--hot); }
.btn.ok { background: var(--ok); }
.btn.sm { width: auto; padding: 8px 12px; font-size: 13px; border-radius: 9px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.card.tap { cursor: pointer; text-align: left; width: 100%; }
.card.tap:hover { border-color: var(--air); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st-aberto { background: var(--warn-soft); color: var(--warn); }
.st-aguardando { background: var(--hot-soft); color: var(--hot); }
.st-a_caminho { background: var(--air-soft); color: var(--air); }
.eta { display: flex; justify-content: space-between; align-items: center; background: var(--air-soft); color: var(--air); border-radius: 12px; padding: 10px 12px; }
.eta b { font-family: var(--f-display); font-size: 24px; }
.map .pin-me { fill: var(--air); stroke: var(--surface); stroke-width: 3; }
.map .pulse { fill: var(--air); opacity: .18; }
.st-no_local { background: var(--navy); color: var(--surface); }
.st-concluido { background: var(--ok-soft); color: var(--ok); }
.st-pendente { background: var(--warn-soft); color: var(--warn); }
.st-verificado { background: var(--ok-soft); color: var(--ok); }
.urg { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--hot); }
.hello h1 { font-size: 24px; }
.hero-cta { background: var(--navy); color: #fff; border-radius: 18px; padding: 18px; display: grid; gap: 10px; }
:root[data-theme="dark"] .hero-cta { background: #16304F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-cta { background: #16304F; } }
.hero-cta h3 { font-size: 19px; }
.hero-cta .btn { background: #fff; color: #10233F; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 700; }
.chip.on { border-color: var(--air); background: var(--air-soft); color: var(--air); }
.opt-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 10px; text-align: left; font-size: 13px; font-weight: 700; min-height: 56px; }
.opt small { display: block; font-weight: 500; color: var(--muted); }
.opt.on { border-color: var(--air); background: var(--air-soft); }
.field { display: grid; gap: 4px; }
.field input, .field select, .field textarea { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 11px; width: 100%; }
.field textarea { min-height: 70px; resize: vertical; }
.upload { border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px; display: flex; gap: 12px; align-items: center; cursor: pointer; }
.upload input { display: none; }
.thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.thumbs img, .thumb-ph { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.thumb-ph { display: grid; place-items: center; background: var(--surface-2); font-size: 10px; color: var(--muted); text-align: center; padding: 4px; }
.price { background: var(--surface-2); border-radius: 12px; padding: 12px; display: grid; gap: 4px; }
.price b { font-family: var(--f-display); font-size: 22px; }
.steps { display: flex; gap: 6px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--line); }
.steps span.on { background: var(--air); }
.back { background: none; border: 0; padding: 0; color: var(--muted); font-weight: 700; font-size: 13px; align-self: flex-start; }

/* Linha do tempo */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; padding-bottom: 14px; position: relative; font-size: 14px; }
.timeline li::before { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); margin-top: 3px; z-index: 1; }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.now::before { background: var(--air); border-color: var(--air); box-shadow: 0 0 0 4px var(--air-soft); }
.timeline li.todo { color: var(--muted); }
.tech { display: flex; gap: 12px; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; background: var(--air); flex: none; font-family: var(--f-display); }
.stars { color: #E2A417; letter-spacing: 1px; }
.rate { display: flex; gap: 4px; }
.rate button { background: none; border: 0; font-size: 28px; color: var(--line); padding: 0 2px; }
.rate button.on { color: #E2A417; }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.check:last-child { border-bottom: 0; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--ok); }
.meas { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.online { display: flex; align-items: center; justify-content: space-between; background: var(--ok-soft); color: var(--ok); border-radius: 12px; padding: 10px 12px; font-weight: 800; }
.online.off { background: var(--surface-2); color: var(--muted); }
.switch { width: 46px; height: 26px; border-radius: 999px; background: var(--line); border: 0; position: relative; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; border-radius: 50%; background: #fff; top: 3px; left: 3px; transition: left .15s; }
.switch.on { background: var(--ok); }
.switch.on::after { left: 23px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.big { font-family: var(--f-display); font-size: 28px; font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 10px; }
.bars div { flex: 1; display: grid; gap: 4px; justify-items: center; font-size: 11px; color: var(--muted); }
.bars i { display: block; width: 100%; border-radius: 6px 6px 2px 2px; background: var(--air); }

/* Mapa */
.map { width: 100%; height: auto; display: block; border-radius: 12px; }
.map .land { fill: var(--land); }
.map .water { fill: var(--water); }
.map .road { stroke: var(--road); fill: none; }
.map text { fill: var(--muted); font: 600 8px var(--f-body); }
.map .pin-tec { fill: var(--ok); stroke: var(--surface); stroke-width: 2; }
.map .pin-tec.off { fill: var(--muted); }
.map .pin-ch { fill: var(--hot); stroke: var(--surface); stroke-width: 2; }
.map .pin-ch.aceito { fill: var(--air); }
.map .pin-sede { fill: var(--navy); }
.map .sel { stroke: var(--fg); stroke-width: 2.5; }
.map .route { stroke: var(--air); stroke-width: 2.5; stroke-dasharray: 5 4; fill: none; }

/* Painel */
.panel { display: grid; gap: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { font-size: 26px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tabs button.on { color: var(--fg); border-bottom-color: var(--air); }
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 2px; }
.kpi b { font-family: var(--f-display); font-size: 22px; font-variant-numeric: tabular-nums; }
.kpi.alert { border-color: var(--hot); }
.split { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.box h3 { font-size: 16px; }
.queue { display: grid; gap: 8px; max-height: 520px; overflow-y: auto; }
.qitem { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; cursor: pointer; background: var(--surface); text-align: left; }
.qitem.sel { border-color: var(--air); box-shadow: 0 0 0 2px var(--air-soft); }
.qitem.urgente { border-left: 4px solid var(--hot); }
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.doc { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 18px; }
.doc-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-bottom: 2px solid var(--navy); padding-bottom: 14px; }
.doc-head img { height: 52px; }
:root[data-theme="dark"] .doc-head img { filter: brightness(0) invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .doc-head img { filter: brightness(0) invert(1); } }
.doc h3 { font-size: 15px; }
.docs-list { display: flex; flex-wrap: wrap; gap: 6px; }
.docs-list span { font-size: 12px; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px; }
.docs-list span.ok { border-color: var(--ok); color: var(--ok); }
.docs-list span.no { border-color: var(--warn); color: var(--warn); }

/* Tela do desenvolvedor */
.dev { display: grid; gap: 16px; }
.dev pre { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; overflow-x: auto; font: 13px/1.5 var(--f-mono); margin: 0; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--fg); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }

@media (max-width: 1080px) { .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .split { grid-template-columns: 1fr; } }
@media (max-width: 820px) { .stage { grid-template-columns: 1fr; } .phone { margin: 0 auto; } }
@media (max-width: 480px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phone { border: 0; border-radius: 16px; height: 720px; box-shadow: none; border: 1px solid var(--line); }
  .phone-status { display: none; }
  .doc { padding: 16px; }
  .brand span { display: none; }
  .guide li:not(.now) { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
