/* Admin dashboard */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 0%, rgba(27, 133, 156, 0.08), transparent 26%),
    radial-gradient(circle at 92% 0%, rgba(37, 183, 70, 0.07), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.36), rgba(246, 248, 252, 0.9) 280px);
}

.admin-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px clamp(20px, 4vw, 40px);
  background: rgba(255, 255, 255, 0.72);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.admin-tabs::-webkit-scrollbar { display: none; }

.admin-tabs a {
  padding: 9px 15px;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.admin-tabs a:hover {
  background: rgba(255, 255, 255, 0.92);
  color: var(--text);
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}

.admin-tabs a.active {
  background: linear-gradient(180deg, #ffffff 0%, var(--brand-soft) 100%);
  color: var(--brand-dark);
  box-shadow: inset 0 0 0 1px rgba(27, 133, 156, 0.16), 0 8px 18px rgba(27, 133, 156, 0.08);
}

.admin-subtabs {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 14px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: fit-content;
  box-shadow: var(--shadow-xs);
}

.admin-subtabs a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
}

.admin-subtabs a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.95);
}

.admin-subtabs a.active {
  background: #fff;
  color: var(--brand-dark);
  box-shadow: var(--shadow-xs);
}

.env-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  margin: 0 0 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
}

.env-banner-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-width: 0;
}

.env-banner-copy strong {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.env-banner-copy span {
  color: inherit;
  opacity: 0.82;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.env-banner-link {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.06);
}

.env-banner-link:hover {
  background: rgba(255, 255, 255, 0.9);
  text-decoration: none;
}

.env-banner--production {
  background: linear-gradient(180deg, rgba(27, 133, 156, 0.1), rgba(27, 133, 156, 0.04));
  border-color: rgba(27, 133, 156, 0.18);
  color: var(--brand-dark);
}

.env-banner--testing {
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.14), rgba(245, 158, 11, 0.05));
  border-color: rgba(217, 119, 6, 0.22);
  color: #92400e;
}

/* Only tint the Apps Testing top tab when viewing testing data — never steal the active state from other tabs. */
.admin-env-testing .admin-tabs a[href="/admin/apps-testing"].active {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #92400e;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.22), 0 8px 18px rgba(245, 158, 11, 0.12);
}

.badge.testing-source.microsoft {
  background: rgba(0, 120, 212, 0.12);
  color: #0078d4;
}

.badge.testing-source.chronodat {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.badge.testing-source.configured {
  background: rgba(245, 158, 11, 0.14);
  color: #92400e;
}

.cron-card {
  margin-bottom: 18px;
  padding: 16px 18px;
}

.cron-card--featured {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 253, 0.98) 100%),
    radial-gradient(circle at 100% 0%, rgba(27, 133, 156, 0.08), transparent 42%);
  border-color: rgba(27, 133, 156, 0.14);
  box-shadow: var(--shadow-xs);
}

.cron-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cron-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.cron-card-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  flex-shrink: 0;
}

.cron-card-icon svg {
  width: 18px;
  height: 18px;
}

.cron-card-title h2 {
  margin: 0 0 2px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--text);
}

.cron-card-title p {
  margin: 0;
  font-size: 0.8125rem;
}

.cron-status-badge {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.cron-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  margin: 0;
  white-space: nowrap;
}

.cron-toggle span {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.cron-card--readonly {
  border-color: rgba(217, 119, 6, 0.28);
  background:
    linear-gradient(180deg, rgba(255, 251, 235, 0.92) 0%, rgba(255, 255, 255, 0.96) 100%),
    radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.08), transparent 42%);
}

.cron-setup-panel {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px 14px;
  align-items: start;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  background: rgba(255, 255, 255, 0.78);
}

.cron-setup-panel-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(245, 158, 11, 0.14);
  color: #b45309;
}

.cron-setup-panel-icon svg {
  width: 18px;
  height: 18px;
}

.cron-setup-panel-copy strong {
  display: block;
  margin-bottom: 2px;
  font-size: 0.875rem;
  color: #92400e;
}

.cron-setup-panel-copy p {
  margin: 0 0 6px;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.cron-setup-details {
  font-size: 0.75rem;
  color: var(--muted);
}

.cron-setup-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #92400e;
}

.cron-setup-steps {
  margin: 8px 0 0;
  padding-left: 1.2rem;
  line-height: 1.5;
}

.cron-form {
  display: grid;
  gap: 0;
}

.cron-form-grid {
  display: grid;
  grid-template-columns: auto minmax(180px, 1.4fr) minmax(110px, 0.7fr) minmax(110px, 0.7fr) auto;
  gap: 10px 12px;
  align-items: end;
}

.cron-form-grid .field {
  margin: 0;
}

.cron-form-grid .field > span {
  font-size: 0.75rem;
}

.cron-form--readonly {
  opacity: 0.72;
  pointer-events: none;
}

.cron-field-template select,
.cron-form-grid input[type='number'] {
  width: 100%;
  min-height: 40px;
}

.cron-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge.cron-status-badge.setup-required {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.cron-card--readonly .cron-actions button {
  opacity: 1;
  pointer-events: auto;
}

.page-header--split {
  align-items: flex-start;
  padding-bottom: 14px;
}

.admin-body > .admin-subtabs + .page-header,
.admin-body > .env-banner + .page-header,
.admin-body > .admin-subtabs + .env-banner + .page-header,
.admin-body > .env-banner + .admin-subtabs + .page-header {
  padding-top: 8px;
}

.page-header-copy {
  flex: 1 1 420px;
}

.page-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.panel-section {
  margin-bottom: 20px;
}

.panel-section--library {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow-xs);
}

.panel-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  margin-bottom: 12px;
}

.panel-section-head h2 {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.panel-section-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.panel-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.placeholder-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.placeholder-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(27, 133, 156, 0.06);
  border: 1px solid rgba(27, 133, 156, 0.12);
  font-size: 0.7rem;
  color: var(--muted);
}

.placeholder-chip code {
  font-size: 0.75rem;
  color: var(--brand-dark);
}

.api-ref-page-card {
  margin-bottom: 16px;
}

.api-ref-page-card h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
}

.api-ref-page-card .api-ref-lead {
  margin: 0 0 14px;
}

.api-endpoints-table code {
  font-size: 0.8125rem;
}

.api-endpoints-table td:first-child {
  width: 88px;
  white-space: nowrap;
  font-weight: 600;
}

.table-wrap--compact {
  box-shadow: var(--shadow-xs);
  margin-bottom: 14px;
}

.cta-card .card-header {
  padding-bottom: 0;
}

.template-table .tenant-name,
.template-table strong {
  font-weight: 700;
}

.preview-dialog {
  width: min(920px, calc(100vw - 32px));
}

.preview-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.preview-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.preview-controls--draft .preview-control-tenant,
.preview-controls--draft .preview-control-site {
  opacity: 0.55;
}

.preview-subject-card {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.88);
}

.preview-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.preview-subject-card p {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.preview-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.preview-context-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted);
}

.preview-context-chip strong {
  color: var(--text);
  font-weight: 600;
}

.preview-frame-wrap {
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: #eef3fa;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.preview-frame-wrap iframe {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 0;
  background: #fff;
}

.template-table .action-links {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

@media (max-width: 980px) {
  .cron-form-grid {
    grid-template-columns: 1fr 1fr;
  }

  .cron-form-grid .cron-toggle,
  .cron-form-grid .cron-field-template,
  .cron-form-grid .cron-actions {
    grid-column: 1 / -1;
  }

  .cron-setup-panel {
    grid-template-columns: 1fr;
  }

  .cron-setup-panel-icon {
    display: none;
  }
}

@media (max-width: 640px) {
  .cron-form-grid {
    grid-template-columns: 1fr;
  }
}

.page-alert {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  border: 1px solid transparent;
}

.page-alert--error {
  background: var(--danger-soft);
  border-color: rgba(220, 38, 38, 0.18);
  color: #991b1b;
}

.page-alert--warning {
  background: var(--warning-soft);
  border-color: rgba(217, 119, 6, 0.18);
  color: #92400e;
}

.page-alert--success {
  background: var(--success-soft);
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}

.admin-toast-stack {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 9999;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.admin-toast {
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.admin-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.admin-toast--error {
  background: #fff;
  border-color: rgba(220, 38, 38, 0.18);
  color: #991b1b;
}

.admin-toast--warning {
  background: #fff;
  border-color: rgba(217, 119, 6, 0.18);
  color: #92400e;
}

.admin-toast--success {
  background: #fff;
  border-color: rgba(22, 163, 74, 0.18);
  color: #166534;
}

.cron-run-output {
  margin-top: 12px;
  padding: 12px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.04);
  overflow: auto;
  font-size: 0.8125rem;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 55% at 50% -10%, var(--brand-glow), transparent),
    radial-gradient(circle at 100% 100%, rgba(37, 183, 70, 0.05), transparent 50%),
    linear-gradient(180deg, #fafbff 0%, var(--bg) 100%);
  z-index: 0;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 253, 255, 0.96)),
    radial-gradient(circle at 0% 0%, rgba(27, 133, 156, 0.08), transparent 40%);
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 28px;
}

.login-brand .brand-tagline {
  font-size: 0.8125rem;
  margin-left: 2px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-sub {
  margin: 0 0 24px;
  font-size: 0.9375rem;
}

.app .site-header {
  border-bottom: none;
  box-shadow: none;
}

.app .site-header .btn.subtle {
  margin-left: auto;
}

.admin-body {
  flex: 1;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 clamp(20px, 4vw, 40px) 48px;
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 24px;
  padding: 18px 0 12px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: clamp(1.4rem, 2.6vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.page-header p {
  margin: 0;
  font-size: 0.875rem;
  max-width: 760px;
  line-height: 1.5;
}

.section-label {
  display: inline-flex;
  align-items: center;
  margin-bottom: 6px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(27, 133, 156, 0.08);
  color: var(--brand-dark);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  padding: 8px 0 16px;
}

.stats-grid-tenants {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(251, 253, 255, 0.98) 100%),
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--stat-accent, #94a3b8) 12%, transparent), transparent 38%);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.stat-card strong {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: var(--text);
}

.stat-card span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--stat-accent, var(--border-strong));
  border-radius: 4px 0 0 4px;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: color-mix(in srgb, var(--stat-accent, #94a3b8) 28%, var(--border));
}

.stat-card.stat-brand { --stat-accent: var(--brand); }
.stat-card.stat-success { --stat-accent: var(--success); }
.stat-card.stat-warning { --stat-accent: var(--warning); }
.stat-card.stat-danger { --stat-accent: var(--danger); }
.stat-card.stat-neutral { --stat-accent: #94a3b8; }

/* Toolbar */
.toolbar-card {
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  flex: 1 1 260px;
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--muted);
  pointer-events: none;
}

.search-wrap input {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px 10px 36px;
  font: inherit;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.86);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-wrap input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-glow);
  background: #fff;
}

.toolbar select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text-secondary);
  cursor: pointer;
}

/* Table */
.table-wrap {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: auto;
  box-shadow: var(--shadow);
}

.tenant-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  font-size: 0.875rem;
}

.tenant-table--compact {
  min-width: 920px;
}

.tenant-table--fixed {
  table-layout: fixed;
}

.tenant-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 13px 16px;
  text-align: left;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.96);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.tenant-table--compact th,
.tenant-table--compact td {
  padding: 12px 14px;
}

.tenant-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.tenant-table tbody tr {
  transition: background var(--transition);
}

.tenant-table tbody tr:hover {
  background: #f8fbff;
}

.tenant-table tbody tr:last-child td {
  border-bottom: none;
}

.tenant-table--compact .col-tenant { width: 18%; }
.tenant-table--compact .col-product { width: 15%; }
.tenant-table--compact .col-status { width: 12%; }
.tenant-table--compact .col-trial { width: 10%; }
.tenant-table--compact .col-activity { width: 15%; }
.tenant-table--compact .col-contact { width: 18%; }
.tenant-table--compact .col-actions,
.tenant-table--compact .th-actions {
  width: 12%;
  text-align: right;
}

.tenant-name {
  font-weight: 700;
  color: var(--text);
  font-size: 0.875rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tenant-id-sub {
  font-size: 0.6875rem;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.01em;
}

.product-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(27, 133, 156, 0.08);
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.status-stack .badge {
  text-transform: none;
  letter-spacing: 0.01em;
  font-size: 0.72rem;
}

.trial-days {
  display: inline-block;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.meta-stack {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.meta-stack > div {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.meta-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.meta-value {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.contact-email,
.contact-site {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.contact-email {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.contact-site {
  font-size: 0.75rem;
  color: var(--brand-dark);
  text-decoration: none;
}

.contact-site:hover {
  text-decoration: underline;
}

.action-links--compact {
  justify-content: flex-end;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.75rem;
  border-radius: 8px;
}

.table-wrap--tenants {
  box-shadow: var(--shadow-xs);
}

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px 0 8px;
}

.pager #page-info {
  font-size: 0.875rem;
  min-width: 160px;
  text-align: center;
}

/* Dialog */
dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: hidden;
  box-shadow: 0 36px 90px rgba(15, 23, 42, 0.22);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
  backdrop-filter: blur(6px);
}

dialog form {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
}

.dialog-header {
  padding: 24px 24px 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  padding-bottom: 20px;
  margin-bottom: 0;
}

.dialog-header h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.dialog-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.dialog-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.dialog-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: #f8fbff;
}

.dialog-meta {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-size: 0.8125rem;
  color: var(--muted);
  margin-bottom: 16px;
  line-height: 1.65;
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 28px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
}

.checkbox input {
  margin-top: 3px;
  accent-color: var(--brand);
}

.event-log {
  margin-bottom: 8px;
}

.event-log h3 {
  margin: 0 0 10px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.event-log ul {
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 180px;
  overflow: auto;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.event-log li {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.event-log li:last-child { border-bottom: none; }

.event-log .event-time {
  color: var(--muted);
  font-size: 0.75rem;
}

.event-log .event-type {
  font-weight: 600;
  color: var(--text);
}

.cell-truncate {
  max-width: min(480px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

dialog .alert.error {
  margin: 0 24px 16px;
}

.empty-row td {
  text-align: center;
  padding: 40px 16px !important;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Subscription detail page */
.breadcrumb {
  padding: 20px 0 8px;
  font-size: 0.875rem;
}

.breadcrumb a {
  color: var(--muted);
  font-weight: 500;
  text-decoration: none;
}

.breadcrumb a:hover { color: var(--brand); }

.detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.detail-header h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.detail-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.detail-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px 24px;
  box-shadow: var(--shadow-xs);
  margin-bottom: 16px;
}

.detail-card h2 {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.detail-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.detail-card-head h2 { margin: 0; }

.detail-dl { margin: 0; }

.detail-dl-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.detail-dl-row:last-child { border-bottom: none; }

.detail-dl-row dt {
  color: var(--muted);
  font-weight: 500;
}

.detail-dl-row dd {
  margin: 0;
  color: var(--text);
  word-break: break-all;
}

.notes-body {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: 0.9375rem;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline li {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}

.timeline li:last-child { border-bottom: none; }

.timeline time {
  color: var(--muted);
  font-size: 0.8125rem;
}

.timeline-body strong { color: var(--text); }

.timeline-empty {
  padding: 20px 0;
  text-align: center;
}

.action-links {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* Email notification history */
.stats-grid-email {
  grid-template-columns: repeat(5, 1fr);
}

.tenant-filter-input {
  flex: 0 1 200px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.86);
}

.email-log-table {
  min-width: 1000px;
}

.badge.email-status.sent { background: var(--success-soft); color: var(--success); }
.badge.email-status.rejected { background: var(--warning-soft); color: var(--warning); }
.badge.email-status.failed { background: var(--danger-soft); color: var(--danger); }
.badge.email-status.blocked { background: var(--bg-subtle); color: var(--muted); }

.request-log-table {
  min-width: 1100px;
}

.stats-grid-requests {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.badge.app-badge.spfx { background: var(--brand-soft); color: var(--brand-dark); }
.badge.app-badge.notification { background: rgba(37, 183, 70, 0.12); color: #136275; }
.badge.app-badge.admin { background: var(--bg-subtle); color: var(--text); }
.badge.app-badge.stripe { background: rgba(99, 91, 255, 0.12); color: #4f46e5; }
.badge.app-badge.health { background: var(--success-soft); color: var(--success); }

.badge.http-status.status-success { background: var(--success-soft); color: var(--success); }
.badge.http-status.status-warning { background: var(--warning-soft); color: var(--warning); }
.badge.http-status.status-danger { background: var(--danger-soft); color: var(--danger); }
.badge.http-status.status-neutral { background: var(--bg-subtle); color: var(--muted); }

.app-log-table {
  min-width: 1040px;
}

.badge.log-level.debug { background: var(--bg-subtle); color: var(--muted); }
.badge.log-level.info { background: var(--brand-soft); color: var(--brand-dark); }
.badge.log-level.warn { background: var(--warning-soft); color: var(--warning); }
.badge.log-level.error { background: var(--danger-soft); color: var(--danger); }
.badge.log-level.fatal { background: var(--danger); color: #fff; }

.badge.log-source {
  background: var(--bg-subtle);
  color: var(--muted);
  text-transform: capitalize;
}

.log-message {
  max-width: 460px;
}

.btn.danger {
  background: var(--danger-soft);
  border-color: transparent;
  color: var(--danger);
  box-shadow: none;
}

.btn.danger:hover {
  background: var(--danger);
  color: #fff;
}

.license-key-table {
  min-width: 1050px;
}

.stats-grid-license,
.stats-grid-products {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.badge.license-status.active { background: var(--success-soft); color: var(--success); }
.badge.license-status.exhausted { background: var(--brand-soft); color: var(--brand-dark); }
.badge.license-status.revoked { background: var(--danger-soft); color: var(--danger); }

.field-span-2 {
  grid-column: span 2;
}

.detail-json {
  margin: 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.btn-sm {
  padding: 6px 10px;
  font-size: 0.8125rem;
}

.recipient-list {
  margin: 0;
  padding-left: 18px;
}

.recipient-list li {
  margin: 2px 0;
  word-break: break-all;
}

.text-danger {
  color: var(--danger);
}

.nowrap {
  white-space: nowrap;
}

.detail-actions {
  margin: 16px 0 0;
}

.send-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 20px;
  align-items: start;
}

.send-main {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.send-aside {
  display: grid;
  gap: 16px;
  position: sticky;
  top: 20px;
}

.send-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.send-form {
  display: grid;
  gap: 16px;
}

.send-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow-xs);
}

.send-panel--actions {
  padding-top: 18px;
}

.send-panel-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.send-panel-head h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.send-panel-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.send-panel-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: rgba(15, 35, 75, 0.08);
  color: #0f234b;
}

.send-panel-icon--brand {
  background: rgba(27, 133, 156, 0.12);
  color: #1b859c;
}

.send-panel-icon svg {
  width: 20px;
  height: 20px;
}

.send-field-grid {
  display: grid;
  gap: 14px;
}

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

.field-hint {
  font-weight: 500;
  color: var(--text-muted);
}

.send-recipient-count {
  margin: 6px 0 0;
  font-size: 0.8125rem;
}

.send-skip-check {
  margin-bottom: 14px;
}

.send-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.send-action-row .btn.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.send-preview-shell,
.send-tip-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.send-preview-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.send-preview-toolbar h2 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 700;
}

.send-preview-toolbar p {
  margin: 0;
  font-size: 0.8125rem;
}

.send-preview-chrome {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #f8fafc;
}

.send-preview-meta {
  padding: 12px 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.send-preview-meta-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.send-preview-meta-row + .send-preview-meta-row {
  margin-top: 8px;
}

.send-preview-meta-label {
  font-weight: 700;
  color: var(--text-muted);
}

.send-preview-meta-value {
  word-break: break-word;
}

.send-preview-frame-wrap {
  background: #eef2f7;
  min-height: 420px;
}

.send-preview-frame-wrap iframe {
  display: block;
  width: 100%;
  min-height: 420px;
  border: 0;
  background: #fff;
}

.send-tip-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.send-tip-card p {
  margin: 0 0 12px;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.spin-icon {
  animation: send-spin 0.9s linear infinite;
}

@keyframes send-spin {
  to { transform: rotate(360deg); }
}

/* Legacy send classes kept for compatibility */
.send-side {
  display: grid;
  gap: 16px;
}

.send-form-card h2,
.send-preview-card h2,
.api-ref-card h2 {
  margin: 0 0 8px;
}

.send-preview-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.send-preview-lead,
.api-ref-lead {
  margin: 0;
  font-size: 0.875rem;
}

.send-preview-frame-wrap iframe {
  min-height: 480px;
}

.api-ref-card summary {
  cursor: pointer;
  list-style: none;
}

.api-ref-card summary::-webkit-details-marker {
  display: none;
}

.api-ref-card[open] .api-ref-lead {
  margin-bottom: 16px;
}

.api-ref-card:not([open]) {
  padding-bottom: 16px;
}

.api-ref-lead {
  margin: 0 0 16px;
  font-size: 0.875rem;
}

.api-ref-block {
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.api-ref-block:last-of-type {
  border-bottom: none;
  margin-bottom: 12px;
  padding-bottom: 0;
}

.api-ref-block h3 {
  margin: 0 0 8px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text);
}

.api-endpoint {
  display: block;
  padding: 10px 12px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  margin-bottom: 10px;
}

.api-sample {
  margin: 0;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.api-note {
  margin: 8px 0 0;
  font-size: 0.8125rem;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 1100px) {
  .send-layout {
    grid-template-columns: 1fr;
  }

  .send-aside {
    position: static;
  }

  .send-field-grid--2 {
    grid-template-columns: 1fr;
  }

  .stats-grid-tenants {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .stats-grid,
  .stats-grid-tenants {
    grid-template-columns: repeat(2, 1fr);
  }
  .stats-grid-email,
  .stats-grid-requests,
  .stats-grid-license,
  .stats-grid-products {
    grid-template-columns: repeat(2, 1fr);
  }
  .detail-grid { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 4px; }
  .detail-dl-row { grid-template-columns: 1fr; gap: 2px; }

  /* Prevent iOS Safari auto-zoom on focus for toolbar controls */
  .search-wrap input,
  .toolbar select,
  .tenant-filter-input {
    font-size: 16px;
  }
}

@media (max-width: 640px) {
  .admin-body { padding: 0 16px 32px; }
  .cell-truncate { max-width: 160px; }
  .log-message { max-width: 200px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .dialog-grid { grid-template-columns: 1fr; }

  /* Header: keep brand + sign-out on the first row, tabs/nav below */
  .app .site-header {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .app .site-header .site-nav { order: 3; }
  .app .site-header .btn.subtle { order: 2; margin-left: auto; }
  .admin-tabs { padding: 10px 16px; }
  .admin-tabs a { padding: 9px 14px; }

  /* Stack the filter toolbar into full-width controls */
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar > * { width: 100%; }
  .search-wrap,
  .tenant-filter-input { flex: 1 1 auto; }

  /* Page header + actions stack and stretch */
  .page-header { padding: 22px 0 12px; }
  .page-header-actions { width: 100%; }
  .page-header-actions .btn { width: 100%; }

  /* Pager controls fill width and are easy to tap */
  .pager { gap: 10px; flex-wrap: wrap; }
  .pager .btn { flex: 1 1 auto; }
  .pager #page-info { order: -1; width: 100%; min-width: 0; }

  /* Dialog footer buttons go full width */
  .dialog-footer { flex-direction: column-reverse; }
  .dialog-footer .btn { width: 100%; }
}

/* ── Platform admin shell (sbAssetManagement-inspired) ── */

.app.admin-shell-active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}

.app.admin-shell-active .admin-tabs--legacy {
  display: none;
}

.app.admin-shell-active .site-header {
  padding: 10px clamp(16px, 3vw, 32px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.app.admin-shell-active .site-header .site-nav {
  display: none;
}

.admin-nav-toggle {
  display: none;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  margin-left: 12px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
  align-items: stretch;
  transition: grid-template-columns 0.24s ease;
}

.admin-sidebar {
  background: #0f234b;
  color: #ffffff;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100%;
  align-self: stretch;
  overflow-x: hidden;
  overflow-y: auto;
  transition: padding 0.24s ease;
}

.admin-sidebar-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 4px 4px;
}

.admin-sidebar-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1 1 auto;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.admin-sidebar-collapse-btn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.88);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.24s ease;
}

.admin-sidebar-collapse-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.admin-sidebar-link-label {
  display: inline;
}

.admin-sidebar-kicker {
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
}

.admin-sidebar-brand strong {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.admin-sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-sidebar-label {
  padding: 0 10px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.48);
}

.admin-sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.88);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  transition: background var(--transition), color var(--transition);
}

.admin-sidebar-link-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.92;
}

.admin-sidebar-link-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.admin-sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

.admin-sidebar-nav a.active {
  background: rgba(255, 185, 0, 0.18);
  color: #ffffff;
}

.admin-sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-sidebar-footer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.72);
  text-decoration: none;
  font-size: 0.8125rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.admin-sidebar-footer-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  text-decoration: none;
}

@media (min-width: 961px) {
  .app.admin-sidebar-collapsed .admin-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .app.admin-sidebar-collapsed .admin-sidebar {
    padding: 24px 10px;
    align-items: stretch;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-brand {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding-inline: 0;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-brand-copy {
    opacity: 0;
    transform: scale(0.92);
    width: 0;
    height: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-collapse-btn svg {
    transform: rotate(180deg);
  }

  .app.admin-sidebar-collapsed .admin-sidebar-label,
  .app.admin-sidebar-collapsed .admin-sidebar-link-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-section {
    gap: 4px;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-nav a::before,
  .app.admin-sidebar-collapsed .admin-sidebar-footer-link::before {
    content: none;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-link-icon {
    width: 20px;
    height: 20px;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-link-icon svg {
    width: 20px;
    height: 20px;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-nav a,
  .app.admin-sidebar-collapsed .admin-sidebar-footer-link {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 8px;
    font-size: inherit;
  }

  .app.admin-sidebar-collapsed .admin-sidebar-footer {
    align-items: stretch;
  }
}

.admin-main {
  min-width: 0;
  padding: clamp(18px, 3vw, 36px);
  overflow-x: hidden;
}

.app.admin-shell-active .admin-body {
  padding: 0;
  max-width: none;
}

.app.admin-shell-active .page-header {
  padding-top: 4px;
  padding-bottom: 16px;
}

.app.admin-shell-active .page-header--split {
  align-items: center;
}

.app.admin-shell-active .admin-subtabs + .page-header,
.app.admin-shell-active .env-banner + .page-header,
.app.admin-shell-active .admin-subtabs + .env-banner + .page-header {
  padding-top: 8px;
}

.app.admin-shell-active .admin-body > .analytics-top-bar {
  margin-bottom: 10px;
}

.app.admin-shell-active .admin-body > .analytics-top-bar + .page-header {
  padding-top: 0;
}

.content-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(14px, 2.5vw, 22px);
  box-shadow: var(--shadow-xs);
}

.content-card > .toolbar-card:first-child,
.content-card > .stats-grid:first-child {
  margin-top: 0;
}

.content-card > .stats-grid {
  padding-top: 0;
}

.content-card > .pager:last-child {
  padding-bottom: 0;
}

/* Right detail panels (native dialog → slide-over) */

body.admin-panel-open {
  overflow: hidden;
}

dialog.admin-right-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(440px, 100vw);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: none;
  border-left: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
  overflow: hidden;
  box-shadow: -12px 0 40px rgba(15, 23, 42, 0.14);
}

dialog.admin-right-panel[open] {
  display: flex;
  flex-direction: column;
}

dialog.admin-right-panel--wide {
  width: min(640px, 100vw);
}

dialog.admin-right-panel--extra-wide {
  width: min(900px, 100vw);
}

dialog.admin-right-panel.preview-dialog {
  width: min(900px, 100vw);
}

dialog.admin-right-panel::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

dialog.admin-right-panel form {
  display: flex;
  flex-direction: column;
  max-height: none;
  height: 100%;
  min-height: 0;
  flex: 1;
}

dialog.admin-right-panel .dialog-header {
  position: relative;
  padding-right: 52px;
  flex-shrink: 0;
}

dialog.admin-right-panel .dialog-dismiss {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  line-height: 1;
  border-radius: 8px;
}

dialog.admin-right-panel .dialog-body {
  flex: 1;
  min-height: 0;
}

dialog.admin-right-panel .dialog-footer {
  flex-shrink: 0;
  background: var(--bg-subtle);
}

@media (max-width: 960px) {
  .admin-nav-toggle {
    display: inline-flex;
  }

  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: fixed;
    z-index: 200;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(280px, 88vw);
    max-height: none;
    min-height: 100vh;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 12px 0 40px rgba(15, 23, 42, 0.2);
  }

  .app.admin-sidebar-open .admin-sidebar {
    transform: translateX(0);
  }

  .admin-sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    border: none;
    padding: 0;
    margin: 0;
    background: rgba(15, 23, 42, 0.42);
    cursor: pointer;
  }

  .app.admin-sidebar-open .admin-sidebar-overlay {
    display: block;
  }

  .admin-main {
    padding: 16px;
  }

  .admin-sidebar-collapse-btn {
    display: none;
  }
}

/* Analytics dashboard */

.analytics-top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  margin: 0 0 4px;
  padding: 14px 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 253, 0.96) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-xs);
}

.analytics-top-bar-range {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.analytics-top-bar-eyebrow {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.analytics-top-bar-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.analytics-top-bar-summary strong {
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.analytics-top-bar-summary .muted {
  font-size: 0.8125rem;
}

.analytics-top-bar-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.analytics-page {
  display: grid;
  gap: 20px;
}

.analytics-header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.analytics-filter-field {
  display: grid;
  gap: 6px;
}

.analytics-filter-label {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.analytics-top-bar-controls select {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font: inherit;
  font-size: 0.875rem;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text-secondary);
  min-width: 150px;
}

.analytics-kpi-section {
  display: grid;
  gap: 16px;
}

.analytics-kpi-panel {
  display: grid;
  gap: 12px;
}

.analytics-kpi-panel-head h2 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.analytics-kpi-panel-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.analytics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.analytics-kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  min-height: 108px;
  height: 100%;
}

.analytics-kpi-card.stat-card strong,
.analytics-kpi-card .analytics-kpi-value {
  display: block;
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.65rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--text);
  word-break: break-word;
}

.analytics-kpi-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.analytics-kpi-label {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}

.analytics-kpi-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: color-mix(in srgb, var(--stat-accent, #94a3b8) 12%, white);
  color: var(--stat-accent, #64748b);
}

.analytics-kpi-icon svg {
  width: 17px;
  height: 17px;
}

.analytics-kpi-card--skeleton {
  pointer-events: none;
}

.analytics-kpi-card--skeleton .analytics-kpi-card-top {
  align-items: center;
}

.analytics-kpi-skeleton-icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: analytics-shimmer 1.2s ease-in-out infinite;
}

.analytics-kpi-skeleton-line {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: analytics-shimmer 1.2s ease-in-out infinite;
}

.analytics-kpi-skeleton-line--lg {
  height: 22px;
  width: 56%;
}

@keyframes analytics-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.analytics-section {
  display: grid;
  gap: 14px;
}

.analytics-section-head h2,
.analytics-section-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.analytics-section-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.analytics-section-head--split {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

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

.analytics-grid--location {
  grid-template-columns: 1fr;
}

.analytics-grid--location .analytics-table-card {
  padding: 18px 20px 0;
}

.location-map-card {
  overflow: hidden;
  padding: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 251, 253, 0.96) 100%);
}

.location-map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  padding: 18px 20px 14px;
}

.location-map-toolbar h3 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.location-map-toolbar p {
  margin: 0;
  font-size: 0.8125rem;
}

.location-map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
}

.location-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.location-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2aa3bb 0%, #16768b 100%);
  box-shadow: 0 0 0 3px rgba(27, 133, 156, 0.16);
}

.location-legend-dot.is-region {
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.16);
}

.location-legend-scale {
  padding-left: 12px;
  border-left: 1px solid #dfe7f3;
  color: #94a3b8;
  font-weight: 500;
}

.location-map-stage {
  position: relative;
  margin: 0 16px 16px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    inset 0 0 0 1px rgba(27, 133, 156, 0.08),
    0 16px 36px rgba(15, 23, 42, 0.06);
}

.location-world-map {
  height: 460px;
  background: #d7e6ee;
}

.location-world-map .leaflet-container {
  height: 100%;
  width: 100%;
  background: #c9dce6;
  font-family: inherit;
}

.location-world-map .leaflet-tile-pane {
  filter: saturate(0.28) contrast(1.06) brightness(1.08) sepia(0.18) hue-rotate(160deg);
}

.location-world-map .leaflet-control-zoom {
  border: 0;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  overflow: hidden;
  border-radius: 12px;
}

.location-world-map .leaflet-bar a {
  width: 34px;
  height: 34px;
  line-height: 34px;
  border: 0;
  color: #0f3d48;
  background: rgba(255, 255, 255, 0.94);
}

.location-world-map .leaflet-bar a:hover {
  background: #f4fafb;
  color: #1b859c;
}

.location-world-map .leaflet-control-attribution {
  background: rgba(255, 255, 255, 0.72);
  color: #64748b;
  font-size: 10px;
  backdrop-filter: blur(8px);
}

.location-world-map .leaflet-tooltip {
  padding: 6px 9px;
  border: 0;
  border-radius: 8px;
  background: #0f3d48;
  color: #fff;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.location-world-map .leaflet-tooltip-top:before {
  border-top-color: #0f3d48;
}

.location-world-map .leaflet-popup-content-wrapper {
  padding: 0;
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.location-world-map .leaflet-popup-content {
  margin: 0;
}

.location-world-map .leaflet-popup-tip {
  background: #fff;
}

.location-map-popup {
  min-width: 168px;
  padding: 12px 14px;
}

.location-map-popup strong {
  display: block;
  margin-bottom: 2px;
  color: #0b1220;
  font-size: 0.9375rem;
}

.location-map-popup span {
  color: #64748b;
  font-size: 0.8125rem;
}

.location-pin-wrap {
  background: none;
  border: 0;
}

.location-pin {
  display: grid;
  justify-items: center;
  gap: 4px;
  transform: translateY(-6px);
}

.location-pin-bubble {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(180deg, #2aa3bb 0%, #16768b 100%);
  box-shadow:
    0 0 0 4px rgba(27, 133, 156, 0.16),
    0 10px 18px rgba(15, 61, 72, 0.22);
}

.location-pin--lg .location-pin-bubble {
  min-width: 42px;
  height: 42px;
  font-size: 0.875rem;
}

.location-pin--sm .location-pin-bubble {
  min-width: 28px;
  height: 28px;
  font-size: 0.6875rem;
}

.location-pin.is-region .location-pin-bubble {
  background: linear-gradient(180deg, #818cf8 0%, #4f46e5 100%);
  box-shadow:
    0 0 0 4px rgba(99, 102, 241, 0.16),
    0 10px 18px rgba(67, 56, 202, 0.2);
}

.location-pin-label {
  max-width: 92px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f3d48;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.1);
}

.location-map-regions {
  margin: 0;
  padding: 0 20px 16px;
  font-size: 0.8125rem;
}

@media (max-width: 720px) {
  .location-map-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .location-legend-scale {
    padding-left: 0;
    border-left: 0;
  }

  .location-world-map {
    height: 360px;
  }
}

.analytics-location-hint {
  margin: 0;
  max-width: 280px;
  text-align: right;
  font-size: 0.8125rem;
}

.analytics-page--loading .chart-wrap {
  opacity: 0.45;
}

.chart-card {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}

.chart-card--wide {
  grid-column: 1 / -1;
}

.chart-card-head {
  margin-bottom: 14px;
}

.chart-card-head h3 {
  margin: 0 0 4px;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.chart-card-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.chart-wrap {
  position: relative;
  height: 280px;
}

.chart-wrap--bar {
  height: 300px;
}

.chart-wrap--donut {
  height: 260px;
}

.analytics-table-card {
  margin-top: 0;
  padding: 0;
  overflow: hidden;
}

.analytics-table-card .table-wrap {
  box-shadow: none;
  border: none;
  border-radius: 0;
}

.analytics-share-cell {
  display: grid;
  gap: 6px;
  min-width: 88px;
}

.analytics-share-cell span {
  font-size: 0.8125rem;
  font-weight: 600;
}

.analytics-share-bar {
  height: 6px;
  border-radius: 999px;
  background: #eef2f7;
  overflow: hidden;
}

.analytics-share-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b859c 0%, #25b746 100%);
}

@media (max-width: 1200px) {
  .analytics-grid--breakdown {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .analytics-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid,
  .analytics-grid--breakdown,
  .analytics-grid--location {
    grid-template-columns: 1fr;
  }

  .analytics-location-hint {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 640px) {
  .analytics-top-bar {
    align-items: stretch;
  }

  .analytics-top-bar-controls {
    width: 100%;
  }

  .analytics-filter-field,
  .analytics-top-bar-controls select,
  .analytics-top-bar-controls .btn {
    width: 100%;
  }

  .analytics-kpi-grid {
    grid-template-columns: 1fr;
  }
}

.cron-link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 16px 18px;
}

.cron-link-card-copy strong {
  display: block;
  margin-bottom: 4px;
}

.cron-link-card-copy p {
  margin: 0;
  font-size: 0.875rem;
}

.cron-env-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid rgba(217, 119, 6, 0.22);
  background: linear-gradient(180deg, rgba(255, 251, 235, 0.92) 0%, rgba(255, 255, 255, 0.96) 100%);
  color: #92400e;
}

.cron-env-banner-copy strong {
  display: block;
  margin-bottom: 4px;
}

.cron-env-banner-copy span {
  font-size: 0.875rem;
  line-height: 1.45;
}

.cron-jobs-table {
  min-width: 920px;
}

.cron-job-meta {
  margin-bottom: 18px;
}

.cron-form-heading {
  margin: 0 0 12px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

@media (max-width: 640px) {
  .cron-link-card {
    flex-direction: column;
    align-items: stretch;
  }
}

.cron-panel-section {
  display: grid;
  gap: 12px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.cron-panel-section:last-of-type,
.cron-panel-section--test {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.cron-panel-head h3 {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.cron-panel-head p {
  margin: 0;
  font-size: 0.8125rem;
}

.cron-trigger-note {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #f4fafb;
  border: 1px solid #d7eef3;
  color: #334155;
  font-size: 0.8125rem;
  line-height: 1.5;
}

.cron-toggle--panel {
  width: fit-content;
}

.cron-panel-meta {
  margin: 0;
}

.cron-panel-test-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

dialog.admin-right-panel .cron-setup-panel {
  margin-bottom: 16px;
}

.cron-day-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cron-day-chip {
  display: inline-flex;
  align-items: center;
  margin: 0;
  cursor: pointer;
}

.cron-day-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.cron-day-chip span {
  display: inline-flex;
  min-width: 44px;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}

.cron-day-chip input:checked + span {
  background: var(--brand-soft);
  border-color: rgba(27, 133, 156, 0.28);
  color: var(--brand-dark);
}

.cron-run-results {
  display: grid;
  gap: 12px;
}

.cron-run-summary strong {
  display: block;
  margin-bottom: 2px;
}

.cron-run-summary p {
  margin: 0;
}

.cron-run-table {
  max-height: 320px;
  overflow: auto;
}

.cron-run-table .cron-select-col {
  width: 36px;
  text-align: center;
  vertical-align: top;
  padding-top: 12px;
}

.cron-run-table .cron-select-col input {
  margin: 0;
}

.cron-run-select-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  align-items: center;
  margin: 0 0 10px;
  font-size: 0.8125rem;
}

.cron-run-select-actions button {
  padding: 0;
  border: 0;
  background: none;
  color: #1b859c;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cron-run-select-actions button:hover {
  text-decoration: underline;
}

.block-sites-layout {
  display: grid;
  gap: 16px;
}

.block-sites-panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow-xs);
}

.block-sites-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.block-sites-panel-head h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.block-sites-panel-head p {
  margin: 0;
}

.block-sites-search {
  position: relative;
  margin-bottom: 16px;
}

.block-sites-search .search-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  color: #94a3b8;
  transform: translateY(-50%);
  pointer-events: none;
}

.block-sites-search input {
  width: 100%;
  height: 46px;
  padding: 0 16px 0 42px;
  border: 1px solid #d7e3ee;
  border-radius: 12px;
  background: #f8fbfd;
  font: inherit;
}

.block-sites-search input:focus {
  outline: none;
  border-color: rgba(27, 133, 156, 0.45);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(27, 133, 156, 0.12);
}

.block-sites-manual {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px dashed #d7e3ee;
  border-radius: 12px;
  background: #f8fbfd;
}

.block-sites-manual summary {
  cursor: pointer;
  font-weight: 600;
  color: #0f3d48;
}

.block-sites-manual[open] summary {
  margin-bottom: 10px;
}

.block-sites-manual-grid {
  display: grid;
  gap: 12px;
  margin: 12px 0;
}

@media (min-width: 720px) {
  .block-sites-manual-grid {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  }
}

.block-sites-empty {
  padding: 28px 16px;
  border: 1px dashed #d7e3ee;
  border-radius: 14px;
  background: #f8fbfd;
  text-align: center;
}

.block-sites-empty strong {
  display: block;
  margin-bottom: 4px;
  color: #0f3d48;
}

.block-sites-empty p {
  margin: 0;
  color: #64748b;
  font-size: 0.875rem;
}

.block-sites-panel .table-wrap {
  margin: 0;
  box-shadow: none;
  border: 1px solid #e6eef5;
}

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

.trial-adjust-hint {
  margin: -4px 0 14px;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.dialog-grid.trial-adjust-grid {
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 720px) {
  .dialog-grid.trial-adjust-grid {
    grid-template-columns: minmax(180px, 220px) repeat(2, minmax(0, 1fr));
    align-items: end;
  }
}

.outlook-layout {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.outlook-sidebar,
.outlook-editor {
  padding: 20px;
}

.outlook-type-list {
  display: grid;
  gap: 8px;
  margin: 16px 0 20px;
}

.outlook-type-btn {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.outlook-type-btn.is-active {
  border-color: rgba(27, 133, 156, 0.35);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(27, 133, 156, 0.12);
}

.outlook-type-btn strong {
  font-size: 0.875rem;
}

.outlook-type-btn span.muted {
  font-size: 0.75rem;
  line-height: 1.45;
}

.outlook-type-badge {
  display: inline-block;
  margin-top: 2px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef3fa;
  color: #475569;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.outlook-placeholder-card {
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.outlook-placeholder-card strong {
  display: block;
  margin-bottom: 4px;
}

.outlook-placeholder-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.placeholder-chip-btn {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

.placeholder-chip-btn code {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef3fa;
  color: #334155;
  font-size: 0.75rem;
}

.outlook-editor-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.outlook-editor-toolbar h2 {
  margin: 0 0 4px;
  font-size: 1.125rem;
}

.outlook-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.outlook-preview-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
}

.outlook-preview {
  padding: 16px;
}

.outlook-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.outlook-preview-copy-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.outlook-preview-label {
  margin: 0 0 6px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.outlook-preview-block {
  margin: 0 0 16px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: Segoe UI, Helvetica, Arial, sans-serif;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.customer-app-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.customer-sites-heading {
  margin: 20px 0 10px;
  font-size: 0.95rem;
}

@media (max-width: 960px) {
  .outlook-layout {
    grid-template-columns: 1fr;
  }

  .outlook-preview-controls {
    grid-template-columns: 1fr;
  }
}

.email-notifications-table {
  min-width: 920px;
}

.email-notifications-table tbody tr[data-id] {
  cursor: pointer;
}

.email-notifications-table tbody tr.is-selected td {
  background: #eef6fb;
}

.email-notification-preview-dialog .dialog-body {
  display: flex;
  flex-direction: column;
  overflow: auto;
}

.email-notification-preview-dialog .send-preview-chrome {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.email-notification-preview-dialog .send-preview-meta,
.email-notification-preview-dialog #preview-missing {
  flex-shrink: 0;
}

.email-notification-preview-dialog .send-preview-frame-wrap,
.email-notification-preview-dialog .preview-frame-wrap {
  position: relative;
  flex: 1 1 auto;
  min-height: 360px;
  background: #eef2f7;
}

.email-notification-preview-dialog .send-preview-frame-wrap iframe,
.email-notification-preview-dialog .preview-frame-wrap iframe {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  border: 0;
  background: #fff;
}

.cron-yesterday-report {
  margin-bottom: 16px;
}

.cron-yesterday-card {
  display: grid;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}

.cron-yesterday-card.is-warning {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  background: color-mix(in srgb, var(--warning) 8%, #fff);
}

.cron-yesterday-card h2 {
  margin: 4px 0 8px;
  font-size: 1.25rem;
}

.cron-history-table {
  min-width: 980px;
}

.badge.cron-run-status.ran,
.badge.cron-run-outcome.ran { background: var(--success-soft); color: var(--success); }

.badge.cron-run-status.skipped,
.badge.cron-run-outcome.checked,
.badge.cron-run-outcome.paused { background: #f1f5f9; color: #475569; }

.badge.cron-run-status.failed,
.badge.cron-run-outcome.failed { background: var(--danger-soft); color: var(--danger); }

.badge.cron-run-outcome.disabled,
.badge.cron-run-outcome.no_record { background: var(--warning-soft); color: #92400e; }

.cron-run-errors {
  margin: 12px 0 0;
  padding-left: 18px;
}

.toolbar-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  white-space: nowrap;
}

