/* ============================================================================
   NCC Atende — identidade própria: base neutra clara, barra lateral carvão
   (alternável para clara), verde-petróleo como único acento. Vermelho / âmbar /
   verde só para severidade e situação. Inter com números tabulares.
   ============================================================================ */
:root {
  --primary-color: #0E7C86;      /* acento: botão primário, item ativo, selo, foco */
  --primary-dark: #0B626A;
  --primary-soft: #E6F3F4;
  --success-color: #2E7D32; --success-bg: #EAF5EB;
  --danger-color: #C62828;  --danger-bg: #FDECEC;
  --warning-color: #B45309; --warning-bg: #FFF5E6;
  --info-color: #0277BD;    --info-bg: #EAF4FB;
  --text-dark: #15171A; --text-2: #4B5058; --text-gray: #8A9099; --text-light: #FFFFFF;
  --bg-light: #F4F9F8; --bg-white: #FFFFFF; --line: #DFE9E7; --line-soft: #ECF3F1;
  --side-bg: #E2F0ED; --side-ink: #2C4A47; --side-ink-strong: #0F2A28; --side-hover: rgba(14,124,134,.08); --side-active: rgba(14,124,134,.14); --side-line: #CFE2DE;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.16);
  --radius: 10px; --radius-lg: 14px;
  --side-w: 248px; --top-h: 52px;
  --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
  --graphite: #2F5A57;
}
.side.light { --side-bg: #0F474D; --side-ink: #BFD9DA; --side-ink-strong: #FFFFFF; --side-hover: rgba(255,255,255,.07); --side-active: rgba(255,255,255,.14); --side-line: rgba(255,255,255,.1); }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg-light); color: var(--text-dark); font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01"; }
body { overflow: hidden; }
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 15px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.muted { color: var(--text-gray); }
svg { flex-shrink: 0; }
a { color: inherit; }

/* -------------------- Botões -------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--text-dark); font-size: 14px; font-weight: 600; padding: 9px 14px; border-radius: var(--radius); transition: background .15s, border-color .15s, transform .08s, box-shadow .15s; white-space: nowrap; line-height: 1.2; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: #FAFBFC; border-color: #D5D8DD; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--line-soft); border-color: transparent; color: var(--text-dark); }
.btn-danger { background: var(--danger-color); border-color: var(--danger-color); color: #fff; }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--danger-color); }
.btn-danger-ghost:hover { background: var(--danger-bg); border-color: transparent; }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:focus-visible, input:focus, select:focus, textarea:focus, .nav-item:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(14,124,134,.22); border-color: var(--primary-color); }
.link { border: none; background: none; padding: 0; color: var(--text-2); font-weight: 600; font-size: 13px; text-decoration: underline; text-decoration-color: #C9CDD3; text-underline-offset: 2px; cursor: pointer; }
.link:hover { color: var(--text-dark); }

/* -------------------- Campos -------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.field input, .field select, .field textarea, .input { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; color: var(--text-dark); line-height: 1.4; }
.field textarea { resize: vertical; min-height: 80px; }
.field small, .hint { font-size: 12px; color: var(--text-gray); line-height: 1.5; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .field { flex: 1; }
.pw { position: relative; }
.pw input { padding-right: 76px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: none; background: var(--line-soft); color: var(--text-2); font-size: 11.5px; font-weight: 600; padding: 5px 9px; border-radius: 6px; }
.switch { position: relative; width: 44px; height: 26px; border-radius: 13px; border: none; background: #CBD0D6; transition: background .2s; flex-shrink: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch.on { background: var(--primary-color); }
.switch.on::after { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-soft); }
.switch-row b { font-size: 14px; font-weight: 600; display: block; }
.switch-row small { font-size: 12px; color: var(--text-gray); }

/* -------------------- Login -------------------- */
.auth { height: 100%; display: grid; grid-template-columns: 1fr; background: #0F3F44; overflow-y: auto; }
.auth-panel { display: none; }
.auth-form-wrap { display: flex; align-items: center; justify-content: center; padding: calc(var(--safe-top) + 24px) 20px calc(var(--safe-bottom) + 24px); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: var(--radius-lg); padding: 28px 26px; box-shadow: var(--shadow-lg); animation: pop .25s ease; }
.auth-card h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-sub { margin: 4px 0 20px; font-size: 14px; color: var(--text-gray); }
.remember { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); margin: -4px 0 14px; }
.auth-error { background: var(--danger-bg); color: var(--danger-color); border: 1px solid #F6CFCF; border-radius: var(--radius); padding: 10px 12px; font-size: 13.5px; margin-bottom: 14px; }
.caps { color: var(--warning-color); font-weight: 600; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--primary-color); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
@media (min-width: 900px) {
  .auth { grid-template-columns: 1.1fr 1fr; }
  .auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 56px 64px; color: #E6E8EB; }
  .auth-brand { display: flex; align-items: center; gap: 12px; font-size: 18px; font-weight: 800; color: #fff; }
  .auth-panel h1 { margin: 0; font-size: 38px; line-height: 1.12; letter-spacing: -.025em; color: #fff; font-weight: 800; max-width: 520px; }
  .auth-panel p { margin: 0; font-size: 16px; line-height: 1.6; color: #A9AEB7; max-width: 520px; }
  .auth-points { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; color: #C9CDD3; }
  .auth-points li { padding: 12px 14px; border: 1px solid rgba(255,255,255,.08); border-radius: var(--radius); background: rgba(255,255,255,.03); }
  .auth-points b { color: #fff; }
  .auth-panel small { color: #6B7280; font-size: 12.5px; }
}

/* -------------------- App shell -------------------- */
/* Altura real visível (iPhone/Android): --app-h vem do visualViewport (app.js), descontando barra do navegador e teclado. */
.app { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: var(--app-h, 100dvh); display: flex; overflow: hidden; }
.side { position: fixed; inset: 0 auto 0 0; width: var(--side-w); background: var(--side-bg); color: var(--side-ink); display: flex; flex-direction: column; transform: translateX(-100%); transition: transform .22s cubic-bezier(.2,.8,.2,1), background .2s; z-index: 50; border-right: 1px solid var(--side-line); }
.app.side-open .side { transform: none; }
.side-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 40; display: none; }
.app.side-open .side-backdrop { display: block; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: calc(var(--safe-top) + 16px) 16px 14px; border-bottom: 1px solid var(--side-line); }
.side-brand .brand-mark { width: 32px; height: 32px; border-radius: 9px; }
.side-brand-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-brand-txt b { color: var(--side-ink-strong); font-size: 14.5px; letter-spacing: -.01em; }
.side-brand-txt small { font-size: 11.5px; color: var(--side-ink); opacity: .8; }
.side-toggle { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--side-ink); background: linear-gradient(90deg, var(--side-ink) 50%, transparent 50%); opacity: .6; }
.side-toggle:hover { opacity: 1; }
.side-nav { flex: 1; overflow-y: auto; padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-h { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--side-ink); opacity: .65; padding: 12px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; border: none; background: transparent; color: var(--side-ink); font-size: 14px; font-weight: 500; text-align: left; width: 100%; position: relative; }
.nav-item svg { width: 18px; height: 18px; opacity: .85; }
.nav-item:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.nav-item.active { background: var(--side-active); color: var(--primary-dark); font-weight: 600; }
.side.light .nav-item.active { color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary-color); }
.nav-item .nb { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-color); color: #fff; }
.nav-item .nb.warn { background: var(--danger-color); }
.side-foot { padding: 10px; border-top: 1px solid var(--side-line); }
.side-collapse { display: none; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; margin-bottom: 4px; border-radius: 9px; border: none; background: transparent; color: var(--side-ink); font-size: 13px; font-weight: 500; text-align: left; }
.side-collapse:hover { background: var(--side-hover); color: var(--side-ink-strong); }
.side-collapse svg { flex-shrink: 0; opacity: .85; transition: transform .22s; }
.side-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 9px; border: none; background: transparent; color: var(--side-ink); text-align: left; }
.side-user:hover { background: var(--side-hover); }
.side-user-txt { display: flex; flex-direction: column; min-width: 0; }
.side-user-txt b { color: var(--side-ink-strong); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-txt small { font-size: 11.5px; opacity: .8; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--graphite); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 16px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.top { height: calc(var(--top-h) + var(--safe-top)); padding: var(--safe-top) 14px 0; display: flex; align-items: center; gap: 10px; background: rgba(244,249,248,.85); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-menu { border: none; background: transparent; color: var(--text-dark); width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.top-title { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 6px; align-items: center; }
.icon-btn { position: relative; border: none; background: transparent; color: var(--text-2); width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--line-soft); color: var(--text-dark); }
.badge { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger-color); color: #fff; font-size: 10px; font-weight: 800; line-height: 16px; text-align: center; }
.content { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page { max-width: 1200px; margin: 0 auto; padding: 18px 16px calc(var(--safe-bottom) + 48px); }
.page-narrow { max-width: 820px; }
.page-wide { max-width: 1400px; }

@media (min-width: 1024px) {
  .side { position: static; transform: none; height: 100%; flex-shrink: 0; width: var(--side-w); transition: width .22s cubic-bezier(.2,.8,.2,1), background .2s; }
  .side-collapse { display: flex; }
  /* Menu recolhido: trilho de ícones de 72px, rótulos somem, badge vira ponto, nome vira só avatar. */
  .app.side-collapsed .side { --side-w: 72px; }
  .app.side-collapsed .side-brand { flex-direction: column; gap: 12px; padding-left: 12px; padding-right: 12px; }
  .app.side-collapsed .side-brand-txt, .app.side-collapsed .nav-item > span, .app.side-collapsed .side-user-txt, .app.side-collapsed .side-collapse > span { display: none; }
  .app.side-collapsed .nav-h { font-size: 0; line-height: 0; padding: 0; height: 1px; margin: 8px 14px; overflow: hidden; opacity: 1; background: var(--side-line); }
  .app.side-collapsed .side-nav { padding: 10px 12px; }
  .app.side-collapsed .nav-item { justify-content: center; padding: 11px 0; }
  .app.side-collapsed .nav-item.active::before { left: -12px; }
  .app.side-collapsed .nav-item .nb { position: absolute; top: 6px; right: 8px; margin: 0; min-width: 8px; width: 8px; height: 8px; padding: 0; font-size: 0; }
  .app.side-collapsed .side-user, .app.side-collapsed .side-collapse { justify-content: center; padding: 8px 0; }
  .app.side-collapsed .side-collapse svg { transform: rotate(180deg); }
  /* Dica com o nome ao passar o mouse (só com o menu recolhido). */
  .app.side-collapsed .side-nav { overflow: visible; }
  .app.side-collapsed .side-brand, .app.side-collapsed .side-foot { position: relative; }
  .app.side-collapsed [data-tip] { position: relative; }
  .app.side-collapsed [data-tip]::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-6px, -50%); background: #0F2A28; color: #fff; font-size: 12.5px; font-weight: 600; line-height: 1; padding: 8px 11px; border-radius: 8px; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .12s, transform .16s cubic-bezier(.2,.8,.2,1); z-index: 60; box-shadow: 0 6px 18px rgba(16,24,40,.18); }
  .app.side-collapsed [data-tip]::before { content: ""; position: absolute; left: calc(100% + 8px); top: 50%; transform: translate(-6px, -50%); border: 6px solid transparent; border-right-color: #0F2A28; border-left: 0; opacity: 0; transition: opacity .12s, transform .16s; pointer-events: none; z-index: 60; }
  .app.side-collapsed [data-tip]:hover::after, .app.side-collapsed [data-tip]:focus-visible::after, .app.side-collapsed [data-tip]:hover::before, .app.side-collapsed [data-tip]:focus-visible::before { opacity: 1; transform: translate(0, -50%); transition-delay: .05s; }
  .app.side-collapsed .side-brand .brand-mark { position: relative; }
  .side-backdrop, .top-menu { display: none !important; }
  .top { padding: 0 24px; }
  .page { padding: 24px 24px 56px; }
}

/* -------------------- Cartões, listas, etiquetas -------------------- */
.card { background: var(--bg-white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 16px 18px; }
.card + .card { margin-top: 14px; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-h h2 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -.005em; }
.card-h h3 { margin: 0; font-size: 12.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; }
.card-h > span { font-size: 12.5px; color: var(--text-gray); }
.grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; } .grid-3 { grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line-soft); }
.list > .item:first-child { border-top: 0; }
.item-btn { cursor: pointer; border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; background: transparent; border-left: 0; border-right: 0; border-bottom: 0; width: calc(100% + 16px); text-align: left; color: inherit; font: inherit; }
.item-btn:hover { background: #FAFBFC; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-size: 14px; font-weight: 600; line-height: 1.35; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-sub { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-time { font-size: 12px; color: var(--text-gray); width: 86px; flex-shrink: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; font-size: 11px; font-weight: 650; padding: 2px 8px; border-radius: 6px; background: var(--line-soft); color: var(--text-2); }
.tag.ok { background: var(--success-bg); color: var(--success-color); }
.tag.warn { background: var(--warning-bg); color: var(--warning-color); }
.tag.bad { background: var(--danger-bg); color: var(--danger-color); }
.tag.info { background: var(--info-bg); color: var(--info-color); }
.tag.accent { background: var(--primary-soft); color: var(--primary-dark); }
/* Faixas de nota */
.nota { display: inline-flex; align-items: baseline; gap: 2px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.nota.big { font-size: 32px; }
.nota small { font-size: .55em; font-weight: 600; color: var(--text-gray); }
.f-critico { color: var(--danger-color); } .f-ruim { color: #D97706; } .f-regular { color: var(--text-2); } .f-bom { color: var(--primary-dark); } .f-excelente { color: var(--success-color); }
.tag.f-critico { background: var(--danger-bg); } .tag.f-ruim { background: #FEF3E2; } .tag.f-regular { background: var(--line-soft); } .tag.f-bom { background: var(--primary-soft); } .tag.f-excelente { background: var(--success-bg); }
.pill-nota { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 30px; padding: 0 8px; border-radius: 8px; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; border: 1px solid var(--line); background: #fff; }
.pill-nota.f-critico { border-color: #F6CFCF; background: var(--danger-bg); }
.pill-nota.f-ruim { border-color: #F7DFB8; background: #FEF3E2; }
.pill-nota.f-bom { border-color: #BFE0E3; background: var(--primary-soft); }
.pill-nota.f-excelente { border-color: #C6E6C8; background: var(--success-bg); }

/* KPI: número principal + secundárias divididas por linhas */
.kpis { display: grid; grid-template-columns: 1fr 1fr; background: var(--bg-white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.kpis > div { padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); }
.kpis > div:nth-child(-n+2) { border-top: 0; }
.kpis > div:nth-child(even) { border-left: 1px solid var(--line); }
.kpis b { font-size: 22px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.kpis .kpi-main b { font-size: 40px; letter-spacing: -.03em; }
.kpis span { font-size: 12px; color: var(--text-gray); }
@media (min-width: 900px) { .kpis { grid-template-columns: 1.5fr repeat(4, 1fr); } .kpis > div { border-top: 0 !important; border-left: 1px solid var(--line); } .kpis > div:first-child { border-left: 0; } }

.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-lg); margin-bottom: 14px; border: 1px solid var(--line); background: #fff; font-size: 13.5px; }
.banner > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.banner b { font-size: 14px; } .banner span { color: var(--text-2); }
.banner.info { background: var(--info-bg); border-color: #CFE4F3; } .banner.info > svg { color: var(--info-color); }
.banner.bad { background: var(--danger-bg); border-color: #F6CFCF; } .banner.bad > svg { color: var(--danger-color); }
.banner.warn { background: var(--warning-bg); border-color: #F7DFB8; } .banner.warn > svg { color: var(--warning-color); }
.empty { text-align: center; color: var(--text-2); padding: 40px 20px; max-width: 420px; margin: 0 auto; }
.empty > svg { width: 30px; height: 30px; color: var(--text-gray); }
.empty h3 { margin: 10px 0 4px; font-size: 15px; color: var(--text-dark); }
.empty p { margin: 0 0 14px; font-size: 13px; line-height: 1.5; }
.empty-sm { padding: 10px 0 4px; font-size: 13px; color: var(--text-gray); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--text-gray); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }

/* Tabelas densas */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.t th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: .04em; background: #F4F5F7; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.clk { cursor: pointer; } table.t tr.clk:hover td { background: #FAFBFC; }
table.t td.r, table.t th.r { text-align: right; }

/* Barras / gráfico simples */
.bar { height: 6px; border-radius: 4px; background: var(--line-soft); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--graphite); border-radius: 4px; }
.bar i.bad { background: var(--danger-color); } .bar i.ok { background: var(--success-color); }
.dist { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--line-soft); }
.dist i { display: block; height: 100%; }
.dist .d-critico { background: var(--danger-color); } .dist .d-ruim { background: #D97706; } .dist .d-regular { background: #9AA0A8; } .dist .d-bom { background: var(--primary-color); } .dist .d-excelente { background: var(--success-color); }
.legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding-top: 8px; }
.chart .c { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.chart .c i { display: block; width: 100%; max-width: 28px; border-radius: 4px 4px 0 0; background: var(--graphite); }
.chart .c span { font-size: 10px; color: var(--text-gray); }

/* Filtros / segmentos / chips */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar select { width: auto; padding: 8px 10px; font-size: 13.5px; }
.seg { display: inline-flex; background: #ECEEF1; padding: 3px; border-radius: 10px; }
.seg button { border: none; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-2); }
.seg button.on { background: #fff; color: var(--text-dark); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--text-2); font-size: 12.5px; font-weight: 600; padding: 5px 11px; border-radius: 16px; }
.chip.on { background: var(--graphite); border-color: var(--graphite); color: #fff; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--text-gray); min-width: 220px; }
.search input { flex: 1; border: none; background: transparent; padding: 9px 0; outline: none; color: var(--text-dark); min-width: 0; font-size: 14px; }
.search:focus-within { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(14,124,134,.16); }

/* -------------------- Conversa (timeline) -------------------- */
.conv-head { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.conv-title { flex: 1; min-width: 0; }
.conv-head h2 { margin: 0; font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.conv-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--text-2); margin-top: 4px; }
.conv-score { margin-left: auto; text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.timeline { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 14px; font-size: 14px; line-height: 1.45; position: relative; white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); background: #fff; }
.bubble.in { align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.out { align-self: flex-end; border-bottom-right-radius: 4px; background: var(--primary-soft); border-color: #D2E8EA; }
.bubble .b-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; color: var(--text-gray); margin-top: 4px; justify-content: flex-end; }
.bubble.in .b-meta { justify-content: flex-start; }
.bubble .b-who { font-size: 11.5px; font-weight: 700; color: var(--primary-dark); margin-bottom: 2px; }
.bubble.in .b-who { color: var(--text-2); }
.bubble .b-media { font-style: italic; color: var(--text-2); }
.gap { align-self: center; font-size: 11.5px; color: var(--text-gray); background: var(--line-soft); padding: 2px 10px; border-radius: 10px; margin: 4px 0; }
.gap.slow { background: var(--warning-bg); color: var(--warning-color); }
.gap.bad { background: var(--danger-bg); color: var(--danger-color); }
.day-sep { align-self: center; font-size: 11px; font-weight: 700; color: var(--text-gray); letter-spacing: .04em; text-transform: uppercase; margin: 8px 0 4px; }
.quote { border-left: 3px solid var(--line); padding: 6px 10px; font-size: 13px; color: var(--text-2); border-radius: 0 6px 6px 0; background: #FAFBFC; }
.quote b { display: block; font-size: 11.5px; color: var(--text-gray); font-weight: 600; margin-bottom: 2px; }
.bullets { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.6; }
.bullets li + li { margin-top: 4px; }
.dl { margin: 0; display: grid; grid-template-columns: 1fr; }
.dl > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 13.5px; }
.dl > div:first-child { border-top: 0; }
.dl dt { color: var(--text-gray); } .dl dd { margin: 0; text-align: right; font-weight: 600; }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 3px 10px 3px 3px; border-radius: 16px; background: var(--line-soft); }

/* -------------------- Chat interno -------------------- */
.chat { display: grid; grid-template-columns: 1fr; height: 100%; min-height: 0; }
.app.rota-chat .content { overflow: hidden; display: flex; flex-direction: column; }
.app.rota-chat .content > .chat { flex: 1; height: auto; }
.chat-list { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chat-room { display: none; flex-direction: column; min-height: 0; background: var(--bg-light); }
.chat.open .chat-list { display: none; } .chat.open .chat-room { display: flex; }
@media (min-width: 1024px) { .chat { grid-template-columns: 320px 1fr; } .chat-list { display: flex !important; } .chat-room { display: flex !important; } }
.chat-list-h { padding: 12px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.chat-rooms { flex: 1; overflow-y: auto; }
.room { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 14px; border: none; border-bottom: 1px solid var(--line-soft); background: #fff; text-align: left; color: inherit; font: inherit; }
.room:hover { background: #FAFBFC; } .room.sel { background: var(--primary-soft); }
.room-main { flex: 1; min-width: 0; } .room-main b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-main small { display: block; font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room .nb { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; background: var(--primary-color); color: #fff; }
.chat-room-h { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--line); }
.chat-room-h b { font-size: 15px; } .chat-room-h small { display: block; font-size: 12px; color: var(--text-gray); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.cm { max-width: 72%; display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; gap: 2px; }
.cm .cm-b { max-width: 100%; }
.cm.me { align-self: flex-end; align-items: flex-end; }
.cm .cm-who { font-size: 11.5px; font-weight: 700; color: var(--text-2); padding: 0 4px; }
.cm .cm-b { padding: 8px 12px; border-radius: 14px; background: #fff; border: 1px solid var(--line); font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; border-bottom-left-radius: 4px; }
.cm.me .cm-b { background: var(--graphite); color: #fff; border-color: var(--graphite); border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.cm .cm-t { font-size: 10.5px; color: var(--text-gray); padding: 0 4px; }
.cm-ref { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; margin-top: 6px; padding: 4px 8px; border-radius: 6px; background: rgba(0,0,0,.05); text-decoration: underline; cursor: pointer; }
.cm.me .cm-ref { background: rgba(255,255,255,.12); }
.chat-room { position: relative; }
.chat-input { position: relative; display: flex; align-items: flex-end; gap: 6px; padding: 10px 14px calc(var(--safe-bottom) + 10px); background: #fff; border-top: 1px solid var(--line); }
.chat-input textarea { flex: 1; resize: none; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 20px; font-size: 14.5px; line-height: 1.4; background: var(--bg-light); font-family: inherit, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; }
.chat-input textarea:focus { background: #fff; }
.ci-btn { width: 40px; height: 40px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border: none; border-radius: 50%; background: transparent; color: var(--text-2); transition: background .15s, color .15s, transform .1s; }
.ci-btn svg { width: 22px; height: 22px; }
.ci-btn:hover, .ci-btn.on { background: var(--primary-soft); color: var(--primary-color); }
.ci-btn:active { transform: scale(.94); }
.ci-btn.off { opacity: .4; }
.ci-send { height: 40px; border-radius: 20px; padding: 0 16px; }
.ci-send svg { width: 16px; height: 16px; }
@media (max-width: 600px) { .ci-send span { display: none; } .ci-send { width: 40px; padding: 0; } .chat-input { padding-left: 8px; padding-right: 8px; gap: 2px; } }

/* Painel de emojis (estilo WhatsApp) */
.emoji-pop { position: absolute; left: 10px; bottom: calc(100% + 8px); width: min(380px, calc(100vw - 20px)); height: 360px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; z-index: 30; animation: epIn .16s cubic-bezier(.2,.8,.2,1); }
@keyframes epIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
.ep-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.ep-tab { flex: 1; min-width: 36px; height: 36px; border: none; background: transparent; font-size: 19px; border-bottom: 2px solid transparent; opacity: .55; filter: grayscale(.5); transition: opacity .15s, filter .15s; }
.ep-tab:hover { opacity: .85; } .ep-tab.on { opacity: 1; filter: none; border-bottom-color: var(--primary-color); }
.ep-busca { display: flex; align-items: center; gap: 8px; margin: 8px 10px 4px; padding: 0 10px; height: 34px; border-radius: 9px; background: var(--bg-light); border: 1px solid var(--line-soft); color: var(--text-gray); }
.ep-busca svg { width: 15px; height: 15px; } .ep-busca input { flex: 1; border: none; background: transparent; outline: none; font-size: 13.5px; min-width: 0; box-shadow: none !important; padding: 0; }
.ep-corpo { flex: 1; overflow-y: auto; padding: 2px 8px 10px; }
.ep-corpo h4 { margin: 8px 4px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-gray); position: sticky; top: 0; background: #fff; padding: 4px 0; z-index: 1; }
.ep-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); }
.ep-e { height: 38px; border: none; background: transparent; border-radius: 8px; font-size: 24px; line-height: 1; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; transition: background .1s, transform .1s; }
.ep-e:hover { background: var(--bg-light); transform: scale(1.15); }
.ep-nada { padding: 30px 10px; text-align: center; color: var(--text-gray); font-size: 13px; }

/* Bolhas com arquivos e emojis */
.cm .cm-b { font-family: inherit, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji"; }
.cm-txt a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.cm.com-anexo .cm-b { padding: 4px; }
.cm.com-anexo .cm-txt { padding: 6px 8px 4px; }
.cm-img { display: block; border-radius: 10px; overflow: hidden; background: var(--line-soft); cursor: zoom-in; max-width: 100%; }
.cm-img img { display: block; max-width: 100%; max-height: 320px; height: auto; object-fit: cover; }
.cm-img + .cm-img, .cm-file + .cm-file { margin-top: 4px; }
.cm-file { display: flex; align-items: center; gap: 10px; min-width: 230px; max-width: 320px; padding: 8px 10px; border-radius: 10px; background: rgba(15,42,40,.05); color: inherit; text-decoration: none; transition: background .15s; }
.cm.me .cm-file { background: rgba(255,255,255,.12); }
.cm-file:hover { background: rgba(15,42,40,.09); } .cm.me .cm-file:hover { background: rgba(255,255,255,.2); }
.cf-ico { width: 38px; height: 44px; flex-shrink: 0; border-radius: 6px; background: #5B6470; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .02em; display: inline-flex; align-items: flex-end; justify-content: center; padding-bottom: 7px; position: relative; overflow: hidden; }
.cf-ico::after { content: ""; position: absolute; top: 0; right: 0; width: 11px; height: 11px; background: rgba(255,255,255,.35); border-bottom-left-radius: 4px; }
.cf-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cf-txt b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-txt small { font-size: 11.5px; opacity: .7; }
.cf-dl { opacity: .6; display: inline-flex; } .cf-dl svg { width: 18px; height: 18px; }
.cm-audio { width: 260px; max-width: 100%; height: 40px; display: block; }
.cm-video { width: 300px; max-width: 100%; border-radius: 10px; display: block; background: #000; }
.cm-dl { display: block; font-size: 11.5px; opacity: .7; padding: 2px 6px 4px; color: inherit; }
.cm-emoji { font-size: 34px; line-height: 1.15; padding: 2px 4px; font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif; }
.cm-emoji.e1 { font-size: 48px; } .cm-emoji.e2 { font-size: 40px; }
.cm-pend .cm-b { opacity: .85; }
.cm-pend.erro .cm-b { background: var(--danger-bg); color: var(--danger-color); border-color: #F3C7C7; }
.cm-prog { height: 3px; margin: 6px 4px 2px; border-radius: 3px; background: rgba(255,255,255,.25); overflow: hidden; }
.cm-prog i { display: block; height: 100%; background: #fff; transition: width .2s; }

/* Área de soltar arquivos */
.chat-drop { position: absolute; inset: 0; z-index: 40; background: rgba(244,249,248,.9); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; padding: 20px; pointer-events: none; }
.chat-drop > div { border: 2px dashed var(--primary-color); border-radius: 18px; padding: 36px 40px; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--primary-dark); background: #fff; text-align: center; }
.chat-drop svg { width: 34px; height: 34px; } .chat-drop b { font-size: 17px; } .chat-drop span { font-size: 13px; color: var(--text-2); }

/* Prévia antes de enviar e visualizador de imagem */
.prev-list { display: flex; flex-direction: column; gap: 8px; max-height: 46vh; overflow-y: auto; }
.prev-item { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; }
.prev-item img { width: 56px; height: 56px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.prev-item.erro { background: var(--danger-bg); border-color: #F3C7C7; } .prev-item.erro small { color: var(--danger-color); font-weight: 600; }
.prev-txt { min-width: 0; display: flex; flex-direction: column; } .prev-txt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .prev-txt small { font-size: 12px; color: var(--text-gray); }
.lightbox { display: flex; align-items: center; justify-content: center; background: #0F1013; border-radius: 10px; overflow: hidden; }
.lightbox img { display: block; max-width: 100%; max-height: 72vh; object-fit: contain; }

/* -------------------- Modais (nunca fecham clicando fora) -------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15,16,19,.5); z-index: 100; display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
.modal { background: #fff; width: 100%; max-width: 540px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92vh; overflow-y: auto; padding: 18px 18px calc(var(--safe-bottom) + 18px); animation: slideUp .26s cubic-bezier(.2,.8,.2,1); }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 750; letter-spacing: -.01em; }
.modal-close { background: var(--line-soft); border: none; width: 32px; height: 32px; border-radius: 50%; font-size: 18px; color: var(--text-2); }
.modal-actions { display: flex; gap: 10px; margin-top: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal p.txt { color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
@media (min-width: 768px) { .modal-backdrop { align-items: center; } .modal { border-radius: var(--radius-lg); max-height: 88vh; } }
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; align-items: center; gap: 8px; z-index: 200; pointer-events: none; }
.toast { background: var(--text-dark); color: #fff; padding: 10px 16px; border-radius: 22px; font-size: 13.5px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; max-width: 90%; }
.toast.success { background: var(--success-color); } .toast.error { background: var(--danger-color); } .toast.info { background: var(--info-color); }

/* Notificações (painel lateral) */
.notif-panel { position: fixed; top: calc(var(--top-h) + var(--safe-top) + 6px); right: 12px; width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 60; animation: pop .18s ease; }
.notif-h { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); font-weight: 700; font-size: 14px; }
.notif { display: block; width: 100%; text-align: left; border: none; border-bottom: 1px solid var(--line-soft); background: #fff; padding: 10px 14px; color: inherit; font: inherit; }
.notif.unread { background: #F6FBFB; }
.notif b { display: block; font-size: 13.5px; } .notif span { display: block; font-size: 12.5px; color: var(--text-2); margin-top: 2px; } .notif small { display: block; font-size: 11px; color: var(--text-gray); margin-top: 4px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@media (min-width: 1600px) { .page { max-width: 1320px; } }

/* Cabeçalho da conversa em telas estreitas: título ocupa a linha toda, nota vai para baixo. */
@media (max-width: 720px) {
  .conv-head .conv-title { flex: 1 1 100%; order: 2; }
  .conv-head .conv-score { order: 1; margin-left: auto; flex-direction: row; align-items: baseline; gap: 8px; }
  .conv-head h2 { font-size: 19px; }
  .conv-meta span:empty { display: none; }
}


/* -------------------- Celular (iPhone / Android) -------------------- */
/* iOS dá zoom em campo com fonte < 16px: em telas de toque, todo campo usa 16px. */
@media (pointer: coarse) {
  input, select, textarea, .input, .field input, .field select, .field textarea, .chat-input textarea, .ep-busca input { font-size: 16px !important; }
  .ep-e:hover { transform: none; }
}
@media (max-width: 1023px) {
  /* Dentro de uma conversa do chat, a sala ocupa a tela toda (como no WhatsApp); o cabeçalho da sala tem o voltar. */
  .app.chat-sala .top { display: none; }
  .app.chat-sala .chat-room-h { padding-top: calc(var(--safe-top) + 10px); }
  .chat-room-h { gap: 8px; padding-left: 6px; }
  .chat-msgs { padding: 12px 10px; }
  .cm { max-width: 84%; }
  .emoji-pop { left: 6px; right: 6px; width: auto; height: min(320px, 45vh); bottom: calc(100% + 6px); }
  .ep-tab { min-width: 34px; font-size: 18px; }
  .cm-file { min-width: 0; max-width: 100%; }
  .cm-img img { max-height: 260px; }
}
@media (max-width: 600px) {
  .page { padding-left: 12px; padding-right: 12px; }
  .toolbar { gap: 8px; }
  .toolbar .search { flex: 1 1 100%; }
  .toolbar > input[type="date"], .toolbar > select { flex: 1 1 calc(50% - 8px); min-width: 0; }
  .modal { padding-left: 16px; padding-right: 16px; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1 1 auto; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex-shrink: 0; }
}
