/* Digimov — painel (tema escuro, verde neon) */
@font-face { font-family: 'Inter'; src: url('fonts/inter.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Space Grotesk'; src: url('fonts/space-grotesk.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #050b08; --bg2: #08110c; --panel: #0d1a13; --panel2: #112219; --panel3: #163024;
  --line: rgba(120, 255, 180, .10); --line2: rgba(120, 255, 180, .18);
  --text: #e8fff1; --text2: #b9d6c6; --muted: #86a796;
  --neon: #39ff88; --neon-d: #1fd673; --neon-ink: #03140a; --glow: 0 0 0 1px rgba(57,255,136,.35), 0 0 22px rgba(57,255,136,.22);
  --warn: #fab219; --danger: #ff6b7d; --info: #4cc9f0; --serious: #ec835a;
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #0ca30c; --s7: #9085e9;
  --r: 14px; --r2: 10px; --r3: 7px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 10px 30px rgba(0,0,0,.35), 0 2px 6px rgba(0,0,0,.3);
  --side: 236px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased; touch-action: manipulation; -webkit-tap-highlight-color: rgba(57,255,136,.15);
  background-image: radial-gradient(1200px 600px at 85% -10%, rgba(57,255,136,.08), transparent 60%), radial-gradient(800px 500px at -10% 110%, rgba(0,229,160,.06), transparent 60%);
  background-attachment: fixed; min-height: 100vh;
}
h1, h2, h3, h4 { font-family: 'Space Grotesk', Inter, sans-serif; letter-spacing: -.01em; margin: 0 0 .5em; line-height: 1.2; text-wrap: balance; scroll-margin-top: 80px; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75em; }
a { color: var(--neon); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, .kpi b, table td.num, .tab { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 2px solid var(--neon); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--neon); color: var(--neon-ink); padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
h1 svg.i { width: 22px; height: 22px; }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; padding: 18px 12px; border-right: 1px solid var(--line); background: linear-gradient(180deg, rgba(13,26,19,.85), rgba(5,11,8,.9)); backdrop-filter: blur(10px); overflow-y: auto; overscroll-behavior: contain; }
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; text-decoration: none; color: var(--text); }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--neon); color: var(--neon-ink); display: grid; place-items: center; box-shadow: var(--glow); flex: none; }
.logo b { font-family: 'Space Grotesk'; font-size: 1.02rem; line-height: 1.1; display: block; }
.logo small { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px; color: var(--text2); text-decoration: none; font-weight: 500; min-height: 40px; position: relative; transition: background-color .15s, color .15s; }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: var(--panel2); color: var(--text); }
.nav a[aria-current="page"] { background: rgba(57,255,136,.10); color: var(--neon); box-shadow: inset 0 0 0 1px rgba(57,255,136,.25); }
.nav a[aria-current="page"]::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--neon); box-shadow: 0 0 12px var(--neon); }
.nav .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--danger); color: #fff; font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.nav-sep { margin: 12px 10px 4px; color: var(--muted); font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; }
.side-foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--panel3); display: grid; place-items: center; font-weight: 700; color: var(--neon); flex: none; font-size: .85rem; border: 1px solid var(--line2); }
.side-foot .who { min-width: 0; flex: 1; }
.side-foot .who b { display: block; font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-foot .who small { color: var(--muted); font-size: .75rem; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: rgba(5,11,8,.78); backdrop-filter: blur(12px); }
.top h1 { font-size: 1.15rem; margin: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search { position: relative; width: min(320px, 40vw); }
.search input { width: 100%; padding-left: 36px; }
.search svg { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 17px; color: var(--muted); pointer-events: none; }
.content { padding: 22px 24px 60px; max-width: 1500px; width: 100%; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.bar .grow { flex: 1; }
.mob-nav { display: none; }

/* ---------- Componentes ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, box-shadow .15s, transform .1s; }
.btn:hover { background: var(--panel3); border-color: rgba(57,255,136,.35); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--neon); color: var(--neon-ink); border-color: transparent; box-shadow: 0 0 18px rgba(57,255,136,.25); }
.btn.primary:hover { background: #6bffa8; box-shadow: var(--glow); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--danger); border-color: rgba(255,107,125,.35); background: transparent; }
.btn.danger:hover { background: rgba(255,107,125,.1); }
.btn.sm { min-height: 32px; padding: 0 11px; font-size: .86rem; border-radius: 8px; }
.btn.icon { width: 38px; padding: 0; }
.btn svg { width: 17px; height: 17px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn .spin { display: none; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn.busy .spin { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

input, select, textarea { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line2); background: var(--bg2); color: var(--text); transition: border-color .15s, box-shadow .15s; }
select { background-color: var(--bg2); color: var(--text); }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--neon); box-shadow: 0 0 0 3px rgba(57,255,136,.18); }
input::placeholder, textarea::placeholder { color: #5e7a6b; }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; min-height: 0; accent-color: var(--neon); margin: 0; flex: none; }
label.f { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; color: var(--text2); font-weight: 500; min-width: 0; }
label.f > span small { color: var(--muted); font-weight: 400; }
label.ck { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; font-size: .92rem; min-height: 32px; }
label.ck input { margin-top: 2px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.fgrid .full { grid-column: 1 / -1; }
.ferr { color: var(--danger); font-size: .82rem; min-height: 0; }
.field-err input, .field-err select, .field-err textarea { border-color: var(--danger); }
.hint { color: var(--muted); font-size: .82rem; }

.card { background: linear-gradient(180deg, var(--panel), rgba(13,26,19,.75)); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow); min-width: 0; }
.card.pad0 { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-h h2 { margin: 0; flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(175px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { position: relative; overflow: hidden; }
.kpi span { color: var(--muted); font-size: .8rem; font-weight: 500; display: block; }
.kpi b { display: block; font-family: 'Space Grotesk'; font-size: 1.85rem; line-height: 1.15; margin: 4px 0 2px; }
.kpi small { color: var(--text2); font-size: .8rem; }
.kpi.hot { border-color: rgba(57,255,136,.35); box-shadow: var(--glow); }
.kpi.hot b { color: var(--neon); text-shadow: 0 0 18px rgba(57,255,136,.45); }
.kpi.alert b { color: var(--warn); }

.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: .74rem; font-weight: 700; white-space: nowrap; border: 1px solid var(--line2); color: var(--text2); background: var(--panel2); }
.badge.g-A { background: var(--neon); color: var(--neon-ink); border-color: transparent; }
.badge.g-B { background: rgba(57,255,136,.18); color: #a8ffcb; border-color: rgba(57,255,136,.35); }
.badge.g-C { background: transparent; color: var(--muted); }
.badge.human { background: rgba(250,178,25,.14); color: var(--warn); border-color: rgba(250,178,25,.4); }
.badge.bot { background: rgba(76,201,240,.12); color: var(--info); border-color: rgba(76,201,240,.35); }
.badge.ok { color: var(--neon); border-color: rgba(57,255,136,.4); }
.badge.off { color: var(--muted); }
.badge.bad { color: var(--danger); border-color: rgba(255,107,125,.4); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--neon); box-shadow: 0 0 0 0 rgba(57,255,136,.6); animation: pulse 2s infinite; display: inline-block; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(57,255,136,.55); } 70% { box-shadow: 0 0 0 9px rgba(57,255,136,0); } 100% { box-shadow: 0 0 0 0 rgba(57,255,136,0); } }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
td.num, th.num { text-align: right; }
tbody tr:hover { background: rgba(57,255,136,.03); }
.tbl { overflow-x: auto; overscroll-behavior-x: contain; }
.tbl table { min-width: 640px; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.muted { color: var(--muted); }
.t2 { color: var(--text2); }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-family: 'Space Grotesk'; font-size: 1.05rem; margin-bottom: 4px; }
.row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row.wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.sep { height: 1px; background: var(--line); margin: 14px 0; border: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.list > li:last-child { border-bottom: 0; }
.list a.rowlink { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.list a.rowlink:hover b { color: var(--neon); }
.li-main { flex: 1; min-width: 0; }
.li-main b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-main small { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); text-decoration: none; border: 0; background: none; border-bottom: 2px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; min-height: 42px; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs [aria-selected="true"], .tabs [aria-current="page"] { color: var(--neon); border-bottom-color: var(--neon); }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--bg2); border: 1px solid var(--line); }
.seg button, .seg a { border: 0; background: none; padding: 6px 12px; border-radius: 7px; color: var(--muted); font-weight: 600; cursor: pointer; min-height: 32px; text-decoration: none; font-size: .88rem; display: inline-flex; align-items: center; }
.seg [aria-pressed="true"], .seg [aria-current="page"] { background: var(--panel3); color: var(--neon); }

/* ---------- Toasts e diálogos ---------- */
.toasts { position: fixed; right: 18px; bottom: calc(18px + var(--safe-b)); z-index: 300; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--neon); padding: 12px 14px; border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: tin .2s ease-out; }
.toast.err { border-left-color: var(--danger); }
.toast button { margin-left: auto; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
dialog { border: 1px solid var(--line2); background: var(--panel); color: var(--text); border-radius: 16px; padding: 0; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 40px); box-shadow: 0 30px 80px rgba(0,0,0,.6), var(--glow); overscroll-behavior: contain; }
dialog.wide { width: min(980px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(2,6,4,.72); backdrop-filter: blur(3px); }
dialog[open] { animation: din .18s ease-out; }
@keyframes din { from { opacity: 0; transform: translateY(10px) scale(.99); } }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.dlg-h h2 { margin: 0; flex: 1; }
.dlg-b { padding: 18px 20px; overflow-y: auto; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--panel); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; inset: -50%; background-image: linear-gradient(rgba(57,255,136,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(57,255,136,.07) 1px, transparent 1px); background-size: 46px 46px; transform: perspective(600px) rotateX(55deg) translateY(-10%); transform-origin: center; mask-image: radial-gradient(closest-side, #000 30%, transparent); animation: gridmove 14s linear infinite; }
@keyframes gridmove { to { background-position: 0 460px; } }
.auth-card { position: relative; width: min(420px, 100%); padding: 30px; }
.auth-card .logo { padding: 0 0 18px; }
.auth-card h1 { font-size: 1.5rem; }

/* ---------- Gráficos ---------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .gl { stroke: rgba(185,214,198,.10); stroke-width: 1; }
.chart .ax { fill: var(--muted); font-size: 11px; font-family: Inter; }
.chart rect.hit { fill: transparent; cursor: default; }
.chart .bar-g:hover rect.v, .chart .bar-g:focus rect.v { filter: brightness(1.25); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 10px; font-size: .82rem; color: var(--text2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tip { position: fixed; z-index: 400; pointer-events: none; background: #0b1610; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; font-size: .8rem; box-shadow: var(--shadow); max-width: 260px; }
.tip b { display: block; margin-bottom: 3px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 160px) 1fr auto; gap: 10px; align-items: center; padding: 5px 0; font-size: .88rem; }
.hbar .track { height: 12px; background: rgba(185,214,198,.06); border-radius: 0 4px 4px 0; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--neon); border-radius: 0 4px 4px 0; box-shadow: 0 0 12px rgba(57,255,136,.35); min-width: 2px; }
.hbar .fill.s { background: var(--neon-d); box-shadow: none; opacity: .75; }
.hbar b { font-variant-numeric: tabular-nums; min-width: 42px; text-align: right; }
.meter { height: 8px; border-radius: 4px; background: rgba(185,214,198,.08); overflow: hidden; display: flex; gap: 2px; }
.meter i { display: block; height: 100%; }

/* ---------- CRM (kanban) ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; overscroll-behavior-x: contain; min-height: 60vh; align-items: start; }
.col { background: rgba(13,26,19,.55); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; max-height: calc(100vh - 200px); min-width: 0; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-family: 'Space Grotesk'; }
.col-h .n { margin-left: auto; color: var(--muted); font-size: .82rem; font-family: Inter; }
.col-b { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overscroll-behavior: contain; min-height: 80px; }
.col.over { border-color: var(--neon); box-shadow: var(--glow); }
.lcard { display: block; text-decoration: none; color: inherit; background: var(--panel2); border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px; cursor: grab; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; }
.lcard:hover { border-color: rgba(57,255,136,.35); }
.lcard.dragging { opacity: .45; user-select: none; }
.lcard.need { border-color: rgba(250,178,25,.45); box-shadow: inset 3px 0 0 var(--warn); }
.lcard .nm { font-weight: 600; display: flex; gap: 8px; align-items: center; min-width: 0; }
.lcard .nm span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.lcard .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.lcard .last { color: var(--muted); font-size: .8rem; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lcard .foot { display: flex; justify-content: space-between; color: var(--muted); font-size: .75rem; margin-top: 7px; gap: 8px; }
.score-ring { --p: 0; width: 34px; height: 34px; border-radius: 50%; background: conic-gradient(var(--neon) calc(var(--p) * 1%), rgba(185,214,198,.12) 0); display: grid; place-items: center; flex: none; }
.score-ring b { width: 26px; height: 26px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-size: .72rem; font-variant-numeric: tabular-nums; }

/* ---------- Atendimento / conversa ---------- */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 360px; height: calc(100vh - 61px); min-height: 520px; }
.inbox.nolist { grid-template-columns: minmax(0, 1fr) 380px; }
.ib-list { border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.ib-list .bar { padding: 12px; margin: 0; border-bottom: 1px solid var(--line); }
.ib-items { overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.ib-item { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; min-width: 0; }
.ib-item:hover { background: rgba(57,255,136,.04); }
.ib-item[aria-current="true"] { background: rgba(57,255,136,.08); box-shadow: inset 3px 0 0 var(--neon); }
.ib-item .li-main small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ib-item time { color: var(--muted); font-size: .74rem; white-space: nowrap; }
.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: radial-gradient(600px 300px at 50% 0%, rgba(57,255,136,.04), transparent); }
.chat-h { display: flex; align-items: center; gap: 10px 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mob-back { display: none; }
@media (max-width: 900px) { .mob-back { display: inline-flex; } }
.chat-h .li-main b { font-family: 'Space Grotesk'; font-size: 1.05rem; }
.chat-h .acts { flex-basis: 100%; flex-wrap: wrap; }
.chat-h .side-tg { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 8px; overscroll-behavior: contain; }
.msg { max-width: min(78%, 560px); padding: 9px 12px 6px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; font-size: .92rem; line-height: 1.45; position: relative; }
.msg.in { align-self: flex-start; background: var(--panel3); border-top-left-radius: 4px; }
.msg.out { align-self: flex-end; background: rgba(57,255,136,.13); border: 1px solid rgba(57,255,136,.22); border-top-right-radius: 4px; }
.msg.out.human { background: rgba(76,201,240,.12); border-color: rgba(76,201,240,.3); }
.msg .mt { display: flex; gap: 8px; justify-content: flex-end; color: var(--muted); font-size: .7rem; margin-top: 4px; white-space: nowrap; }
.msg .who { font-size: .72rem; font-weight: 700; color: var(--neon); display: block; margin-bottom: 2px; }
.msg.human .who { color: var(--info); }
.msg.failed { border-color: var(--danger); }
.day-sep { align-self: center; font-size: .72rem; color: var(--muted); background: var(--panel2); padding: 3px 10px; border-radius: 10px; margin: 6px 0; }
.composer { border-top: 1px solid var(--line); padding: 12px 14px calc(12px + var(--safe-b)); display: flex; gap: 10px; align-items: flex-end; }
.composer textarea { min-height: 44px; max-height: 160px; }
.alertbar { display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: rgba(250,178,25,.10); border-bottom: 1px solid rgba(250,178,25,.3); color: #ffe2a3; font-size: .88rem; flex-wrap: wrap; }
.alertbar.info { background: rgba(76,201,240,.08); border-color: rgba(76,201,240,.25); color: #bfefff; }
.ib-side { border-left: 1px solid var(--line); overflow-y: auto; padding: 16px; overscroll-behavior: contain; }
.ib-side h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 18px 0 8px; font-family: Inter; }
.ib-side h3:first-child { margin-top: 0; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .88rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.match { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: var(--panel2); }
.match .row b { flex: 1; min-width: 0; }
.match ul { margin: 6px 0 0; padding-left: 16px; color: var(--text2); font-size: .8rem; }
.tl { list-style: none; margin: 0; padding: 0; font-size: .84rem; }
.tl li { padding: 7px 0 7px 16px; border-left: 1px solid var(--line2); position: relative; }
.tl li::before { content: ''; position: absolute; left: -4px; top: 13px; width: 7px; height: 7px; border-radius: 50%; background: var(--panel3); border: 1px solid var(--neon); }
.tl li time { color: var(--muted); font-size: .74rem; display: block; }

/* ---------- Empreendimentos ---------- */
.devs { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.dev { display: flex; flex-direction: column; text-decoration: none; color: inherit; padding: 0; overflow: hidden; transition: border-color .15s, box-shadow .15s, transform .15s; }
.dev:hover { border-color: rgba(57,255,136,.35); box-shadow: var(--glow); }
.dev-img { aspect-ratio: 16/8; background: linear-gradient(135deg, color-mix(in oklab, var(--acc, #39ff88) 35%, #050b08), #050b08); position: relative; display: grid; place-items: center; overflow: hidden; }
.dev-img img { width: 100%; height: 100%; object-fit: cover; }
.dev-img .ini { font-family: 'Space Grotesk'; font-size: 3rem; font-weight: 700; color: var(--acc, #39ff88); opacity: .9; text-shadow: 0 0 30px var(--acc, #39ff88); }
.dev-img .badge { position: absolute; left: 12px; top: 12px; background: rgba(5,11,8,.8); }
.dev-b { padding: 14px 16px 16px; }
.dev-b h2 { margin-bottom: 2px; }
.dev-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; text-align: center; }
.dev-stats div { background: var(--bg2); border-radius: 8px; padding: 7px 4px; }
.dev-stats b { display: block; font-family: 'Space Grotesk'; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.dev-stats small { color: var(--muted); font-size: .72rem; }
.mirror { display: flex; flex-direction: column-reverse; gap: 6px; }
.floor { display: flex; gap: 6px; align-items: center; }
.floor > span { width: 44px; color: var(--muted); font-size: .78rem; text-align: right; flex: none; }
.unit { min-width: 74px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; text-align: left; font-size: .78rem; line-height: 1.25; transition: border-color .12s, box-shadow .12s; }
.unit b { display: block; font-size: .86rem; }
.unit.disponivel { border-color: rgba(57,255,136,.45); }
.unit.disponivel b::after { content: ' ●'; color: var(--neon); }
.unit.reservada { border-color: rgba(250,178,25,.55); background: rgba(250,178,25,.10); }
.unit.reservada b::after { content: ' ◐'; color: var(--warn); }
.unit.vendida { opacity: .55; background: repeating-linear-gradient(135deg, var(--panel2) 0 6px, var(--bg2) 6px 12px); }
.unit.vendida b::after { content: ' ✕'; color: var(--muted); }
.unit.bloqueada { opacity: .45; border-style: dashed; }
.unit[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--neon); }
.copybox { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; white-space: pre-wrap; font-size: .88rem; position: relative; overflow-wrap: anywhere; }
.copybox + .copybox { margin-top: 8px; }
.copybox .btn { position: absolute; right: 8px; top: 8px; }
.copybox.pr { padding-right: 90px; }
.typ-row { display: grid; grid-template-columns: 1.4fr repeat(6, minmax(70px, 1fr)) 38px; gap: 8px; align-items: end; margin-bottom: 8px; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos figure { margin: 0; position: relative; width: 120px; aspect-ratio: 4/3; border-radius: 8px; overflow: hidden; border: 1px solid var(--line2); }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos figure button { position: absolute; right: 4px; top: 4px; }

/* ---------- Automações ---------- */
.auto { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.steps { list-style: none; margin: 10px 0 0; padding: 0; grid-column: 1 / -1; display: grid; gap: 8px; }
.steps li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; padding: 10px; background: var(--bg2); border-radius: 10px; border: 1px solid var(--line); }
.steps .when { font-weight: 700; color: var(--neon); font-size: .85rem; font-variant-numeric: tabular-nums; }
.switch { position: relative; width: 46px; height: 26px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: 13px; background: var(--panel3); border: 1px solid var(--line2); transition: background-color .15s; }
.switch i::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--muted); transition: transform .15s, background-color .15s; }
.switch input:checked + i { background: rgba(57,255,136,.25); border-color: var(--neon); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--neon); box-shadow: 0 0 10px var(--neon); }
.switch input:focus-visible + i { outline: 2px solid var(--neon); outline-offset: 2px; }

/* ---------- Laboratório ---------- */
.lab { display: grid; grid-template-columns: 400px minmax(0, 1fr); gap: 16px; align-items: start; }
.phone { border-radius: 34px; padding: 12px; background: #020604; border: 1px solid var(--line2); box-shadow: var(--glow), var(--shadow); }
.phone-in { border-radius: 24px; overflow: hidden; background: #0a1510; display: flex; flex-direction: column; height: 640px; }
.phone-h { padding: 14px 16px; background: #0f2219; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); }
.phone .msgs { padding: 12px; background-image: radial-gradient(rgba(57,255,136,.05) 1px, transparent 1px); background-size: 18px 18px; }
.phone .msg { max-width: 86%; font-size: .86rem; }
.phone .msg.in { align-self: flex-end; background: #1c5a3a; border-radius: 14px 4px 14px 14px; }
.phone .msg.out { align-self: flex-start; background: #15241c; border: 0; border-radius: 4px 14px 14px 14px; }
.quick { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px 0; }
.quick button { font-size: .78rem; padding: 5px 10px; border-radius: 14px; border: 1px solid rgba(57,255,136,.35); background: transparent; color: var(--neon); cursor: pointer; min-height: 30px; }
.quick button:hover { background: rgba(57,255,136,.1); }
.evbtns { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.evbtn { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); cursor: pointer; display: flex; gap: 10px; align-items: center; min-height: 56px; }
.evbtn:hover { border-color: var(--neon); box-shadow: var(--glow); }
.evbtn b { display: block; font-size: .9rem; }
.evbtn small { color: var(--muted); font-size: .75rem; }
.evbtn .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--bg2); flex: none; color: var(--neon); }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; background: var(--bg2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; overflow-x: auto; white-space: pre; display: block; color: #bfffd8; }
.urlrow { display: flex; gap: 8px; align-items: center; }
.urlrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Responsivo ---------- */
@media (max-width: 1280px) {
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .inbox .ib-side { display: none; }
  .inbox .chat-h .side-tg { display: inline-flex; }
  .inbox.side-open .ib-side { display: block; position: fixed; right: 0; top: 61px; bottom: 0; width: min(380px, 100vw); z-index: 30; background: var(--bg); box-shadow: -20px 0 40px rgba(0,0,0,.5); }
  .inbox.nolist { grid-template-columns: minmax(0, 1fr) 340px; }
  .inbox.nolist .ib-side { display: block; }
}
@media (max-width: 1080px) {
  .g-main, .g3 { grid-template-columns: 1fr; }
  .lab { grid-template-columns: 1fr; }
  .phone { max-width: 420px; }
}
@media (max-width: 900px) {
  :root { --side: 0px; }
  .app { grid-template-columns: 1fr; }
  .side { display: none; }
  .top { padding: 10px 16px; }
  .search { width: auto; flex: 1; }
  .top h1 { display: none; }
  .content { padding: 16px 16px calc(90px + var(--safe-b)); }
  .g2 { grid-template-columns: 1fr; }
  .mob-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(8,17,12,.95); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + var(--safe-b)); }
  .mob-nav a, .mob-nav button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .68rem; color: var(--muted); text-decoration: none; padding: 6px 2px; min-height: 48px; border: 0; background: none; position: relative; }
  .mob-nav svg { width: 22px; height: 22px; }
  .mob-nav [aria-current="page"] { color: var(--neon); }
  .mob-nav .count { position: absolute; top: 2px; right: calc(50% - 22px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .65rem; display: grid; place-items: center; padding: 0 4px; }
  .inbox, .inbox.nolist { grid-template-columns: 1fr; height: calc(100vh - 57px - 64px - var(--safe-b)); }
  .inbox .ib-list { display: flex; }
  .inbox.has-sel .ib-list { display: none; }
  .inbox:not(.has-sel) .chat { display: none; }
  .inbox .ib-side, .inbox.nolist .ib-side { display: none; }
  .inbox.side-open .ib-side { display: block; position: fixed; inset: 57px 0 calc(64px + var(--safe-b)) 0; z-index: 30; background: var(--bg); }
  .msg { max-width: 88%; }
  .typ-row { grid-template-columns: repeat(3, 1fr); padding-bottom: 10px; border-bottom: 1px solid var(--line); }
  .typ-row > :first-child { grid-column: 1 / -1; }
  .kanban { grid-auto-columns: 82vw; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { padding: 14px; }
  .kpi b { font-size: 1.45rem; }
  .bar > .grow { flex-basis: 100%; }
  .alertbar span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .alertbar.info { font-size: .8rem; padding: 8px 14px; }
  input, select, textarea { font-size: 16px; }
  .phone-in { height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .auth::before { animation: none; }
}
@media (forced-colors: active) { .badge, .btn, .unit { border: 1px solid CanvasText; } }
.mmedia { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.mmedia img { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; display: block; }
/* ---------- Identidade Digimov ---------- */
.logo-mark { background: none; box-shadow: none; width: 36px; height: 36px; }
.logo-mark img { width: 36px; height: 36px; display: block; filter: drop-shadow(0 0 14px rgba(57,255,136,.45)); }
.logo b { font-family: 'Space Grotesk', Inter, sans-serif; font-weight: 700; letter-spacing: -.02em; font-size: 1.12rem; }
.logo small { color: var(--neon); opacity: .8; }
.auth-card .logo-mark, .auth-card .logo-mark img { width: 48px; height: 48px; }

/* ---------- Celular: nada vaza da tela, formulários em tela cheia ---------- */
.grid > *, .stack > *, .content > * { min-width: 0; }
details.hint > .tbl, .card > .tbl { max-width: 100%; }
@media (max-width: 1080px) {
  .g-main, .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  html, body { overflow-x: hidden; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .content { padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .top { gap: 8px; padding-top: max(10px, env(safe-area-inset-top)); }
  .top .btn { padding-inline: 12px; }
  .card { padding: 14px; }
  .bar { gap: 8px; }
  .bar > select, .bar > input, .bar .seg { max-width: 100%; }
  .seg { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
  .tabs { margin-inline: -14px; padding-inline: 14px; }
  .devs { grid-template-columns: minmax(0, 1fr); }
  .card-h { flex-wrap: wrap; }
  .li-main small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .copybox.pr { padding-right: 12px; padding-top: 48px; }
  .steps li { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .auto { grid-template-columns: minmax(0, 1fr) auto; }
  .mirror { overflow-x: auto; padding-bottom: 6px; }
  .typ-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .urlrow { flex-wrap: wrap; }
  .urlrow code { flex-basis: 100%; white-space: normal; overflow-wrap: anywhere; }
  .toasts { left: 12px; right: 12px; max-width: none; bottom: calc(76px + var(--safe-b)); }

  /* Formulários (dialog) ocupam a tela inteira, com cabeçalho e botões sempre visíveis */
  dialog, dialog.wide {
    width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0;
    inset: 0; box-shadow: none;
  }
  dialog[open] { display: flex; flex-direction: column; animation-name: dinm; }
  @keyframes dinm { from { opacity: 0; transform: translateY(24px); } }
  dialog > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .dlg-h { padding: max(12px, env(safe-area-inset-top)) 16px 12px; }
  .dlg-b { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; -webkit-overflow-scrolling: touch; }
  .dlg-f { padding: 12px 16px calc(12px + var(--safe-b)); }
  .dlg-f .btn { flex: 1; justify-content: center; min-height: 46px; }
  .fgrid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .fgrid .row { flex-wrap: wrap; }
}
@media (max-width: 900px) {
  .chat-h { padding: 8px 12px; gap: 8px; }
  .chat-h .avatar { width: 30px; height: 30px; font-size: .75rem; }
  .chat-h .li-main { flex: 1 1 0; min-width: 0; }
  .chat-h .li-main b { font-size: 1rem; }
  .chat-h .score-ring, .chat-h .badge.bot { display: none; }
  .chat-h .acts { gap: 6px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .chat-h .acts .btn { flex: none; }
  .alertbar.info { font-size: .76rem; padding: 6px 12px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .alertbar.info svg { display: none; }
  .msgs { padding: 12px; }
  .composer { padding: 8px 10px calc(8px + var(--safe-b)); }
  .composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
}
