:root { --fundo: #f3f4f8; --card: #fff; --texto: #14161c; --suave: #646c7d; --linha: #e1e4ec; --cor: #4f46e5; --cor-texto: #fff; --cor-f: #eef0ff;
  --ok: #067647; --ok-f: #dcfae6; --alerta: #b54708; --alerta-f: #fef0c7; --erro: #b42318; --erro-f: #fee4e2; --azul-f: #e0f2fe; --azul: #026aa2; --cena: #dfe3ee; --sombra: 0 6px 24px rgba(20, 22, 40, .10); }
:root[data-tema="escuro"] { --fundo: #0b0d13; --card: #141722; --texto: #eceef4; --suave: #99a1b5; --linha: #262b3a; --cor: #818cf8; --cor-texto: #0b0d1f; --cor-f: #1d2040;
  --ok: #75e0a7; --ok-f: #0d3323; --alerta: #fdb022; --alerta-f: #3d2a05; --erro: #f97066; --erro-f: #3f1512; --azul-f: #0b2c40; --azul: #7cd4fd; --cena: #0a0c14; --sombra: 0 8px 30px rgba(0, 0, 0, .5); color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-tema="claro"]) { --fundo: #0b0d13; --card: #141722; --texto: #eceef4; --suave: #99a1b5; --linha: #262b3a; --cor: #818cf8; --cor-texto: #0b0d1f; --cor-f: #1d2040;
  --ok: #75e0a7; --ok-f: #0d3323; --alerta: #fdb022; --alerta-f: #3d2a05; --erro: #f97066; --erro-f: #3f1512; --azul-f: #0b2c40; --azul: #7cd4fd; --cena: #0a0c14; --sombra: 0 8px 30px rgba(0, 0, 0, .5); color-scheme: dark; } }
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--fundo); color: var(--texto); font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.muted { color: var(--suave); } .small { font-size: 12px; } .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.topo { display: flex; align-items: center; gap: 14px; padding: 8px 16px; background: var(--card); border-bottom: 1px solid var(--linha); position: sticky; top: 0; z-index: 30; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 8px; font-size: 16px; }
#abas { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
#abas button { border: 0; background: none; color: var(--suave); padding: 8px 12px; border-radius: 9px; font: inherit; cursor: pointer; white-space: nowrap; }
#abas button:hover { color: var(--texto); }
#abas button.ativa { background: var(--cor); color: var(--cor-texto); font-weight: 600; }
#abas .conta-aba { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; border-radius: 99px; background: var(--erro); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.conta { display: flex; align-items: center; gap: 8px; }
main#tela { padding: 16px; max-width: 1500px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--linha); border-radius: 14px; padding: 14px; margin-bottom: 14px; }
h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 13px; margin: 16px 0 6px; color: var(--suave); text-transform: uppercase; letter-spacing: .04em; }
label { display: grid; gap: 3px; font-size: 12px; color: var(--suave); }
input, select, textarea { font: inherit; color: var(--texto); background: var(--card); border: 1px solid var(--linha); border-radius: 9px; padding: 7px 9px; min-width: 0; }
textarea { width: 100%; min-height: 80px; resize: vertical; }
.btn { font: inherit; border: 1px solid var(--linha); background: var(--card); color: var(--texto); border-radius: 9px; padding: 7px 12px; cursor: pointer; }
.btn:hover { border-color: var(--cor); }
.btn.primario { background: var(--cor); color: var(--cor-texto); border-color: var(--cor); font-weight: 600; }
.btn.pequeno { padding: 4px 9px; font-size: 12px; } .btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ativo { background: var(--cor-f); border-color: var(--cor); color: var(--cor); font-weight: 600; }
.rolar { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--linha); text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--suave); font-weight: 600; white-space: nowrap; }
.selo { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--linha); color: var(--suave); }
.selo.ok { background: var(--ok-f); color: var(--ok); } .selo.alerta { background: var(--alerta-f); color: var(--alerta); }
.selo.erro { background: var(--erro-f); color: var(--erro); } .selo.info { background: var(--azul-f); color: var(--azul); }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.nota-aviso { background: var(--azul-f); color: var(--azul); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 12px; }
.nota-aviso.alerta { background: var(--alerta-f); color: var(--alerta); }
dialog { border: 1px solid var(--linha); border-radius: 16px; background: var(--card); color: var(--texto); width: min(760px, 94vw); padding: 18px; max-height: 90vh; overflow: auto; }
dialog::backdrop { background: rgba(0, 0, 0, .5); }
#aviso { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--texto); color: var(--fundo); padding: 9px 14px; border-radius: 10px; z-index: 60; max-width: 90vw; }
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-box { width: min(360px, 100%); } .login-box form { display: grid; gap: 10px; margin-top: 10px; } .down { color: var(--erro); }

/* ----- escritório 3D ----- */
.escritorio { position: relative; border-radius: 18px; overflow: hidden; border: 1px solid var(--linha); background: var(--cena); height: min(68vh, 720px); min-height: 420px; margin-bottom: 14px; }
.escritorio canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }
.hud { position: absolute; left: 12px; top: 12px; display: flex; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 24px); pointer-events: none; }
.hud > * { pointer-events: auto; }
.pilula { background: color-mix(in srgb, var(--card) 86%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--linha); border-radius: 12px; padding: 7px 11px; cursor: pointer; font: inherit; color: var(--texto); text-align: left; line-height: 1.2; }
.pilula b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.pilula span { font-size: 11px; color: var(--suave); }
.pilula.quente b { color: var(--erro); }
.legenda { position: absolute; left: 12px; bottom: 12px; display: flex; gap: 12px; flex-wrap: wrap; font-size: 11px; color: var(--suave); background: color-mix(in srgb, var(--card) 80%, transparent); backdrop-filter: blur(8px); padding: 6px 10px; border-radius: 10px; border: 1px solid var(--linha); }
.legenda i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dica3d { position: absolute; right: 12px; bottom: 12px; font-size: 11px; color: var(--suave); }
@media (max-width: 1000px) { .dica3d { display: none; } }
.ficha { position: absolute; top: 12px; right: 12px; bottom: 12px; width: min(380px, calc(100% - 24px)); background: color-mix(in srgb, var(--card) 94%, transparent); backdrop-filter: blur(14px); border: 1px solid var(--linha); border-radius: 16px; box-shadow: var(--sombra); padding: 14px; overflow: auto; }
.ficha .fechar { position: absolute; top: 8px; right: 8px; }
.ficha .cab { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; padding-right: 30px; }
.avatar { width: 56px; height: 56px; border-radius: 16px; object-fit: cover; flex: none; display: grid; place-items: center; font-size: 26px; color: #fff; font-weight: 700; }
.ficha h2 { margin: 0; font-size: 18px; } .ficha p { margin: 6px 0; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 10px 0; }
.numeros div { background: var(--fundo); border-radius: 10px; padding: 7px 6px; text-align: center; }
.numeros b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; } .numeros span { font-size: 10.5px; color: var(--suave); }
.lista-simples { list-style: none; margin: 0; padding: 0; } .lista-simples li { padding: 6px 0; border-bottom: 1px solid var(--linha); font-size: 13px; }
.lista-simples li:last-child { border-bottom: 0; }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 8px; background: var(--fundo); border: 1px solid var(--linha); font-size: 12px; white-space: nowrap; }
.equipe { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.cartao-agente { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--linha); border-radius: 14px; padding: 10px; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.cartao-agente:hover, .cartao-agente.sel { border-color: var(--cor); box-shadow: 0 0 0 1px var(--cor); }
.cartao-agente .avatar { width: 44px; height: 44px; border-radius: 13px; font-size: 20px; }
.cartao-agente b { display: block; } .cartao-agente .linha2 { font-size: 12px; color: var(--suave); }
.ponto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 1px; }
.trabalhando { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .25); } .de_plantao { background: #38bdf8; } .erro-p { background: #ef4444; } .sob_demanda { background: #94a3b8; }

/* ----- quadro ----- */
.categorias { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.cat { border: 1px solid var(--linha); background: var(--card); color: var(--texto); border-radius: 12px; padding: 8px 12px; cursor: pointer; font: inherit; text-align: left; border-left-width: 4px; }
.cat.ativa { box-shadow: 0 0 0 2px var(--cor); } .cat b { font-size: 18px; margin-right: 6px; font-variant-numeric: tabular-nums; } .cat small { display: block; color: var(--suave); font-size: 11px; }
.quadro { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; padding-bottom: 6px; }
.coluna { background: color-mix(in srgb, var(--card) 60%, var(--fundo)); border: 1px solid var(--linha); border-radius: 14px; padding: 8px; min-height: 160px; }
.coluna.sobre { outline: 2px dashed var(--cor); }
.coluna > header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 8px; font-weight: 600; }
.cartao { background: var(--card); border: 1px solid var(--linha); border-left: 4px solid var(--linha); border-radius: 11px; padding: 9px 10px; margin-bottom: 8px; cursor: pointer; }
.cartao:hover { border-color: var(--cor); } .cartao.urgente { box-shadow: inset 0 0 0 1px var(--erro); }
.cartao .tit { font-weight: 600; font-size: 13px; overflow-wrap: anywhere; } .cartao .meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--suave); margin-top: 5px; align-items: center; }
.cartao .nota { font-size: 12px; margin-top: 5px; padding: 4px 7px; background: var(--alerta-f); color: var(--alerta); border-radius: 7px; }
.texto-aviso { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--fundo); border-radius: 10px; padding: 10px 12px; font-size: 13px; max-height: 44vh; overflow: auto; }
.situacoes { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.linha-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.aovivo summary { cursor: pointer; font-weight: 600; } .aovivo { margin-bottom: 12px; }
.prazo { font-weight: 700; color: var(--erro); }
/* ----- atividade ----- */
.feed { display: grid; gap: 8px; }
.item-feed { background: var(--card); border: 1px solid var(--linha); border-radius: 12px; padding: 10px 12px; }
.item-feed header { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--suave); margin-bottom: 4px; }
.item-feed .txt { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; max-height: 7.4em; overflow: hidden; cursor: pointer; }
.item-feed .txt.aberto { max-height: none; }
/* ----- estrutura ----- */
.matriz td, .matriz th { text-align: center; padding: 6px; } .matriz td:first-child, .matriz th:first-child { text-align: left; white-space: nowrap; }
.matriz .cel { display: inline-block; min-width: 26px; padding: 2px 6px; border-radius: 7px; background: var(--cor-f); color: var(--cor); font-weight: 700; font-size: 12px; }
.camadas { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
/* tela estreita: as abas descem para uma linha própria e quebram, para nenhuma (ex.: Usuários) ficar escondida */
@media (max-width: 1100px) { #abas { order: 3; flex: 0 0 100%; flex-wrap: wrap; overflow: visible; } .conta { margin-left: auto; } }
@media (max-width: 760px) {
  main#tela { padding: 10px; } .ficha { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 62%; }
  .escritorio { height: 66vh; } .hud { gap: 5px; } .pilula { padding: 4px 8px; border-radius: 9px; } .pilula b { font-size: 15px; display: inline; margin-right: 4px; } .pilula span { font-size: 10px; } .numeros { grid-template-columns: repeat(4, 1fr); } .legenda { display: none; } .quadro { grid-template-columns: repeat(4, 82vw); }
}
