/* ============================================
   Admin Panel Styles
   ============================================ */
.admin-body {
  font-family: var(--font-sans);
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
}

/* Nav */
.admin-nav {
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 1rem 2rem;
  background: var(--color-bg-card);
  border-bottom: 1px solid var(--color-border);
}

.admin-nav__brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--color-cyan);
  letter-spacing: 0.02em;
}

.admin-nav__links {
  display: flex;
  gap: 1.5rem;
  flex: 1;
}

.admin-nav__link {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s;
}

.admin-nav__link:hover,
.admin-nav__link--active {
  color: #fff;
}

.admin-nav__dropdown {
  position: relative;
  display: inline-flex;
}

.admin-nav__dropdown-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-sans);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0;
}

.admin-nav__dropdown-caret {
  font-size: 0.6rem;
}

.admin-nav__dropdown-menu {
  position: absolute;
  top: calc(100% + 0.7rem);
  left: 0;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.4rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 50;
}

.admin-nav__dropdown-menu[hidden] {
  display: none;
}

.admin-nav__dropdown-item {
  color: var(--color-text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
}

.admin-nav__dropdown-item:hover,
.admin-nav__dropdown-item--active {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.admin-nav__user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.admin-nav__email {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.admin-nav__logout {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--color-text-muted);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: color 0.2s, border-color 0.2s;
}

.admin-nav__logout:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

/* Main content */
.admin-main {
  max-width: 1800px;
  margin: 0 auto;
  padding: 2rem;
}

/* Page title */
.admin-page-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 1.5rem;
}

/* Stat cards */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.admin-stats--compact {
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.admin-stats--compact .admin-stat-card {
  padding: 0.75rem 1rem;
}

.admin-stats--compact .admin-stat-card__label {
  font-size: 0.75rem;
  margin-bottom: 0.25rem;
}

.admin-stats--compact .admin-stat-card__value {
  font-size: 1.25rem;
}

.admin-stats--inline {
  grid-template-columns: repeat(7, 1fr);
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.admin-stat-card--inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
}

.admin-stat-card--inline .admin-stat-card__label {
  margin-bottom: 0;
  font-size: 0.7rem;
}

.admin-stat-card--inline .admin-stat-card__value {
  font-size: 1.1rem;
}

.admin-stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.5rem;
}

.admin-stat-card__label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.admin-stat-card__value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-cyan);
}

/* Flash messages */
.admin-flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.admin-flash--notice {
  background: rgba(0, 229, 255, 0.1);
  border: 1px solid rgba(0, 229, 255, 0.2);
  color: var(--color-cyan);
}

.admin-flash--alert {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.admin-stat-card--link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.2s;
}

.admin-stat-card--link:hover {
  border-color: var(--color-cyan);
}

.admin-stat-card__detail {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.25rem;
}

/* Placeholder text */
.admin-placeholder {
  color: var(--color-text-muted);
  font-size: 0.95rem;
}

.admin-dashboard-designs {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 1.5rem 0 0.35rem;
}

/* Page header (title + action button) */
.admin-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.admin-page-header .admin-page-title {
  margin-bottom: 0;
}

/* Buttons */
.admin-btn {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--color-cyan);
  color: var(--color-bg);
  border: none;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.2s;
}

.admin-btn:hover {
  opacity: 0.85;
}

.admin-btn--outline {
  background: transparent;
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
}

.admin-btn--outline:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
  opacity: 1;
}

/* Per-page selector inside filter bar */
.admin-filter-bar__per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-left: auto;
  white-space: nowrap;
}

/* Filter bar */
.admin-filter-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.admin-filter-bar__field {
  flex: 1;
  min-width: 140px;
}

.admin-filter-bar__label {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.admin-filter-bar__clear {
  flex: 0 0 auto;
  color: var(--color-text-muted);
  font-size: 0.85rem;
  text-decoration: underline;
  white-space: nowrap;
}

.admin-filter-bar__clear:hover {
  color: var(--color-text);
}

.admin-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  color: var(--color-text);
  font-size: 0.85rem;
  font-family: var(--font-sans);
}

.admin-input:focus {
  outline: none;
  border-color: var(--color-cyan);
}

/* Table */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.admin-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.admin-table td {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  color: var(--color-text);
}

/* Sortable tables get fixed layout + truncation */
.admin-table--sortable {
  table-layout: fixed;
}

.admin-table--sortable td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0;
}

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

/* Links */
.admin-link {
  color: var(--color-cyan);
  text-decoration: none;
}

.admin-link:visited {
  color: var(--color-cyan);
}

.admin-link:hover {
  text-decoration: underline;
}

.admin-table a {
  color: var(--color-cyan);
  text-decoration: none;
}

.admin-table a:visited {
  color: var(--color-cyan);
}

.admin-table a:hover {
  text-decoration: underline;
}

/* Status badges */
.admin-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.admin-badge--discovered {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.admin-badge--contacted {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-cyan);
}

.admin-badge--interested {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.admin-badge--converted {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.admin-badge--suppressed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

/* Detail page */
.admin-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-detail-grid--auto-fit {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 32rem), 1fr));
}

.admin-detail-grid--auto-fit .admin-detail-card {
  min-width: 0;
}

.admin-detail-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.admin-detail-card__title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.admin-dl dt {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  margin-top: 0.5rem;
}

.admin-dl dd {
  font-size: 0.9rem;
  color: var(--color-text);
}

.admin-technical-value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.admin-connection-action {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

/* ============================================
   Voice agent control room
   ============================================ */
.voice-agent-page {
  --voice-agent-success: #34d399;
  --voice-agent-warning: #fbbf24;
  --voice-agent-danger: #fb7185;
  max-width: 1180px;
  margin: 0 auto;
}

.voice-agent-hero {
  padding: 2.25rem;
  margin-bottom: 2.5rem;
  background:
    linear-gradient(120deg, rgba(0, 229, 255, 0.08), transparent 46%),
    var(--color-bg-card);
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 16px;
}

.voice-agent-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.voice-agent-hero__title {
  margin: 0 0 0.8rem;
  color: #fff;
  font-size: 2.35rem;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.voice-agent-phone {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: -0.15rem 0 0.85rem;
}

.voice-agent-phone__label {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.voice-agent-phone__link {
  color: #fff;
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-decoration-color: rgba(0, 229, 255, 0.55);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.voice-agent-phone__link:hover {
  color: var(--color-cyan);
  text-decoration-color: var(--color-cyan);
}

.voice-agent-phone__link:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 4px;
  border-radius: 2px;
}

.voice-agent-section__heading > p {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.voice-agent-kicker {
  color: var(--color-cyan);
}

.voice-agent-section {
  margin-bottom: 2.5rem;
}

.voice-agent-section__heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.voice-agent-section__heading--stacked {
  align-items: stretch;
  flex-direction: column;
  gap: 0.65rem;
}

.voice-agent-section__heading h2 {
  margin-top: 0.25rem;
  color: #fff;
  font-size: 1.15rem;
  line-height: 1.25;
}

.voice-agent-instructions__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.voice-agent-instruction-tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 1.25rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.voice-agent-instruction-tile__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.voice-agent-instruction-tile__heading h3 {
  margin-top: 0.25rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
}

.voice-agent-instruction-tile__heading span {
  color: var(--color-cyan);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-agent-instruction-tile__edit,
.voice-agent-profile__edit,
.voice-agent-instruction-modal__close {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  color: var(--color-cyan);
  background: rgba(0, 229, 255, 0.07);
  border: 1px solid rgba(0, 229, 255, 0.25);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.voice-agent-instruction-tile__edit:hover,
.voice-agent-profile__edit:hover,
.voice-agent-instruction-tile__edit:focus-visible,
.voice-agent-profile__edit:focus-visible,
.voice-agent-instruction-modal__close:hover,
.voice-agent-instruction-modal__close:focus-visible {
  color: #fff;
  background: rgba(0, 229, 255, 0.14);
  border-color: rgba(0, 229, 255, 0.55);
  outline: none;
}

.voice-agent-instruction-tile__edit:focus-visible,
.voice-agent-profile__edit:focus-visible,
.voice-agent-instruction-modal__close:focus-visible {
  box-shadow: 0 0 0 2px var(--color-bg-card), 0 0 0 4px var(--color-cyan);
}

.voice-agent-instruction-tile__edit svg,
.voice-agent-profile__edit svg,
.voice-agent-instruction-modal__close svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.voice-agent-instruction-tile__description {
  margin: 0.65rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.voice-agent-instruction-tile__content {
  flex: 1;
  margin-top: 1rem;
  padding-top: 1rem;
  color: var(--color-text);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 0.82rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.voice-agent-instruction-tile__saved {
  margin-top: 1rem;
  color: var(--color-text-muted);
  font-size: 0.7rem;
}

.voice-agent-instruction-tile__saved time {
  color: var(--color-text);
}

.voice-agent-instruction-modal {
  width: min(680px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 1.5rem;
  color: var(--color-text);
  background: var(--color-bg-card);
  border: 1px solid rgba(0, 229, 255, 0.28);
  border-radius: 14px;
  opacity: 0;
  overflow-y: auto;
  transform: translateY(0.5rem);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.voice-agent-instruction-modal::backdrop {
  background: rgba(7, 11, 26, 0.78);
  opacity: 0;
  transition: opacity 0.18s ease;
}

.voice-agent-instruction-modal.is-open {
  opacity: 1;
  transform: translateY(0);
}

.voice-agent-instruction-modal.is-open::backdrop {
  opacity: 1;
}

.voice-agent-instruction-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.voice-agent-instruction-modal__header span {
  color: var(--color-cyan);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.voice-agent-instruction-modal__header h3 {
  margin-top: 0.2rem;
  color: #fff;
  font-size: 1.15rem;
}

.voice-agent-instruction-modal__close {
  color: var(--color-text-muted);
  background: transparent;
  border-color: var(--color-border);
}

.voice-agent-instruction-modal__description {
  margin: 0.6rem 0 1rem;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.voice-agent-instruction-modal__errors {
  margin-bottom: 1rem;
  padding: 0.8rem 0.9rem;
  color: #fecdd3;
  background: rgba(251, 113, 133, 0.07);
  border: 1px solid rgba(251, 113, 133, 0.28);
  border-radius: 10px;
  font-size: 0.78rem;
}

.voice-agent-instruction-modal__errors strong {
  color: #fff;
}

.voice-agent-instruction-modal__errors ul {
  margin: 0.3rem 0 0;
  padding-left: 1rem;
}

.voice-agent-instruction-modal__label {
  display: block;
  margin-bottom: 0.4rem;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.voice-agent-instruction-modal__textarea {
  display: block;
  width: 100%;
  min-height: 16rem;
  resize: vertical;
  padding: 0.85rem;
  color: var(--color-text);
  background: rgba(7, 11, 26, 0.88);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1.6;
  caret-color: var(--color-cyan);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.voice-agent-instruction-modal__textarea:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.voice-agent-instruction-modal__textarea:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
  border-color: transparent;
  background: rgba(7, 11, 26, 1);
}

.voice-agent-instruction-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1rem;
}

.voice-agent-instruction-modal__actions .admin-btn:disabled {
  cursor: wait;
  opacity: 0.58;
}

.voice-agent-panel {
  padding: 1.4rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
}

.voice-agent-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.voice-agent-settings-grid .voice-agent-section {
  min-width: 0;
  margin-bottom: 0;
}

.voice-agent-panel--unlock {
  display: flex;
  flex-direction: column;
}

.voice-agent-panel--unlock .voice-agent-unlock {
  display: flex;
  flex: 1;
  align-items: center;
}

.voice-agent-panel--unlock .voice-agent-unlock__row {
  width: 100%;
}

.voice-agent-profile {
  display: grid;
  gap: 0.75rem;
}

.voice-agent-profile > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.voice-agent-profile dt {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

.voice-agent-profile dd {
  max-width: 65%;
  color: var(--color-text);
  font-size: 0.8rem;
  text-align: right;
  overflow-wrap: anywhere;
}

.voice-agent-profile code {
  color: var(--color-cyan);
  font-size: 0.78rem;
}

@media (max-width: 900px) {
  .admin-nav {
    flex-wrap: wrap;
    gap: 0.8rem 1rem;
    padding: 0.85rem 1rem;
  }

  .admin-nav__links {
    order: 3;
    flex-basis: 100%;
    gap: 1rem;
    padding-bottom: 0.2rem;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .admin-nav__link,
  .admin-nav__dropdown {
    flex: 0 0 auto;
  }

  .admin-nav__user {
    margin-left: auto;
  }

  .voice-agent-instructions__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .voice-agent-settings-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .admin-main {
    padding: 1.25rem 1rem;
  }

  .admin-nav__email {
    display: none;
  }

  .voice-agent-hero {
    padding: 1.4rem;
  }

  .voice-agent-hero__title {
    font-size: 1.8rem;
  }

  .voice-agent-phone {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .voice-agent-section__heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .voice-agent-instructions__grid {
    grid-template-columns: 1fr;
  }

  .voice-agent-instruction-modal {
    padding: 1rem;
  }

  .voice-agent-instruction-modal__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .voice-agent-instruction-modal__actions .admin-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .voice-agent-instruction-modal,
  .voice-agent-instruction-modal::backdrop {
    transition: none;
  }
}

.admin-pre {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 1rem;
  font-size: 0.8rem;
  color: var(--color-text);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.admin-back-link {
  margin-top: 1.5rem;
}

/* Pagy pagination nav */
.pagy.series-nav {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  align-items: center;
  margin: 1.5rem 0;
}

.pagy.series-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0 0.6rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border: 1px solid var(--color-border);
  background: var(--color-bg-card);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}

.pagy.series-nav a:hover:not([aria-disabled]) {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

/* Current page */
.pagy.series-nav a[aria-current="page"] {
  background: var(--color-cyan);
  color: var(--color-bg);
  border-color: var(--color-cyan);
  font-weight: 600;
  cursor: default;
}

/* Gap / ellipsis */
.pagy.series-nav a[role="separator"] {
  border: none;
  background: none;
  color: var(--color-text-muted);
  cursor: default;
  min-width: auto;
  padding: 0 0.25rem;
  letter-spacing: 0.1em;
}

/* Disabled prev/next */
.pagy.series-nav a[aria-disabled="true"]:not([aria-current]):not([role="separator"]) {
  opacity: 0.3;
  cursor: default;
}

/* Prev/next arrows */
.pagy.series-nav a[rel="prev"],
.pagy.series-nav a[rel="next"] {
  font-weight: 700;
  font-size: 0.9rem;
}

/* Scrape run status badges */
.admin-badge--pending {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.admin-badge--running {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.admin-badge--paused {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.admin-badge--completed {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.admin-badge--failed {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.admin-badge--blocked {
  background: rgba(251, 146, 60, 0.15);
  color: #fb923c;
}

.admin-badge--cancelled {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
}

/* Scrape form */
.admin-scrape-form {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-scrape-form--stacked {
  flex-direction: column;
  align-items: stretch;
  gap: 0.5rem;
}

.admin-scrape-form__field {
  flex: 1;
}

/* Scrape grid */
.admin-scrape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.admin-scrape-grid .admin-detail-card {
  margin-bottom: 0;
}

/* Form */
.admin-form__field {
  margin-bottom: 1rem;
}

.admin-form__label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
  margin-bottom: 0.35rem;
}

/* Section title */
.admin-section-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 1.5rem 0 1rem;
}

/* Table toolbar (count + per-page) */
.admin-table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.admin-table-toolbar__count {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.admin-table-toolbar__per-page {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.admin-input--inline {
  width: auto;
  min-width: 4.5rem;
  padding: 0.35rem 0.5rem;
}

/* Sortable column headers */
.sort-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.2s;
}

.sort-header:hover {
  color: #fff;
}

.sort-arrows {
  display: inline-flex;
  flex-direction: column;
  line-height: 1;
  gap: 0;
}

.sort-arrow {
  font-size: 0.5rem;
  line-height: 0.65;
  color: rgba(255, 255, 255, 0.15);
  transition: color 0.2s;
}

.sort-arrow--active {
  color: var(--color-cyan);
}

.sort-header:hover .sort-arrow:not(.sort-arrow--active) {
  color: rgba(255, 255, 255, 0.3);
}

/* Delete button (styled as red text link) */
.admin-btn--delete {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
}

.admin-btn--delete:hover {
  color: #ef4444;
  text-decoration: underline;
}

.admin-btn--delete:disabled {
  color: var(--color-text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* Table action cells (inline links + button_to forms) */
.admin-table__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  overflow: visible;
  white-space: nowrap;
  text-overflow: clip;
}

.admin-table__actions form {
  display: inline;
}

/* Tag card grid */
.admin-tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.admin-tag-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1.25rem;
  transition: border-color 0.2s;
}

.admin-tag-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.admin-tag-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.admin-tag-card__name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-cyan);
  text-decoration: none;
}

.admin-tag-card__name:hover {
  text-decoration: underline;
}

.admin-tag-card__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.admin-tag-card__actions form {
  display: inline;
}

.admin-tag-card__stats {
  display: flex;
  gap: 1.5rem;
}

.admin-tag-card__stat {
  display: flex;
  flex-direction: column;
}

.admin-tag-card__stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}

.admin-tag-card__stat-label {
  font-size: 0.75rem;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Campaign stats bar */
.campaign-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.5rem;

  >div {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    text-align: center;
  }

  .label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
  }

  .value {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--color-cyan);
  }
}

/* Campaign card grid */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

/* Campaign card */
.campaign-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;

  &--archived {
    opacity: 0.65;
  }

  .header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-cyan);
    text-decoration: none;

    &:hover {
      text-decoration: underline;
    }
  }

  .territory {
    font-size: 0.75rem;
    color: var(--color-text-muted);
  }

  .verticals {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;

    .stat-value {
      display: block;
      font-size: 1.1rem;
      font-weight: 700;
      color: #fff;
    }

    .stat-label {
      font-size: 0.65rem;
      color: var(--color-text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }
  }

  .budget {
    .budget-label {
      font-size: 0.7rem;
      color: var(--color-text-muted);
    }
  }

  .actions {
    display: flex;
    gap: 0.375rem;
    margin-top: auto;
  }
}

/* Campaign vertical chip */
.campaign-chip {
  background: rgba(0, 229, 255, 0.1);
  color: var(--color-cyan);
  font-size: 0.7rem;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

/* Budget progress bar */
.budget-bar {
  height: 4px;
  background: rgba(0, 229, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 0.25rem;

  &__fill {
    height: 100%;
    background: var(--color-cyan);
    border-radius: 2px;
  }
}

/* Campaign status badges */
.campaign-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;

  &--active {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
  }

  &--paused,
  &--budget_paused {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
  }

  &--draft {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
  }

  &--completed {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
  }

  &--archived {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
  }
}

/* Small button variant */
.admin-btn--sm {
  padding: 0.3rem 0.625rem;
  font-size: 0.75rem;
  border-radius: 6px;
  flex: 1;
}

/* Primary button */
/* The :visited selector (specificity 0,2,0) is required to beat the
   global `a:visited { color: inherit }` rule (0,1,0 + pseudo-class),
   which otherwise turns these link buttons' text light/low-contrast. */
.admin-btn--primary,
.admin-btn--primary:visited {
  background: var(--color-cyan);
  color: #070b1a;
}

/* Empty state */
.admin-empty-state {
  text-align: center;
  color: var(--color-text-muted);
  padding: 3rem 1rem;
  font-size: 0.9rem;
}

.campaign-form__section .checkboxes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Campaign form */
.campaign-form {
  max-width: 640px;

  &__section {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;

    h2 {
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--color-cyan);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      margin-bottom: 1rem;
    }

    .field {
      margin-bottom: 1rem;

      &:last-child {
        margin-bottom: 0;
      }
    }

    .checkboxes {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }

    .checkbox {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      cursor: pointer;
      font-size: 0.85rem;
      color: var(--color-text);
    }
  }

  &__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
}

/* Invoicing client form */
.client-form {
  max-width: 640px;

  &__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
}

/* Invoicing billable item form */
.billable-item-form {
  max-width: 640px;

  &__actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
  }
}

/* Billing index section headings */
.billable-items__section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 1.5rem 0 0.75rem;
}

/* Short muted helper line (e.g. under a section title) */
.admin-hint {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: -0.25rem 0 0.75rem;
}

.admin-hint strong {
  color: var(--color-text);
  font-weight: 600;
}

/* Receipt upload: file input hidden with accessible clipping (not display:none) */
.admin-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.admin-file-field {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;

  .admin-form__label {
    width: 100%;
  }

  &__filename {
    font-size: 0.85rem;
    color: var(--color-text-muted);

    &.file-input-selected {
      color: var(--color-cyan);
      font-weight: 500;
    }
  }
}

/* Billable item status badges */
.admin-badge--unbilled {
  background: rgba(250, 204, 21, 0.15);
  color: #facc15;
}

.admin-badge--invoiced {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-cyan);
}

.admin-badge--paid {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

/* Invoice status badges (draft/sent; paid reuses the green above) */
.admin-badge--draft {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.admin-badge--sent {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-cyan);
}

/* Invoice status dropdown (index + detail): tinted like the status badges */
.invoice-status-form {
  display: inline-block;
  margin: 0;
}

.invoice-status-select {
  font-size: 0.8rem;
  font-weight: 600;
}

.invoice-status-select option {
  background: var(--color-bg, #0b0f19);
  color: var(--color-text, #e2e8f0);
}

/* Invoice source badges */
.admin-badge--generated {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.admin-badge--imported {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
}

.admin-input-group {
  display: flex;
  align-items: center;
  gap: 0;
}

.admin-input-group__prefix {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-right: none;
  border-radius: 8px 0 0 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.admin-input-group .admin-input {
  border-radius: 0 8px 8px 0;
}

/* Campaign show page */
.progress-bar {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  height: 12px;
  overflow: hidden;
}

.progress-bar__fill {
  background: var(--color-cyan);
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
  min-width: 0;
}

.campaign-show__territory {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin: 0;
}

.campaign-show__actions {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
}

.campaign-show__section {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;

  h3 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-cyan);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
  }

  .detail {
    font-size: 0.85rem;
    color: var(--color-text-muted);
  }

  .verticals {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
  }

  .detail {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin: 0;
  }
}

/* Campaign tabs */
.campaign-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 1.5rem;
}

.campaign-tabs__tab {
  padding: 0.75rem 1.25rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;

  &:hover {
    color: #fff;
  }

  &--active {
    color: var(--color-cyan);
    border-bottom-color: var(--color-cyan);
  }
}

/* Budget Hero Bar */
.budget-hero-bar {
  margin-bottom: 2rem;

  .budget-bar {
    height: 12px;
    margin-bottom: 0.5rem;
  }
}

/* Sync Records (admin/sync_records) */
.admin-table-toolbar--inline {
  justify-content: flex-start;
  gap: 1rem;
}

.admin-sync-warnings {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.admin-sync-warnings li {
  margin-bottom: 0.2rem;
}

/* ============================================
   Landing page gallery (admin/landing_pages)
   ============================================ */
.landing-intro {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.75rem;
  max-width: 640px;
}

.landing-intro code {
  color: var(--color-cyan);
  font-size: 0.85em;
}

.landing-section {
  margin-bottom: 3rem;
}

.landing-section__title {
  margin: 0 0 1rem;
}

.landing-section__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.landing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.5rem;
}

.landing-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.landing-card--active {
  border-color: rgba(0, 229, 255, 0.6);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.08);
}

/* Scaled live render of the variant: a 1280px-wide page shrunk to card width. */
.landing-card__preview {
  position: relative;
  height: 240px;
  overflow: hidden;
  background: #070b1a;
  border-bottom: 1px solid var(--color-border);
  pointer-events: none; /* preview is look-only; Preview button opens the real page */
}

.landing-card__iframe {
  width: 1280px;
  height: 960px;
  border: 0;
  transform: scale(0.3);
  transform-origin: top left;
  /* 1280 * 0.3 = 384 ≈ card width; overflow hides the rest */
}

.landing-card__body {
  padding: 1.25rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.landing-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.landing-card__name {
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
}

.landing-card__badge {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
}

.landing-card__badge--live {
  background: rgba(0, 229, 255, 0.15);
  color: var(--color-cyan);
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.landing-card__badge--missing {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.landing-card__key code {
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.landing-card__desc {
  color: var(--color-text-muted);
  font-size: 0.88rem;
}

.landing-card__stats {
  color: var(--color-text-muted);
  font-size: 0.82rem;
}

.landing-card__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 0.75rem;
}

/* Live design status: a non-interactive, fully opaque marker in the Audit Featured CTA purple. */
.admin-btn--active-status,
.admin-btn--active-status:hover {
  background: var(--gradient-cta-purple);
  color: #fff;
  cursor: default;
  opacity: 1;
}

.landing-card__current {
  color: var(--color-cyan);
  font-size: 0.85rem;
  font-weight: 600;
}

/* "Locked" label for billable items on sent/paid invoices (tooltip gives the reason) */
.admin-locked {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  cursor: help;
}

/* Modal dialog (native <dialog>) — Billing page edit form */
.admin-modal {
  width: min(640px, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 1.5rem;
  background: var(--color-bg);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow-y: auto;
}

.admin-modal::backdrop {
  background: rgba(7, 11, 26, 0.75);
}

.admin-modal .admin-page-header {
  margin-bottom: 1rem;
}

.landing-card__scope {
  color: var(--color-text-muted, #94a3b8);
  font-size: 0.8rem;
  margin: 0.25rem 0;
}

.voice-agent-unlock__status {
  display: block;
  margin-top: 0.25rem;
  color: #fff;
  font-weight: 600;
}

.voice-agent-unlock__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.voice-agent-unlock__row .voice-agent-config-control {
  flex: 1 1 16rem;
  width: auto;
}

.voice-agent-config-modal {
  max-width: 44rem;
}

.voice-agent-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.9rem 1rem;
}

.voice-agent-config-field--wide {
  margin-top: 1rem;
}

.voice-agent-config-control {
  display: block;
  width: 100%;
  padding: 0.6rem 0.7rem;
  color: var(--color-text);
  background: rgba(7, 11, 26, 0.88);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  font: inherit;
  font-size: 0.82rem;
  caret-color: var(--color-cyan);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.voice-agent-config-control:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.voice-agent-config-control:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: 2px;
  border-color: transparent;
  background: rgba(7, 11, 26, 1);
}

.voice-agent-config-textarea {
  min-height: 5.5rem;
}

.voice-agent-config-hint {
  margin: 0.35rem 0 0;
  color: var(--color-text-muted);
  font-size: 0.72rem;
}

/* Creatives */
.creative-status {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  border: 1px solid var(--color-text-muted);
  color: var(--color-text-muted);
}

.creative-status--approved {
  border-color: #22c55e;
  color: #22c55e;
}

.creative-form__preview {
  max-width: 240px;
  max-height: 240px;
  border-radius: 4px;
  display: block;
  margin-bottom: 0.5rem;
}

.creative-form__remove {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.85rem;
}

/* Creatives: list + preview, form + preview */
.creative-browser,
.creative-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 2rem;
  align-items: start;
}

.creative-editor .client-form {
  max-width: none;
}

.creative-browser__list {
  min-width: 0;
  overflow-x: auto;
}

.creative-browser__preview,
.creative-editor__preview {
  position: sticky;
  top: 1rem;
}

.creative-browser__preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.creative-editor__preview-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 0 0 0.75rem;
}

.creative-browser__preview-head .creative-editor__preview-title {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 1rem;
  color: var(--color-text);
}

.creatives-table__row {
  cursor: pointer;
}

/* The shared actions cell is flex, which stops it filling the row height. */
.creatives-table td.admin-table__actions {
  display: table-cell;
  vertical-align: middle;
}

.creatives-table__row:hover td {
  background: rgba(0, 229, 255, 0.04);
}

.creatives-table__row.is-selected td {
  background: rgba(0, 229, 255, 0.08);
}

.creatives-table__row:focus-visible {
  outline: 2px solid var(--color-cyan);
  outline-offset: -2px;
}

/* The mock ad itself: light, like the platforms render it. */
.creative-preview-wrap {
  margin: 0;
  width: 100%;
  max-width: var(--creative-max-width, 100%);
}

.creative-preview {
  --preview-text: #0f172a;
  --preview-muted: #64748b;
  position: relative;
  background: #fff;
  color: var(--preview-text);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-family: var(--font-sans);
}

.creative-preview [hidden] {
  display: none !important;
}

.creative-preview__header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.5rem;
}

.creative-preview__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.6rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--color-cyan), var(--color-purple));
  flex: none;
}

.creative-preview__brand {
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.2;
}

.creative-preview__brand small {
  display: block;
  font-weight: 400;
  font-size: 0.72rem;
  color: var(--preview-muted);
}

.creative-preview__body {
  margin: 0;
  padding: 0 0.85rem 0.6rem;
  font-size: 0.85rem;
  line-height: 1.4;
  white-space: pre-line;
}

.creative-preview__media {
  position: relative;
  aspect-ratio: var(--creative-ar, 1 / 1);
  background: linear-gradient(135deg, #1e1b4b, #312e81 45%, #0e7490);
  display: grid;
  place-items: center;
}

.creative-preview__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creative-preview__no-image {
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.creative-preview__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: #f1f5f9;
}

.creative-preview__text {
  min-width: 0;
}

.creative-preview__domain {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  color: var(--preview-muted);
}

.creative-preview__domain:empty {
  display: none;
}

.creative-preview__headline {
  display: block;
  font-size: 0.9rem;
  line-height: 1.3;
}

.creative-preview__cta {
  flex: none;
  margin-left: auto;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  background: #e2e8f0;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.creative-preview__caption {
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--color-text-muted);
  text-align: center;
}

/* Story and display: the image fills the frame and the copy sits on top. */
.creative-preview--overlay {
  aspect-ratio: var(--creative-ar);
  display: flex;
  flex-direction: column;
  background: linear-gradient(135deg, #1e1b4b, #312e81 45%, #0e7490);
  color: #fff;
}

.creative-preview--overlay .creative-preview__media {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
}

.creative-preview--overlay .creative-preview__header,
.creative-preview--overlay .creative-preview__body,
.creative-preview--overlay .creative-preview__footer {
  position: relative;
  z-index: 1;
}

.creative-preview--overlay .creative-preview__header {
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}

.creative-preview--overlay .creative-preview__brand small {
  color: rgba(255, 255, 255, 0.75);
}

/* Copy sits at the bottom: body, then headline and CTA. */
.creative-preview--overlay .creative-preview__body {
  margin-top: auto;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.creative-preview--overlay .creative-preview__footer {
  margin-top: auto;
  flex-direction: column;
  align-items: stretch;
  background: none;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

.creative-preview--overlay .creative-preview__body:not([hidden]) + .creative-preview__media + .creative-preview__footer {
  margin-top: 0;
}

.creative-preview--overlay .creative-preview__headline {
  font-size: 1.15rem;
}

.creative-preview--overlay .creative-preview__domain {
  color: rgba(255, 255, 255, 0.75);
}

.creative-preview--overlay .creative-preview__cta {
  margin-left: 0;
  text-align: center;
  background: #fff;
  color: var(--preview-text);
  text-shadow: none;
}

@media (max-width: 1024px) {
  .creative-browser,
  .creative-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .creative-browser__preview,
  .creative-editor__preview {
    position: static;
  }
}

/* Text layers on the creative's image */
.creative-preview__media {
  container-type: inline-size;
}

.creative-preview__layers {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
}

.creative-layer {
  position: absolute;
  max-width: 100%;
  font-size: calc(var(--layer-size, 48) * 100cqw / var(--native-width, 1080));
  line-height: 1.1;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.creative-preview__layers.is-editable .creative-layer {
  cursor: move;
  touch-action: none;
  user-select: none;
  outline: 1px dashed transparent;
  outline-offset: 3px;
}

.creative-preview__layers.is-editable .creative-layer:hover {
  outline-color: rgba(255, 255, 255, 0.6);
}

.creative-preview__layers.is-editable .creative-layer.is-selected,
.creative-preview__layers.is-editable .creative-layer:focus-visible {
  outline: 2px dashed var(--color-cyan);
}

.creative-preview__layers.is-editable .creative-layer.is-dragging {
  opacity: 0.85;
}

.creative-layers {
  margin-top: 1rem;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 1rem;
}

.creative-layers__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.creative-layers__title {
  margin: 0;
  font-size: 0.95rem;
}

.creative-layers__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.creative-layers__list:empty {
  display: none;
}

.creative-layers__chip {
  border: 1px solid var(--color-border);
  background: transparent;
  color: var(--color-text);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.78rem;
  cursor: pointer;
}

.creative-layers__chip.is-selected {
  border-color: var(--color-cyan);
  color: var(--color-cyan);
}

.creative-layers__panel[hidden] {
  display: none;
}

.creative-layers__panel .admin-form__label {
  display: block;
  margin-top: 0.6rem;
}

.creative-layers__row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.creative-layers__row > div:first-child {
  flex: 1;
  min-width: 0;
}

.creative-layers__color input[type="color"] {
  width: 3rem;
  height: 2.4rem;
  padding: 0.15rem;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

.creative-layers__row--size {
  align-items: center;
}

.creative-layers__row--size input[type="range"] {
  flex: 1;
  accent-color: var(--color-cyan);
}

.creative-layers__row--size input[type="number"] {
  width: 5.5rem;
}

.creative-layers__row--actions {
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
}

/* Story/display copy sits over the image like the platform UI does; let
   drags reach the text layers underneath it. */
.creative-preview--overlay .creative-preview__header,
.creative-preview--overlay .creative-preview__body,
.creative-preview--overlay .creative-preview__footer {
  pointer-events: none;
}

/* The editor's side column (preview + text controls) can outgrow the window. */
.creative-editor__preview {
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

@media (max-width: 1024px) {
  .creative-editor__preview {
    max-height: none;
  }
}

.creatives-table .creative-delete {
  display: inline;
  margin-left: 0.75rem;
}

/* Mini creative in the list: image plus text layers at the format's shape. */
.creative-thumb {
  position: relative;
  container-type: inline-size;
  overflow: hidden;
  border-radius: 4px;
  background: linear-gradient(135deg, #1e1b4b, #312e81 45%, #0e7490);
}

.creative-thumb__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.creative-thumb .creative-layer {
  text-shadow: none;
}

/* Ad campaigns: the Creatives index is a grid of campaigns, each shown by one
   composed creative (image plus text layers). */
.ad-campaign-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.ad-campaign-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  transition: border-color 0.15s ease;
}

.ad-campaign-card:hover,
.ad-campaign-card:focus-within {
  border-color: var(--color-cyan);
}

.ad-campaign-card__link {
  display: block;
  padding: 1rem;
  color: inherit;
  text-decoration: none;
}

.ad-campaign-card__thumb {
  display: grid;
  place-items: center;
  height: 240px;
  margin-bottom: 0.75rem;
}

.ad-campaign-card__thumb .creative-thumb {
  border-radius: 6px;
}

.ad-campaign-card__empty {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.ad-campaign-card__name {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}

.ad-campaign-card__meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

.creative-breadcrumb {
  margin: 0 0 0.25rem;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.creative-header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.creative-header-actions .creative-delete {
  display: inline;
}

.creative-variation-number {
  display: block;
  font-size: 0.72rem;
  color: var(--color-text-muted);
}

.creatives-table .creative-new-variation {
  margin-left: 0.75rem;
}

.creative-layers__panel .creative-layers__width {
  max-width: 7rem;
}

.creative-breadcrumb a {
  color: var(--color-cyan);
  text-decoration: none;
}

.creative-breadcrumb a:hover {
  text-decoration: underline;
}

/* The authored layers supply the on-image copy in story and display ads. */
.creative-preview--overlay:has(.creative-layer) :is(.creative-preview__header, .creative-preview__body, .creative-preview__footer) {
  display: none;
}
