/* ============================================================
   Dashboard PX3 Lab — dark editorial
============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg-0: #0f1117;
  --bg-1: #161b22;
  --bg-2: #1c222c;
  --bg-3: #232a36;
  --line: #232a36;
  --line-2: #2c3441;
  --text: #e6edf3;
  --muted: #8b95a7;
  --muted-2: #5b6473;
  --accent: #d6c08a;        /* dourado editorial */
  --accent-2: #f1e2b5;
  --green: #4ade80;
  --red: #f87171;
  --blue: #60a5fa;
  --purple: #a78bfa;
  --pink: #f472b6;
  --orange: #fb923c;
  --radius: 14px;
  --radius-sm: 10px;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-0);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ====== SIDEBAR ====== */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 264px;
  background: var(--bg-0);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 18px;
  z-index: 10;
  overflow-y: auto;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 22px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}
.brand-mark {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), #a08043);
  color: #11151c;
  font-weight: 800;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0.5px;
}
.brand-mark.big { width: 64px; height: 64px; font-size: 22px; border-radius: 16px; margin: 0 auto 16px; }
.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text);
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.4px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  transition: background .15s, color .15s;
  position: relative;
}
.menu-item:hover { background: var(--bg-2); color: var(--text); }
.menu-item.active {
  background: var(--bg-2);
  color: var(--text);
}
.menu-item.active::before {
  content: '';
  position: absolute;
  left: -18px;
  top: 8px; bottom: 8px;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.menu-item .ic { font-size: 15px; width: 18px; text-align: center; }
.menu-item .ic-svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--muted); }
.menu-item:hover .ic-svg, .menu-item.active .ic-svg { color: var(--accent); }
.menu-item .caret { margin-left: auto; font-size: 10px; color: var(--muted-2); }

.menu-group { display: flex; flex-direction: column; }
.menu-group .submenu {
  display: none;
  flex-direction: column;
  margin: 4px 0 8px 36px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
  gap: 2px;
}
.menu-group.open .submenu { display: flex; }
.submenu-item {
  padding: 7px 10px;
  font-size: 13px;
  color: var(--muted);
  border-radius: 8px;
  transition: background .15s, color .15s;
}
.submenu-item:hover { color: var(--text); background: var(--bg-2); }
.submenu-item.active {
  color: var(--accent-2);
  background: var(--bg-2);
  font-weight: 600;
}

.sidebar-footer {
  padding-top: 16px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
}
.user {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: var(--accent);
}
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.logout-link { font-size: 11px; color: var(--muted); }
.logout-link:hover { color: var(--red); }

/* ====== MAIN ====== */
.main {
  margin-left: 264px;
  padding: 32px 36px;
  min-height: 100vh;
  background: var(--bg-1);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  font-weight: 700;
  margin-bottom: 6px;
}
.page-head h1 {
  font-size: 28px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.5px;
  margin-bottom: 6px;
}
.muted { color: var(--muted); }
.center { text-align: center; }

/* ====== FILTRO ====== */
.filter-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.filter-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-inline span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
}
.field-inline select,
.field-inline input[type="date"] {
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 8px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  min-width: 140px;
}
.custom-range { display: flex; gap: 10px; }

.btn-primary, .btn-secondary {
  background: var(--accent);
  color: #11151c;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: filter .15s;
  font-family: inherit;
}
.btn-primary:hover, .btn-secondary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--bg-3); color: var(--text); border: 1px solid var(--line-2); }
.btn-secondary:hover { background: var(--bg-2); }

/* ====== CARDS KPI ====== */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: transform .15s, border-color .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-2); }
.card .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}
.card .value {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.1;
  letter-spacing: -0.5px;
}
.card .sub {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 4px;
}
.card.accent-blue .value { color: var(--blue); }
.card.accent-purple .value { color: var(--purple); }
.card.accent-green .value { color: var(--green); }
.card.accent-red .value { color: var(--red); }
.card.accent-pink .value { color: var(--pink); }

/* ====== PANEL ====== */
.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}
.panel h2 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.panel h2::before {
  content: '';
  width: 3px; height: 16px;
  background: var(--accent);
  border-radius: 2px;
}
.panel .desc {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 16px;
}

/* ====== TABELA ====== */
table {
  width: 100%;
  border-collapse: collapse;
}
thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
  background: var(--bg-3);
}
tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
  color: var(--text);
}
tbody tr:hover { background: rgba(214, 192, 138, 0.04); }
.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.stage-tag {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: rgba(214, 192, 138, 0.12);
  color: var(--accent-2);
  border: 1px solid rgba(214, 192, 138, 0.25);
}
.bar-wrap {
  position: relative;
  background: var(--bg-3);
  border-radius: 8px;
  height: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar {
  height: 100%;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width .5s ease;
}
.bar-label {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.phone {
  color: var(--green);
  font-variant-numeric: tabular-nums;
}
.phone:hover { text-decoration: underline; }
.obs {
  color: #cbd5e1;
  font-size: 12px;
  max-width: 380px;
}

/* ====== EMPTY STATE ====== */
.empty-state {
  text-align: center;
  padding: 80px 24px;
  background: var(--bg-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
}
.empty-state .empty-icon { font-size: 42px; margin-bottom: 12px; }
.empty-state h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p { max-width: 480px; margin: 0 auto; }

/* ====== INDEX OVERVIEW ====== */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}
.ov-card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  transition: transform .15s, border-color .15s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.ov-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
}
.ov-icon { font-size: 28px; margin-bottom: 14px; color: var(--accent); }
.ov-icon svg { width: 32px; height: 32px; }
.ov-card h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.ov-card p {
  font-size: 13px;
  color: var(--muted);
  flex: 1;
  margin-bottom: 14px;
}
.ov-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.5px;
}

/* ====== FLASH ====== */
.flashes { margin-bottom: 16px; }
.flash {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 6px;
}
.flash-error { background: rgba(248, 113, 113, 0.1); border: 1px solid rgba(248, 113, 113, 0.25); color: var(--red); }
.flash-success { background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.25); color: var(--green); }

/* ====== LOGIN ====== */
.login-body {
  background: radial-gradient(circle at 30% 20%, #1a1f2c 0%, #0a0d13 60%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 36px 32px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--text);
  margin-bottom: 4px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  font-weight: 600;
}
.field input {
  background: var(--bg-0);
  border: 1px solid var(--line-2);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
}
.btn-primary {
  width: 100%;
  margin-top: 8px;
}
.login-footer {
  text-align: center;
  font-size: 11px;
  margin-top: 22px;
  letter-spacing: 0.5px;
}

/* ====== RESPONSIVE ====== */
@media (max-width: 880px) {
  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .main { margin-left: 0; padding: 20px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .filter-form { flex-direction: column; align-items: stretch; }
  .field-inline select, .field-inline input { width: 100%; }
}
