/* Layout: app de celular numa coluna, barra azul-marinho no topo, abas fixas embaixo; no computador a coluna fica centralizada. */
:root {
  --navy: #1E2150;        /* azul da marca */
  --sky: #91B3EE;         /* azul-claro do V */
  --bg: #F3F5FA;
  --surface: #FFFFFF;
  --sunk: #E8ECF5;
  --ink: #1E2150;
  --text: #2A2E4F;
  --muted: #646A8C;
  --line: #D6DCEA;
  --accent: #1E2150;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EBFB;
  --bar: #1E2150; --bar-ink: #FFFFFF; --bar-sub: #91B3EE;
  --urgente: #C0322B; --urgente-soft: #FBE3E1;
  --alta: #B8630B;    --alta-soft: #FBEBD6;
  --media: #3B63B8;   --media-soft: #E1E9FA;
  --baixa: #646A8C;   --baixa-soft: #E8ECF5;
  --ok: #23845A;      --ok-soft: #DDF2E7; --ok-ink: #FFFFFF;
  --font: "Poppins", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --r: 14px;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11132C; --surface: #1A1D3F; --sunk: #23274F; --ink: #F1F4FC; --text: #DCE2F2; --muted: #9AA3C7; --line: #2E3360;
  --accent: #91B3EE; --accent-ink: #11132C; --accent-soft: #263063;
  --bar: #161939; --bar-ink: #FFFFFF; --bar-sub: #91B3EE;
  --urgente: #FF8E86; --urgente-soft: #43202A; --alta: #F2B064; --alta-soft: #3D2C1E;
  --media: #9DBBF2; --media-soft: #22305A; --baixa: #9AA3C7; --baixa-soft: #262A52;
  --ok: #78D3A6; --ok-soft: #1B3A35; --ok-ink: #0F2A1E; color-scheme: dark; } }
:root[data-theme="dark"] {
  --bg: #11132C; --surface: #1A1D3F; --sunk: #23274F; --ink: #F1F4FC; --text: #DCE2F2; --muted: #9AA3C7; --line: #2E3360;
  --accent: #91B3EE; --accent-ink: #11132C; --accent-soft: #263063;
  --bar: #161939; --bar-ink: #FFFFFF; --bar-sub: #91B3EE;
  --urgente: #FF8E86; --urgente-soft: #43202A; --alta: #F2B064; --alta-soft: #3D2C1E;
  --media: #9DBBF2; --media-soft: #22305A; --baixa: #9AA3C7; --baixa-soft: #262A52;
  --ok: #78D3A6; --ok-soft: #1B3A35; --ok-ink: #0F2A1E; color-scheme: dark; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body { background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; }
h1, h2, h3 { color: var(--ink); margin: 0; line-height: 1.2; text-wrap: balance; font-weight: 600; }
.label { font-size: .7rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Barra superior ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 6; background: var(--bar); color: var(--bar-ink); }
.bar-in { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 12px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); min-height: 60px; }
.bar .back { border: 0; background: rgb(255 255 255 / .1); color: inherit; width: 36px; height: 36px; border-radius: 50%; font-size: 20px; line-height: 1; flex: none; }
.bar-title { min-width: 0; margin-right: auto; }
.bar-title b { display: block; font-weight: 500; font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-title small { display: block; font-size: .64rem; letter-spacing: .32em; color: var(--bar-sub); font-weight: 500; text-transform: uppercase; }
.vmark { width: 26px; height: 27px; flex: none; }
.test-chip { white-space: nowrap; flex: none; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; border: 1px solid rgb(145 179 238 / .6); color: var(--bar-sub); border-radius: 999px; padding: 3px 9px; background: transparent; }

main { max-width: 720px; margin: 0 auto; padding-block: 18px calc(96px + env(safe-area-inset-bottom, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px; }
main.no-tabs { padding-bottom: calc(32px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Abas inferiores ---------- */
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
.tabs-in { max-width: 720px; margin: 0 auto; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
.tab { border: 0; background: transparent; padding: 8px 4px 10px; display: grid; justify-items: center; gap: 2px; font-size: .7rem; color: var(--muted); font-weight: 500; position: relative; }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); }
.tab[aria-current="page"]::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--sky); }
.tab.new .plus { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; margin-top: -18px; box-shadow: 0 4px 12px rgb(30 33 80 / .35); }
.tab .dot { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--urgente); color: #fff; font-size: .66rem; display: grid; place-items: center; }

/* ---------- Peças comuns ---------- */
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--ink); padding: 11px 18px; border-radius: 10px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: var(--ok-ink); }
.btn.danger { color: var(--urgente); }
.btn.block { width: 100%; }
.btn.small { padding: 7px 12px; font-size: .86rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.linkish { border: 0; background: none; padding: 0; color: var(--media); text-decoration: underline; font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.seg { display: flex; background: var(--sunk); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; font-weight: 500; font-size: .86rem; color: var(--muted); white-space: nowrap; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgb(20 24 60 / .14); }
.seg .count { font-size: .74rem; opacity: .7; }
.notice { border-radius: 12px; padding: 12px 14px; font-size: .88rem; background: var(--accent-soft); color: var(--ink); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.notice b { font-weight: 600; }
.notice.warn { background: var(--alta-soft); }
.empty { border: 1.5px dashed var(--line); border-radius: var(--r); padding: 28px 18px; text-align: center; color: var(--muted); font-size: .9rem; }
.empty b { display: block; color: var(--ink); font-weight: 500; font-size: 1rem; margin-bottom: 4px; }
.section-title { display: flex; align-items: baseline; gap: 8px; }
.section-title h2 { font-size: 1.05rem; margin-right: auto; }

/* ---------- Formulários ---------- */
form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field > label, .field > .lbl { font-weight: 500; color: var(--ink); font-size: .92rem; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], textarea, select { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 13px; font-size: 1rem; }
textarea { min-height: 110px; resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 7px 13px; font-size: .86rem; }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.toggle input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--navy); flex: none; }
.toggle.urg input { accent-color: var(--urgente); }
.toggle b { color: var(--ink); font-weight: 500; }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumb { position: relative; aspect-ratio: 1; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--sunk); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgb(0 0 0 / .6); color: #fff; font-size: 15px; line-height: 1; }
.code-inputs input { text-align: center; letter-spacing: .5em; font-size: 1.5rem; font-weight: 500; }

/* ---------- Chamados ---------- */
.list { display: grid; gap: 10px; }
.ticket { position: relative; display: grid; gap: 6px; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 14px 14px 20px; overflow: hidden; }
.ticket::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--stripe, var(--line)); }
.ticket[data-p="urgente"] { --stripe: var(--urgente); }
.ticket[data-p="alta"] { --stripe: var(--alta); }
.ticket[data-p="media"] { --stripe: var(--media); }
.ticket[data-p="baixa"] { --stripe: var(--baixa); }
.ticket[data-s="concluido"] { --stripe: var(--ok); }
.ticket[data-s="programado"] { --stripe: var(--accent); }
.ticket[data-s="nao_procede"] { --stripe: var(--muted); }
.ticket[data-s="aberto"][data-t="0"] { --stripe: var(--sky); }
.t-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; min-width: 0; }
.t-title { font-weight: 500; color: var(--ink); font-size: 1rem; margin-right: auto; min-width: 0; }
.t-meta { color: var(--muted); font-size: .8rem; }
.t-desc { font-size: .88rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: .7rem; font-weight: 500; white-space: nowrap; }
.pill.urgente { background: var(--urgente-soft); color: var(--urgente); }
.pill.alta { background: var(--alta-soft); color: var(--alta); }
.pill.media { background: var(--media-soft); color: var(--media); }
.pill.baixa { background: var(--baixa-soft); color: var(--baixa); }
.pill.st-aberto { background: var(--sunk); color: var(--ink); }
.pill.st-andamento { background: var(--media-soft); color: var(--media); }
.pill.st-concluido { background: var(--ok-soft); color: var(--ok); }
.pill.st-programado { background: var(--accent-soft); color: var(--ink); }
.pill.st-nao_procede { background: var(--sunk); color: var(--muted); }
.pill.priv { background: var(--sunk); color: var(--muted); }
.pill.novo { background: var(--navy); color: #fff; }
.pill.triagem { background: var(--accent-soft); color: var(--ink); }
.sla { font-size: .76rem; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.sla.late { color: var(--urgente); }
.sla.soon { color: var(--alta); }
.sla.fine { color: var(--muted); font-weight: 400; }
.mini-photos { display: flex; gap: 4px; }
.mini-photos img { width: 34px; height: 34px; object-fit: cover; border-radius: 6px; background: var(--sunk); }
.resolution { background: var(--ok-soft); border-radius: 10px; padding: 10px 12px; font-size: .86rem; color: var(--text); }
.resolution .label { color: var(--ok); }
.resolution.np { background: var(--sunk); }
.resolution.np .label { color: var(--muted); }
.resolution.prog { background: var(--accent-soft); }
.resolution.prog .label { color: var(--ink); }

.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 12px 14px; }
.kpi b { display: block; font-weight: 500; font-size: 1.8rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.kpi span { color: var(--muted); font-size: .76rem; }
.kpi.alert b { color: var(--urgente); }
.kpi.hero { background: var(--navy); border-color: var(--navy); }
.kpi.hero b { color: #fff; }
.kpi.hero span { color: var(--sky); }

/* ---------- Ficha ---------- */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); font-weight: 500; }
.facts dd { margin: 2px 0 0; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; }
.gallery button { padding: 0; border: 0; background: var(--sunk); border-radius: 10px; overflow: hidden; aspect-ratio: 4/3; max-width: 100%; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; }
.prio-pick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.prio-pick button { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 2px; font-size: .8rem; font-weight: 500; display: grid; gap: 1px; }
.prio-pick button small { font-weight: 400; color: var(--muted); font-size: .7rem; }
.prio-pick button[aria-pressed="true"][data-v="urgente"] { background: var(--urgente-soft); border-color: var(--urgente); color: var(--urgente); }
.prio-pick button[aria-pressed="true"][data-v="alta"] { background: var(--alta-soft); border-color: var(--alta); color: var(--alta); }
.prio-pick button[aria-pressed="true"][data-v="media"] { background: var(--media-soft); border-color: var(--media); color: var(--media); }
.prio-pick button[aria-pressed="true"][data-v="baixa"] { background: var(--baixa-soft); border-color: var(--baixa); color: var(--baixa); }
.timeline { list-style: none; margin: 0 0 0 6px; padding: 0; display: grid; gap: 14px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding-left: 16px; font-size: .88rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.mail::before { border-color: var(--sky); background: var(--sky); }
.timeline time { display: block; color: var(--muted); font-size: .76rem; }
.stack { display: grid; gap: 12px; }
.stack > h3 { font-size: .98rem; font-weight: 500; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* ---------- Prédio (unidades) ---------- */
.predio { display: grid; gap: 4px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.andar { display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 8px; align-items: center; }
.andar > span { font-size: .7rem; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.unids { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
.unids.um { grid-template-columns: minmax(0, 1fr); }
.unid { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: .78rem; display: flex; justify-content: space-between; gap: 6px; background: var(--bg); min-width: 0; }
.unid b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.unid.ocup { background: var(--accent-soft); border-color: transparent; }
.unid.pend { border-color: var(--alta); border-style: dashed; }
.unid em { font-style: normal; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.andar.gap > span { font-style: italic; }
.terreo { height: 6px; border-radius: 3px; background: var(--navy); margin-top: 4px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--line); }

.person { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--ink); display: grid; place-items: center; font-weight: 500; flex: none; font-size: .9rem; }
.person .who { min-width: 0; margin-right: auto; }
.person .who b { display: block; color: var(--ink); font-weight: 500; }

/* ---------- Entrada ---------- */
.splash { min-height: 100vh; min-height: 100dvh; background: var(--navy); color: #fff; }
.splash-in { max-width: 440px; margin: 0 auto; padding-block: 48px 40px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); display: grid; gap: 28px; }
.brandlock { display: grid; justify-items: center; gap: 14px; text-align: center; }
.brandlock .vbig { width: 76px; height: 78px; }
.brandlock .w1 { font-weight: 300; font-size: 2.2rem; letter-spacing: .32em; margin-right: -.32em; line-height: 1; }
.brandlock hr { width: 200px; border: 0; border-top: 1.5px solid var(--sky); margin: 0; }
.brandlock .w2 { font-weight: 500; font-size: .82rem; letter-spacing: .62em; margin-right: -.62em; color: var(--sky); }
.brandlock .tag { margin-top: 8px; font-size: .9rem; color: #D3DDF5; font-weight: 300; }
.splash .card { color: var(--text); }
.demo-list { display: grid; gap: 8px; }
.demo-list button { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid rgb(145 179 238 / .35); background: rgb(255 255 255 / .06); color: #fff; border-radius: 12px; padding: 10px 12px; }
.demo-list button .avatar { background: rgb(145 179 238 / .25); color: #fff; }
.demo-list small { display: block; color: #C3D2F2; font-size: .76rem; }
.splash .label { color: var(--sky); }
.splash p.fine { font-size: .78rem; color: #B9C6E6; text-align: center; margin: 0; }

.viewer { position: fixed; inset: 0; z-index: 30; background: rgb(0 0 0 / .9); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); }
.viewer img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.toast { position: fixed; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: .88rem; z-index: 40; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgb(0 0 0 / .25); }
.toast small { display: block; color: var(--sky); font-size: .76rem; }

@media (prefers-reduced-motion: no-preference) {
  .screen-anim { animation: fadeUp .2s ease-out; }
  @keyframes fadeUp { from { opacity: .4; transform: translateY(6px); } }
}

/* ---------- App real ---------- */
.splash .card .hint { color: var(--muted); }
.carregando { display: grid; place-items: center; gap: 14px; padding-top: 30vh; color: var(--sky); font-size: .9rem; }
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgb(145 179 238 / .3); border-top-color: var(--sky); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
.btn[aria-busy="true"] { opacity: .6; pointer-events: none; }
.foto-vazia { background: var(--sunk); }
input[type="month"] { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 11px 13px; font-size: 1rem; }
.carregando .vbig { width: 76px; height: 78px; }
