/* Belico — sistema de despachante bélico.
   Design próprio, sem framework. Desktop e celular desde o primeiro dia.
   Tema claro/escuro por atributo no <html>, trocado por localStorage. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface2: #fafbfc;
  --line: #e2e5ea;
  --text: #16191d;
  --muted: #6b7280;
  --accent: #1f4b8e;
  --accent-soft: #e8eefa;
  --good: #17794a;
  --good-soft: #e3f5ec;
  --warn: #9a6200;
  --warn-soft: #fdf1dc;
  --crit: #a51f1f;
  --crit-soft: #fbe9e9;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

[data-tema="escuro"] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface2: #1d222a;
  --line: #2a313b;
  --text: #e6e9ee;
  --muted: #939ba8;
  --accent: #6f9ae8;
  --accent-soft: #1b2740;
  --good: #5fd39b;
  --good-soft: #12291f;
  --warn: #e8b45f;
  --warn-soft: #2c2416;
  --crit: #f28b8b;
  --crit-soft: #2e1a1a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ----------------------------------------------------------- estrutura */

.app { display: flex; min-height: 100vh; }

.side {
  width: 232px;
  flex: 0 0 232px;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.marca {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 8px 16px;
  font-weight: 700; font-size: 17px; letter-spacing: -.02em;
}
.marca span { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px;
  color: var(--text); font-size: 14px; font-weight: 500;
}
.nav-item:hover { background: var(--surface2); text-decoration: none; }
.nav-item.ativo { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-sep { margin: 12px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 22px clamp(16px, 3vw, 32px) 60px; }

.topo {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
h1 { font-size: 22px; margin: 0 0 3px; letter-spacing: -.02em; }
.sub { color: var(--muted); font-size: 13.5px; margin: 0; }

/* ------------------------------------------------------------- blocos */

.painel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.painel-h {
  padding: 13px 16px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-weight: 600; font-size: 14.5px; background: var(--surface2);
}
.painel-c { padding: 16px; }
.painel-c.sem-pad { padding: 0; }

.grade { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.cartao { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; box-shadow: var(--shadow); }
.cartao .n { font-size: 27px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.cartao .r { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.cartao.alerta { border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.cartao.alerta .n { color: var(--crit); }
.cartao.aviso .n { color: var(--warn); }

/* ------------------------------------------------------------ tabelas */

.rolo { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th {
  text-align: left; padding: 10px 14px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface2);
}
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface2); }

/* --------------------------------------------------------------- selo */

.selo {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
  background: var(--surface2); color: var(--muted); border: 1px solid var(--line);
}
.selo.ok { background: var(--good-soft); color: var(--good); border-color: transparent; }
.selo.atencao { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.selo.grave { background: var(--crit-soft); color: var(--crit); border-color: transparent; }
.selo.info { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.ponto { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }

/* ------------------------------------------------------------- botões */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 15px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; white-space: nowrap; min-height: 40px;
}
.btn:hover { background: var(--surface2); text-decoration: none; }
.btn.primario { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primario:hover { filter: brightness(1.08); }
.btn.pequeno { padding: 6px 11px; font-size: 13px; min-height: 34px; }
.btn.perigo { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); }

/* ----------------------------------------------------------- formulário */

.campo { margin-bottom: 14px; }
.campo label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.campo .dica { font-size: 12px; color: var(--muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date],
input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 16px; /* 16px evita o zoom do iOS */
  min-height: 42px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.linha { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

.check { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 7px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--accent); }

/* ------------------------------------------------------------- avisos */

.aviso {
  padding: 11px 14px; border-radius: 8px; font-size: 13.5px;
  margin-bottom: 16px; border: 1px solid transparent;
}
.aviso.ok { background: var(--good-soft); color: var(--good); }
.aviso.atencao { background: var(--warn-soft); color: var(--warn); }
.aviso.grave { background: var(--crit-soft); color: var(--crit); }
.aviso.info { background: var(--accent-soft); color: var(--accent); }

.vazio { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 14px; }

.mono { font-family: var(--mono); font-size: 12.5px; }
.mudo { color: var(--muted); }
.peq { font-size: 12.5px; }

/* ---------------------------------------------------------- checklist */

.item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 16px; border-bottom: 1px solid var(--line);
}
.item:last-child { border-bottom: 0; }
.item .marca-status { flex: 0 0 auto; margin-top: 2px; }
.item .corpo { flex: 1; min-width: 0; }
.item .t { font-weight: 600; font-size: 14px; }
.item .f { font-size: 12px; color: var(--muted); margin-top: 3px; font-family: var(--mono); }
.item .i { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.item .acao { flex: 0 0 auto; }
.item.impedimento { background: var(--crit-soft); }

/* ------------------------------------------------------------ celular */

.menu-btn { display: none; }

@media (max-width: 860px) {
  .app { display: block; }
  .side {
    width: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--line);
    flex-direction: row; flex-wrap: wrap; align-items: center;
    padding: 10px 14px; gap: 6px;
    position: sticky; top: 0; z-index: 30;
  }
  .marca { padding: 0; margin-right: auto; font-size: 15px; }
  .marca span { display: none; }
  .nav-sep { display: none; }
  .nav { display: none; width: 100%; flex-direction: column; gap: 2px; padding-top: 8px; }
  .nav.aberto { display: flex; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 14px 50px; }
  h1 { font-size: 19px; }
  .grade { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
  .cartao .n { font-size: 23px; }
  .item { flex-wrap: wrap; }
  .item .acao { width: 100%; padding-left: 24px; }
  /* tabela vira lista no celular */
  table.responsiva thead { display: none; }
  table.responsiva tr { display: block; border-bottom: 1px solid var(--line); padding: 10px 0; }
  table.responsiva td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 14px; }
  table.responsiva td::before {
    content: attr(data-r); font-size: 11.5px; text-transform: uppercase;
    letter-spacing: .04em; color: var(--muted); font-weight: 600; flex: 0 0 auto;
  }
}

/* -------------------------------------------------------------- login */

.entrada {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px; background: var(--bg);
}
.entrada-caixa {
  width: 100%; max-width: 380px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 28px; box-shadow: var(--shadow);
}
.entrada-caixa h1 { font-size: 20px; margin-bottom: 4px; }

/* ------------------------------------------------- escolher arquivo
   O botão nativo do <input type=file> vem em inglês e não se traduz.
   Some com ele e usa um <label> no lugar, que aceita clique igual. */
.arq { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.arq input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.arq .escolher {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border: 1px dashed var(--line); border-radius: 8px;
  background: var(--surface2); color: var(--text);
  font-size: 13.5px; font-weight: 600; cursor: pointer; min-height: 38px;
}
.arq .escolher:hover { border-color: var(--accent); color: var(--accent); }
.arq .nome { font-size: 12.5px; color: var(--muted); flex: 1; min-width: 90px; word-break: break-all; }
.arq.tem .escolher { border-style: solid; border-color: var(--good); color: var(--good); }

/* no portal do cliente o botão ocupa a linha toda, para acertar com o dedo */
.env .arq { display: block; }
.env .arq .escolher { width: 100%; justify-content: center; padding: 13px; font-size: 15px; min-height: 48px; }
.env .arq .nome { display: block; margin-top: 6px; text-align: center; }
