/* C.A. 360 — identidade C.A. Guimarães: Azul Profundo, Inter (títulos) e Source Sans 3 (texto). */
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('../fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('../fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 300; font-display: swap; src: url('../fonts/source-sans-3-latin-300-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 400; font-display: swap; src: url('../fonts/source-sans-3-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Source Sans 3'; font-weight: 600; font-display: swap; src: url('../fonts/source-sans-3-latin-600-normal.woff2') format('woff2'); }

:root {
  --navy: #1F3047; --navy-2: #2F486A; --blue-d: #36537D; --blue: #3D6090; --blue-h: #4D77B3; --blue-l: #B8C9E0; --mist: #E8EAED;
  --bg: #F4F5F7; --card: #FFFFFF; --ink: #1B2430; --muted: #5E6B7A; --line: #D9DEE5;
  --amber: #F2B134; --green: #2F9E6E; --red: #C2413A;
  --r: 10px; --shadow: 0 1px 2px rgba(31, 48, 71, .06), 0 4px 16px rgba(31, 48, 71, .06);
  --top-h: 58px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', sans-serif; font-size: 16px; line-height: 1.45; color: var(--ink); background: var(--bg); -webkit-text-size-adjust: 100%; }
h1, h2, h3, .btn, .tag, .chip, .tabs a, .brand-word { font-family: 'Inter', system-ui, sans-serif; }
h1 { font-size: 1.1rem; font-weight: 700; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; }
a { color: var(--blue); }
.muted { color: var(--muted); } .small { font-size: .88rem; } .pre { white-space: pre-wrap; }
[hidden] { display: none !important; }

/* ---------- topo */
header.top { position: sticky; top: 0; z-index: 30; height: var(--top-h); display: flex; align-items: center; gap: .7rem; padding: 0 .8rem;
  background: var(--navy); color: #fff; padding-top: env(safe-area-inset-top); }
header.top .top-title { flex: 1; min-width: 0; }
header.top h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
header.top .sub { font-size: .82rem; color: var(--blue-l); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
header.top .sub a { color: var(--blue-l); }
.brand { display: flex; align-items: center; text-decoration: none; color: #fff; }
.brand-logo { height: 30px; max-width: 120px; object-fit: contain; }
.brand-word { font-weight: 400; font-size: 1.05rem; color: #fff; letter-spacing: .02em; }
.brand-word b { font-weight: 700; margin-left: 2px; color: var(--blue-l); }
.auth-brand .brand-word { color: var(--navy); font-size: 1.4rem; } .auth-brand .brand-word b { color: var(--blue); }
.auth-brand .brand-logo { height: 44px; max-width: 200px; }
.icon-btn { appearance: none; border: 0; background: transparent; color: inherit; font-size: 1.35rem; line-height: 1; min-width: 40px; height: 40px;
  border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.icon-btn:hover { background: rgba(255,255,255,.1); }
main .icon-btn { color: var(--navy); background: var(--card); border: 1px solid var(--line); }
.icon-btn.back { font-size: 2rem; padding-bottom: 4px; }

main { padding: 1rem; max-width: 980px; margin: 0 auto; }
main.wide { max-width: 1400px; }
main.full { padding: 0; max-width: none; height: calc(100dvh - var(--top-h) - env(safe-area-inset-top)); position: relative; }

/* ---------- elementos */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 1rem; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--card); color: var(--navy); font-weight: 600; font-size: .9rem;
  padding: .55rem .9rem; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 40px; }
.btn:hover { border-color: var(--blue-l); background: #F7F9FC; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.danger { color: var(--red); } .btn.primary.danger, .modal-actions .btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { background: transparent; }
.btn.big { min-height: 48px; font-size: 1rem; padding: .7rem 1.2rem; }
.btn.sm { min-height: 30px; padding: .25rem .6rem; font-size: .82rem; }
.btn.active, .btn.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn:disabled { opacity: .55; cursor: default; }
.link { appearance: none; border: 0; background: none; color: var(--blue); cursor: pointer; font: inherit; padding: 0; text-decoration: underline; }
.link.danger { color: var(--red); }
.file-btn { position: relative; overflow: hidden; }
.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .1rem .45rem; border-radius: 99px; background: var(--mist); color: var(--muted); vertical-align: middle; }
.tag.ok { background: #DDF2E8; color: #1D6B48; } .tag.warn { background: #FDF0D5; color: #8A5A00; }
.bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: 1rem; }
.bar-actions .spacer { flex: 1; }
.empty { text-align: center; padding: 2rem 1rem; }
.hint { margin: -.4rem 0 .6rem; font-size: .9rem; }
select.mini { font: inherit; font-size: .9rem; padding: .45rem .6rem; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--ink); max-width: 100%; }

.field { display: block; margin-bottom: .8rem; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
.field input, .field textarea, .field select { width: 100%; font: inherit; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--blue-l); border-color: var(--blue); }
.check { display: flex; gap: .5rem; align-items: flex-start; margin: .5rem 0 .9rem; cursor: pointer; }
.check input { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--blue); }
.row2 { display: grid; grid-template-columns: 1fr 2fr; gap: .7rem; }
.progress { height: 8px; background: var(--mist); border-radius: 99px; overflow: hidden; margin: .7rem 0 .3rem; }
.progress .bar { height: 100%; width: 0; background: var(--blue); transition: width .2s; }

/* ---------- autenticação */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--navy) 0%, var(--blue-d) 100%); }
.auth-card { width: 100%; max-width: 400px; padding: 1.6rem; }
.auth-card h1 { font-size: 1.35rem; margin: .8rem 0; }
.auth-brand { margin-bottom: .4rem; }

/* ---------- listas e cartões */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: .9rem; }
.obra-card { display: block; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit; }
.obra-card .cover { aspect-ratio: 2 / 1; background: var(--mist); display: grid; place-items: center; }
.obra-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.obra-card .ph { color: var(--muted); font-size: .85rem; }
.obra-card .info, .planta-card .info { padding: .7rem .8rem; display: flex; flex-direction: column; gap: .1rem; }
.obra-card .info span { color: var(--muted); font-size: .92rem; }
.obra-card .info small, .planta-card .info small { color: var(--muted); }
.planta-card { padding: 0; overflow: hidden; }
.planta-card .pl-img { display: block; aspect-ratio: 4 / 3; background: #fff; border-bottom: 1px solid var(--line); }
.planta-card .pl-img img { width: 100%; height: 100%; object-fit: contain; }
.card-actions { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .8rem .8rem; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.list .row { display: flex; gap: .7rem; align-items: center; flex-wrap: wrap; }
.list .row .card-actions { padding: 0; }
.list .grow { flex: 1; min-width: 200px; }
.list.compact .row { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.list li.off { opacity: .6; }
details.arq { margin-top: 1.5rem; } details.arq summary { cursor: pointer; color: var(--muted); margin-bottom: .8rem; }
.tabs { display: flex; gap: .3rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; border-bottom: 1px solid var(--line); }
.tabs a { padding: .6rem .8rem; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--blue); }
.tabs .link { margin-left: auto; font-size: .9rem; }
.kv { width: 100%; border-collapse: collapse; } .kv td { padding: .4rem 0; border-bottom: 1px solid var(--line); } .kv td:first-child { color: var(--muted); width: 45%; }
.logo-prev { max-height: 60px; display: block; margin: .3rem 0 .8rem; background: var(--navy); padding: 8px; border-radius: 8px; }
.form.card, .card.form { margin-bottom: 1rem; }
.linkbox input { width: 100%; font: inherit; font-size: .9rem; padding: .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--mist); }
.menu { display: grid; gap: .2rem; } .menu a, .menu .link { padding: .7rem .2rem; text-decoration: none; font-weight: 600; text-align: left; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .4rem; }

/* ---------- planta e marcadores */
.plan-scroll { overflow: auto; background: #fff; border-radius: var(--r); box-shadow: var(--shadow); max-height: calc(100dvh - 200px); -webkit-overflow-scrolling: touch; }
.plan, .upl-plan, .dir-plan { position: relative; width: 100%; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.plan img, .upl-plan img, .dir-plan img { display: block; width: 100%; height: auto; pointer-events: none; }
.pin { position: absolute; transform: translate(-50%, -100%); appearance: none; border: 0; background: none; padding: 0 0 9px; cursor: pointer;
  font-family: 'Inter', sans-serif; font-size: clamp(.72rem, 1.1vw, .9rem); font-weight: 600; line-height: 1; touch-action: none; }
.pin span { display: inline-block; background: var(--blue); color: #fff; padding: .32rem .5rem; border-radius: 99px; white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pin::after { content: ''; position: absolute; left: 50%; bottom: 0; width: 2px; height: 9px; background: var(--blue); transform: translateX(-50%); }
.pin::before { content: ''; position: absolute; left: 50%; bottom: -3px; width: 6px; height: 6px; border-radius: 50%; background: var(--navy); transform: translateX(-50%); }
.pin i { position: absolute; top: -8px; right: -8px; font-style: normal; background: var(--amber); color: var(--navy); border-radius: 99px; min-width: 18px; height: 18px; display: grid; place-items: center; font-size: .65rem; padding: 0 4px; }
.pin.none span { background: #8C99A8; } .pin.none::after { background: #8C99A8; }
.pin.edit span { outline: 2px dashed var(--amber); outline-offset: 2px; }
.pin.sel span { background: var(--navy); outline: 3px solid var(--amber); }
.pin.sel.sug span { outline-style: dashed; }
.pin.me span { background: var(--navy); }
.dir-plan { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; cursor: crosshair; margin: .6rem 0; }

/* ---------- envio da visita */
.upl { display: grid; gap: .8rem; }
.upl-pick { text-align: center; padding: 2rem 1rem; }
.upl-work { display: grid; gap: .7rem; }
.upl-current { display: grid; gap: .5rem; }
.upl-prev { position: relative; background: var(--navy); border-radius: var(--r); overflow: hidden; aspect-ratio: 2 / 1; max-height: 34vh; }
.upl-prev img { width: 100%; height: 100%; object-fit: cover; display: block; }
.upl-meta { position: absolute; left: 0; right: 0; bottom: 0; padding: .4rem .6rem; background: linear-gradient(transparent, rgba(0,0,0,.65)); color: #fff; font-size: .88rem; }
.upl-ask { background: #FFF8E8; border: 1px solid #F6DFA6; border-radius: 8px; padding: .55rem .7rem; font-size: .95rem; }
.upl-plan-wrap { background: #fff; border-radius: var(--r); box-shadow: var(--shadow); overflow: auto; max-height: 55vh; }
.upl-tools { display: flex; gap: .4rem; flex-wrap: wrap; }
.upl-strip { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; -webkit-overflow-scrolling: touch; }
.upl-strip .thumb { flex: 0 0 auto; width: 112px; appearance: none; border: 2px solid transparent; border-radius: 8px; padding: 0; background: var(--card); cursor: pointer; position: relative; overflow: hidden; text-align: left; }
.upl-strip .thumb img, .upl-strip .thumb .ph { display: block; width: 100%; aspect-ratio: 2 / 1; object-fit: cover; background: var(--mist); }
.upl-strip .thumb small { display: block; padding: .2rem .35rem; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upl-strip .thumb.cur { border-color: var(--blue); }
.upl-strip .thumb.sug small { color: #8A5A00; } .upl-strip .thumb.skip { opacity: .45; }
.upl-strip .thumb em { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: .75rem; color: #fff; }
.upl-strip .thumb em.ok { background: var(--green); } .upl-strip .thumb em.err { background: var(--red); }
.upl-strip .thumb.st-enviando { border-color: var(--amber); }
.upl-send { display: grid; gap: .3rem; }
@media (min-width: 900px) {
  .upl-work { grid-template-columns: 380px 1fr; align-items: start; }
  .upl-current { grid-column: 1; } .upl-plan-wrap { grid-column: 2; grid-row: 1 / span 3; max-height: calc(100dvh - 140px); }
  .upl-tools, .upl-strip, .upl-send { grid-column: 1; }
  .upl-strip { flex-wrap: wrap; max-height: 260px; overflow-y: auto; }
}

/* ---------- visualizador */
.tour { position: absolute; inset: 0; background: #0d1520; overflow: hidden; }
.tour-view { position: absolute; inset: 0; }
.tour-view.crosshair::after { content: ''; position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; transform: translate(-50%, -50%); z-index: 20; pointer-events: none;
  background: linear-gradient(var(--amber), var(--amber)) center / 2px 100% no-repeat, linear-gradient(var(--amber), var(--amber)) center / 100% 2px no-repeat;
  border: 2px solid var(--amber); border-radius: 50%; filter: drop-shadow(0 0 2px #000); }
.tour-tools { position: absolute; z-index: 25; right: .6rem; top: .6rem; display: flex; flex-direction: column; gap: .4rem; }
.tool { appearance: none; border: 0; cursor: pointer; width: 62px; padding: .45rem .2rem; border-radius: 10px; background: rgba(31,48,71,.86); color: #fff;
  display: grid; gap: 2px; justify-items: center; font-family: 'Inter', sans-serif; backdrop-filter: blur(4px); }
.tool b { font-size: 1.1rem; line-height: 1; } .tool span { font-size: .66rem; font-weight: 600; }
.tool.on { background: var(--amber); color: var(--navy); }
.tour-banner { position: absolute; z-index: 26; top: .6rem; left: 50%; transform: translateX(-50%); width: min(560px, calc(100% - 100px)); background: rgba(255,248,232,.97);
  color: var(--ink); border-radius: 10px; padding: .55rem .75rem; font-size: .92rem; box-shadow: var(--shadow); }
.timeline { position: absolute; z-index: 25; left: 0; right: 0; bottom: 52px; display: flex; gap: .35rem; padding: .4rem .6rem; overflow-x: auto;
  -webkit-overflow-scrolling: touch; scrollbar-width: none; pointer-events: none; }
.timeline > * { pointer-events: auto; }
.chip { appearance: none; flex: 0 0 auto; border: 1px solid rgba(255,255,255,.35); background: rgba(31,48,71,.82); color: #fff; padding: .35rem .7rem;
  border-radius: 99px; font-size: .78rem; font-weight: 600; cursor: pointer; backdrop-filter: blur(4px); }
.chip.on { background: var(--amber); color: var(--navy); border-color: var(--amber); }
@media (min-width: 641px) { .timeline { left: 230px; } }
@media (max-width: 640px) {
  .tour-tools { top: auto; bottom: 96px; right: .4rem; } .tool { width: 54px; }
  .timeline { bottom: 50px; } .tour-banner { width: calc(100% - 1.2rem); top: .5rem; }
}

/* marcadores de anotação */
.anot-pin { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 .8rem 'Inter', sans-serif; color: var(--navy);
  background: var(--amber); border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.45); cursor: pointer; }
.anot-pin.s-resolvida { background: var(--green); color: #fff; }
.anot-tip b { display: block; font-weight: 600; } .anot-tip small { opacity: .8; }
.anot-list { padding-left: 1.3rem; } .anot-list li { margin-bottom: .6rem; } .anot-list li.s-resolvida button { color: var(--green); }
.anot-list button { text-align: left; } .anot-list small { display: block; }
.anot-text { font-size: 1.05rem; white-space: pre-wrap; }

/* PSV: cores da marca */
.psv-container { font-family: 'Source Sans 3', sans-serif; }
.psv-navbar { background: rgba(31,48,71,.85); }
.psv-caption-content { font-family: 'Inter', sans-serif; font-size: .82rem; }
.psv-map__container { border: 2px solid rgba(255,255,255,.85); }
.psv-tooltip { font-family: 'Source Sans 3', sans-serif; }

/* ---------- comparação */
.cmp-bar { position: absolute; z-index: 5; flex-wrap: wrap; top: 0; left: 0; right: 0; display: flex; gap: .5rem; align-items: center; justify-content: center; padding: .5rem; background: rgba(31,48,71,.9); color: #fff; }
.cmp-bar select { max-width: 42vw; }
.cmp { position: absolute; inset: 52px 0 0 0; display: flex; gap: 2px; background: #000; }
.cmp-side { position: relative; flex: 1; min-width: 0; min-height: 0; }
.cmp-view { position: absolute; inset: 0; background: #0d1520; }
.cmp-label { position: absolute; z-index: 10; left: .5rem; top: .5rem; background: rgba(31,48,71,.86); color: #fff; padding: .25rem .6rem; border-radius: 99px; font: 600 .78rem 'Inter', sans-serif; pointer-events: none; }
.panzoom { overflow: hidden; touch-action: none; background: #fff; }
.panzoom img { position: absolute; left: 0; top: 0; transform-origin: 0 0; max-width: none; user-select: none; -webkit-user-drag: none; }
@media (max-aspect-ratio: 1/1) { .cmp { flex-direction: column; } }
.cmp-overlay { position: absolute; inset: 0; z-index: 1000; background: #000; }
.cmp-overlay .cmp-bar { justify-content: space-between; }

/* ---------- cliente */
header.top.client .brand-word { font-size: .95rem; }
@media (max-width: 560px) { header.top.client .brand-word { font-size: .72rem; max-width: 92px; line-height: 1.15; white-space: normal; display: block; } header.top.client .brand-logo { height: 24px; max-width: 80px; } }
.tour.client .timeline { bottom: 50px; }
.floating { position: absolute; z-index: 26; left: .6rem; top: .6rem; }
.hint-bubble { position: absolute; z-index: 24; left: 50%; top: 40%; transform: translate(-50%, -50%); background: rgba(31,48,71,.88); color: #fff; padding: .7rem 1rem;
  border-radius: 12px; max-width: min(360px, 80vw); text-align: center; font-size: .95rem; pointer-events: none; transition: opacity .6s; }
.hint-bubble.fade { opacity: 0; }

/* ---------- janelas e avisos */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(13,21,32,.55); display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.modal { background: var(--card); border-radius: 14px; width: 100%; max-width: 460px; box-shadow: 0 20px 60px rgba(0,0,0,.35); max-height: calc(100dvh - 2rem); display: flex; flex-direction: column; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .9rem 1rem .2rem; }
.modal-head h2 { margin: 0; } .modal-head .icon-btn { color: var(--muted); }
.modal-body { padding: .6rem 1rem; overflow-y: auto; }
.modal-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; padding: .6rem 1rem 1rem; }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 1.2rem; transform: translate(-50%, 150%); background: var(--navy); color: #fff; padding: .7rem 1rem;
  border-radius: 10px; max-width: calc(100% - 2rem); box-shadow: 0 8px 24px rgba(0,0,0,.3); transition: transform .25s; font-size: .95rem; }
.toast.show { transform: translate(-50%, 0); }
.toast.error { background: var(--red); } .toast.ok { background: var(--green); }

@media (max-width: 560px) {
  main { padding: .75rem; }
  .row2 { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .modal-wrap { align-items: end; padding: 0; }
  .modal { border-radius: 14px 14px 0 0; max-height: 92dvh; }
}
#al-banner { top: 60px; z-index: 30; }
@media (max-width: 560px) { .cmp-bar select { max-width: 36vw; font-size: .8rem; } }
