.analytics-shell { min-width: 0; }
.analytics-toolbar,
.analytics-tabs,
.analytics-growth-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.analytics-toolbar { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.analytics-toolbar label,
.analytics-growth-controls > label { min-width: 145px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.analytics-toolbar select,
.analytics-toolbar input,
.analytics-growth-controls select { display: block; width: 100%; margin-top: 5px; }
.analytics-tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: thin; }
.analytics-tabs .button { flex: 0 0 auto; }
.analytics-panel { min-width: 0; margin-top: 16px; }
.analytics-chart { min-width: 0; overflow: hidden; }
.analytics-chart svg { display: block; width: 100%; height: auto; min-height: 240px; overflow: visible; }
.analytics-grid line { stroke: var(--border); stroke-width: 1; }
.analytics-grid text,
.analytics-chart svg > text { fill: var(--muted); font: 12px system-ui, sans-serif; }
.analytics-line { fill: none; stroke: var(--series); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.analytics-chart circle { fill: var(--series); stroke: var(--white); stroke-width: 2; cursor: pointer; }
.analytics-bar { fill: var(--series); cursor: pointer; }
.analytics-bar:hover,
.analytics-bar:focus { filter: brightness(1.12); }
.analytics-bar-label { fill: var(--muted); font: 700 11px system-ui, sans-serif; }
.analytics-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 16px; margin-top: 8px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.analytics-legend span { display: inline-flex; align-items: center; gap: 6px; }
.analytics-legend i { width: 10px; height: 10px; border-radius: 50%; }
.analytics-growth-controls { align-items: start; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
.analytics-growth-controls fieldset {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  flex: 1 1 720px;
  gap: 8px;
  min-width: 0;
  max-height: 320px;
  margin: 0;
  padding: 8px 10px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  align-content: start;
  scrollbar-gutter: stable;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.analytics-growth-controls legend { padding: 0 5px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.analytics-growth-controls fieldset > label {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  min-height: 44px;
  box-sizing: border-box;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--cream);
  font-size: .82rem;
  font-weight: 750;
}
.analytics-growth-controls fieldset > label > input[type="checkbox"] { justify-self: center; margin: 0; }
.analytics-growth-controls fieldset label { font-size: .82rem; font-weight: 750; }
.analytics-growth-controls input[type="color"] { width: 26px; height: 26px; padding: 1px; border: 0; border-radius: 50%; background: transparent; }
.analytics-color-row,
.analytics-module-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; margin: 12px 0; }
.analytics-module-controls label { min-width: 190px; color: var(--muted); font-size: .78rem; font-weight: 800; }
.analytics-module-controls select,
.analytics-module-controls input { display: block; width: 100%; margin-top: 5px; }
.analytics-market-filters { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--white); }
html[data-theme="dark"] .analytics-market-filters { background: #172738; }
.analytics-color-control { display: inline-flex; align-items: center; gap: 6px; min-width: 0; padding: 5px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--cream); color: var(--navy); font-size: .78rem; font-weight: 800; }
.analytics-color-control input[type="color"] { flex: 0 0 auto; width: 26px; height: 26px; padding: 1px; border: 0; border-radius: 50%; background: transparent; }
.analytics-color-control span { min-width: 0; overflow-wrap: break-word; word-break: normal; line-height: 1.2; }
.analytics-growth-controls fieldset > label > .analytics-color-control { width: 100%; min-width: 0; box-sizing: border-box; padding: 0; border: 0; background: transparent; }
.analytics-two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.analytics-two-column .analytics-panel { min-width: 0; }
.analytics-notice { margin: 0 0 14px; padding: 11px 13px; border: 1px solid #c88f2e; border-radius: 10px; color: var(--navy); background: #fff4d7; font-size: .85rem; font-weight: 750; }
.analytics-table-wrap { max-height: 460px; overflow: auto; }
.analytics-table-wrap th { position: sticky; top: 0; z-index: 1; background: var(--white); }
.analytics-empty { padding: 30px 18px; border: 1px dashed var(--border); border-radius: var(--radius); text-align: center; background: var(--white); }
.analytics-empty strong { display: block; color: var(--navy); font-size: 1.05rem; }
.analytics-empty p { margin: 7px 0 0; color: var(--muted); }
.analytics-availability { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.analytics-availability > div { padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--cream); }
.analytics-availability strong,
.analytics-availability span { display: block; }
.analytics-availability span { margin-top: 4px; color: var(--muted); font-size: .76rem; text-transform: capitalize; }
html[data-theme="dark"] .analytics-toolbar,
html[data-theme="dark"] .analytics-growth-controls,
html[data-theme="dark"] .analytics-empty { background: #172738; }
html[data-theme="dark"] .analytics-growth-controls fieldset > label,
html[data-theme="dark"] .analytics-availability > div,
html[data-theme="dark"] .analytics-color-control { color: #f3efe5; background: #203245; }
html[data-theme="dark"] .analytics-growth-controls fieldset > label > .analytics-color-control { background: transparent; }
html[data-theme="dark"] .analytics-empty strong { color: #f3efe5; }
html[data-theme="dark"] .analytics-notice { border-color: #c99a45; color: #fff4d7; background: #3a3021; }
html[data-theme="dark"] .analytics-table-wrap th { color: #f3efe5; background: #172738; }
html[data-theme="dark"] .analytics-chart circle { stroke: #172738; }
html[data-theme="dark"] .analytics-bar-label { fill: #c9d4df; }
@media (max-width: 700px) {
  .analytics-toolbar label { flex: 1 1 42%; min-width: 125px; }
  .analytics-chart svg { width: 760px; max-width: none; }
  .analytics-chart { overflow-x: auto; padding-bottom: 5px; }
  .analytics-chart svg > text,
  .analytics-grid text { font-size: 14px; }
  .analytics-growth-controls { width: 100%; max-width: 100%; box-sizing: border-box; overflow: hidden; }
  .analytics-growth-controls > label { flex: 1 1 100%; min-width: 0; }
  .analytics-growth-controls fieldset {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    max-height: 280px;
    overflow-x: hidden;
    overflow-y: auto;
  }
  .analytics-growth-controls fieldset > label {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  .analytics-growth-controls fieldset > label:not(.analytics-color-control) {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
  }
  .analytics-growth-controls fieldset > label:not(.analytics-color-control) > input[type="checkbox"] {
    grid-column: 1;
    justify-self: center;
    margin: 0;
  }
  .analytics-growth-controls fieldset > label:not(.analytics-color-control) > .analytics-color-control {
    grid-column: 2;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
  @supports selector(fieldset:has(> .analytics-color-control)) {
    .analytics-growth-controls fieldset:has(> .analytics-color-control) {
      grid-template-columns: 44px minmax(0, 1fr);
      column-gap: 8px;
      row-gap: 8px;
    }
    .analytics-growth-controls fieldset:has(> .analytics-color-control) > label:not(.analytics-color-control) {
      grid-column: 1;
      display: flex;
      width: 44px;
      min-height: 44px;
      padding: 0;
      justify-content: center;
      border: 0;
      background: transparent;
    }
    .analytics-growth-controls fieldset:has(> .analytics-color-control) > .analytics-color-control {
      grid-column: 2;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      box-sizing: border-box;
      margin: 0;
    }
  }
  .analytics-two-column { grid-template-columns: 1fr; }
  .analytics-market-filters label { flex: 1 1 42%; min-width: 150px; }
  .analytics-table-wrap { max-width: 100%; overflow-x: auto; }
}
@media (max-width: 430px) {
  .analytics-toolbar label { flex-basis: 100%; }
  .analytics-tabs .button { min-height: 44px; }
  .analytics-market-filters label { flex-basis: 100%; }
  .analytics-chart svg { width: 660px; }
  .analytics-growth-controls fieldset { padding-inline: 8px; }
}
