:root {
  --navy: #0d2137;
  --navy-2: #14314f;
  --teal: #1b7a6c;
  --teal-2: #15967f;
  --gold: #c9a227;
  --cream: #f4f1ea;
  --bg: #eef2f6;
  --card: #ffffff;
  --text: #1c2834;
  --muted: #627084;
  --line: #d7dee8;
  --danger: #c0392b;
  --ok: #1b7a6c;
  --warn: #b7791f;
  --shadow: 0 10px 30px rgba(13, 33, 55, 0.08);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  background: var(--navy);
}
.login-brand {
  padding: 64px;
  color: #fff;
  background:
    radial-gradient(900px 500px at -10% 110%, rgba(27, 122, 108, 0.45), transparent 60%),
    linear-gradient(160deg, #0d2137 0%, #14314f 55%, #0d2137 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.marca {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.3px;
}
.marca-selo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--teal), #0e5b50);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
}
.login-brand h1 {
  font-size: 42px;
  line-height: 1.15;
  margin: 0 0 16px;
  max-width: 520px;
}
.login-brand p {
  color: #c5d0dc;
  font-size: 17px;
  max-width: 460px;
}
.login-form-wrap {
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-card { width: 100%; max-width: 380px; }
.login-card h2 { margin: 0 0 8px; font-size: 28px; }
.login-card .sub { color: var(--muted); margin-bottom: 28px; }

.campo { margin-bottom: 16px; }
.campo label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.campo input,
.campo select,
.campo textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  font: inherit;
  background: #fff;
  color: var(--text);
}
.campo textarea { min-height: 90px; resize: vertical; }
.campo input:focus,
.campo select:focus,
.campo textarea:focus {
  outline: 2px solid rgba(27, 122, 108, 0.25);
  border-color: var(--teal);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none !important;
}
.btn-primario { background: var(--teal); color: #fff; width: 100%; }
.btn-primario:hover { background: var(--teal-2); }
.btn-secundario { background: var(--navy); color: #fff; }
.btn-claro { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.btn-perigo { background: var(--danger); color: #fff; }
.btn-pequeno { padding: 8px 12px; font-size: 13px; width: auto; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.alerta {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alerta-erro { background: #fdecea; color: #8a1f16; }
.alerta-ok { background: #e7f6f2; color: #0e5b50; }
.alerta-info { background: #eef3f8; color: #14314f; }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: var(--navy);
  color: #d7e2ee;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .marca { color: #fff; margin-bottom: 28px; padding: 0 8px; }
.menu { display: flex; flex-direction: column; gap: 4px; }
.menu-titulo {
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #7f93a8;
  margin: 18px 8px 6px;
}
.menu a {
  color: #d7e2ee;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  display: block;
}
.menu a:hover, .menu a.ativo { background: rgba(255,255,255,0.08); color: #fff; }
.sidebar-rodape {
  margin-top: auto;
  padding: 12px 8px 4px;
  font-size: 12px;
  color: #7f93a8;
}
.conteudo { padding: 28px; }
.topo {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.topo h1 { margin: 0 0 6px; font-size: 26px; }
.topo p { margin: 0; color: var(--muted); }
.usuario-chip {
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.usuario-chip strong { display: block; }
.usuario-chip span { color: var(--muted); font-size: 12px; }

.cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card .rotulo { color: var(--muted); font-size: 13px; }
.card .numero { font-size: 28px; font-weight: 700; margin-top: 8px; }

.painel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.painel-topo {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.tabela-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}
.badge-ok { background: #e7f6f2; color: #0e5b50; }
.badge-warn { background: #fff4d6; color: #7a5410; }
.badge-off { background: #fdecea; color: #8a1f16; }
.badge-info { background: #eef3f8; color: #14314f; }

.grade-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grade-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.oculto { display: none !important; }
.check-linha {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 16px;
}
.check-linha input { width: auto; }

.vazio {
  text-align: center;
  color: var(--muted);
  padding: 32px 12px;
}

.filtros { margin-bottom: 4px; }
.td-num { text-align: right; white-space: nowrap; }
.linha-grupo td {
  background: #eef3f8;
  font-weight: 700;
  color: var(--navy);
}
.linha-subtotal td {
  background: #f7f4ee;
  font-weight: 700;
  color: var(--navy-2);
}
.linha-total td {
  background: var(--navy);
  color: #fff;
  font-weight: 700;
}

@media (max-width: 980px) {
  .login-page, .app, .cards, .grade-2, .grade-3 {
    grid-template-columns: 1fr;
  }
  .login-brand { display: none; }
  .sidebar { display: none; }
  .conteudo { padding: 16px; }
}
