.yandex-direct-actions {
  position: relative;
  display: grid;
  grid-template-columns: minmax(240px, 1.2fr) minmax(170px, 0.75fr) minmax(145px, 0.6fr) minmax(180px, 0.8fr) auto;
  align-items: end;
  gap: 10px;
  width: min(100%, 1080px);
}

.yandex-direct-period-filter {
  position: relative;
}

.yandex-direct-search {
  width: 100%;
}

.yandex-direct-search input {
  width: 100%;
}

.yandex-direct-period-filter summary {
  width: 100%;
  min-height: 46px;
  display: grid;
  align-content: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 7px 36px 7px 12px;
  cursor: pointer;
  list-style: none;
}

.yandex-direct-period-filter summary::-webkit-details-marker {
  display: none;
}

.yandex-direct-period-filter summary::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 12px;
}

.yandex-direct-period-filter summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.1;
}

.yandex-direct-period-filter summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
}

.yandex-direct-period-popover {
  position: absolute;
  z-index: 20;
  right: 0;
  top: calc(100% + 10px);
  width: min(680px, calc(100vw - 48px));
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 220px;
  gap: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 22px 60px rgba(28, 24, 18, 0.18);
  padding: 24px;
}

.yandex-direct-period-calendars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.yandex-direct-period-calendars label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.yandex-direct-period-calendars input {
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 0 12px;
  color-scheme: light;
}

.yandex-direct-period-popover .period-presets {
  display: grid;
  align-content: start;
  gap: 8px;
}

.yandex-direct-period-popover .period-presets button {
  min-height: 0;
  justify-content: start;
  border: 0;
  border-bottom: 1px dotted color-mix(in srgb, var(--accent) 55%, transparent);
  border-radius: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  text-align: left;
  font-size: 15px;
  font-weight: 500;
}

.yandex-direct-period-popover .period-presets button.is-active {
  border-bottom-style: solid;
  color: var(--ink);
  font-weight: 900;
}

.yandex-direct-period-popover .period-filter-actions {
  grid-column: 2;
  display: grid;
  gap: 8px;
}

.yandex-direct-period-popover .period-filter-actions .primary-action {
  height: 42px;
  border-color: var(--accent);
  background: var(--accent);
  color: var(--surface-strong);
}

.yandex-direct-actions #refreshAllYandexDirectBtn {
  width: auto;
  min-height: 0;
  height: 46px;
  padding: 0 18px;
  white-space: nowrap;
}

.yandex-direct-actions .compact-filter select,
.yandex-direct-actions .compact-filter input {
  min-height: 46px;
  background: var(--surface-strong);
}

.yandex-direct-employee-filter[hidden] {
  display: none;
}

.yandex-direct-status {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface-strong));
  color: var(--accent);
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.15;
}

.yandex-direct-status:empty {
  display: none;
}

.yandex-campaigns-refresh-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.yandex-retry-failed-tokens {
  min-height: 30px;
  padding: 5px 10px;
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
  color: var(--danger);
  font-size: 12px;
  font-weight: 800;
}

.yandex-retry-failed-tokens[hidden] {
  display: none;
}

.yandex-direct-detail-row td {
  background: #fbfaf7;
  padding: 0;
}

.yandex-direct-account-toggle,
.yandex-direct-campaign-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  padding: 0;
  cursor: pointer;
}

.yandex-direct-account-toggle {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}

.yandex-direct-account-title,
.yandex-direct-account-meta,
.yandex-direct-campaign-main {
  min-width: 0;
}

.yandex-direct-account-title {
  display: grid;
  gap: 3px;
}

.yandex-direct-account-title strong,
.yandex-direct-campaign-main strong {
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.yandex-direct-account-title small,
.yandex-direct-account-meta,
.yandex-direct-campaign-main small,
.yandex-direct-empty-detail {
  color: var(--muted);
}

.yandex-direct-account-meta {
  display: grid;
  gap: 2px;
  margin: 7px 0 0 34px;
  font-size: 12px;
}

.yandex-direct-disclosure {
  width: 23px;
  height: 23px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--accent);
  font-weight: 900;
  line-height: 1;
}

.yandex-direct-campaign-list {
  display: grid;
  gap: 0;
}

.yandex-direct-campaign-item {
  border-top: 1px solid var(--line);
}

.yandex-direct-campaign-toggle {
  display: grid;
  grid-template-columns: 26px minmax(220px, 1fr) minmax(360px, 2.4fr);
  align-items: start;
  gap: 12px;
  padding: 12px;
}

.yandex-direct-campaign-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.yandex-direct-campaign-metrics span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.yandex-direct-ad-list {
  display: grid;
  margin: 0 12px 12px 50px;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface);
}

.yandex-direct-ad-item {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(150px, 0.6fr) minmax(90px, 0.45fr) minmax(100px, 0.5fr) minmax(260px, 2fr);
  gap: 14px;
  align-items: start;
  padding: 9px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

.yandex-direct-ad-item:first-child {
  border-top: 0;
}

.yandex-direct-ad-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.yandex-direct-ad-item > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.yandex-direct-ad-links a {
  overflow-wrap: anywhere;
}

.yandex-direct-empty-detail {
  padding: 12px;
  font-size: 13px;
}
