:root {
  color-scheme: light;
  --bg: #edf4ff;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --line: #e6ebf4;
  --text: #121b2e;
  --muted: #667187;
  --blue: #3468f4;
  --blue-soft: #eaf1ff;
  --green: #16b26b;
  --red: #ef4444;
  --orange: #f59e0b;
  --cyan: #16a3b8;
  --shadow: 0 18px 50px rgba(33, 72, 140, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 16% 0%, rgba(52, 104, 244, 0.12), transparent 34%),
    linear-gradient(135deg, #f6faff 0%, #edf4ff 48%, #f8fbff 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 174px minmax(0, 1fr);
  min-height: 100vh;
  padding: 18px;
  gap: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 36px);
  padding: 26px 18px;
  border-right: 1px solid var(--line);
  border-radius: 14px 0 0 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 42px;
  font-weight: 800;
  font-size: 18px;
}

.brand-mark {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
}

.nav-list,
.sidebar-footer {
  display: grid;
  gap: 9px;
}

.sidebar-footer {
  margin-top: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 10px 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #536079;
  text-align: left;
  font-size: 13px;
  white-space: nowrap;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  stroke-width: 2;
}

.nav-item.active {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 10px 22px rgba(52, 104, 244, 0.28);
}

.nav-item.muted {
  color: #657188;
}

.main {
  min-height: calc(100vh - 36px);
  padding: 24px 28px 30px;
  border-radius: 0 14px 14px 0;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.topbar,
.section-header,
.filter-row,
.topbar-actions,
.user-chip {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  margin-bottom: 24px;
}

.search {
  display: flex;
  align-items: center;
  width: min(520px, 44vw);
  height: 38px;
  gap: 10px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
  color: #8a95a8;
}

.search svg {
  width: 16px;
  height: 16px;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
}

.topbar-actions {
  gap: 14px;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #24314a;
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.user-chip {
  gap: 10px;
  min-width: 172px;
}

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #2f66f4, #16b26b);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip strong {
  font-size: 12px;
}

.user-chip span {
  color: var(--muted);
  font-size: 11px;
}

.status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
  padding: 14px 16px;
  border: 1px solid #dce7fb;
  border-radius: 8px;
  background: #f7fbff;
}

.status-strip strong,
.status-strip span {
  display: block;
}

.status-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.primary-button,
.ghost-button {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
}

.ghost-button {
  border: 1px solid #d8e3f5;
  background: #fff;
  color: var(--blue);
}

.section-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.section-header h1 {
  margin: 2px 0 0;
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.filter-row {
  gap: 10px;
}

select {
  height: 34px;
  min-width: 140px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #2a3448;
  padding: 0 10px;
  font-size: 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(16, 35, 80, 0.05);
}

.metric-card {
  min-height: 105px;
  padding: 18px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.metric-card strong {
  display: block;
  margin-top: 9px;
  font-size: 24px;
  line-height: 1.1;
}

.metric-card small {
  display: block;
  margin-top: 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.overview-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.panel {
  min-width: 0;
  padding: 18px;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-header h2 {
  margin: 0;
  font-size: 15px;
  line-height: 1.2;
}

.panel-header span {
  color: var(--muted);
  font-size: 12px;
}

.chart-wrap {
  width: 100%;
  height: 270px;
}

canvas {
  max-width: 100%;
}

.donut-layout {
  display: grid;
  grid-template-columns: 210px 1fr;
  align-items: center;
  gap: 18px;
}

.legend {
  display: grid;
  gap: 10px;
  font-size: 12px;
}

.legend-item {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 12px;
}

#topCampaignTable {
  min-width: 640px;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid #edf1f7;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #6b768a;
  font-size: 11px;
  font-weight: 800;
}

td {
  color: #263148;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 5px;
  font-size: 11px;
  font-weight: 800;
}

.badge.green {
  background: #eafaf2;
  color: #138a53;
}

.badge.red {
  background: #fff1f1;
  color: #dc2626;
}

.badge.orange {
  background: #fff7e6;
  color: #b96b00;
}

.badge.blue {
  background: var(--blue-soft);
  color: var(--blue);
}

.badge.gray {
  background: #f1f5f9;
  color: #607089;
}

.alert-list,
.bar-list {
  display: grid;
  gap: 12px;
}

.alert-item,
.bar-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 7px;
  background: #f8fafc;
}

.alert-item strong,
.bar-item strong {
  font-size: 12px;
}

.alert-item span,
.bar-item span {
  color: var(--muted);
  font-size: 12px;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

.row-actions {
  display: flex;
  gap: 8px;
}

.mini-button {
  min-width: 58px;
  height: 28px;
  border: 1px solid #d8e3f5;
  border-radius: 5px;
  background: #fff;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.mini-button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 0;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 5;
    min-height: auto;
    border-radius: 0;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 12px;
  }

  .brand {
    margin: 0 12px 0 0;
  }

  .nav-list,
  .sidebar-footer {
    display: flex;
  }

  .sidebar-footer {
    margin-left: auto;
  }

  .nav-item {
    width: auto;
  }

  .main {
    min-height: auto;
    border-radius: 0;
    padding: 18px;
  }

  .topbar,
  .section-header,
  .status-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .search {
    width: 100%;
  }

  .metrics-grid,
  .overview-grid,
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .donut-layout {
    grid-template-columns: 1fr;
  }
}
