:root {
  --bg: #eff3fb;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-soft: #f2f5f9;
  --line: #e4e8ef;
  --text: #111827;
  --muted: #667085;
  --muted-2: #98a2b3;
  --accent: #1f6feb;
  --accent-2: #14a37f;
  --danger: #d92d20;
  --warning: #b54708;
  --shadow: 0 18px 50px rgba(16, 24, 40, 0.08);
  --shadow-soft: 0 10px 32px rgba(16, 24, 40, 0.06);
  --radius: 8px;
  font-family:
    "Manrope", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  overflow-x: hidden;
  overflow-y: hidden;
  background:
    radial-gradient(60% 160% at 100% -10%, rgba(31, 111, 235, 0.11), transparent 58%),
    radial-gradient(45% 120% at -10% 0%, rgba(20, 163, 127, 0.1), transparent 52%),
    linear-gradient(160deg, #eef2ff 0%, #eef4ff 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background:
    linear-gradient(120deg, rgba(16, 24, 40, 0.05), rgba(31, 111, 235, 0.08)),
    var(--bg);
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-brand {
  padding-bottom: 4px;
}

.login-card h1 {
  font-size: 26px;
}

.login-card input,
.login-card button {
  width: 100%;
}

.login-error {
  margin: 0;
  border-radius: var(--radius);
  border: 1px solid #fecdca;
  background: #fef3f2;
  color: #b42318;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  padding: 10px 10px 10px 0;
}

.sidebar {
  background:
    linear-gradient(180deg, #111827 0%, #1a2436 100%);
  color: #eef2ff;
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow: auto;
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  border-radius: 0 18px 18px 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 0;
  box-shadow: var(--shadow-soft);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  background: #101828;
  color: white;
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 15px;
  color: #f8fafc;
}

.brand small {
  color: #bec9ea;
  font-size: 12px;
  margin-top: 2px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav-item {
  border: 0;
  color: #dbe1fa;
  background: rgba(255, 255, 255, 0.02);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: transform 160ms ease, background-color 160ms ease, color 160ms ease;
}

.nav-item::before {
  content: attr(data-icon);
  width: 18px;
  opacity: 0.92;
  text-align: center;
  font-size: 13px;
}

.nav-item:hover,
.nav-item.active {
  transform: translateX(2px);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.sidebar-status {
  margin-top: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  color: #d0d8f1;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: center;
  background: rgba(8, 15, 30, 0.26);
  backdrop-filter: blur(8px);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted-2);
}

.status-dot.ok {
  background: var(--accent-2);
}

.status-dot.error {
  background: var(--danger);
}

.workspace {
  padding: 28px;
  display: grid;
  gap: 20px;
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: auto;
  background: var(--surface);
  border-radius: 18px 18px 0 0;
  margin: 0 10px 10px 0;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(8px);
  animation: dashboardFadeIn 280ms ease;
}

@keyframes dashboardFadeIn {
  from {
    opacity: 0.92;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(16, 24, 40, 0.08);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.section-label,
.panel-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  font-size: 16px;
  line-height: 1.25;
}

.toolbar {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

select,
input {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  padding: 0 11px;
  min-width: 130px;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 3px solid rgba(31, 111, 235, 0.16);
  outline-offset: 1px;
}

.refresh-btn {
  height: 38px;
  border: 0;
  border-radius: var(--radius);
  background: linear-gradient(140deg, #111827 0%, #1f2937 100%);
  color: white;
  padding: 0 14px;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease;
}

.refresh-btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.search-row {
  position: relative;
  animation: dashboardFadeIn 240ms ease;
}

.user-chip {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 4px 5px 4px 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.user-chip button {
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: #f2f4f7;
  color: #344054;
  padding: 0 10px;
  font-weight: 700;
}

.search-row {
  position: relative;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  max-width: 620px;
  box-shadow: var(--shadow-soft);
}

.search-box input {
  width: 100%;
  border: 0;
  padding: 0;
}

.search-icon {
  color: var(--muted);
  font-weight: 700;
}

.search-results {
  position: absolute;
  top: 46px;
  left: 0;
  width: min(620px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 20;
  overflow: hidden;
}

.search-result {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.search-result:last-child {
  border-bottom: 0;
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  color: var(--muted);
  margin-top: 3px;
}

.status-banner {
  border-radius: var(--radius);
  border: 1px solid #fedf89;
  background: #fffbeb;
  color: #7a2e0e;
  padding: 12px 14px;
  font-size: 14px;
  animation: dashboardFadeIn 260ms ease;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.kpi-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  min-width: 0;
}

.kpi-card::before,
.panel::before {
  content: "";
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1f6feb, #14a37f);
  display: block;
}

.kpi-card {
  padding: 18px;
  display: grid;
  gap: 8px;
  min-height: 128px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.96), rgba(247, 249, 255, 0.9));
  transition: transform 180ms ease;
}

.kpi-card:hover {
  transform: translateY(-1px);
}

.kpi-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpi-card strong {
  font-size: clamp(20px, 1.45vw, 28px);
  line-height: 1.1;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.kpi-primary strong {
  font-size: clamp(24px, 1.85vw, 30px);
}

.kpi-card small {
  color: var(--muted);
}

.kpi-trend {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.kpi-trend.up { color: #22c55e; }
.kpi-trend.down { color: #ef4444; }

.kpi-primary {
  background:
    linear-gradient(135deg, #101827 0%, #1d2838 100%),
    #101828;
  color: white;
  box-shadow: var(--shadow);
  border-color: rgba(255, 255, 255, 0.1);
}

.kpi-primary::before {
  background: linear-gradient(90deg, #9cc1ff, #a4f0dc);
}

.kpi-primary span,
.kpi-primary small {
  color: #cbd5e1;
}

.kpi-primary .kpi-trend {
  color: #cbd5e1;
}
.kpi-primary .kpi-trend.up { color: #86efac; }
.kpi-primary .kpi-trend.down { color: #fca5a5; }

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, 0.9fr);
  gap: 14px;
}

.module-content-grid {
  grid-template-columns: 1.2fr minmax(240px, 0.8fr);
}

.bar-chart {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(180px, 2fr) minmax(130px, 0.8fr);
  align-items: center;
  gap: 10px;
}

.bar-row-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f1f5f9;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1f6feb, #14a37f);
}

.bar-value {
  color: var(--text);
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.panel {
  padding: 18px;
  border-radius: var(--radius);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.98), rgba(246, 249, 255, 0.96));
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.panel:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(16, 24, 40, 0.07);
}

.panel-wide {
  min-height: 360px;
}

.view-stack {
  display: grid;
  gap: 14px;
  animation: dashboardFadeIn 260ms ease;
}

.module-panel {
  min-height: 260px;
  align-content: center;
  display: grid;
  gap: 14px;
}

.module-total,
.module-number {
  color: var(--text);
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.module-note {
  margin: 0;
  max-width: 560px;
  color: var(--muted);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 16px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.chart {
  min-height: 280px;
}

.chart svg {
  width: 100%;
  height: 280px;
  display: block;
}

.single-day-chart {
  min-height: 280px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.single-day-chart div {
  display: grid;
  gap: 8px;
}

.single-day-chart span,
.single-day-chart small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.single-day-chart strong {
  font-size: 28px;
}

.single-day-chart i {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(31, 111, 235, 0.1));
}

.single-day-chart i.green {
  background: linear-gradient(90deg, var(--accent-2), rgba(20, 163, 127, 0.1));
}

.table-wrap {
  overflow: auto;
}

.panel .table-wrap {
  max-height: 520px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td.numeric,
th.numeric {
  text-align: right;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 700;
  background: var(--surface-soft);
  color: #344054;
}

.badge.ok {
  color: #027a48;
  background: #ecfdf3;
}

.badge.critico {
  color: #b42318;
  background: #fef3f2;
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.segment {
  height: 34px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: white;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.segment:last-child {
  border-right: 0;
}

.segment.active {
  background: #101828;
  color: white;
}

.segment:not(:disabled):hover {
  filter: brightness(0.98);
}

.search-result {
  transition: background-color 140ms ease;
}

.search-result:hover {
  background: #f8fbff;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 10px;
  align-items: center;
  min-height: 280px;
}

.donut-svg svg {
  width: 100%;
  height: 280px;
  display: block;
}

.donut-sidebar {
  display: grid;
  gap: 14px;
  align-content: center;
}

.donut-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 10px;
  align-items: start;
}

.donut-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  margin-top: 3px;
}

.donut-item div {
  display: grid;
  gap: 2px;
}

.donut-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.donut-amount {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.donut-pct {
  font-size: 12px;
  color: var(--muted-2);
}

.donut-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 0;
}

.empty-row {
  color: var(--muted);
  text-align: center;
}

.pagination-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.pagination-actions button {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: white;
  color: #344054;
  padding: 0 12px;
  font-weight: 700;
}

.pagination-actions button:not(:disabled):hover {
  border-color: #b7c3d6;
  color: var(--text);
}

.pagination-actions button:disabled {
  cursor: not-allowed;
  color: var(--muted-2);
  background: #f8fafc;
}

.pagination-actions strong {
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 1180px) {
  .kpi-grid,
  .content-grid {
    grid-template-columns: 1fr 1fr;
  }
  .module-content-grid {
    grid-template-columns: 1fr 1fr;
  }

  .panel-wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 780px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .nav-item {
    text-align: center;
    padding-inline: 8px;
  }

  .workspace {
    margin: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    padding: 16px;
  }

  .topbar,
  .toolbar {
    display: grid;
    justify-content: stretch;
    width: 100%;
  }

  .toolbar label {
    width: 100%;
  }

  .kpi-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }
  .module-content-grid {
    grid-template-columns: 1fr;
  }

  .pagination-bar,
  .pagination-actions {
    align-items: stretch;
    display: grid;
  }

  select,
  input,
  .refresh-btn {
    width: 100%;
  }
}
