:root {
  --navy: #1f4e78;
  --navy-dark: #163a5a;
  --bg: #f4f6f8;
  --card: #ffffff;
  --border: #e0e4e8;
  --text: #222;
  --muted: #6b7280;
  --red: #c0392b;
  --red-bg: #fdecea;
  --orange: #b9770e;
  --orange-bg: #fef5e7;
  --yellow-bg: #fff8db;
  --green: #1e8449;
  --green-bg: #eafaf1;
  --blue-link: #1f4e78;
}
* { box-sizing: border-box; }
body {
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  font-size: 14px;
}
a { color: var(--blue-link); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
}
.topbar .brand { font-weight: bold; font-size: 16px; }
.topbar .brand a { color: white; }
.topbar nav { display: flex; gap: 4px; flex-wrap: wrap; }
.topbar nav a {
  color: #dbe6f0;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 13px;
}
.topbar nav a:hover, .topbar nav a.active {
  background: rgba(255,255,255,0.15);
  color: white;
  text-decoration: none;
}
.topbar .user { font-size: 12px; color: #cfe0ee; display: flex; align-items: center; gap: 10px; }
.topbar .user a { color: white; text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.container.wide { max-width: 1500px; }

h1 { font-size: 22px; color: var(--navy); margin: 0 0 4px; }
h2 { font-size: 16px; color: var(--navy); margin: 24px 0 10px; border-bottom: 2px solid var(--navy); padding-bottom: 4px; }
h3 { font-size: 14px; color: var(--navy); margin: 16px 0 8px; }
.subtitle { color: var(--muted); margin-bottom: 20px; font-size: 13px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; } }

.stat-tile { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px; text-align: center; }
.stat-tile .num { font-size: 28px; font-weight: bold; color: var(--navy); }
.stat-tile .label { color: var(--muted); font-size: 12px; margin-top: 4px; }
.stat-tile.critico .num { color: var(--red); }

table { width: 100%; border-collapse: collapse; background: var(--card); }
table.tight th, table.tight td { padding: 6px 8px; font-size: 12.5px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { background: var(--navy); color: white; font-weight: 600; font-size: 12.5px; position: sticky; top: 0; }
tr:hover td { background: #f8fafc; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 8px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.yellow { background: var(--yellow-bg); color: #7a6000; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.gray { background: #eee; color: #555; }

.row-alert-critica { background: var(--red-bg) !important; }
.row-alert-alta { background: var(--orange-bg) !important; }

form .field { margin-bottom: 12px; }
form .field label { display: block; font-size: 12.5px; font-weight: 600; color: #444; margin-bottom: 4px; }
form .field .hint { font-size: 11px; color: var(--muted); margin-top: 2px; }
input, select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #ccd3da;
  border-radius: 5px;
  font-size: 13.5px;
  font-family: inherit;
  background: white;
}
textarea { min-height: 60px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #7fb0d8; border-color: var(--navy); }

.btn {
  display: inline-block;
  background: var(--navy);
  color: white;
  border: none;
  padding: 9px 18px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--navy-dark); text-decoration: none; }
.btn.secondary { background: white; color: var(--navy); border: 1px solid var(--navy); }
.btn.secondary:hover { background: #eef4f9; }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn.danger { background: var(--red); }

.actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }
.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.section-header { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: white; padding: 36px; border-radius: 10px; box-shadow: 0 4px 24px rgba(0,0,0,0.08); width: 340px; }
.login-card h1 { text-align: center; }
.login-card .subtitle { text-align: center; }
.error-msg { background: var(--red-bg); color: var(--red); padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }

.demo-note { background: var(--yellow-bg); border: 1px solid #f0d878; padding: 10px 14px; border-radius: 6px; font-size: 12.5px; margin-bottom: 14px; }
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.footer-note { color: var(--muted); font-size: 11.5px; margin-top: 30px; text-align: center; }
.field-value { padding: 8px 0; font-size: 13.5px; }
.calc-tag { font-size: 10.5px; color: var(--muted); font-weight: normal; }
fieldset { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 18px; padding: 14px 16px; }
legend { font-weight: bold; color: var(--navy); padding: 0 6px; font-size: 13px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
