/* Clean, compact hierarchy for the read-only creative performance overview. */
html[data-direto-creative-analysis] main {
  max-width: 1720px !important;
  width: calc(100vw - 432px) !important;
  max-width: 100% !important;
  min-width: 0 !important;
  flex: 1 1 0% !important;
  box-sizing: border-box !important;
  padding: 22px clamp(16px, 2vw, 32px) 40px !important;
}

html.direto-sidebar-collapsed[data-direto-creative-analysis] main {
  width: calc(100vw - 120px) !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) {
  display: flex !important;
  flex-direction: column !important;
  gap: 14px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > * {
  margin-block: 0 !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > header {
  order: 1;
  padding: 20px 24px !important;
  border: 1px solid rgba(71, 205, 190, .17);
  border-radius: 20px;
  background: linear-gradient(112deg, rgba(8, 31, 38, .96), rgba(5, 15, 22, .88) 64%, rgba(9, 43, 37, .6));
  box-shadow: 0 14px 38px rgba(0, 0, 0, .14);
}

html[data-direto-creative-analysis] main > div:has(> header h1) > header h1 {
  font-size: clamp(1.8rem, 3vw, 2.65rem) !important;
  line-height: 1.05 !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > header h1 + p {
  margin-top: 7px !important;
  font-size: .9rem !important;
  line-height: 1.45 !important;
}

/* Four headline numbers form one readable row. */
html[data-direto-creative-analysis] main > div:has(> header h1) > section:first-of-type {
  order: 2;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)) !important;
  gap: 12px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:first-of-type > div {
  min-height: 112px;
  padding: 15px 17px !important;
  border-radius: 16px !important;
  border: 1px solid rgba(127, 180, 191, .14);
  background: linear-gradient(145deg, rgba(11, 24, 32, .96), rgba(5, 13, 19, .96)) !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:first-of-type > div > div:nth-child(2) {
  font-size: clamp(1.2rem, 2.15vw, 1.85rem) !important;
}

/* Supporting indicators stay in a compact strip instead of competing with totals. */
html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(2) {
  order: 3;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)) !important;
  gap: 9px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(2) > button {
  min-width: 0;
  min-height: 72px;
  padding: 9px 11px !important;
  border: 1px solid rgba(127, 180, 191, .13) !important;
  border-radius: 13px !important;
  background: rgba(8, 20, 27, .88) !important;
  box-shadow: none !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(2) > button > div {
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  gap: 8px !important;
}

/* Filters are a single, quieter panel: presets first, fields below. */
html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) {
  order: 4;
  padding: 15px 17px !important;
  border: 1px solid rgba(71, 205, 190, .16) !important;
  border-radius: 17px !important;
  background: linear-gradient(145deg, rgba(8, 23, 30, .95), rgba(5, 13, 19, .96)) !important;
  box-shadow: none !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) > div:nth-child(2) {
  gap: 7px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) > div:nth-child(2) button {
  height: 30px !important;
  padding-inline: 11px !important;
  border-radius: 9px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) > div:last-child {
  gap: 10px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) label {
  color: #9ab1bd !important;
  font-size: 10px !important;
  font-weight: 700 !important;
}

/* Ranking follows the filters, keeping the ranking relevant to the selected period. */
html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(3) {
  order: 6;
  padding: 14px 16px 16px;
  border: 1px solid rgba(127, 180, 191, .13);
  border-radius: 17px;
  background: rgba(7, 18, 25, .68);
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(3) > div:last-child {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 10px !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(3) > div:last-child > button {
  padding: 13px 15px !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  background: linear-gradient(145deg, rgba(20, 27, 31, .98), rgba(8, 16, 21, .96)) !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(3) > div:last-child > button:only-child {
  max-width: 680px;
  width: 100%;
}

/* The data table is the main work surface: fixed header, calm rows, clear numbers. */
html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(table) {
  order: 5;
  border: 1px solid rgba(71, 205, 190, .17) !important;
  border-radius: 17px !important;
  background: rgba(6, 15, 21, .94) !important;
  box-shadow: 0 14px 38px rgba(0, 0, 0, .12);
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(table) > div {
  max-height: min(48vh, 620px);
  overflow: auto !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(table) thead {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #0c1a22 !important;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(table) th {
  padding: 11px 10px !important;
  color: #9cb4c0 !important;
  font-size: 9px !important;
  letter-spacing: .1em !important;
  white-space: nowrap;
}

html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(table) td {
  padding: 10px !important;
  border-color: rgba(127, 180, 191, .1) !important;
  white-space: nowrap;
}

@media (max-width: 760px) {
  html[data-direto-creative-analysis] main {
    width: 100vw !important;
    max-width: 100vw !important;
    padding: 14px 12px 28px !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > header {
    padding: 16px !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > section:first-of-type {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > section:first-of-type > div {
    min-height: 100px;
    padding: 12px !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(2) {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > section:nth-of-type(3) > div:last-child {
    grid-template-columns: 1fr !important;
  }
  html[data-direto-creative-analysis] main > div:has(> header h1) > div:has(> div > button):not(:has(table)) {
    padding: 13px !important;
  }
}
