:root {
  --wpe-top-offset: 0px;
  --wpe-toolbar-height: 0px;
}

body.wpe-active {
  padding-top: calc(var(--wpe-top-offset) + var(--wpe-toolbar-height));
}

.wpe-toolbar {
  position: fixed;
  top: var(--wpe-top-offset);
  left: 0;
  right: 0;
  z-index: 1200;
  background: rgba(7, 8, 10, 0.97);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.wpe-toolbar-inner {
  width: min(1220px, calc(100% - 24px));
  margin: 0 auto;
  min-height: 70px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}

.wpe-toolbar-meta,
.wpe-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wpe-toolbar-actions {
  justify-content: flex-end;
}

.wpe-toolbar-center {
  display: grid;
  justify-items: center;
  gap: 4px;
  text-align: center;
}

.wpe-toolbar-center strong {
  color: #ffffff;
  font-size: 0.94rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wpe-toolbar-status {
  min-height: 1.1em;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.78rem;
}

.wpe-toolbar-status[data-tone="success"] {
  color: #9ff0b7;
}

.wpe-toolbar-status[data-tone="error"] {
  color: #ffb2b2;
}

.wpe-toolbar-status[data-tone="warning"] {
  color: #ffd08b;
}

.wpe-toolbar-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wpe-button,
.wpe-icon-button,
.wpe-security-item {
  appearance: none;
  font: inherit;
}

.wpe-button,
.wpe-icon-button {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #ffffff;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease, opacity 160ms ease;
}

.wpe-button:hover,
.wpe-icon-button:hover,
.wpe-icon-button[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
}

.wpe-button:disabled,
.wpe-icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.wpe-button-primary {
  background: linear-gradient(135deg, #2f80ff, #0fb79d);
  border-color: transparent;
  box-shadow: 0 14px 28px rgba(22, 94, 186, 0.28);
}

.wpe-icon-button {
  width: 42px;
  padding: 0;
  justify-content: center;
}

.wpe-icon-button svg {
  width: 18px;
  height: 18px;
}

.wpe-security {
  position: relative;
}

.wpe-security-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 220px;
  padding: 8px;
  border-radius: 18px;
  background: #ffffff;
  border: 1px solid rgba(16, 18, 23, 0.08);
  box-shadow: 0 22px 44px rgba(0, 0, 0, 0.2);
}

.wpe-security-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: #101217;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  text-align: left;
  cursor: pointer;
  font-size: 0.92rem;
}

.wpe-security-item:hover {
  background: rgba(16, 18, 23, 0.06);
}

.wpe-target {
  position: relative;
  transition: box-shadow 160ms ease, background-color 160ms ease;
}

.wpe-target:hover {
  box-shadow: 0 0 0 2px rgba(47, 128, 255, 0.28);
  background: rgba(47, 128, 255, 0.08);
}

.wpe-target:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 183, 157, 0.35);
  background: rgba(15, 183, 157, 0.08);
}

.wpe-target-image {
  cursor: pointer;
}

.wpe-target-image::after {
  content: "Replace image";
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(7, 8, 10, 0.84);
  color: #ffffff;
  font-size: 0.74rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease;
}

.wpe-target-image:hover::after {
  opacity: 1;
}

.wpe-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(8, 10, 14, 0.68);
  display: grid;
  place-items: center;
  padding: 24px;
}

.wpe-modal-card {
  width: min(520px, 100%);
  border-radius: 24px;
  background: #ffffff;
  color: #101217;
  box-shadow: 0 28px 64px rgba(0, 0, 0, 0.26);
  padding: 26px;
}

.wpe-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.wpe-modal-header h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
}

.wpe-modal-copy,
.wpe-modal-note {
  margin: 0;
  color: #5d6776;
  line-height: 1.65;
}

.wpe-modal-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: #101217;
  font: inherit;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.wpe-modal-form {
  display: grid;
  gap: 14px;
}

.wpe-modal-form label {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
  font-weight: 600;
}

.wpe-modal-form input {
  width: 100%;
  min-height: 48px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 14px;
  padding: 0 14px;
  font: inherit;
}

.wpe-modal-form textarea {
  width: 100%;
  min-height: 180px;
  border: 1px solid rgba(16, 18, 23, 0.12);
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  line-height: 1.6;
  resize: vertical;
}

.wpe-modal-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 6px;
}

.wpe-dashboard {
  position: fixed;
  left: 50%;
  top: calc(var(--wpe-top-offset) + var(--wpe-toolbar-height) + 14px);
  transform: translateX(-50%);
  z-index: 1250;
  width: min(1220px, calc(100% - 24px));
  pointer-events: none;
}

.wpe-dashboard-shell {
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 24px;
  background: rgba(7, 8, 10, 0.97);
  color: #ffffff;
  box-shadow: 0 24px 54px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
  padding: 20px;
  display: grid;
  gap: 16px;
  max-height: min(72vh, 820px);
  overflow: auto;
}

.wpe-dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.wpe-dashboard-heading h2,
.wpe-dashboard-kicker,
.wpe-dashboard-copy,
.wpe-dashboard-status,
.wpe-dashboard-note,
.wpe-history-item p,
.wpe-top-page-row span,
.wpe-recent-item small {
  margin: 0;
}

.wpe-dashboard-kicker {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.wpe-dashboard-heading h2 {
  font-size: clamp(1.35rem, 2.8vw, 1.85rem);
  line-height: 1.06;
  margin-bottom: 8px;
}

.wpe-dashboard-copy {
  color: rgba(255, 255, 255, 0.72);
  line-height: 1.65;
  max-width: 64ch;
}

.wpe-dashboard-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.wpe-dashboard-tab,
.wpe-dashboard-close {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #ffffff;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.wpe-dashboard-tab.is-active {
  background: linear-gradient(135deg, #2f80ff, #0fb79d);
  border-color: transparent;
}

.wpe-dashboard-status {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.9rem;
  min-height: 1.1em;
}

.wpe-dashboard-status[data-tone="success"] {
  color: #a0efb8;
}

.wpe-dashboard-status[data-tone="warning"] {
  color: #ffd08b;
}

.wpe-dashboard-status[data-tone="error"] {
  color: #ffb4b4;
}

.wpe-dashboard-panels {
  display: grid;
  gap: 16px;
}

.wpe-dashboard-panel {
  display: grid;
  gap: 16px;
}

.wpe-dashboard-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wpe-summary-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.82rem;
}

.wpe-summary-pill strong {
  color: #ffffff;
}

.wpe-history-list {
  display: grid;
  gap: 12px;
}

.wpe-history-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 18px;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

.wpe-history-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wpe-history-item-head strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
}

.wpe-history-item-head p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.84rem;
}

.wpe-history-badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.wpe-history-change-list,
.wpe-recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.wpe-history-change,
.wpe-recent-item {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.84);
  font-size: 0.76rem;
}

.wpe-history-actions {
  display: flex;
  justify-content: flex-end;
}

.wpe-button-secondary {
  background: rgba(255, 255, 255, 0.05);
}

.wpe-button-secondary:disabled {
  opacity: 0.45;
}

.wpe-history-empty {
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 18px;
  color: rgba(255, 255, 255, 0.76);
}

.wpe-history-empty strong {
  display: block;
  margin-bottom: 6px;
  color: #ffffff;
}

.wpe-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.wpe-stat-card {
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px;
  display: grid;
  gap: 6px;
}

.wpe-stat-card strong {
  font-size: clamp(1.55rem, 4vw, 2.1rem);
  line-height: 1;
}

.wpe-stat-card span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.84rem;
}

.wpe-top-pages {
  display: grid;
  gap: 12px;
}

.wpe-top-pages-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
  padding: 14px 16px;
  display: grid;
  gap: 12px;
}

.wpe-dashboard-section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.wpe-dashboard-section-title strong {
  font-size: 0.98rem;
}

.wpe-dashboard-section-title span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.78rem;
}

.wpe-top-pages-list {
  display: grid;
  gap: 10px;
}

.wpe-top-page {
  display: grid;
  gap: 6px;
}

.wpe-top-page-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wpe-top-page-row strong {
  font-size: 0.92rem;
}

.wpe-top-page-row span {
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.8rem;
}

.wpe-top-page-track {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.wpe-top-page-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, #2f80ff, #0fb79d);
}

.wpe-recent-list {
  display: grid;
  gap: 10px;
}

.wpe-recent-item {
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
}

.wpe-recent-item span {
  min-width: 46px;
  color: #9ff0b7;
  font-weight: 700;
}

.wpe-recent-item strong {
  flex: 1 1 auto;
  color: #ffffff;
}

.wpe-recent-item small {
  color: rgba(255, 255, 255, 0.58);
}

.wpe-dashboard-note {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
  line-height: 1.55;
}

@media (max-width: 860px) {
  .wpe-toolbar-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "center center"
      "meta actions";
    row-gap: 10px;
    min-height: 82px;
  }

  .wpe-toolbar-center {
    grid-area: center;
  }

  .wpe-toolbar-meta {
    grid-area: meta;
  }

  .wpe-toolbar-actions {
    grid-area: actions;
  }

  .wpe-dashboard {
    width: calc(100% - 18px);
    top: calc(var(--wpe-top-offset) + var(--wpe-toolbar-height) + 8px);
  }

  .wpe-dashboard-shell {
    max-height: calc(100vh - var(--wpe-top-offset) - var(--wpe-toolbar-height) - 20px);
    padding: 16px;
  }

  .wpe-dashboard-header {
    flex-direction: column;
  }

  .wpe-dashboard-actions {
    justify-content: flex-start;
  }

  .wpe-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  body.wpe-active {
    padding-top: calc(var(--wpe-top-offset) + var(--wpe-toolbar-height) + 8px);
  }

  .wpe-toolbar-inner {
    width: calc(100% - 18px);
    grid-template-columns: 1fr;
    grid-template-areas:
      "center"
      "actions";
    padding: 12px 0;
  }

  .wpe-toolbar-meta {
    display: none;
  }

  .wpe-toolbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .wpe-button {
    flex: 1 1 auto;
    justify-content: center;
  }

  .wpe-security-menu {
    right: 0;
    left: auto;
    min-width: min(220px, calc(100vw - 28px));
  }

  .wpe-modal {
    padding: 16px;
  }

  .wpe-modal-card {
    padding: 22px;
  }

  .wpe-dashboard-shell {
    width: 100%;
    border-radius: 20px;
  }

  .wpe-stat-grid {
    grid-template-columns: 1fr;
  }

  .wpe-history-item-head,
  .wpe-top-page-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
