#advertisingView {
  --ads-blue: #176b9b;
  --ads-border: #dde3eb;
  color: #243143;
  padding: 6px 4px 0;
  min-width: 0;
}
#advertisingView * {
  box-sizing: border-box;
}
#advertisingView button,
#advertisingView select,
#advertisingView input,
.ads-dialog button,
.ads-dialog input,
.ads-dialog select {
  font: inherit;
}
#advertisingView button,
.ads-dialog button {
  cursor: pointer;
  border: 1px solid #cad3dd;
  background: white;
  border-radius: 7px;
  padding: 8px 12px;
  color: #253349;
}
#advertisingView button:disabled,
.ads-dialog button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
#advertisingView .ads-primary,
.ads-dialog .ads-primary {
  background: #223247;
  color: white;
  border-color: #223247;
}
.ads-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
}
.ads-header h1 {
  font-size: 27px;
  margin: 10px 0 5px;
}
.ads-subtitle {
  color: #637184;
  font-size: 13px;
}
.ads-tabs {
  display: flex;
  gap: 26px;
  border-bottom: 1px solid var(--ads-border);
  margin: 20px 0;
}
.ads-tabs button[role="tab"] {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 12px 4px;
  font-weight: 600;
}
.ads-tabs button[aria-selected="true"] {
  color: var(--ads-blue);
  border-bottom: 3px solid var(--ads-blue);
}
.ads-topbar,
.ads-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.ads-topbar input,
.ads-toolbar input,
.ads-toolbar select {
  border: 1px solid #cad3dd;
  padding: 8px;
  border-radius: 6px;
  background: #fff;
}
.ads-topbar .ads-sync {
  margin-left: auto;
  font-size: 12px;
  color: #687789;
}
.ads-message {
  border: 1px solid #d7e2ed;
  background: #f2f7fc;
  border-radius: 8px;
  padding: 12px 15px;
  margin: 14px 0;
  line-height: 1.6;
}
.ads-message:empty {
  display: none;
}
.ads-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(100px, 1fr));
  gap: 0;
  background: white;
  border: 1px solid var(--ads-border);
  border-radius: 10px;
  margin: 15px 0;
}
.ads-kpi {
  padding: 18px 14px;
}
.ads-kpi small {
  color: #67778b;
}
.ads-kpi strong {
  display: block;
  font-size: 23px;
  font-variant-numeric: tabular-nums;
  margin-top: 8px;
  color: #1f2d3d;
}
.ads-chart {
  background: #fff;
  border: 1px solid var(--ads-border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.ads-chart header {
  display: flex;
  gap: 14px;
  align-items: center;
}
.ads-chart h2 {
  font-size: 17px;
  margin: 0 auto 0 0;
}
.ads-chart svg {
  width: 100%;
  height: 210px;
  display: block;
  margin-top: 12px;
}
.ads-legend {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: #607082;
}
.ads-grid {
  border: 1px solid var(--ads-border);
  background: white;
  border-radius: 8px;
  overflow: auto;
  max-height: 58vh;
}
.ads-grid table {
  border-collapse: separate;
  border-spacing: 0;
  white-space: nowrap;
  width: 100%;
  font-size: 13px;
}
.ads-grid th {
  position: sticky;
  top: 0;
  background: #f5f7fa;
  z-index: 2;
  border-bottom: 1px solid #d7dfe8;
  padding: 12px 10px;
  text-align: left;
}
.ads-grid th button {
  border: 0 !important;
  background: none !important;
  padding: 0 !important;
}
.ads-grid td {
  border-bottom: 1px solid #e9edf2;
  padding: 14px 10px;
}
.ads-grid tbody tr:hover td {
  background: #f8fbff;
}
.ads-grid tbody tr.selected td {
  background: #edf6ff;
}
.ads-grid th:nth-child(1),
.ads-grid td:nth-child(1) {
  position: sticky;
  left: 0;
  background: white;
  z-index: 1;
}
.ads-grid th:nth-child(2),
.ads-grid td:nth-child(2) {
  position: sticky;
  left: 35px;
  background: white;
  z-index: 1;
  min-width: 235px;
  max-width: 360px;
}
.ads-grid th:nth-child(-n + 2) {
  z-index: 3;
  background: #f5f7fa;
}
.ads-grid td:nth-child(2) small {
  display: block;
  font-size: 11px;
  color: #7a8797;
  margin-top: 5px;
}
.ads-link {
  color: #12699e !important;
  border: 0 !important;
  background: transparent !important;
  padding: 0 !important;
  white-space: normal;
  text-align: left;
  font-weight: 600;
}
.ads-pill {
  display: inline-block;
  background: #e5f4eb;
  color: #27714a;
  padding: 3px 9px;
  border-radius: 12px;
}
.ads-pill.paused {
  background: #f0f2f5;
  color: #697585;
}
.ads-grid tfoot td {
  font-weight: 600;
  background: #f6f8fb;
}
.ads-empty {
  text-align: center !important;
  padding: 48px !important;
  color: #738092;
}
.ads-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 15px;
  margin-top: 12px;
  font-size: 13px;
  color: #647286;
}
.ads-grid.compact td {
  padding: 7px 10px;
}
.ads-breadcrumb {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}
.ads-detail-tabs {
  display: flex;
  gap: 8px;
  margin: 15px 0;
}
.ads-detail-tabs .active {
  background: #e9f3fc !important;
  color: #156ba0 !important;
}
.ads-dialog {
  border: 0;
  border-radius: 12px;
  box-shadow: 0 20px 80px #172c4b40;
  width: min(700px, 92vw);
  padding: 25px;
  max-height: 85vh;
  color: #243143;
}
.ads-dialog::backdrop {
  background: #10203565;
}
.ads-dialog h2 {
  margin: 0 0 20px;
  font-size: 22px;
}
.ads-dialog form {
  display: grid;
  gap: 15px;
}
.ads-dialog label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}
.ads-dialog input,
.ads-dialog select {
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 9px;
  width: 100%;
}
.ads-dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}
.ads-dialog pre {
  white-space: pre-wrap;
  overflow: auto;
  background: #f5f7fa;
  padding: 12px;
  font-size: 12px;
}
.ads-dialog .ads-field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}
.ads-dialog .ads-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ads-dialog .ads-columns label {
  display: flex;
  align-items: center;
}
.ads-dialog input[type="checkbox"] {
  width: auto;
}
.ads-error {
  color: #a92828;
}
.ads-filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #edf3fa;
  border-radius: 5px;
  padding: 5px 9px;
  font-size: 13px;
}
.ads-filter-tag button {
  padding: 0 3px !important;
  border: 0 !important;
  background: transparent !important;
}
.ads-chart-empty {
  height: 180px;
  display: grid;
  place-items: center;
  color: #7a889a;
}
.ads-settings {
  background: white;
  border: 1px solid var(--ads-border);
  border-radius: 10px;
  padding: 22px;
  line-height: 2;
}
.ads-switch {
  border-radius: 20px !important;
  background: #287ba4 !important;
  color: white !important;
  font-size: 12px !important;
  padding: 3px 8px !important;
}
.ads-switch.off {
  background: #e6ebf0 !important;
  color: #596779 !important;
}
@media (max-width: 1200px) {
  .ads-kpis {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (max-width: 700px) {
  .ads-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
  .ads-header {
    align-items: flex-start;
  }
  .ads-tabs {
    gap: 10px;
    overflow: auto;
  }
  .ads-tabs button {
    white-space: nowrap;
  }
  .ads-topbar .ads-sync {
    margin-left: 0;
  }
  .ads-grid td:nth-child(2) {
    min-width: 180px;
  }
  .ads-dialog .ads-field-grid {
    grid-template-columns: 1fr;
  }
}

/* Compact, consistently sized module header and controls. */
body:has(#advertisingView:not(.hidden)) .main { padding-top: 12px; }
#advertisingView { padding-top: 0; }
#advertisingView .ads-header { justify-content: flex-start; flex-wrap: wrap; gap: 12px 24px; }
#advertisingView .ads-header h1 { margin: 0; font-size: 24px; line-height: 40px; white-space: nowrap; }
#advertisingView .ads-header > [data-act="connect"] { margin-left: auto; }
#advertisingView .ads-tabs { margin: 0; gap: 16px; border: 0; align-items: center; }
#advertisingView .ads-tabs button[role="tab"] { min-height: 40px; padding: 8px 6px; border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: transparent; }
#advertisingView .ads-tabs button[aria-selected="true"] { color: #176b9b; border-bottom-color: #176b9b; }
#advertisingView .ads-topbar { margin: 12px 0; }
#advertisingView .ads-topbar label { display: inline-flex; align-items: center; gap: 8px; }
#advertisingView .ads-topbar input,
#advertisingView .ads-topbar select,
#advertisingView .ads-topbar button,
#advertisingView .ads-chart header select,
#advertisingView .ads-chart header button { height: 40px; min-height: 40px; border: 1px solid #cad3dd; border-radius: 7px; background: #fff; color: #253349; padding: 8px 12px; font: inherit; }
#advertisingView .ads-topbar select,
#advertisingView .ads-chart header select { min-width: 165px; }
#advertisingView .ads-message { margin: 8px 0; }
@media (max-width: 900px) {
  #advertisingView .ads-header { gap: 8px 12px; }
  #advertisingView .ads-tabs { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 10px; }
}

/* Campaign controls and table use the available viewport without a footer. */
.ads-other { margin-left:auto; position:relative; flex-shrink:0; }
.ads-other summary { list-style:none; cursor:pointer; border:1px solid #cad3dd; border-radius:7px; padding:8px 12px; background:white; }
.ads-other-menu { position:absolute; right:0; top:calc(100% + 6px); z-index:30; min-width:160px; padding:6px; background:white; border:1px solid #cad3dd; border-radius:8px; box-shadow:0 5px 20px #24314322; display:grid; gap:4px; }
#advertisingView [aria-pressed="true"] { background:#e7f2ff; border-color:#3688d5; color:#175d9b; }
#adsCount { color:#607082; font-size:13px; white-space:nowrap; }
#advertisingView .ads-toolbar { flex-wrap:nowrap; gap:8px; }
#adsSearch { min-width:90px; width:210px; flex-shrink:1; }
@media(max-width:900px) { #advertisingView .ads-toolbar { flex-wrap:wrap; } }

#advertisingView .ads-footer[hidden] { display:none; }
body:has(#advertisingView:not(.hidden)) .main { padding-bottom:8px; }

#advertisingView > .ads-grid { max-height:none; min-height:240px; }

/* One summary region collapses completely, releasing space to the table. */
#advertisingView .ads-summary { background:white; border:1px solid var(--ads-border); border-radius:10px; margin:15px 0 20px; }
#advertisingView .ads-summary[hidden] { display:none; }
#advertisingView .ads-summary .ads-kpis { border:0; border-radius:0; margin:0; background:transparent; }
#advertisingView .ads-summary .ads-chart { border:0; border-top:1px solid var(--ads-border); border-radius:0; margin:0; background:transparent; }
#advertisingView [data-act="summary"] { margin-left:auto; flex-shrink:0; }

/* Match the Amazon products toolbar dimensions and keep both control rows together. */
#advertisingView .ads-controls {
  background:#fff; border:1px solid var(--border, #dde3eb); border-radius:8px;
  padding:10px 12px; margin:12px 0; display:flex; flex-direction:column; gap:12px; min-width:0;
}
#advertisingView .ads-controls .ads-topbar,
#advertisingView .ads-controls .ads-toolbar { margin:0; gap:8px; flex-wrap:wrap; min-width:0; }
#advertisingView .ads-controls button,
#advertisingView .ads-controls input,
#advertisingView .ads-controls select,
#advertisingView .ads-controls summary {
  height:34px; min-height:34px; border:1px solid #cbd5e1; border-radius:8px;
  padding:0 10px; font-family:Arial,sans-serif; font-size:13px; font-weight:400;
}
#advertisingView .ads-controls label { font-size:13px; }
#advertisingView .ads-controls button { min-width:58px; }
#advertisingView .ads-controls summary { display:flex; align-items:center; }
#advertisingView .ads-controls .ads-other { margin-left:0; }
#advertisingView .ads-controls #adsFilterTags { display:flex; flex:1 1 180px; flex-wrap:wrap; align-items:center; gap:6px; min-width:0; }
#advertisingView .ads-controls #adsFilterTags:empty { display:none; }
#advertisingView .ads-controls .ads-filter-tag { margin:0; display:inline-flex; align-items:center; gap:4px; min-height:28px; max-width:100%; overflow-wrap:anywhere; font-size:12px; }
#advertisingView .ads-controls .ads-filter-tag button { min-width:22px; width:22px; height:22px; min-height:22px; padding:0; border:0; flex-shrink:0; }
