/* Visual da plataforma de Licitações (tema "clínico" da Florença Medical): mesmos tokens, fontes e logo. */
:root {
  --bg: #F6F8FA; --surface: #FFFFFF; --border: #E4E9F0;
  --ink: #1B2733; --brand: #2E4A7A; --muted: #5B6B7B; --faint: #90A0AE;
  --accent: #007CBA; --accent-soft: #E6F2F9;
  --positive: #15803D; --attention: #B45309; --negative: #DC2626;
  --radius: 12px; --shadow: 0 1px 2px rgba(27,39,51,0.04);
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  /* Séries dos gráficos (paleta validada: separação para daltonismo e visão normal) */
  --s1: #257de0; --s2: #f47230; --s3: #00b894; --s4: #6a4ce2;
  --neg: #ec4647;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; }
*:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
* { -webkit-tap-highlight-color: transparent; }
.num { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 32px; width: 100%; max-width: 400px; display: flex; flex-direction: column; }
.login img { display: block; width: 220px; max-width: 80%; margin: 0 auto 12px; }
.login .sub { text-align: center; font-size: 13px; color: var(--faint); letter-spacing: .5px; margin-bottom: 28px; }
.login input { padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 15px; margin-bottom: 12px; color: var(--ink); }
.erro { background: #FEF2F2; border: 1px solid #FECACA; color: var(--negative); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.ok { background: #F0FDF4; border: 1px solid #BBF7D0; color: var(--positive); font-size: 13px; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }

/* Estrutura */
.shell { display: flex; min-height: 100vh; }
.side { width: 196px; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 18px 10px; position: fixed; height: 100vh; }
.side .marca { padding: 0 8px; margin-bottom: 20px; text-align: center; }
.side .marca img { display: block; width: 132px; margin: 0 auto 6px; }
.marca-sub { font-size: 11px; color: var(--faint); letter-spacing: .5px; }
.side nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side nav a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; text-decoration: none; }
.side nav a.ativo { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.quem { font-size: 12px; color: var(--muted); padding: 10px 8px; overflow: hidden; text-overflow: ellipsis; }
.quem small { display: block; color: var(--faint); font-size: 11px; }
.btn-sair { padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: none; color: var(--muted); font-size: 13px; cursor: pointer; text-align: left; }
main { flex: 1; margin-left: 196px; padding: 16px 20px 40px; min-width: 0; }

.topo-cel, .nav-cel { display: none; }
@media (max-width: 760px) {
  .side { display: none; }
  main { margin-left: 0; padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .topo-cel { position: sticky; top: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--surface); border-bottom: 1px solid var(--border); }
  .topo-cel .m { display: flex; align-items: center; gap: 8px; min-width: 0; }
  .topo-cel .m img.s { height: 26px; }
  .topo-cel .m img.n { height: 15px; max-width: 45vw; object-fit: contain; object-position: left; }
  .nav-cel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); background: var(--surface); border-top: 1px solid var(--border); padding: 6px 2px calc(6px + env(safe-area-inset-bottom)); }
  .nav-cel a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 10px; color: var(--muted); text-decoration: none; min-width: 0; }
  .nav-cel a.ativo { color: var(--accent); background: var(--accent-soft); }
  .nav-cel a svg { width: 22px; height: 22px; }
  .nav-cel span { font-size: 9.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  input, select, textarea { font-size: 16px !important; }
  button, select { min-height: 40px; }
}

/* Página */
.cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
h1 { font-family: var(--font-display); font-size: 22px; color: var(--brand); font-weight: 600; }
h2 { font-family: var(--font-display); font-size: 15px; color: var(--ink); font-weight: 600; margin-bottom: 10px; }
.sub { color: var(--muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; min-width: 0; }
.grade { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grade .card { margin-bottom: 0; }
@media (max-width: 1100px) { .grade { grid-template-columns: minmax(0, 1fr); } }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.kpi .r { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.kpi .v { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .d { font-size: 12px; color: var(--muted); margin-top: 4px; }
.pos { color: var(--positive); } .neg { color: var(--negative); } .ate { color: var(--attention); }

/* Controles */
.btn { padding: 9px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink); font-size: 13px; cursor: pointer; font-family: inherit; }
.btn.pri { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.peq { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: default; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 7px 12px; font-size: 13px; color: var(--muted); cursor: pointer; font-family: inherit; }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
select, input[type=text], input[type=number], input[type=email], input[type=password], input[type=date], input[type=month], textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; color: var(--ink); background: var(--surface); width: 100%; }
label.campo { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 0; }
.campos { display: grid; gap: 10px 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.campo.calc input { background: var(--bg); color: var(--muted); }
fieldset { border: 0; margin-bottom: 18px; }
legend { font-family: var(--font-display); font-weight: 600; font-size: 14px; margin-bottom: 10px; color: var(--ink); }
.dica { font-size: 12px; color: var(--faint); }

/* Tabelas */
.tab-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { border-collapse: collapse; width: 100%; font-size: 13px; }
table.t th, table.t td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
table.t th { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); }
table.t td.n, table.t th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.t tr.grupo td { background: var(--bg); font-weight: 600; color: var(--brand); font-size: 12px; }
table.t tr.total td { font-weight: 700; }
table.t .fixa { position: sticky; left: 0; background: var(--surface); z-index: 1; }
table.t tr.grupo .fixa { background: var(--bg); }
table.t tr.clic { cursor: pointer; } table.t tr.clic:hover td { background: var(--accent-soft); }
.selo { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.selo.pos { background: #F0FDF4; border-color: #BBF7D0; } .selo.neg { background: #FEF2F2; border-color: #FECACA; } .selo.ate { background: #FFFBEB; border-color: #FDE68A; }

/* Cartões no celular (tabela vira lista) */
.cartoes { display: none; }
@media (max-width: 760px) {
  .so-pc { display: none !important; }
  .cartoes { display: block; }
  .cartoes .c { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; background: var(--surface); }
  .cartoes .c .l1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
  .cartoes .c .l2 { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; margin-top: 4px; flex-wrap: wrap; }
}
@media (min-width: 761px) { .so-cel { display: none !important; } }

/* Gráficos */
.graf { position: relative; width: 100%; }
.graf svg { display: block; width: 100%; height: auto; overflow: visible; }
.graf text { font-family: var(--font-body); font-size: 11px; fill: var(--muted); }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.legenda i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legenda i.linha { height: 3px; border-radius: 2px; vertical-align: 2px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 8px 10px; border-radius: 8px; box-shadow: 0 4px 12px rgba(0,0,0,.15); max-width: 260px; }
.tip b { display: block; margin-bottom: 4px; font-weight: 600; }
.tip .lin { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Janela */
.fundo { position: fixed; inset: 0; background: rgba(27,39,51,.35); z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.janela { background: var(--surface); border-radius: var(--radius); width: 100%; max-width: 640px; max-height: 90vh; overflow: auto; padding: 18px; }
.janela .jcab { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; }
.janela .fim { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; position: sticky; bottom: -18px; background: var(--surface); padding: 12px 0 0; }
.x { border: 0; background: none; font-size: 22px; width: 44px; height: 44px; cursor: pointer; color: var(--muted); }
@media (max-width: 760px) { .fundo { padding: 0; } .janela { max-width: none; max-height: none; height: 100%; border-radius: 0; } }

.aviso { border-left: 3px solid var(--attention); background: #FFFBEB; padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 8px; }
.aviso.neg { border-color: var(--negative); background: #FEF2F2; }
.aviso.info { border-color: var(--accent); background: var(--accent-soft); }
.vazio { color: var(--muted); font-size: 13px; padding: 12px 0; }
ul.lista { list-style: none; } ul.lista li { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
