/* ===================================================================
   CLIENTE GVA — sistema de design
   Regras de uso em CLAUDE.md. Use sempre os tokens abaixo.
   =================================================================== */
:root {
  /* Marca */
  --navy: #012B52;
  --navy-2: #023A6E;
  --navy-3: #07577B;
  --gold: #D4A853;
  --gold-2: #7A5A12;
  --gold-soft: #FAF3E3;
  /* Texto e superfícies */
  --ink: #0A1A2A;
  --slate: #3D5568;
  --muted: #526879;
  --line: #CFDAE3;
  --line-2: #EBF0F4;
  --bg: #F0F4F7;
  --surface: #FFFFFF;
  /* Status: use sempre junto de texto ou ícone */
  --green: #166B4A;
  --green-soft: #E3F3EC;
  --red: #B42318;
  --red-soft: #FDECEA;
  --amber: #8F5206;
  --amber-soft: #FEF3DC;
  --blue: #1D5FA8;
  --blue-soft: #E5EFFA;
  --purple: #6941C6;
  --purple-soft: #F0EBFB;
  /* Tipografia */
  --fs-mini: 12px;
  --fs-legenda: 13px;
  --fs-texto: 15px;
  --fs-campo: 16px;
  --fs-secao: 18px;
  --fs-titulo: 24px;
  --fs-destaque: 30px;
  /* Espaçamento */
  --e1: 4px;
  --e2: 8px;
  --e3: 12px;
  --e4: 16px;
  --e5: 24px;
  --e6: 32px;
  --e7: 48px;
  /* Forma */
  --raio: 12px;
  --raio-sm: 6px;
  --radius: var(--raio);
  --radius-sm: var(--raio);
  --sombra: 0 1px 3px rgba(1, 43, 82, .10);
  --sombra-alta: 0 12px 32px rgba(1, 43, 82, .18);
  --shadow: var(--sombra);
  --shadow-lg: var(--sombra-alta);
  --foco: 0 0 0 3px #fff, 0 0 0 5px var(--navy-3);
  --toque: 44px;
  --sidebar: 252px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: var(--fs-texto);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; line-height: 1.25; color: var(--navy); font-weight: 700; }
h1 { font-size: var(--fs-titulo); letter-spacing: -.02em; }
h2 { font-size: var(--fs-secao); letter-spacing: -.01em; }
h3 { font-size: var(--fs-campo); font-weight: 600; }
h4 { font-size: var(--fs-texto); font-weight: 600; }
p { margin: 0 0 var(--e3); }
a { color: var(--navy-3); }
img { max-width: 100%; }
strong, b { font-weight: 700; }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-legenda); }
.tiny { font-size: var(--fs-mini); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.center { text-align: center; }
.right { text-align: right; }
.gold { color: var(--gold-2); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Foco visível em qualquer elemento interativo, só no uso por teclado */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--foco); border-radius: var(--raio-sm); }

.splash { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: var(--e3); color: var(--muted); }

/* ---------- Ícones ---------- */
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.i.sm { width: 16px; height: 16px; }
.i.lg { width: 24px; height: 24px; }
.i.xl { width: 40px; height: 40px; stroke-width: 1.5; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--e2);
  min-height: var(--toque); padding: 0 var(--e4); border-radius: var(--raio); border: 1px solid transparent;
  background: var(--navy); color: #fff; font-weight: 600; font-size: var(--fs-texto); cursor: pointer;
  text-decoration: none; transition: background .15s, box-shadow .15s; white-space: nowrap; position: relative;
}
.btn:hover { background: var(--navy-2); }
.btn:focus-visible { border-radius: var(--raio); }
.btn:disabled, .btn[aria-disabled="true"], .btn.success:disabled, .btn.gold:disabled, .btn.danger:disabled { background: var(--line); color: var(--muted); border-color: var(--line); cursor: not-allowed; }
.btn.gold { background: var(--gold); color: var(--navy); }
.btn.gold:hover { background: #DDB566; }
.btn.ghost { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn.ghost:hover { background: var(--line-2); }
.btn.light { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn.light:hover { background: var(--line-2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.danger:hover { background: #95190F; }
.btn.success { background: var(--green); color: #fff; }
.btn.success:hover { background: #0F5239; }
.btn.texto { background: none; color: var(--navy-3); padding: 0 var(--e2); text-decoration: underline; text-underline-offset: 3px; }
.btn.texto:hover { background: var(--line-2); }
.btn.sm { min-height: 36px; padding: 0 var(--e3); font-size: var(--fs-legenda); }
.btn.block { width: 100%; }
.btn.icon { padding: 0; width: var(--toque); min-height: var(--toque); }
.btn.icon.sm { width: 36px; min-height: 36px; }
.btn.carregando { color: transparent !important; pointer-events: none; }
.btn.carregando > * { visibility: hidden; }
.btn.carregando::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; border-top-color: transparent; animation: gira .7s linear infinite; }
.btn.ghost.carregando::after, .btn.light.carregando::after, .btn.gold.carregando::after { border-color: var(--navy); border-top-color: transparent; }
@keyframes gira { to { transform: rotate(360deg); } }
.link { background: none; border: 0; padding: 0; color: var(--navy-3); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formulários ---------- */
.field { display: flex; flex-direction: column; gap: var(--e1); margin-bottom: var(--e4); min-width: 0; }
.field > label, .label { font-size: var(--fs-legenda); font-weight: 600; color: var(--slate); }
.field .dica { font-size: var(--fs-mini); color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--toque); padding: 10px var(--e3); border-radius: var(--raio);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-campo);
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 110px; resize: vertical; line-height: 1.5; }
/* Vídeo "Primeiros passos": cartão da tela inicial e player no modal */
.cartao-video { display: flex; gap: var(--e4); align-items: center; border-left: 4px solid var(--gold); }
.cartao-video h3 { font-size: var(--fs-secao); }
.capa-video { position: relative; flex: none; width: 72px; height: 128px; padding: 0; border: 0; border-radius: var(--raio-sm); overflow: hidden; cursor: pointer; background: var(--navy); }
.capa-video img { display: block; width: 100%; height: 100%; object-fit: cover; }
.capa-video .play { position: absolute; inset: 0; margin: auto; width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--navy); display: grid; place-items: center; }
.capa-video .play .i { margin-left: 2px; fill: currentColor; }
.video-guia { display: block; width: auto; max-width: 100%; height: min(70vh, 640px); aspect-ratio: 9 / 16; margin: 0 auto; border-radius: var(--raio); background: #0A1622; }
/* Imóvel vinculado ao cliente: imóvel, tipo de vínculo e remover, sempre numa linha só */
.vinculo-linha { display: grid; grid-template-columns: minmax(0, 1fr) 170px 44px; gap: var(--e2); align-items: center; margin-bottom: var(--e3); }
.vinculo-linha .input { text-overflow: ellipsis; }
@media (max-width: 560px) {
  .vinculo-linha { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) 44px; gap: 6px; }
  .vinculo-linha select.input { padding-left: 8px; padding-right: 2px; }
}
.input:focus, .input:focus-visible { outline: none; border-color: var(--navy-3); border-radius: var(--raio); box-shadow: 0 0 0 3px rgba(7, 87, 123, .2); }
.input:disabled { background: var(--line-2); color: var(--muted); }
.input[aria-invalid="true"] { border-color: var(--red); }
.campo-erro { display: flex; align-items: center; gap: var(--e1); font-size: var(--fs-legenda); font-weight: 600; color: var(--red); }
.check { display: flex; gap: var(--e3); align-items: flex-start; font-size: var(--fs-texto); cursor: pointer; min-height: 24px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--navy); flex: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--e4); }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.search { position: relative; }
.search .i { position: absolute; left: var(--e3); top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 40px; }

/* ---------- Cartões e grades ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--raio); padding: var(--e4); box-shadow: var(--sombra); min-width: 0; }
.card.flat { box-shadow: none; }
.card.tight { padding: var(--e3); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); margin-bottom: var(--e3); flex-wrap: wrap; }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: var(--e2); }
.stack { display: flex; flex-direction: column; gap: var(--e4); min-width: 0; }
.stack.sm { gap: var(--e3); }
.row { display: flex; align-items: center; gap: var(--e3); flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.nowrap { flex-wrap: nowrap; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: var(--e4); }
.grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid.side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
@media (max-width: 1100px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .grid.side { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid.c2, .grid.c3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 420px) { .grid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e3); } }
.divider { height: 1px; background: var(--line); margin: var(--e4) 0; border: 0; }

/* ---------- Etiquetas de status ---------- */
.badge { display: inline-flex; align-items: center; gap: var(--e1); padding: 2px var(--e3); border-radius: 999px; font-size: var(--fs-mini); font-weight: 600; white-space: nowrap; background: var(--line-2); color: var(--slate); }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.plain::before { display: none; }
.b-gray { background: #EEF2F6; color: #475467; }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-green { background: var(--green-soft); color: var(--green); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-navy { background: #E2E9F1; color: var(--navy); }
.b-gold { background: var(--gold-soft); color: var(--gold-2); }

.alert { display: flex; gap: var(--e3); padding: var(--e3) var(--e4); border-radius: var(--raio); background: var(--blue-soft); color: var(--navy); font-size: var(--fs-texto); align-items: flex-start; }
.alert.warn { background: var(--amber-soft); color: #6B3D05; }
.alert.err { background: var(--red-soft); color: #7A1A12; }
.alert.ok { background: var(--green-soft); color: #0F4A33; }
.alert .i { margin-top: 1px; }

/* ---------- Tabelas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: var(--fs-texto); }
.table th { position: sticky; top: 0; background: var(--surface); text-align: left; font-size: var(--fs-mini); text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: var(--e3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: var(--e3); border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:nth-child(even) td { background: #F9FBFC; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--line-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Abas e filtros ---------- */
.tabs { display: flex; gap: var(--e1); padding: var(--e1); background: #E3EAF0; border-radius: var(--raio); width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: transparent; min-height: 36px; padding: 0 var(--e4); border-radius: var(--raio-sm); font-weight: 600; font-size: var(--fs-texto); color: var(--slate); cursor: pointer; white-space: nowrap; display: inline-flex; gap: var(--e2); align-items: center; }
.tabs button.on { background: var(--surface); color: var(--navy); box-shadow: var(--sombra); }
.chips { display: flex; gap: var(--e2); flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; min-height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 0 var(--e3); font-size: var(--fs-legenda); font-weight: 600; color: var(--slate); cursor: pointer; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- Modal e avisos ---------- */
.overlay { position: fixed; inset: 0; background: rgba(1, 25, 48, .55); display: flex; align-items: center; justify-content: center; padding: var(--e4); z-index: 100; animation: fade .15s; }
.modal { background: var(--surface); border-radius: var(--raio); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--sombra-alta); animation: up .18s; }
.modal.wide { max-width: 820px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: var(--e3) var(--e4); border-bottom: 1px solid var(--line); gap: var(--e3); flex: none; }
.modal-body { padding: var(--e4); overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot { padding: var(--e3) var(--e4) calc(var(--e3) + var(--safe-bottom)); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--e3); flex-wrap: wrap; flex: none; }
@media (max-width: 640px) {
  .overlay { align-items: stretch; padding: 0; }
  .modal, .modal.wide { border-radius: 0; max-width: none; max-height: none; height: 100%; height: 100dvh; }
  .modal-foot .btn { flex: 1; }
}
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(12px); opacity: 0; } }
#toasts { position: fixed; right: var(--e4); bottom: calc(var(--e4) + var(--safe-bottom)); display: flex; flex-direction: column; gap: var(--e2); z-index: 200; max-width: calc(100vw - 32px); }
.toast { background: var(--navy); color: #fff; padding: var(--e3) var(--e4); border-radius: var(--raio); box-shadow: var(--sombra-alta); font-size: var(--fs-texto); display: flex; gap: var(--e3); align-items: center; animation: up .2s; max-width: 420px; overflow-wrap: anywhere; }
.toast.err { background: var(--red); }
.toast.ok .i { color: var(--gold); }
.toast .btn { flex: none; min-height: 36px; background: #fff; color: var(--navy); font-size: var(--fs-legenda); padding: 0 var(--e3); }
body.cliente #toasts { bottom: calc(84px + var(--safe-bottom)); }

/* ---------- Estado vazio e carregando ---------- */
.empty { text-align: center; padding: var(--e6) var(--e4); color: var(--muted); }
.empty .i { color: var(--gold-2); margin-bottom: var(--e2); }
.empty h3 { margin-bottom: var(--e1); }
.empty .btn { margin-top: var(--e3); }
.esqueleto { display: grid; gap: var(--e3); }
.esqueleto span { display: block; height: 16px; border-radius: var(--raio-sm); background: linear-gradient(90deg, #E3EAF0 25%, #F0F4F7 50%, #E3EAF0 75%); background-size: 200% 100%; animation: brilho 1.2s linear infinite; }
.esqueleto span:first-child { height: 28px; width: 45%; }
.esqueleto span:nth-child(2) { width: 70%; }
.esqueleto span.bloco { height: 96px; border-radius: var(--raio); }
@keyframes brilho { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; } }

/* ===================================================================
   Autenticação
   =================================================================== */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-art { background: radial-gradient(1200px 600px at 10% -10%, var(--navy-3) 0%, transparent 60%), var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(212, 168, 83, .3); box-shadow: 0 0 0 60px rgba(212, 168, 83, .05), 0 0 0 120px rgba(212, 168, 83, .03); }
.auth-art h1 { color: #fff; font-size: var(--fs-destaque); max-width: 460px; }
.auth-art h1 span { color: var(--gold); }
.auth-art p { color: #C8DCE8; max-width: 440px; font-size: var(--fs-campo); }
.auth-feats { display: grid; gap: 14px; max-width: 420px; position: relative; z-index: 1; }
.auth-feat { display: flex; gap: 12px; align-items: center; color: #E3EEF5; font-size: var(--fs-texto); }
.auth-feat .i { color: var(--gold); }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: var(--fs-titulo); margin-bottom: 6px; }
.logo { display: flex; align-items: center; gap: 10px; }
.logo img.marca { height: 38px; width: auto; aspect-ratio: 1136 / 500; }
.logo .nome { font-weight: 700; letter-spacing: .08em; font-size: var(--fs-legenda); color: var(--gold); text-transform: uppercase; }
.demo-box { margin-top: 22px; padding: 14px; border: 1px dashed var(--gold); border-radius: var(--radius-sm); background: var(--gold-soft); font-size: var(--fs-legenda); }
.demo-box .row { margin-top: 8px; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 28px 20px 32px; }
  .auth-art h1 { font-size: var(--fs-titulo); }
  .auth-feats { display: none; }
}

/* ===================================================================
   Área do cliente (mobile-first)
   =================================================================== */
.c-top { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
.c-top-in { max-width: 1080px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; }
.c-top .logo img.marca { height: 32px; }
.c-nav { display: flex; gap: 4px; margin-left: auto; }
.c-nav a { color: #C8DCE8; text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 600; font-size: var(--fs-texto); display: flex; gap: 8px; align-items: center; }
.c-nav a.on, .c-nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.c-main { max-width: 1080px; margin: 0 auto; padding: 20px 16px calc(100px + var(--safe-bottom)); }
.c-bottom { display: none; }
@media (min-width: 821px) { [data-avatar] { display: none !important; } }
@media (max-width: 820px) {
  .c-nav { display: none; }
  .c-bottom { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-bottom)); z-index: 40; box-shadow: var(--sombra-alta); }
  .c-bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: var(--fs-mini); font-weight: 600; padding: 6px 0; border-radius: var(--raio); }
  .c-bottom a.on { color: var(--navy); }
  .c-bottom a.on .i { color: var(--gold-2); }
  .c-bottom a.cta .bubble { width: 46px; height: 46px; border-radius: 50%; background: var(--gold); color: var(--navy); display: grid; place-items: center; margin-top: -22px; box-shadow: var(--sombra-alta); border: 3px solid #fff; }
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--fs-texto); margin-bottom: 10px; }

.hero { border-radius: var(--raio); overflow: hidden; background: var(--navy); color: #fff; position: relative; min-height: 190px; display: flex; align-items: flex-end; box-shadow: var(--shadow); }
.hero .bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: .45; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(1, 43, 82, .1) 0%, rgba(1, 43, 82, .92) 100%); }
.hero-in { position: relative; z-index: 1; padding: 20px; width: 100%; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.hero h1 { color: #fff; font-size: var(--fs-titulo); }
.hero .eyebrow { color: var(--gold); font-weight: 700; font-size: var(--fs-mini); letter-spacing: .1em; text-transform: uppercase; }
.hero .meta { color: #C8DCE8; font-size: var(--fs-texto); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.hero-in > div { min-width: 0; }
.hero select { min-height: var(--toque); background: rgba(255, 255, 255, .12); color: #fff; border: 1px solid rgba(255, 255, 255, .25); border-radius: var(--raio); padding: 8px 14px; font: inherit; font-size: var(--fs-campo); font-weight: 600; max-width: 100%; text-overflow: ellipsis; }
.hero select option { color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 12px; text-decoration: none; color: var(--navy); display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; font-weight: 600; font-size: var(--fs-texto); box-shadow: var(--shadow); transition: transform .12s, box-shadow .12s; }
.tile:hover { transform: translateY(-2px); box-shadow: var(--sombra-alta); }
.tile .ic { width: 48px; height: 48px; border-radius: var(--raio); background: var(--navy); color: var(--gold); display: grid; place-items: center; }
.tile.destaque { background: var(--gold); border-color: var(--gold); }
.tile.destaque .ic { background: var(--navy); }
@media (max-width: 640px) { .tiles { grid-template-columns: repeat(3, 1fr); gap: 10px; } .tile { padding: 14px 6px; font-size: var(--fs-mini); } .tile .ic { width: 42px; height: 42px; } }

.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line-2); text-decoration: none; color: inherit; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list-item .ic { width: 42px; height: 42px; border-radius: var(--raio); background: var(--line-2); color: var(--navy); display: grid; place-items: center; flex: none; }
.list-item .ic.gold { background: var(--gold-soft); color: var(--gold-2); }
.list-item .t { font-weight: 600; color: var(--navy); }
.list-item .chev { color: var(--muted); margin-left: auto; }

.chamado-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-decoration: none; color: inherit; box-shadow: var(--shadow); transition: box-shadow .12s; }
.chamado-card:hover { box-shadow: var(--sombra-alta); }
.chamado-card .prot { font-size: var(--fs-mini); font-weight: 700; color: var(--gold-2); letter-spacing: .04em; }

/* Linha do tempo de status (stepper) */
.stepper { display: flex; gap: 0; overflow-x: auto; padding-bottom: 4px; }
.step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: var(--fs-mini); color: var(--muted); font-weight: 600; }
.step .dot { width: 30px; height: 30px; border-radius: 50%; margin: 0 auto 6px; display: grid; place-items: center; background: #E3EAF0; color: var(--muted); position: relative; z-index: 1; }
.step::before { content: ''; position: absolute; top: 15px; left: -50%; right: 50%; height: 2px; background: #E3EAF0; }
.step:first-child::before { display: none; }
.step.done .dot { background: var(--green); color: #fff; }
.step.done::before, .step.cur::before { background: var(--green); }
.step.cur .dot { background: var(--gold); color: var(--navy); box-shadow: 0 0 0 4px var(--gold-soft); }
.step.cur { color: var(--navy); }
.step.err .dot { background: var(--red); color: #fff; }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.tl { position: relative; padding-bottom: 16px; }
.tl::before { content: ''; position: absolute; left: -21px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--navy-3); }
.tl.obs::before { border-color: var(--gold); }
.tl .when { font-size: var(--fs-mini); color: var(--muted); }

/* Anexos */
.anexos { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.anexo { position: relative; aspect-ratio: 1; border-radius: var(--raio); overflow: hidden; background: var(--line-2); border: 1px solid var(--line); display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.anexo img, .anexo video { width: 100%; height: 100%; object-fit: cover; }
.anexo .tag { position: absolute; left: 6px; bottom: 6px; background: rgba(1, 43, 82, .8); color: #fff; font-size: var(--fs-mini); padding: 2px 8px; border-radius: 999px; }
.anexo .rm { position: absolute; top: 6px; right: 6px; background: rgba(0, 0, 0, .55); color: #fff; border: 0; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; cursor: pointer; }
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); cursor: pointer; background: #FAFCFD; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: var(--gold-soft); }

/* Seleção de categoria (grid de sistemas) */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.cat { border: 1.5px solid var(--line); background: #fff; border-radius: var(--raio); padding: 12px; display: flex; gap: 10px; align-items: center; cursor: pointer; text-align: left; font-size: var(--fs-legenda); font-weight: 600; color: var(--navy); }
.cat .ic { width: 36px; height: 36px; border-radius: var(--raio); background: var(--line-2); display: grid; place-items: center; flex: none; }
.cat.on { border-color: var(--navy); background: #F3F7FB; box-shadow: 0 0 0 3px rgba(1, 43, 82, .08); }
.cat.on .ic { background: var(--navy); color: var(--gold); }
@media (max-width: 760px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .cat-grid { grid-template-columns: 1fr; } }

/* Manual */
.manual-body { font-size: var(--fs-texto); line-height: 1.7; color: #1F3346; }
.manual-body ul, .manual-body ol { padding-left: 22px; margin: 0 0 12px; }
.manual-body li { margin-bottom: 4px; }
.progress { height: 8px; border-radius: 999px; background: #E3EAF0; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--green); }
.progress.amber > span { background: var(--gold); }
.progress.red > span { background: var(--red); }

/* Estrelas */
.stars { display: inline-flex; gap: 4px; }
.stars button { background: none; border: 0; padding: 2px; cursor: pointer; color: #C9D3DC; }
.stars button.on { color: var(--gold); }
.stars button.on .i { fill: var(--gold); }

/* Chat */
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 380px; overflow-y: auto; padding: 4px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: var(--raio); font-size: var(--fs-texto); background: var(--line-2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.mine { align-self: flex-end; background: var(--navy); color: #fff; border-bottom-left-radius: 16px; border-bottom-right-radius: 4px; }
.msg .meta { font-size: var(--fs-mini); opacity: .7; margin-top: 4px; }
.chat-form { display: flex; gap: 8px; margin-top: 12px; }

/* Assinatura */
.assinatura { border: 1.5px dashed var(--line); border-radius: var(--raio); background: #FAFCFD; touch-action: none; width: 100%; height: 160px; display: block; cursor: crosshair; }
.assinatura-img { max-height: 90px; background: #fff; border-bottom: 1px solid var(--line); }

/* ===================================================================
   Painel administrativo
   =================================================================== */
.a-shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.a-side { background: var(--navy); color: #C8DCE8; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; padding: 18px 12px; }
.a-side .logo { padding: 4px 10px 18px; }
.a-side .logo img.marca { height: 34px; }
.a-nav { display: flex; flex-direction: column; gap: 2px; }
.a-nav .sec { font-size: var(--fs-mini); text-transform: uppercase; letter-spacing: .1em; color: #B4C8D9; padding: 14px 12px 6px; font-weight: 700; }
.a-nav a { display: flex; align-items: center; gap: 12px; color: #C8DCE8; text-decoration: none; padding: 9px 12px; border-radius: var(--raio); font-weight: 600; font-size: var(--fs-texto); }
.a-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.a-nav a.on { background: rgba(212, 168, 83, .14); color: #fff; }
.a-nav a.on .i { color: var(--gold); }
.a-nav a .count { margin-left: auto; background: var(--gold); color: var(--navy); font-size: var(--fs-mini); font-weight: 700; padding: 1px 8px; border-radius: 999px; }
.a-user { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255, 255, 255, .08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: var(--fs-texto); flex: none; }
.a-main { min-width: 0; }
.a-top { display: none; }
.a-content { padding: 28px 32px 48px; max-width: 1400px; }
@media (max-width: 980px) {
  .a-shell { grid-template-columns: 1fr; }
  .a-side { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; z-index: 90; transform: translateX(-100%); transition: transform .2s; }
  .a-shell.menu-on .a-side { transform: none; box-shadow: var(--shadow-lg); }
  .a-shell.menu-on::after { content: ''; position: fixed; inset: 0; background: rgba(0, 18, 36, .45); z-index: 80; }
  .a-top { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
  .a-top .logo img.marca { height: 28px; }
  .a-top .btn.icon { background: transparent; }
  .a-content { padding: 20px 16px 48px; }
}

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.kpi .lbl { font-size: var(--fs-legenda); color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-size: var(--fs-destaque); font-weight: 700; color: var(--navy); letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .lbl .i { color: var(--gold-2); }
.kpi.alerta { border-color: var(--gold); background: var(--gold-soft); }
.chart-box { position: relative; height: 260px; }

/* Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.k-col { background: #E6ECF1; border-radius: var(--radius); padding: 10px; min-height: 200px; }
.k-col.over { background: #DCE6EE; outline: 2px dashed var(--gold); }
.k-col h4 { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-size: var(--fs-legenda); }
.k-card { background: #fff; border-radius: var(--raio); padding: 12px; margin-bottom: 8px; box-shadow: var(--sombra); cursor: pointer; border: 1px solid transparent; font-size: var(--fs-legenda); }
.k-card:hover { border-color: var(--gold); }
.k-card.dragging { opacity: .5; }
.k-card .prot { font-size: var(--fs-mini); font-weight: 700; color: var(--gold-2); }

/* Calendário */
.cal-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cal-head h2 { min-width: 200px; }
.cal-head h2::first-letter, .agenda h3::first-letter { text-transform: uppercase; }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: var(--raio); overflow: hidden; }
.cal-month .dow { background: #F5F8FA; padding: 8px; font-size: var(--fs-mini); font-weight: 700; color: var(--muted); text-transform: uppercase; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; cursor: pointer; min-width: 0; }
.cal-day.out { background: #F5F8FA; color: var(--muted); }
.cal-day.today .n { background: var(--navy); color: #fff; }
.cal-day .n { font-size: var(--fs-mini); font-weight: 700; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.ev { display: block; font-size: var(--fs-mini); padding: 3px 6px; border-radius: var(--raio-sm); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; cursor: pointer; border-left: 3px solid; }
.ev.assistencia { background: var(--blue-soft); color: var(--blue); border-color: var(--blue); }
.ev.preventiva { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.ev.vistoria { background: var(--purple-soft); color: var(--purple); border-color: var(--purple); }
.ev.outro { background: var(--gold-soft); color: var(--gold-2); border-color: var(--gold); }
.ev.concluido { opacity: .55; text-decoration: line-through; }
.cal-week { display: grid; grid-template-columns: 56px repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--raio); overflow: hidden; }
.cal-week.dia { grid-template-columns: 56px 1fr; }
.cal-week .hd { background: #F5F8FA; padding: 8px; font-size: var(--fs-mini); font-weight: 700; color: var(--muted); text-align: center; border-bottom: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-week .hr { font-size: var(--fs-mini); color: var(--muted); padding: 4px 6px; border-top: 1px solid var(--line-2); height: 52px; text-align: right; }
.cal-week .slot { border-top: 1px solid var(--line-2); border-left: 1px solid var(--line); height: 52px; padding: 2px; min-width: 0; cursor: pointer; }
.cal-week .slot:hover { background: #F8FAFC; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: var(--fs-mini); color: var(--slate); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: var(--raio-sm); display: inline-block; }
@media (max-width: 760px) {
  .cal-day { min-height: 64px; padding: 3px; }
  .cal-day .ev { font-size: 0; padding: 0; height: 6px; border-left-width: 0; border-radius: var(--raio-sm); }
  .cal-month .dow { padding: 6px 2px; font-size: var(--fs-mini); text-align: center; }
  .cal-week { grid-template-columns: 40px repeat(7, minmax(0, 1fr)); font-size: var(--fs-mini); }
}

/* Impressão (relatórios) */
.print-only { display: none; }
@media print {
  body { background: #fff; }
  .no-print, .a-side, .a-top, .c-top, .c-bottom, #toasts { display: none !important; }
  .print-only { display: block; }
  .a-shell { display: block; }
  .a-content, .c-main { padding: 0; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .page-break { page-break-after: always; }
}

.demo-banner { background: var(--gold); color: var(--navy); text-align: center; font-size: var(--fs-mini); font-weight: 600; padding: var(--e1) var(--e3); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 var(--e2); }
.demo-banner button { background: none; border: 0; text-decoration: underline; font-weight: 700; cursor: pointer; color: var(--navy); }

/* ===================================================================
   Celular: nenhum texto pode ser cortado ou sair da tela
   =================================================================== */
body { overflow-wrap: break-word; }
h1, h2, h3, h4, .strong, .t { overflow-wrap: anywhere; }
.pg { min-width: 0; }

@media (max-width: 640px) {
  h1 { font-size: var(--fs-titulo); }
  .page-head > div { min-width: 0; max-width: 100%; }
  .page-head .row, .card-head .row { max-width: 100%; }
  .page-head .btn { white-space: normal; height: auto; padding-top: 8px; padding-bottom: 8px; }
  .badge { white-space: normal; line-height: 1.3; max-width: 100%; }
  .btn { white-space: normal; text-align: center; line-height: 1.25; }
  .row.between.nowrap { flex-wrap: wrap; }
  .list-item { flex-wrap: wrap; gap: 8px 12px; }
  .list-item > .grow { flex: 1 1 60%; }
  .list-item .chev { margin-left: 0; }
  .list-item > .badge { margin-left: 54px; }
  .tile { min-width: 0; overflow-wrap: anywhere; hyphens: auto; }
  .tabs { width: 100%; }
  .tabs button { padding: 8px 12px; font-size: var(--fs-legenda); flex: 1 0 auto; justify-content: center; }
  .chips .chip { font-size: var(--fs-mini); padding: 6px 10px; }
  .hero-in { flex-direction: column; align-items: stretch; }
  .hero select { width: 100%; }
  .hero .meta { gap: 6px 12px; }
  .kpi { min-width: 0; }
  .kpi .val { font-size: var(--fs-titulo); overflow-wrap: anywhere; }
  .cal-head h2 { min-width: 0; width: 100%; order: -1; }
  .cal-head .tabs { margin-left: 0 !important; }
  .chat .msg { max-width: 90%; overflow-wrap: anywhere; }
  .c-top-in .logo .nome { font-size: var(--fs-mini); }
  .modal-head h2 { font-size: var(--fs-secao); }
  .table td, .table th { padding: 10px 8px; }
  .cal-week.dia .slot { height: auto; min-height: 52px; }
  .cal-week.dia .ev { white-space: normal; font-size: var(--fs-mini); height: auto; }
  summary .row { display: block; }
  summary .badge { margin-top: 6px; }
  select.input { padding-left: 10px; padding-right: 6px; }
}
@media (max-width: 820px) {
  .c-bottom a { min-width: 0; font-size: var(--fs-mini); letter-spacing: -.01em; white-space: nowrap; }
}

/* Inventário de sistemas da obra */
.inv-item { padding: 10px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); margin-bottom: 8px; background: #fff; }
.inv-item.baixa { background: var(--amber-soft); border-color: #F3D8A5; }

/* Texto longo quebra a linha em vez de empurrar a tela no celular */
.row.nowrap { max-width: 100%; white-space: normal; }
.row.nowrap > * { min-width: 0; }

/* ===================================================================
   Toque: telas de celular e tablet
   =================================================================== */
@media (max-width: 980px) {
  .btn, .btn.sm, .btn.icon.sm, .chip, .tabs button, .a-nav a { min-height: var(--toque); }
  .btn.icon.sm { width: var(--toque); }
  .back { min-height: var(--toque); }
  summary { min-height: var(--toque); display: flex; align-items: center; }
  .stars button { min-width: var(--toque); min-height: var(--toque); display: inline-grid; place-items: center; }
  .anexo .rm { width: var(--toque); height: var(--toque); top: 0; right: 0; background: none; }
  .anexo .rm .i { background: rgba(0, 0, 0, .6); border-radius: 50%; padding: 3px; width: 24px; height: 24px; }
  .demo-banner button { min-height: var(--toque); }
  .link { min-height: var(--toque); display: inline-flex; align-items: center; }
  .btn.icon { flex: none; }
}

/* ===================================================================
   Utilitários. Vêm por último e substituem estilos escritos nas telas.
   =================================================================== */
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: var(--e1) !important; } .mt-2 { margin-top: var(--e2) !important; } .mt-3 { margin-top: var(--e3) !important; } .mt-4 { margin-top: var(--e4) !important; } .mt-5 { margin-top: var(--e5) !important; } .mt-6 { margin-top: var(--e6) !important; }
.mb-0 { margin-bottom: 0 !important; } .mb-1 { margin-bottom: var(--e1) !important; } .mb-2 { margin-bottom: var(--e2) !important; } .mb-3 { margin-bottom: var(--e3) !important; } .mb-4 { margin-bottom: var(--e4) !important; } .mb-5 { margin-bottom: var(--e5) !important; } .mb-6 { margin-bottom: var(--e6) !important; }
.ml-auto { margin-left: auto !important; }
.g-2 { gap: var(--e2) !important; } .g-3 { gap: var(--e3) !important; } .g-4 { gap: var(--e4) !important; }
.p-4 { padding: var(--e4) !important; } .py-2 { padding-top: var(--e2) !important; padding-bottom: var(--e2) !important; }
.a-start { align-items: flex-start !important; } .a-end { align-items: flex-end !important; }
.j-end { justify-content: flex-end !important; } .j-center { justify-content: center !important; }
.t-red { color: var(--red) !important; } .t-navy { color: var(--navy) !important; } .t-amber { color: var(--amber) !important; } .t-slate { color: var(--slate) !important; } .t-sec { color: var(--navy-3) !important; } .t-branco { color: #fff !important; }
.bg-cinza { background: var(--line-2) !important; } .bg-gold-soft { background: var(--gold-soft) !important; } .bg-gold { background: var(--gold) !important; } .bg-blue { background: var(--blue) !important; } .bg-purple { background: var(--purple) !important; } .bg-green { background: var(--green) !important; } .bg-none { background: transparent !important; } .bg-preto { background: #000 !important; }
.borda-gold { border-color: var(--gold) !important; }
.fs-titulo { font-size: var(--fs-titulo) !important; } .fs-secao { font-size: var(--fs-secao) !important; }
.w-auto { width: auto !important; } .w-150 { width: 150px; max-width: 100%; }
.min-200 { min-width: min(200px, 100%); } .mw-210 { max-width: 210px; } .mw-360 { max-width: 360px; } .mw-860 { max-width: 860px; }
.alt-240 { height: 240px; } .col-full { grid-column: 1 / -1; }
.sem-sublinhado { text-decoration: none !important; } .pre { white-space: pre-wrap; } .quebra { overflow-wrap: anywhere; }
.c-padrao { cursor: default !important; } .c-ponteiro { cursor: pointer; } .sem-marca { list-style: none; }
.acima { position: relative; z-index: 1; } .fixo-topo { position: sticky; top: 84px; }
ul.lista, ol.lista, .lista { padding-left: 18px; }

/* Padrões repetidos */
.linha { padding: var(--e2) 0; border-bottom: 1px solid var(--line-2); }
.linha-topo { padding: var(--e3) 0; border-top: 1px solid var(--line-2); }
.ico-box { width: var(--toque); height: var(--toque); flex: none; display: grid; place-items: center; border-radius: var(--raio); background: var(--line-2); color: var(--navy); }
.ico-box.gold { background: var(--gold-soft); color: var(--gold-2); }
.ico-box.ok { background: var(--green-soft); color: var(--green); }
.ico-box.grande { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto var(--e4); }
.protocolo { color: var(--gold-2); font-weight: 700; letter-spacing: .04em; }
.protocolo.grande { color: var(--navy); font-size: var(--fs-titulo); }
.rotulo-caps { text-transform: uppercase; font-size: var(--fs-mini); letter-spacing: .08em; }
.bloco-texto { white-space: pre-wrap; background: var(--bg); padding: var(--e3); border-radius: var(--raio); }
.destaque-gold { background: var(--gold-soft); border: 1px dashed var(--gold); border-radius: var(--raio); padding: var(--e3); }
.cabecalho-doc { border-bottom: 2px solid var(--navy); padding-bottom: var(--e3); margin-bottom: var(--e4); }
.cartao-central { max-width: 520px; margin: var(--e5) auto; padding: var(--e6) var(--e5); }
.card-link { padding: 0; overflow: hidden; text-decoration: none; color: inherit; }
.btn-linha { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }
.midia { width: 100%; border-radius: var(--raio); }
.mini-midia { max-height: 110px; border-radius: var(--raio-sm); }
.avatar-mini { width: 24px; height: 24px; font-size: var(--fs-mini); }
.logo-fundo { background: var(--navy); padding: var(--e2) var(--e3); border-radius: var(--raio); }
.btn-resp { text-align: left; cursor: pointer; }
.btn-resp.on { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }

/* Telas: filtros, capa de obra, contatos e painel */
.filtros { display: flex; flex-wrap: wrap; gap: var(--e3); }
.filtros .search { flex: 1 0 100%; }
.filtros select { flex: 1 1 200px; min-width: 0; }
.filtros .btn { flex: none; }
.filtros .input { text-overflow: ellipsis; }
.filtros > .field { flex: 1 1 240px; min-width: 0; margin: 0; }
.filtros > .field select { flex: none; }
/* O atributo hidden vence o display dos componentes (.field é flex) */
[hidden] { display: none !important; }
.chip-filtro { display: inline-flex; align-items: center; gap: var(--e2); max-width: 100%; padding: 6px 6px 6px 14px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 14px; }
.chip-filtro strong { color: var(--gold); }
/* Vistorias: pré-cadastro dentro do formulário e validação */
.pre-cadastro { border: 1px dashed var(--navy-3); background: var(--line-2); }
.destaque-validar { border-left: 4px solid var(--amber); }
.destaque-validar .linha .row.nowrap { flex-wrap: wrap; justify-content: flex-end; }
tr.muted td { color: var(--muted); }
/* Avaliações dos clientes */
.nota-aval { display: inline-flex; align-items: center; gap: 4px; padding: 2px 10px; border-radius: 999px; background: #FBF3E2; color: #7A5A12; font-weight: 700; font-size: 14px; }
.nota-aval .i { fill: var(--gold); color: var(--gold); }
.nota-aval.baixa { background: #FDECEA; color: var(--red); }
.nota-aval.baixa .i { fill: var(--red); color: var(--red); }
.alerta-aval, .coment-aval { padding: var(--e3); border: 1px solid var(--line-2); border-radius: var(--raio); background: #fff; min-width: 0; overflow-wrap: anywhere; }
.alerta-aval.a_tratar, .coment-aval.baixa { border-left: 4px solid var(--red); }
.alerta-aval.em_contato { border-left: 4px solid var(--gold); }
.alerta-aval.resolvido { border-left: 4px solid var(--green); }
.retorno-item { padding: 4px 0; color: var(--ink-2, #3D5568); }
.aval-nome { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dist-rot { width: 44px; flex: none; display: inline-flex; align-items: center; gap: 2px; }
.dist-n { width: 32px; flex: none; text-align: right; }
.dist-rot .i { fill: var(--gold); color: var(--gold); }
.sel-compacto { width: auto; max-width: 100%; min-width: 0; }
@media (max-width: 560px) {
  .card-head .sel-compacto { width: 100%; }
  .filtros > .field { flex: 1 1 calc(50% - var(--e3)); }
  .filtros > .field .input { padding-left: 10px; padding-right: 4px; }
}
.chip-filtro button { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border: 0; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; cursor: pointer; }
.chip-filtro button:hover, .chip-filtro button:focus-visible { background: rgba(255,255,255,.28); }
.capa { height: 120px; display: grid; place-items: center; color: rgba(255, 255, 255, .55); background: var(--navy) center / cover no-repeat; }
.contatos { display: flex; flex-direction: column; gap: var(--e1); }
.contatos a { display: inline-flex; align-items: center; gap: var(--e1); min-height: 24px; overflow-wrap: anywhere; min-width: 0; }
.table tr.linha-destaque td { background: var(--gold-soft); }
.a-side .logo { flex-direction: column; align-items: flex-start; gap: var(--e1); }
@media (max-width: 640px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .filtros select { flex-basis: 100%; }
}

/* ===================================================================
   Celular, downloads e acessibilidade
   =================================================================== */
.pular { position: fixed; left: var(--e2); top: -64px; z-index: 300; min-height: var(--toque); padding: 0 var(--e4); border: 0; border-radius: var(--raio); background: var(--navy); color: #fff; font-weight: 600; cursor: pointer; }
.pular:focus { top: var(--e2); }
#view:focus, #view:focus-visible { box-shadow: none; }
body.modal-aberto { overflow: hidden; }
label.btn:focus-within, .dropzone:focus-within { box-shadow: var(--foco); }

.gira { display: inline-block; width: 14px; height: 14px; flex: none; border-radius: 50%; border: 2px solid currentColor; border-top-color: transparent; animation: gira .7s linear infinite; }
.arquivo-acoes { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--e2); min-width: 0; max-width: 100%; }
.arquivo-acoes .btn { white-space: normal; }
.arquivo-acoes .desc { font-weight: 400; }
.item-arquivo { cursor: default; flex-wrap: wrap; }
.anexo .dl { position: absolute; top: var(--e1); left: var(--e1); width: 28px; height: 28px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 50%; font-size: 0; background: rgba(1, 43, 82, .85); color: #fff; cursor: pointer; }
.so-toque { display: none; }
@media (pointer: coarse) {
  .dropzone { display: none; }
  .so-toque { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e2); }
  .so-toque p { grid-column: 1 / -1; margin: 0; }
}

.agenda section + section { margin-top: var(--e4); }
.agenda h3 { font-size: var(--fs-texto); margin-bottom: var(--e1); }
.agenda-item.concluido { opacity: 1; }
.agenda-item { display: flex; gap: var(--e3); align-items: flex-start; min-height: var(--toque); padding: var(--e2) var(--e3); margin-top: var(--e2); white-space: normal; font-size: var(--fs-legenda); }
.etapa-item { padding: var(--e3) 0; border-top: 1px solid var(--line-2); cursor: pointer; }
.etapa-item .prot { font-size: var(--fs-mini); font-weight: 700; color: var(--gold-2); letter-spacing: .04em; }

@media (max-width: 1100px) { .fixo-topo { position: static; } }

@media screen and (max-width: 820px) {
  /* Cada linha de tabela vira um cartão, com os campos empilhados */
  .table-wrap { overflow: visible; }
  table.table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { border: 1px solid var(--line); border-radius: var(--raio); padding: var(--e3); margin-bottom: var(--e3); background: var(--surface); }
  .table tr:last-child { margin-bottom: 0; }
  .table td, .table td.nowrap, .table td.num, .table td.right { padding: var(--e1) 0; border: 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  .table tbody tr:nth-child(even) td, .table tr.click:hover td { background: none; }
  .table tr.linha-destaque { background: var(--gold-soft); }
  .table td[data-rotulo]::before { content: attr(data-rotulo); display: block; font-size: var(--fs-mini); font-weight: 600; color: var(--muted); }
  .table td:first-child::before { display: none !important; }
  .table td:empty { display: none; }

  /* Botão principal sempre ao alcance do polegar */
  .barra-fixa { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: flex; gap: var(--e2); justify-content: stretch; padding: var(--e2) var(--e4) calc(var(--e2) + var(--safe-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: var(--sombra-alta); }
  .barra-fixa .btn { flex: 1; }
  body.cliente .barra-fixa { bottom: calc(64px + var(--safe-bottom)); }
  body.cliente .c-main:has(.barra-fixa) { padding-bottom: calc(172px + var(--safe-bottom)); }
  .a-content:has(.barra-fixa) { padding-bottom: calc(96px + var(--safe-bottom)); }
}

@media (max-width: 980px) {
  .anexo .dl { width: var(--toque); height: var(--toque); top: 0; left: 0; background: none; }
  .anexo .dl .i { background: rgba(1, 43, 82, .85); border-radius: 50%; padding: 4px; width: 26px; height: 26px; }
}

@media (max-width: 640px) {
  .stepper { flex-direction: column; gap: var(--e2); overflow: visible; }
  .step { display: flex; align-items: center; gap: var(--e3); min-width: 0; text-align: left; font-size: var(--fs-legenda); }
  .step .dot { margin: 0; flex: none; }
  .step::before { display: none; }
  .tabs { flex-wrap: wrap; }
  .arquivo-acoes, .arquivo-acoes .btn { width: 100%; }
}
@media print {
  .pular, .anexo .dl, .anexo .rm, .barra-fixa { display: none !important; }
  .table th { position: static; }
}

/* Fluxo de execução: linha do tempo, telas por link e gravador */
.fx-lista { list-style: none; margin: 0; padding: 0; }
.fx { position: relative; display: flex; gap: var(--e3); padding-bottom: var(--e4); }
.fx:not(:last-child)::before { content: ''; position: absolute; left: 11px; top: 26px; bottom: 2px; width: 2px; background: var(--line); }
.fx.feito:not(:last-child)::before { background: var(--navy-3); }
.fx-ponto { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 2px solid var(--line); background: var(--surface); }
.fx.feito .fx-ponto { background: var(--navy); border-color: var(--navy); color: #fff; }
.fx-corpo { min-width: 0; flex: 1; }
.fx-whats { display: flex; gap: var(--e1); align-items: center; color: var(--green); margin-top: var(--e1); }
.quebra { overflow-wrap: anywhere; }
.pub { min-height: 100vh; background: var(--line-2); }
.pub-topo { background: var(--navy); padding: var(--e3) var(--e4); }
.pub-corpo { max-width: 640px; margin: 0 auto; padding: var(--e4); }
.exec-botoes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e2); }
.exec-botoes .btn { white-space: normal; text-align: center; }
/* Não comparecimento: contador da tolerância e prévia da foto */
.espera-contador { font-size: var(--fs-secao); font-weight: 700; color: var(--navy); }
.espera-contador.fim { color: var(--red); }
.ausencia { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: var(--e3); align-items: start; }
.ausencia.sem-foto { grid-template-columns: minmax(0, 1fr); }
.ausencia > .anexo { width: 96px; padding: 0; }
.ausencia > .anexo img { width: 100%; height: 100%; object-fit: cover; }
.ausencia audio { width: 100%; max-width: 320px; }
.previa { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; object-fit: cover; }
.exec-lista { list-style: none; margin: 0; padding: 0; }
.exec-item { display: flex; gap: var(--e3); align-items: center; padding: var(--e2) 0; border-top: 1px solid var(--line-2); }
.anexo-audio { grid-column: 1 / -1; display: flex; flex-direction: column; gap: var(--e1); }
.anexo-audio audio { width: 100%; }
.gravador-previa { width: 100%; max-height: 50vh; background: #000; border-radius: var(--raio-sm); }
@media (max-width: 820px) { .pub-corpo:has(.barra-fixa) { padding-bottom: calc(96px + var(--safe-bottom)); } }

/* Equipe e acessos: usuários e cargos */
.usuarios, .cargos { list-style: none; margin: 0; padding: 0; }
.usuario { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(0, 300px) 44px; gap: var(--e3); align-items: center; padding: var(--e3) 0; border-bottom: 1px solid var(--line-2); }
.usuario:last-child, .cargo-linha:last-child { border-bottom: 0; }
.usuario-id { min-width: 0; }
.usuario-nome { font-weight: 600; color: var(--ink); overflow-wrap: break-word; }
.usuario-email { font-size: var(--fs-mini); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.usuario-meta { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); min-width: 0; }
.usuario-cargo { min-width: 0; }
.usuario-cargo .badge { display: inline-block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.usuario-status { flex: none; }
.usuario-acoes { display: flex; justify-content: flex-end; }
.fim-lista { margin-bottom: 72px; }
.cargo-linha { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: var(--e3); align-items: center; padding: var(--e3) 0; border-bottom: 1px solid var(--line-2); }
.cargo-acoes { display: flex; gap: var(--e1); align-items: center; }
.matriz { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--e3); }
.modulo { border: 1px solid var(--line-2); border-radius: var(--raio-sm); padding: var(--e3); margin: 0; min-width: 0; display: grid; gap: var(--e2); align-content: start; }
.modulo legend { padding: 0 var(--e1); }
.alcance-lista { border: 1px solid var(--line-2); border-radius: var(--raio-sm); padding: var(--e3); display: grid; gap: var(--e2); }
.somente-leitura form { display: none; }
@media (max-width: 900px) {
  .usuario { grid-template-columns: auto minmax(0, 1fr) 44px; }
  .usuario-meta { grid-column: 2 / -1; grid-row: 2; }
  .cargo-linha { grid-template-columns: minmax(0, 1fr); }
  .cargo-acoes { flex-wrap: wrap; }
}
@media (max-width: 640px) { .matriz { grid-template-columns: minmax(0, 1fr); } }
/* Termo de Vistoria e Recebimento (migração 28) */
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: var(--fs-legenda); }
.sem-borda { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.sem-borda:disabled { opacity: .55; }
.borda-alerta { border-left: 4px solid var(--red); }
.termo-texto .pre-wrap { line-height: 1.6; }
.termo-leitura-fim { scroll-margin-bottom: 80px; }
