:root {
  --azul-escuro: #1f3a5f;
  --azul: #2f6db5;
  --fundo: #f3f5f8;
  --borda: #e2e6eb;
  --texto-suave: #66727f;
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-primary: #2f6db5;
  --bs-primary-rgb: 47, 109, 181;
  --bs-link-color: #2f6db5;
  --bs-link-color-rgb: 47, 109, 181;
}
body { background: var(--fundo); color: #1d2733; font-size: .95rem; }
.btn-primary { --bs-btn-bg: var(--azul); --bs-btn-border-color: var(--azul); --bs-btn-hover-bg: #275c99; --bs-btn-hover-border-color: #275c99; --bs-btn-active-bg: #234f84; }
.btn-outline-primary { --bs-btn-color: var(--azul); --bs-btn-border-color: var(--azul); --bs-btn-hover-bg: var(--azul); --bs-btn-hover-border-color: var(--azul); }

/* Topo */
.topo { background: var(--azul-escuro); padding-top: .55rem; padding-bottom: .55rem; }
.topo .navbar-brand { font-weight: 600; font-size: 1rem; }
.topo .nav-link { color: rgba(255,255,255,.75); border-radius: 6px; padding: .4rem .75rem !important; }
.topo .nav-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.topo .nav-link.active { color: #fff; background: rgba(255,255,255,.14); }
.marca { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--azul); color: #fff; }
.marca-grande { width: 56px; height: 56px; border-radius: 14px; font-size: 1.6rem; background: var(--azul-escuro); }
.status-email { color: rgba(255,255,255,.7); white-space: nowrap; }
.status-email .ponto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: #8a96a3; }
.status-email.ok .ponto { background: #4cd07d; }
.status-email.erro .ponto { background: #ff6b6b; }
.status-email.erro { color: #ffb3b3; }

/* Avatares */
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: var(--azul-escuro); color: #fff; font-size: .75rem; font-weight: 600; flex-shrink: 0; }
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar-usuario { background: #dbe7f5; color: var(--azul-escuro); }
.avatar-link { text-decoration: none; }
.topo .avatar { background: rgba(255,255,255,.18); }

/* Cartões */
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: 10px; }
.borda-alerta { border-color: #f0c36d; background: #fffaf0; }
.vazio { text-align: center; padding: 3rem 1rem; color: var(--texto-suave); }
.vazio i { font-size: 2.4rem; display: block; margin-bottom: .5rem; opacity: .5; }
pre.codigo { background: #f4f6f9; border: 1px solid var(--borda); border-radius: 6px; padding: .5rem .7rem; white-space: pre-wrap; word-break: break-all; }

/* Cartões de visão (painel) */
.cards-visao { display: flex; flex-wrap: wrap; gap: .6rem; }
.card-visao { display: flex; align-items: center; gap: .55rem; background: #fff; border: 1px solid var(--borda); border-radius: 10px; padding: .55rem .9rem; text-decoration: none; color: #1d2733; min-width: 140px; transition: border-color .15s, box-shadow .15s; }
.card-visao i { color: var(--texto-suave); font-size: 1.1rem; }
.card-visao .num { font-size: 1.25rem; font-weight: 600; line-height: 1; }
.card-visao .rot { font-size: .82rem; color: var(--texto-suave); }
.card-visao:hover { border-color: #b9c6d6; }
.card-visao.ativo { border-color: var(--azul); box-shadow: 0 0 0 2px rgba(47,109,181,.15); }
.card-visao.ativo i { color: var(--azul); }
.card-visao.alerta .num { color: #b26a00; }
.card-visao-link { min-width: 0; }

/* Tabela de chamados */
.tabela-chamados thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); font-weight: 600; background: #fafbfc; border-bottom-color: var(--borda); }
.tabela-chamados td { padding-top: .7rem; padding-bottom: .7rem; border-color: #eef1f4; }
.linha-chamado { cursor: pointer; }
.linha-chamado:hover td { background: #f7f9fc; }
.linha-chamado .assunto { color: #1d2733; text-decoration: none; font-weight: 500; }
.linha-chamado.precisa-resposta .assunto { font-weight: 700; }
.linha-chamado .sub { font-size: .8rem; color: var(--texto-suave); margin-top: 2px; }
.badge-novo { font-size: .68rem; background: #e6f0fb; color: var(--azul); border-radius: 10px; padding: 1px 7px; font-weight: 600; }

/* Status e prioridade */
.badge-status { display: inline-block; font-size: .74rem; font-weight: 600; padding: .25rem .6rem; border-radius: 20px; white-space: nowrap; }
.st-aberto { background: #e6f0fb; color: #1f5596; }
.st-atendimento { background: #fff1d6; color: #8a5a00; }
.st-aguardando { background: #efe6fb; color: #5e3a99; }
.st-fechado { background: #e3f4ea; color: #1f6b41; }
.pri { font-size: .8rem; white-space: nowrap; color: var(--texto-suave); }
.pri-alta { color: #b8580b; font-weight: 600; }
.pri-urgente { color: #c62828; font-weight: 700; }
.pri-baixa { color: #8a96a3; }

/* Conversa */
.linha-tempo { display: flex; flex-direction: column; gap: .9rem; }
.msg { display: flex; gap: .75rem; align-items: flex-start; }
.msg-corpo { flex: 1; min-width: 0; background: #fff; border: 1px solid var(--borda); border-radius: 10px; padding: .8rem 1rem; }
.msg-atendente .msg-corpo { background: #f2f7fd; border-color: #d3e2f3; }
.msg-nota .msg-corpo { background: #fff8e1; border-color: #f2dd9c; }
.msg-topo { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: .4rem; }
.msg-texto { overflow-wrap: anywhere; line-height: 1.55; }
.tag-nota { font-size: .72rem; color: #8a6200; font-weight: 600; }
.tag-resp { font-size: .72rem; color: var(--azul); }
.evento-sistema { font-size: .8rem; color: var(--texto-suave); padding-left: 2.6rem; }
.evento-sistema span { opacity: .75; }
.anexos { margin-top: .7rem; }
.miniaturas { display: flex; flex-wrap: wrap; gap: .5rem; }
.miniatura { display: block; border: 1px solid var(--borda); border-radius: 8px; overflow: hidden; background: #fff; }
.miniatura img { display: block; max-width: 220px; max-height: 160px; object-fit: contain; }
.arquivos { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.arquivo { display: inline-flex; gap: .35rem; align-items: center; font-size: .82rem; border: 1px solid var(--borda); border-radius: 6px; padding: .25rem .6rem; background: #fff; text-decoration: none; }

/* Caixa de resposta */
.caixa-resposta .nav-tabs { border-bottom-color: var(--borda); }
.caixa-resposta .nav-link { font-size: .88rem; color: var(--texto-suave); }
.caixa-resposta .nav-link.active { color: #1d2733; }
textarea.nota { background: #fffdf3; }
.zona-anexos.arrastando { outline: 2px dashed var(--azul); outline-offset: 4px; border-radius: 6px; }
.previas { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }
.previa { position: relative; border: 1px solid var(--borda); border-radius: 6px; padding: 3px; background: #fff; font-size: .75rem; display: flex; align-items: center; gap: .35rem; max-width: 240px; }
.previa img { width: 56px; height: 42px; object-fit: cover; border-radius: 4px; }
.previa .nome { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.previa button { border: 0; background: none; color: #c62828; padding: 0 4px; line-height: 1; }

/* Relatórios */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; }
.kpi { background: #fff; border: 1px solid var(--borda); border-radius: 10px; padding: .9rem 1rem; display: flex; flex-direction: column; }
.kpi .rot { font-size: .78rem; color: var(--texto-suave); }
.kpi .num { font-size: 1.7rem; font-weight: 600; line-height: 1.2; margin-top: .2rem; }
.kpi .num-tempo { font-size: 1.25rem; }
.kpi .sub { font-size: .75rem; color: var(--texto-suave); }

/* Login */
.login-caixa { max-width: 380px; margin: 6vh auto 0; }

@media (max-width: 575px) {
  .card-visao { min-width: calc(50% - .3rem); }
  .miniatura img { max-width: 140px; }
  .evento-sistema { padding-left: 0; }
}

/* Gráficos dos relatórios */
.grafico-svg { width: 100%; height: auto; display: block; }
.grafico-svg .grade { stroke: #e9edf1; stroke-width: 1; }
.grafico-svg .eixo { font-size: 11px; fill: #7a8592; }
.serie-a { fill: var(--azul); background: var(--azul); }
.serie-b { fill: #2e8b57; background: #2e8b57; }
.legenda { font-size: .8rem; color: var(--texto-suave); display: inline-flex; align-items: center; gap: .3rem; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.barras { display: flex; flex-direction: column; gap: .45rem; }
.barra-linha { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 32px; align-items: center; gap: .6rem; font-size: .85rem; }
.barra-rot { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barra-trilho { background: #eef2f6; border-radius: 4px; height: 14px; overflow: hidden; }
.barra { display: block; height: 100%; background: var(--azul); border-radius: 4px; }
.barra-val { text-align: right; font-variant-numeric: tabular-nums; color: var(--texto-suave); }

/* Portal do usuário */
.portal main { max-width: 1040px; }
.lista-portal { display: flex; flex-direction: column; gap: .6rem; }
.item-portal { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.1rem; text-decoration: none; color: #1d2733; transition: border-color .15s, box-shadow .15s; }
.item-portal:hover { border-color: #b9c6d6; box-shadow: 0 2px 8px rgba(31,58,95,.06); color: #1d2733; }
.item-portal.tem-resposta { border-left: 3px solid var(--azul); }
.min-w-0 { min-width: 0; }
.nav-pills .nav-link { color: var(--texto-suave); }
.nav-pills .nav-link.active { background: var(--azul-escuro); }
.trilha { display: flex; align-items: center; gap: .5rem; }
.trilha .passo { display: flex; flex-direction: column; align-items: center; gap: .3rem; font-size: .8rem; color: var(--texto-suave); min-width: 92px; text-align: center; }
.trilha .bola { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: #eef2f6; color: #8a96a3; font-size: 1rem; }
.trilha .passo.feito .bola { background: #dbe7f5; color: var(--azul); }
.trilha .passo.atual .bola { background: var(--azul); color: #fff; box-shadow: 0 0 0 4px rgba(47,109,181,.15); }
.trilha .passo.atual { color: #1d2733; font-weight: 600; }
.trilha .linha { flex: 1; height: 3px; border-radius: 2px; background: #eef2f6; margin-bottom: 1.4rem; }
.trilha .linha.feito { background: var(--azul); }
.dados-pc dt { font-weight: 500; color: var(--texto-suave); }
.dados-pc dd { margin-bottom: .3rem; overflow-wrap: anywhere; }
kbd { font-size: .75em; }
@media (max-width: 575px) {
  .trilha .passo { min-width: 0; font-size: .72rem; }
  .item-portal { padding: .75rem .85rem; }
}
.item-portal.recem-aberto { border-color: #7fb08f; box-shadow: 0 0 0 3px rgba(46,139,87,.15); }
.badge-recem { background: #e3f4ea; color: #1f6b41; }

/* Conserto externo */
.st-conserto { background: #e0f2f4; color: #0f6170; }
.borda-conserto { border-color: #9fd1d8; }
.badge-conserto { font-size: .72rem; font-weight: 600; background: #e0f2f4; color: #0f6170; border-radius: 20px; padding: .2rem .55rem; }
.badge-conserto.atrasado { background: #fdecea; color: #c62828; }
.orcamento { border: 1px solid var(--borda); border-radius: 8px; padding: .55rem .7rem; margin-bottom: .45rem; background: #fff; }
.orc-pendente { border-color: #f0c36d; background: #fffaf0; }
.orc-aprovado { border-color: #9fd5b3; background: #f3fbf6; }
.orc-aprovado .orc-tag { color: #1f6b41; font-weight: 600; }
.orc-recusado { opacity: .65; }
.orc-recusado strong { text-decoration: line-through; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
tr.atrasado td { background: #fff5f5; }
.card-visao.alerta-vermelho .num { color: #c62828; }
.st-fornecedor { background: #fdf0e1; color: #8a4b00; }
.msg-forn_env .msg-corpo { background: #fdf6ee; border-color: #f0d6b4; }
.msg-forn_resp .msg-corpo { background: #fff9f2; border-color: #f0c38f; }
.avatar-forn { background: #f3dfc5; color: #8a4b00; }
.tag-forn { font-size: .72rem; color: #8a4b00; font-weight: 600; }
.etiqueta { display: inline-block; font-family: ui-monospace, Consolas, monospace; background: #fff; border: 1px dashed #b9c6d6; border-radius: 4px; padding: 0 .4rem; }
.btn-fornecedor { background: #b8650b; color: #fff; }
.btn-fornecedor:hover { background: #9a5409; color: #fff; }
.badge-contrato { display: inline-block; margin-left: .35rem; font-size: .7rem; font-weight: 600; background: #fdf0e1; color: #8a4b00; border-radius: 20px; padding: .1rem .5rem; }
.badge-assist { display: inline-block; margin-left: .35rem; font-size: .7rem; background: #e0f2f4; color: #0f6170; border-radius: 20px; padding: .1rem .5rem; }
.evento-conserto { display: flex; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid #eef1f4; }
.evento-conserto:last-child { border-bottom: 0; }
.evento-conserto .quando { width: 120px; flex-shrink: 0; font-size: .8rem; color: var(--texto-suave); }
.doc-conserto { display: flex; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid var(--borda); border-radius: 8px; margin-bottom: .4rem; text-decoration: none; color: #1d2733; background: #fff; }
.doc-conserto:hover { border-color: #b9c6d6; color: #1d2733; }
.doc-conserto .tipo { font-size: .7rem; font-weight: 600; text-transform: uppercase; color: var(--texto-suave); }
.badge-perfil { display: inline-block; font-size: .72rem; font-weight: 600; border-radius: 20px; padding: .15rem .55rem; background: #e6f0fb; color: #1f5596; }
.badge-perfil.admin { background: #1f3a5f; color: #fff; }
.badge-perfil.restrito { background: #fdf0e1; color: #8a4b00; white-space: normal; }
.lista-empresas { max-height: 220px; overflow-y: auto; border: 1px solid var(--borda); border-radius: 6px; padding: .5rem .75rem; }
