:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --panel-soft: #eef4fb;
  --line: #d8e1ec;
  --text: #111827;
  --muted: #667085;
  --blue: #1769e8;
  --green: #31bf8e;
  --amber: #eea33a;
  --red: #d94b4b;
  --shadow: 0 12px 34px rgba(28, 41, 62, 0.06);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 34px;
  line-height: 1.12;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
  line-height: 1.25;
}

.brand,
.section-kicker {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted,
small {
  color: var(--muted);
  font-size: 14px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px max(24px, calc((100vw - 1180px) / 2)) 28px;
  background: linear-gradient(180deg, #f7fbff 0%, #eef4fb 100%);
  border-bottom: 1px solid var(--line);
}

.layout {
  width: min(1180px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.user-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  min-width: 260px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-bar span {
  font-weight: 800;
}

.user-bar small {
  grid-column: 1;
}

.icon-button,
.secondary-button,
.primary-button,
.danger-button,
.tabs button,
.actions-cell button {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--blue);
  color: #ffffff;
}

.secondary-button,
.icon-button,
.tabs button,
.actions-cell button {
  background: #ffffff;
  color: var(--text);
  border-color: #c9d4e2;
}

.danger-button {
  background: #fff3f3;
  color: var(--red);
  border-color: #f0c7c7;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  background: #fff8e7;
  border: 1px solid #f0d99d;
  border-radius: 8px;
  color: #765100;
  font-weight: 700;
}

.panel,
.kpi-card,
.chart-block,
.mini-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel,
.chart-block {
  padding: 22px;
  margin-bottom: 16px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.top-align {
  align-items: start;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.advertiser-home {
  padding-bottom: 18px;
}

.advertiser-home-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr);
  gap: 16px;
  align-items: start;
}

.upload-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.soft-badge {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: #eef6ff;
  color: #215da8;
  font-size: 13px;
  font-weight: 800;
}

.status-list.refined {
  gap: 10px;
}

.kpi-card {
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 138px;
  padding: 22px;
}

.metric-label {
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.kpi-card strong {
  font-size: 32px;
  line-height: 1;
}

.time-kpi {
  font-size: 22px !important;
  line-height: 1.2 !important;
}

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

.network-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.7fr) minmax(0, 1.3fr);
  gap: 16px;
  align-items: center;
}

.inline-settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr)) minmax(120px, auto) auto;
  gap: 10px;
  align-items: end;
}

.advanced-settings {
  align-self: stretch;
  min-height: 40px;
  border: 1px solid #c9d4e2;
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
}

.advanced-settings summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.advanced-settings[open] {
  display: grid;
  gap: 10px;
}

.placement-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-height: 250px;
  align-content: center;
}

.placement-summary div {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}

.placement-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 8px;
}

.placement-summary strong {
  font-size: 22px;
  line-height: 1.2;
}

.section-head.compact {
  margin-bottom: 14px;
}

.report-controls {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 130px 76px;
  align-items: end;
  gap: 10px;
  min-width: 440px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid #c9d4e2;
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
}

.file-drop {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px dashed #aac0da;
  border-radius: 8px;
  background: #f8fbff;
}

.hint {
  padding: 10px 12px;
  background: #f3f6fa;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
}

.hint.success {
  background: #ecfbf5;
  color: #087a52;
}

.hint.error {
  background: #fff1f1;
  color: #b43333;
}

.status-list,
.cards-grid {
  display: grid;
  gap: 12px;
}

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

.status-item,
.mini-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.status-item {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.status-item strong,
.mini-card strong {
  display: block;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
}

.status-pending {
  background: #fff6e5;
  color: #996500;
}

.status-approved {
  background: #eaf9f3;
  color: #087a52;
}

.status-rejected {
  background: #fff1f1;
  color: #ad3535;
}

.row-actions,
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.empty-state {
  padding: 24px;
  border: 1px dashed #c7d3e3;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--muted);
  font-weight: 700;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 18px;
  height: 3px;
  border-radius: 999px;
}

.legend-blue {
  background: var(--blue);
}

.legend-green {
  background: var(--green);
}

.chart {
  width: 100%;
  min-height: 260px;
}

.panel > .chart-block {
  margin: 10px 0 18px;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.panel > .split-grid .chart-block {
  min-height: 320px;
  box-shadow: none;
}

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

.demography {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 24px;
  align-items: center;
  min-height: 250px;
}

.donut {
  width: 178px;
  height: 178px;
  margin: 0 auto;
  border-radius: 50%;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 44px;
  border-radius: 50%;
  background: var(--panel);
  border: 1px solid #edf1f6;
}

.donut-legend {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 14px;
}

.donut-legend span,
.age-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 8px;
}

.age-bars {
  display: grid;
  gap: 12px;
}

.age-row {
  display: grid;
  grid-template-columns: 54px 1fr 48px;
}

.age-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
}

.age-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

th,
td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child {
  text-align: left;
  white-space: normal;
}

th {
  background: #f4f7fa;
  color: var(--muted);
  font-weight: 800;
}

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

td strong {
  display: block;
}

td small {
  color: var(--muted);
}

.object-picker {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.object-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  max-height: 230px;
  overflow: auto;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
}

.checkbox-line input {
  width: auto;
  min-height: auto;
}

@media (max-width: 980px) {
  .app-header,
  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .user-bar,
  .report-controls {
    min-width: 0;
  }

  .split-grid,
  .hero-grid,
  .cards-grid,
  .advertiser-home-grid,
  .network-panel {
    grid-template-columns: 1fr 1fr;
  }

  .report-controls {
    grid-template-columns: 1fr 1fr auto;
  }

  .inline-settings {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }
}

@media (max-width: 680px) {
  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 20px;
  }

  .layout {
    width: min(100% - 20px, 1180px);
  }

  .app-header {
    padding: 24px 16px;
  }

  .split-grid,
  .hero-grid,
  .cards-grid,
  .advertiser-home-grid,
  .network-panel,
  .inline-settings,
  .report-controls,
  .demography,
  .object-checks {
    grid-template-columns: 1fr;
  }

  .panel,
  .chart-block,
  .kpi-card {
    padding: 18px;
  }

  .status-item {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 118px;
  }

  .kpi-card strong {
    font-size: 28px;
  }
}
