/* ---------------------------------------------------------------------
   Cópia fiel do padrão estético do Enemax Hub (processobm-web,
   app/static/index.html). REGRA DE OURO do projeto: o lado interno deste
   app tem que ser indistinguível do Hub — mesmos tokens, mesmas classes,
   mesmas medidas. Ao mexer aqui, conferir contra o index.html do Hub em
   vez de improvisar.
   --------------------------------------------------------------------- */
:root {
  --azul: #003CE0;
  --azul-2: #2A66FF;
  --azul-3: #00BDF7;
  --off-white: #EDEEE9;
  --nav-bg: #0A0E1F;
  --nav-bg-2: #0E1428;
  --nav-muted: #8790a8;
  --texto: #1a1f2e;
  --texto-suave: #5a6072;
  --borda: #E2E5DE;
  --font-title: 'Roboto Mono', 'Consolas', monospace;
  --font-body: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --ok: #1a9d6c;
  --warn: #b8790a;
  --crit: #C0392B;
}
* { box-sizing: border-box; }
/* Precisa de !important: seletores de id (#casca) são mais específicos que
   o display:none que o atributo [hidden] traz do browser — sem isto, um
   bloco escondido continua ocupando a tela. Mesmo problema já corrigido no
   revisao.css. */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-body); color: var(--texto);
  background: var(--off-white); display: flex; min-height: 100vh;
}
a { color: inherit; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 258px; flex-shrink: 0; background: var(--nav-bg);
  color: #cfd6ea; display: flex; flex-direction: column;
  height: 100vh; position: sticky; top: 0;
}
.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand .chip {
  width: 38px; height: 38px; border-radius: 10px; background: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,60,224,.35);
}
.brand .chip img { width: 24px; height: 24px; object-fit: contain; }
.brand .titulo { font-family: var(--font-title); font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .5px; line-height: 1.1; }
.brand .titulo small { display: block; font-weight: 500; font-size: 9.5px; color: var(--azul-3); letter-spacing: 1.5px; margin-top: 2px; }

.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group { margin-bottom: 6px; }
.nav-group-head {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 10px; background: none; border: none; cursor: pointer;
  color: var(--nav-muted); font-family: var(--font-title); font-weight: 600;
  font-size: 10px; letter-spacing: 1.2px; text-transform: uppercase; text-align: left;
}
.nav-group-head .gi { width: 15px; height: 15px; flex-shrink: 0; }
.nav-group-head .lbl { flex: 1; }

.nav-items { padding: 2px 0 4px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 11px 9px 13px; margin: 1px 0; border: none; background: none;
  border-radius: 8px; cursor: pointer; color: #b7bfd6;
  font-family: var(--font-body); font-size: 12.5px; text-align: left;
  border-left: 3px solid transparent; text-decoration: none;
}
.nav-item .ii { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.ativo {
  background: rgba(42,102,255,.16);
  color: #fff; border-left-color: var(--azul-3); font-weight: 600;
}
.nav-item.ativo .ii { opacity: 1; color: var(--azul-3); }

.sidebar-footer {
  border-top: 1px solid rgba(255,255,255,.07); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .avatar {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--azul);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 13px; font-family: var(--font-title);
}
.sidebar-footer .info { flex: 1; min-width: 0; }
.sidebar-footer .info .nome { font-size: 12px; color: #eef1f8; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer .info .papel { font-size: 10px; color: var(--azul-3); letter-spacing: .3px; }
.sidebar-footer a.sair { color: var(--nav-muted); display: flex; }
.sidebar-footer a.sair:hover { color: #fff; }
.sidebar-footer a.sair svg { width: 17px; height: 17px; }

/* ---------- CONTEÚDO ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.view-wrap { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 30px 40px; }
.view { max-width: 1000px; }
.view-head { margin-bottom: 22px; }
.view-head h1 { font-family: var(--font-title); font-size: 24px; font-weight: 700; color: var(--texto); margin: 0 0 5px; letter-spacing: -.3px; }
.view-head p { margin: 0; font-size: 13px; color: var(--texto-suave); max-width: 640px; line-height: 1.5; }

/* KPIs — mesmo componente do dashboard do Hub */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(20,30,60,.05); position: relative; overflow: hidden;
}
.kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--azul); }
.kpi .cap { font-size: 10.5px; color: var(--texto-suave); text-transform: uppercase; letter-spacing: .5px; font-weight: 700; }
.kpi .val {
  font-family: var(--font-title); font-size: 22px; font-weight: 700; margin: 8px 0 6px; line-height: 1.15;
  letter-spacing: -.5px; font-variant-numeric: tabular-nums; color: var(--azul);
  white-space: nowrap;
}
.kpi .sub { font-size: 11px; color: #97a0b5; white-space: pre-line; }

/* abas/filtros — mesmo .tabs do Hub */
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--borda); border-radius: 8px; padding: 4px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { font-family: var(--font-body); font-size: 11px; font-weight: 600; border: none; background: none; color: var(--texto-suave); padding: 5px 12px; border-radius: 6px; cursor: pointer; }
.tabs button.on { background: var(--azul); color: #fff; }

/* tabela — mesmo .tabela-conferencia do Hub */
.tabela-box { overflow-x: auto; margin-bottom: 6px; background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 4px 14px; }
table.tabela-conferencia { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tabela-conferencia thead th {
  text-align: left; font-family: var(--font-title); font-size: 10px; font-weight: 700;
  letter-spacing: .5px; text-transform: uppercase; color: var(--texto-suave);
  padding: 8px 10px; border-bottom: 2px solid var(--borda); white-space: nowrap;
}
.tabela-conferencia tbody td { padding: 9px 10px; border-bottom: 1px solid #eceef0; vertical-align: top; }
.tabela-conferencia tbody tr:last-child td { border-bottom: none; }
.tabela-conferencia tbody tr.clicavel { cursor: pointer; }
.tabela-conferencia tbody tr.clicavel:hover td { background: #fbfcfa; }
.tabela-vazio { padding: 30px 4px; text-align: center; color: var(--texto-suave); font-size: 12.5px; }

.pill {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 9px; font-weight: 700;
  font-family: var(--font-title); letter-spacing: .4px; text-transform: uppercase;
}
.pill.Aberta { background: #d7ecdf; color: #0b4a2e; }
.pill.Fechada { background: #cfe0ff; color: #073b8c; }
.pill.Arquivada { background: #e5e6ea; color: #555; }

/* ---------- formulário (mesmo .card/.field/.btn do Hub) ---------- */
.card { max-width: 620px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11.5px; color: var(--texto-suave); margin-bottom: 5px; font-weight: 600; }
.field input[type="text"], .field input[type="file"], .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd4e4; border-radius: 7px;
  font-size: 13px; font-family: inherit; color: var(--texto); background: #fff; resize: vertical;
}
.field input[type="text"]:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--azul-2); box-shadow: 0 0 0 3px rgba(42,102,255,.12);
}
.field .ajuda { font-size: 10.5px; color: #97a0b5; margin-top: 4px; line-height: 1.4; }
.field .erro { font-size: 11px; color: var(--crit); margin-top: 4px; display: none; }
.field.invalido input, .field.invalido select { border-color: var(--crit); }
.field.invalido .erro { display: block; }
.campo-duplo { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.btn-row { display: flex; gap: 10px; margin-top: 6px; flex-wrap: wrap; }
button.btn {
  border: none; border-radius: 8px; padding: 10px 18px; font-size: 13px; font-weight: 700;
  cursor: pointer; color: #fff; font-family: inherit; transition: filter .15s, transform .05s;
}
button.btn:disabled { opacity: .45; cursor: not-allowed; }
button.btn:not(:disabled):active { transform: translateY(1px); }
button.btn.primario { background: var(--azul); }
button.btn.executar { background: var(--crit); }
button.btn.neutro { background: #8a93a8; }
button.btn:not(:disabled):hover { filter: brightness(.92); }
.aviso { font-size: 10.5px; color: #97a0b5; margin-top: 10px; font-style: italic; line-height: 1.45; }
.msg { font-size: 12.5px; margin-top: 12px; line-height: 1.4; }
.msg.erro { color: var(--crit); }

/* ---------- modal (idêntico ao do Hub, com o blur no fundo) ---------- */
.modal-backdrop {
  display: flex; position: fixed; inset: 0; background: rgba(10,14,31,.55);
  align-items: center; justify-content: center; z-index: 20;
  opacity: 0; visibility: hidden; pointer-events: none;
  backdrop-filter: blur(0px); -webkit-backdrop-filter: blur(0px);
  transition: opacity .22s ease, backdrop-filter .28s ease;
}
.modal-backdrop.aberto {
  opacity: 1; visibility: visible; pointer-events: auto;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.modal {
  background: #fff; border-radius: 14px; padding: 24px 26px; width: 400px; max-width: 92vw;
  border-top: 4px solid var(--crit); box-shadow: 0 20px 60px rgba(0,0,0,.3);
  transform: scale(.94) translateY(8px); opacity: 0;
  transition: transform .24s cubic-bezier(.2,.8,.2,1), opacity .2s ease;
}
.modal-backdrop.aberto .modal { transform: scale(1) translateY(0); opacity: 1; }
.modal h3 { margin: 0 0 10px; font-family: var(--font-title); font-size: 15px; color: var(--crit); }
.modal p { margin: 0 0 18px; font-size: 13px; color: var(--texto); line-height: 1.55; }
/* variante azul: confirmação não-destrutiva/navegação, mesmo critério do
   .modal-lg do Hub (azul = não é alerta) */
.modal.azul { border-top-color: var(--azul); }
.modal.azul h3 { color: var(--azul); }
.modal .link-copiavel { display: flex; gap: 8px; margin-bottom: 18px; }
.modal .link-copiavel input {
  flex: 1; padding: 9px 11px; border: 1px solid #cfd4e4; border-radius: 7px; font-size: 12px;
  font-family: var(--font-title); color: var(--texto-suave); min-width: 0;
}

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  body { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: static; flex-direction: column;
  }
  .brand { padding: 14px 16px 12px; }
  .nav { padding: 8px 10px; overflow-y: visible; }
  .nav-items { display: flex; gap: 4px; flex-wrap: wrap; }
  .nav-item { width: auto; margin: 0; }
  .sidebar-footer { padding: 10px 16px; }
  .view-wrap { padding: 20px 16px; overflow-y: visible; }
  .view-head h1 { font-size: 20px; }
  .kpis { grid-template-columns: 1fr; gap: 10px; }
  .campo-duplo { grid-template-columns: 1fr; }
  .card { max-width: none; }
  /* A tabela não cabe num celular: vira lista de cartões, com o rótulo de
     cada coluna vindo do data-rotulo da célula. */
  .tabela-box { padding: 0; border: none; background: none; }
  table.tabela-conferencia thead { display: none; }
  table.tabela-conferencia, .tabela-conferencia tbody, .tabela-conferencia tr, .tabela-conferencia td { display: block; width: 100%; }
  .tabela-conferencia tbody tr {
    background: #fff; border: 1px solid var(--borda); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 10px;
  }
  .tabela-conferencia tbody td { border-bottom: none; padding: 3px 0; }
  .tabela-conferencia tbody td[data-rotulo]::before {
    content: attr(data-rotulo) ': '; font-family: var(--font-title); font-size: 9.5px;
    text-transform: uppercase; letter-spacing: .4px; color: var(--texto-suave); font-weight: 700;
  }
  .tabela-conferencia tbody td.td-titulo { font-weight: 600; font-size: 13.5px; padding-bottom: 6px; }
  .tabela-conferencia tbody td.td-titulo::before { content: none; }
  .modal { padding: 20px 18px; }
  .modal .link-copiavel { flex-direction: column; }
}
