.sw-rep-head {
  align-items: flex-start;
  margin-bottom: 20px;
}

.sw-rep-head__title {
  font-size: 28px;
  line-height: 1.2;
}
.sw-rep-head__sub {
  font-size: 14px;
  margin: 6px 0 0;
}
.sw-rep-crumb {
  font-size: 13px;
  margin-bottom: 6px;
}
.sw-rep-new {
  height: 40px;
  padding: 0 18px;
}
.sw-rep-new svg {
  width: 16px;
  height: 16px;
}

.sw-rb,
.sw-saved {
  min-width: auto;
}
.sw-rb__title {
  font-size: 17px;
}
.sw-rb__sub {
  font-size: 13px;
  margin: 4px 0 20px;
}

.sw-rb-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.sw-rb-field {
  min-width: 0;
}

.sw-rb .sw-dd--field .sw-dd__menu {
  width: max-content;
  min-width: 100%;
  max-width: 260px;
}
.sw-rb-field__label {
  font-size: 13px;
  margin-bottom: 7px;
}

.sw-rb-metrics {
  margin-top: 22px;
}

.sw-rb-metrics__label {
  font-size: 12px;
  letter-spacing: 0.6px;
  margin: 0 0 10px;
}

.sw-rchip {
  --bs-btn-padding-x: 14px;
  --bs-btn-padding-y: 0px;
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--sw-border);
  --bs-btn-color: var(--sw-text);
  --bs-btn-hover-bg: var(--bs-btn-bg);
  --bs-btn-hover-border-color: var(--sw-border-strong);
  --bs-btn-hover-color: var(--bs-btn-color);
  --bs-btn-active-bg: var(--bs-btn-hover-bg);
  --bs-btn-active-border-color: var(--bs-btn-hover-border-color);
  --bs-btn-active-color: var(--bs-btn-hover-color);
  --bs-btn-focus-shadow-rgb: 110, 93, 248;
  --bs-btn-font-size: 13px;
  --bs-btn-font-weight: 500;
  /* Chip is now a <label> (Bootstrap .btn-check); unlike the old <button> it
     doesn't auto-centre its text in the fixed height, so centre it explicitly. */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
}

/* Selected metric chip. Chips are Bootstrap .btn-check checkboxes (name="metrics[]")
   so the label lives inside a form and submits natively; the selected state is
   .btn-check:checked + label. Overriding the REST vars is enough — the base
   .sw-rchip aliases --bs-btn-active-*: var(--bs-btn-hover-*) → var(--bs-btn-bg)
   (gotcha 30), so the checked state resolves to the same #f1eefe/violet look. */
.btn-check:checked + .sw-rchip {
  --bs-btn-bg: #f1eefe;
  --bs-btn-border-color: var(--sw-violet);
  --bs-btn-color: var(--sw-violet);
  --bs-btn-hover-border-color: var(--sw-violet);
}

.sw-rtable {
  --bs-border-radius: 12px;
  margin-top: 18px;
}

.sw-rt-row {
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
}
.sw-rt-row--head {
  background: var(--sw-bg-app);
}

.sw-rt-cell {
  padding: 13px 16px;
  font-size: 14px;
  min-width: 0;
}
.sw-rt-row--head .sw-rt-cell {
  font-size: 12px;
  font-weight: 600;
  color: var(--sw-text-muted);
}
.sw-rt-cell--node {
  font-weight: 500;
}

.sw-rb-foot {
  gap: 10px;
  margin-top: 20px;
}
.sw-rb-foot .sw-export,
.sw-rb-foot .sw-create {
  height: 40px;
}

.sw-saved__row {
  gap: 12px;
  padding: 13px 0;
}

.sw-saved__ic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #f1eefe;
  color: var(--sw-violet);
}
.sw-saved__ic svg {
  width: 18px;
  height: 18px;
}
.sw-saved__tc {
  flex: 1;
  min-width: 0;
}
.sw-saved__name {
  font-size: 14px;
}
.sw-saved__meta {
  font-size: 13px;
  margin: 2px 0 0;
}

.sw-saved__run {
  --bs-btn-padding-x: 0px;
  --bs-btn-padding-y: 0px;
  --bs-btn-border-width: 0;
  --bs-btn-bg: transparent;
  --bs-btn-color: var(--sw-text-muted);
  --bs-btn-border-radius: 9px;
  --bs-btn-hover-bg: var(--sw-bg-app);
  --bs-btn-hover-color: var(--sw-violet);
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--bs-btn-hover-bg);
  --bs-btn-active-color: var(--bs-btn-hover-color);
  --bs-btn-active-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 110, 93, 248;
  width: 34px;
  height: 34px;
}
.sw-saved__run svg {
  width: 17px;
  height: 17px;
}

/* =========================
  Responsive
========================= */
@media (max-width: 767px) {
  .sw-rep-head {
    flex-direction: column;
    align-items: stretch;
  }
  .sw-rep-head__title {
    font-size: 24px;
  }
  .sw-rep-new {
    width: 100%;
    justify-content: center;
  }

  .sw-rb-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sw-rt-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .sw-rt-cell--node {
    display: none;
  }

  .sw-rb-foot > * {
    flex: 1;
    justify-content: center;
  }
}

@media (min-width: 768px) {
  #newReportModal {
    --bs-modal-width: 640px;
  }
}

.sw-nr__head {
  padding: 20px 24px 0;
}

.sw-nr__crumb {
  font-size: 13px;
  color: #6b7280;
}
.sw-nr__crumb-sep {
  padding: 0 2px;
}
.sw-nr__crumb strong {
  color: #0f1020;
  font-weight: 500;
}

.sw-nr__close {
  --bs-btn-padding-x: 6px;
  --bs-btn-padding-y: 1px;
  --bs-btn-border-width: 0;
  --bs-btn-border-radius: 8px;
  --bs-btn-bg: transparent;
  --bs-btn-color: #667080;
  --bs-btn-hover-bg: #f0f2f5;
  --bs-btn-hover-color: #0f1020;
  --bs-btn-hover-border-color: transparent;
  --bs-btn-active-bg: var(--bs-btn-hover-bg);
  --bs-btn-active-color: var(--bs-btn-hover-color);
  --bs-btn-active-border-color: transparent;
  --bs-btn-focus-shadow-rgb: 110, 93, 248;
  width: 28px;
  height: 28px;
}
.sw-nr__close svg {
  width: 18px;
  height: 18px;
}
.sw-nr__title {
  font-size: 20px;
  color: #0f1020;
}
.sw-nr__sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: #6b7280;
}

.sw-nr__body {
  flex: 1;
  gap: 14px;
  padding: 14px 24px 16px;
}

.sw-nr-field {
  gap: 6px;
  min-width: 0;
}
.sw-nr-field__label {
  font-size: 13px;
  color: #2b3345;
}

.sw-nr-input {
  --bs-border-color: #e0e5ed;
  --bs-border-radius: 10px;
  height: 40px;
  padding: 0 12px;
  font-size: 14px;
  color: #0f1020;
  outline: 0;
}
.sw-nr-input::placeholder {
  color: #9ea3ad;
}
.sw-nr-input:focus {
  border-color: var(--sw-violet);
  box-shadow: 0 0 0 3px rgba(110, 93, 248, 0.15);
}

.sw-nr-row {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}
.sw-nr-row > * {
  min-width: 0;
}

.sw-nr__body .sw-dd--field .sw-dd__toggle {
  --bs-btn-border-color: #e0e5ed;
  height: 40px;
}

.sw-nr__foot {
  gap: 12px;
  padding: 16px 24px 20px;
  background: #fbfcfe;
  border-top: 1px solid #e5e8ed;
}

@media (max-width: 767.98px) {
  .sw-nr-row--stack {
    grid-template-columns: 1fr;
  }
  .sw-nr__foot .sw-btn-ghost,
  .sw-nr__foot .sw-btn-primary {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}
