:root {
  --bg: #f4f6fa;
  --surface: #ffffff;
  --border: #dfe3ec;
  --text: #1c2430;
  --muted: #6b7688;
  /* Cores da marca MEGANEWS */
  --brand: #003078;
  --brand-red: #d00912;
  --brand-soft: #e9eff8;
  --accent: #2f80ed;
  --success: #1e9e6a;
  --danger: #d64545;
  --warning: #e0a020;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(20, 30, 50, .08), 0 4px 12px rgba(20, 30, 50, .05);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}

/* ---------- layout ---------- */

/* Barra clara para que a logo apareça nas cores originais da marca. */
.topbar {
  background: var(--surface);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 0 24px;
  height: 64px;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.topbar .brand { display: flex; align-items: center; gap: 12px; }
.topbar .brand img { height: 44px; width: auto; display: block; }
.topbar .brand .title {
  font-weight: 700;
  font-size: 15px;
  color: var(--brand);
  line-height: 1.2;
  border-left: 1px solid var(--border);
  padding-left: 12px;
}
.topbar nav { display: flex; gap: 4px; flex: 1; }
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
}
.topbar nav a:hover { background: var(--brand-soft); color: var(--brand); }
.topbar nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.topbar .user a { color: var(--brand); text-decoration: none; font-weight: 600; }
.topbar .user a:hover { text-decoration: underline; }

.badge {
  background: var(--brand-soft);
  color: var(--brand);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
}

main { max-width: 1240px; margin: 28px auto; padding: 0 24px 60px; }

.page-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 14px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 15px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }

/* ---------- forms ---------- */

.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

@media (max-width: 860px) {
  .col-3, .col-4, .col-6 { grid-column: span 12; }
}

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #3c4757; }
label .req { color: var(--danger); }

input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, .15);
}
input:disabled, select:disabled { background: #f2f4f7; color: var(--muted); }
textarea { resize: vertical; min-height: 84px; }

.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .55; cursor: not-allowed; filter: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: #f6f8fb; filter: none; }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 5px 11px; font-size: 13px; }

.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 13px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
  background: #f7f9fc;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--muted);
  position: sticky;
  top: 0;
}
tbody tr:hover { background: var(--brand-soft); }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.obs { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.pill.yes { background: #e2f5ec; color: var(--success); }
.pill.no { background: #fdecec; color: var(--danger); }

.empty { padding: 46px 20px; text-align: center; color: var(--muted); }

/* ---------- dashboard ---------- */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.kpi .label { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.kpi .value { font-size: 27px; font-weight: 700; margin-top: 5px; font-variant-numeric: tabular-nums; }
.kpi .value.brand { color: var(--brand); }
.kpi .value.ok { color: var(--success); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(430px, 1fr)); gap: 20px; }
@media (max-width: 900px) { .charts { grid-template-columns: 1fr; } }
.chart svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.chart-legend span { display: flex; align-items: center; gap: 6px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }

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

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(20, 30, 50, .12); padding: 34px 30px; }
.login-card .login-logo { display: block; height: 96px; width: auto; margin: 0 auto 20px; }
.login-card h1 { margin: 0 0 4px; font-size: 20px; text-align: center; color: var(--brand); }
.login-card .sub { text-align: center; color: var(--muted); font-size: 14px; margin: 0 0 26px; }
.login-card .field { margin-bottom: 16px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 6px; }

/* ---------- feedback ---------- */

.alert { padding: 11px 15px; border-radius: 8px; font-size: 14px; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert.error { background: #fdecec; color: #a13333; border: 1px solid #f5c9c9; }
.alert.ok { background: #e4f6ee; color: #146b48; border: 1px solid #bfe6d5; }

/* ---------- confirmação de cadastro ---------- */

.confirm-card { border-left: 4px solid var(--success); }
.confirm-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.confirm-check {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e2f5ec;
  color: var(--success);
  font-size: 22px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.confirm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px 24px;
  margin: 0;
}
.confirm-grid div { border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.confirm-grid dt { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.confirm-grid dd { margin: 2px 0 0; font-weight: 600; }

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #22303f;
  color: #fff;
  padding: 12px 18px;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  font-size: 14px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(18, 26, 38, .5);
  display: none;
  place-items: center;
  padding: 20px;
  z-index: 40;
}
.modal-backdrop.show { display: grid; }
.modal { background: #fff; border-radius: 12px; padding: 26px; max-width: 900px; width: 100%; max-height: 88vh; overflow-y: auto; }
.modal h2 { margin-top: 0; }
