:root {
  --bg: #161616;
  --card: #262626;
  --sidebar: #0f1a33;
  --primary: #1d5fd6;
  --primary-dark: #17469e;
  --text: #f2f2f2;
  --muted: #a7a7a7;
  --border: #3a3a3a;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 236px;
  background: var(--sidebar);
  padding: 22px 12px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: margin-left .25s;
}
body.menu-hidden .sidebar { margin-left: -236px; }

.company { display: flex; align-items: center; gap: 10px; padding: 0 6px 28px; }
.logo {
  width: 34px; height: 34px; border-radius: 8px;
  background: #fff; color: var(--primary);
  display: grid; place-items: center; font-weight: 700; font-size: 18px;
  border: 4px solid #2a9df4;
}
.company-info { flex: 1; font-size: 11px; line-height: 1.4; }
.company-info strong { display: block; font-size: 12px; }
.icon-btn { background: none; border: 0; color: var(--text); cursor: pointer; font-size: 14px; }

.menu a {
  display: flex; align-items: center; gap: 14px;
  padding: 9px 10px; margin-bottom: 10px;
  font-size: 13px; font-weight: 500; border-radius: 6px;
}
.menu a i { width: 18px; text-align: center; color: #c9cfdc; }
.menu a:hover { background: rgba(255,255,255,.06); }
.menu a.active { background: var(--primary); }
.menu a.active i { color: #fff; }
.menu a.has-sub::after {
  content: "\f078"; font-family: "Font Awesome 6 Free"; font-weight: 900;
  margin-left: auto; font-size: 11px; color: #c9cfdc;
}

/* ---------- Conteúdo ---------- */
.content { flex: 1; padding: 26px 16px 26px 48px; min-width: 0; }

.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 22px; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar h1 i { font-size: 17px; margin-left: 6px; }
.topbar-actions { display: flex; gap: 8px; }

.period {
  background: transparent; color: var(--muted);
  border: 1px solid #777; border-radius: 6px;
  padding: 7px 10px; font-family: inherit; font-size: 12px; width: 148px;
}
.period option { background: var(--card); }

.btn-primary {
  background: var(--primary); color: #fff; border: 0; border-radius: 6px;
  padding: 7px 10px; cursor: pointer; font-family: inherit;
}
.btn-primary:hover { background: var(--primary-dark); }

.layout { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }

.main-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
  align-content: start;
}

.card { background: var(--card); border-radius: 6px; padding: 16px; }
.card h2 { font-size: 16px; font-weight: 500; margin-bottom: 12px; }

.stat { grid-column: span 4; }
.stat-head { display: flex; justify-content: space-between; font-size: 16px; }
.stat-head i { color: var(--primary); font-size: 13px; }
.stat-value { font-size: 18px; font-weight: 700; margin-top: 18px; }

.chart-card { grid-column: span 6; }
.chart-wrap { height: 280px; }
.empty-card { grid-column: span 3; text-align: center; }
.empty { padding-top: 60px; color: var(--muted); }
.empty i { font-size: 54px; color: #4b6fb5; margin-bottom: 14px; }
.empty p { font-size: 12px; font-weight: 600; color: var(--text); }

.help-card {
  grid-column: span 4; text-align: center;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  min-height: 260px;
}
.help-card h3 { font-size: 19px; margin-bottom: 16px; }
.help-card p { font-size: 15px; margin-bottom: 26px; }
.btn-wide { padding: 8px 18px; font-size: 13px; font-weight: 600; }

.table-card { grid-column: span 8; }
table { width: 100%; border-collapse: collapse; font-size: 12px; border: 1px solid var(--border); }
th { color: var(--muted); font-weight: 400; text-align: left; padding: 12px 4px; border-right: 1px solid var(--border); }
td { padding: 6px 4px; border-top: 1px solid var(--border); }

/* ---------- Acesso rápido ---------- */
.quick h2 { font-size: 18px; margin-bottom: 8px; }
.quick-item {
  display: flex; justify-content: space-between; align-items: center;
  border: 1px solid #ddd; border-radius: 4px;
  padding: 4px 8px 4px 4px; margin-bottom: 12px; min-height: 44px;
  font-size: 12px; font-weight: 600;
}
.quick-item:hover { border-color: var(--primary); }
.quick-item span { display: block; }

/* ---------- Login / instalação ---------- */
.auth-page { align-items: center; justify-content: center; padding: 16px; }
.auth-box { width: 100%; max-width: 380px; padding: 32px 28px; display: flex; flex-direction: column; gap: 14px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 18px; margin-bottom: 6px; }
.auth-box h2 { margin-bottom: 0; }
.auth-box p { font-size: 13px; color: var(--muted); }
.auth-box label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.auth-box input {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; font-family: inherit; font-size: 14px;
}
.auth-box input:focus { outline: none; border-color: var(--primary); }
.auth-box .btn-wide { padding: 11px; margin-top: 6px; }
.alert { background: #4a1820; border: 1px solid #a3283c; color: #ffd5dc; padding: 10px 12px; border-radius: 6px; font-size: 13px; }
.alert.ok { background: #143d2c; border-color: #1f8a5c; color: #c8f5df; }

.user-box { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.user-box a { color: var(--text); }
.user-box a:hover { color: var(--primary); }
.chart-small { height: 210px; }

/* ---------- Telas de cadastro ---------- */
.flash { margin-bottom: 16px; }
.btn-secondary {
  background: transparent; color: var(--text); border: 1px solid #777; border-radius: 6px;
  padding: 8px 18px; font-size: 13px;
}
.btn-secondary:hover { border-color: var(--text); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filters input, .filters select, .form-grid input, .form-grid select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 9px 12px; font-family: inherit; font-size: 13px;
}
.filters input { flex: 1; min-width: 220px; }
.filters input:focus, .filters select:focus, .form-grid input:focus, .form-grid select:focus {
  outline: none; border-color: var(--primary);
}

.table-scroll { overflow-x: auto; }
table.list { border: 0; font-size: 13px; }
table.list th { border-right: 0; border-bottom: 1px solid var(--border); padding: 10px 8px; }
table.list td { padding: 10px 8px; }
table.list tbody tr:hover { background: rgba(255,255,255,.03); }
.center { text-align: center; color: var(--muted); }
.row-actions { display: flex; gap: 12px; justify-content: flex-end; }
.row-actions form { display: inline; }
.row-actions a, .row-actions button { color: var(--muted); background: none; border: 0; cursor: pointer; font-size: 14px; }
.row-actions a:hover { color: var(--primary); }
.row-actions button:hover { color: #e0103a; }

.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pager div { display: flex; gap: 14px; }
.pager a { color: var(--primary); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 820px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 1fr; }
  .chart-card, .table-card { grid-column: span 12; }
  .empty-card { grid-column: span 6; }
  .help-card { grid-column: span 12; }
}
@media (max-width: 768px) {
  .sidebar { position: fixed; z-index: 10; margin-left: -236px; }
  body.menu-open .sidebar { margin-left: 0; }
  .content { padding: 18px 16px; }
  .stat, .empty-card { grid-column: span 12; }
}
