:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #132033;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f4f6f8;
  color: #132033;
}

button,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

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

.topbar h1,
.panel h2,
.panel h3,
.panel p {
  margin: 0;
}

.eyebrow,
.section-label,
.muted {
  color: #61708a;
}

.eyebrow,
.section-label {
  font-size: 12px;
  text-transform: uppercase;
}

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

.account-chip {
  padding: 8px 12px;
  border-radius: 8px;
  background: #e6edf8;
  color: #28456f;
}

.primary-button,
.ghost-button {
  border-radius: 8px;
  padding: 10px 14px;
  border: 1px solid transparent;
  cursor: pointer;
}

.primary-button {
  background: #1f5eff;
  color: #ffffff;
}

.ghost-button {
  background: #ffffff;
  color: #213249;
  border-color: #d5deea;
}

.content-grid,
.dashboard {
  display: grid;
  gap: 16px;
}

.panel {
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 20px;
}

.auth-panel {
  max-width: 520px;
}

.scope-panel {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.filters {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-field {
  display: grid;
  gap: 8px;
  color: #41526a;
}

.filter-field select {
  min-width: 100px;
  border: 1px solid #d5deea;
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.metric-card {
  background: #ffffff;
  border: 1px solid #dbe3ee;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 8px;
}

.metric-card h3 {
  font-size: 14px;
  color: #61708a;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
}

.chart-panel {
  display: grid;
  gap: 12px;
  grid-template-rows: auto 1fr;
}

.chart-panel .panel-header {
  min-height: 68px;
  align-items: start;
}

.chart {
  min-height: 300px;
  border: 1px solid #e6edf5;
  border-radius: 8px;
  padding: 12px;
  background:
    radial-gradient(circle at top left, rgba(92, 141, 255, 0.14), transparent 36%),
    radial-gradient(circle at top right, rgba(55, 201, 166, 0.12), transparent 32%),
    #fbfcfe;
  overflow-x: auto;
  overflow-y: hidden;
}

.chart-svg {
  width: 100%;
  min-width: 0;
  height: 300px;
  display: block;
}

.chart-grid-line {
  stroke: #dde6f0;
  stroke-width: 1;
}

.chart-bar {
  fill: url(#chartBarGradient);
}

.chart-bar:hover {
  fill: #315dff;
}

.chart-axis {
  stroke: #8ea0ba;
  stroke-width: 1.25;
}

.chart-tick-label {
  fill: #5d6f88;
  font-size: 12px;
}

.chart-value-label {
  fill: #35506f;
  font-size: 12px;
  font-weight: 600;
}

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

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #edf2f7;
  vertical-align: top;
}

th {
  font-size: 12px;
  text-transform: uppercase;
  color: #61708a;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.error-panel {
  border-color: #f2c1c1;
  background: #fff6f6;
  color: #8f2525;
}

.empty-state {
  color: #61708a;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 16px;
  }

  .charts-grid,
  .topbar,
  .scope-panel {
    grid-template-columns: 1fr;
    display: grid;
  }
}
