/* ============================================================
   Huppmail — Dashboard Styles (Light Modern Theme)
   ============================================================ */

/* ---------- CSS Variables / Theme ---------- */
:root {
  --bg-primary: #f0f4f8;
  --bg-secondary: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #eef2f7;
  --bg-input: #f7f9fc;
  --border-color: #e2e8f0;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: rgba(99, 102, 241, 0.10);
  --success: #34d399;
  --success-bg: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-bg: rgba(251, 191, 36, 0.12);
  --error: #f87171;
  --error-bg: rgba(248, 113, 113, 0.12);
  --info: #60a5fa;
  --info-bg: rgba(96, 165, 250, 0.10);
  --sidebar-width: 250px;
  --sidebar-collapsed-width: 68px;
  --header-height: 60px;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.10);
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --gradient-accent: linear-gradient(135deg, #6366f1, #8b5cf6);
  --gradient-success: linear-gradient(135deg, #34d399, #6ee7b7);
  --gradient-warm: linear-gradient(135deg, #fbbf24, #f59e0b);
  --gradient-rose: linear-gradient(135deg, #fb7185, #f43f5e);

  /* Aliases used by suppression / webhook sections */
  --bg-page: var(--bg-primary);
  --text: var(--text-primary);
  --border: var(--border-color);
  --primary: var(--accent);
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* No default blue browser focus outline; keyboard users still get a subtle,
   intentional ring via :focus-visible. Deliberately resets ONLY the outline,
   not box-shadow, so inputs that use a glow ring on focus keep it. */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 1px; }

html { font-size: 14px; }

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ---------- Login Page ---------- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: linear-gradient(160deg, #f0f4f8 0%, #e0e7ff 50%, #f0f4f8 100%);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-card h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.login-card .subtitle {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 0.875rem;
}

.login-card .logo {
  font-size: 2rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 800;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-card .logo span {
  background: none;
  -webkit-text-fill-color: var(--text-primary);
}

.auth-toggle {
  text-align: center;
  margin-top: 1.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.auth-toggle a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.auth-toggle a:hover {
  text-decoration: underline;
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  width: 100%;
  padding: 0.625rem 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: var(--font-family);
  transition: border-color var(--transition);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

textarea.form-control {
  resize: vertical;
  min-height: 100px;
}

select.form-control {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L0.575 3.4 1.4 2.575 6 7.175 10.6 2.575 11.425 3.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-family);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: var(--gradient-accent);
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-secondary:hover {
  background: var(--border-color);
}

.btn-danger {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  color: #fff;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 14px rgba(244, 63, 94, 0.35);
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8rem;
}

.btn-ghost {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}
.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent);
  box-shadow: 0 3px 10px rgba(99, 102, 241, 0.15);
  transform: translateY(-1px);
}
.btn-ghost svg {
  opacity: 0.65;
  transition: opacity 0.15s;
}
.btn-ghost:hover svg {
  opacity: 1;
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Layout (Sidebar + Main) ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.03);
  transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-logo {
  padding: 1.375rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: nowrap;
  min-height: 78px;
}

.sidebar-logo .logo-icon {
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-logo .logo-icon img {
  width: 55px;
  height: 55px;
  border-radius: 14px;
  object-fit: contain;
}

.sidebar-logo .logo-text {
  font-size: 1.35rem;
  font-weight: 900;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  transition: opacity 0.2s ease, width 0.2s ease;
}

.sidebar-logo .logo-text .logo-accent {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.sidebar-toggle {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: var(--accent-light);
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.75rem;
  transition: all var(--transition);
  border-radius: 6px;
}

.sidebar-toggle:hover {
  background: var(--accent);
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0;
}

.nav-section-label {
  padding: 0.5rem 1.5rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.nav-section-label:not(:first-child) {
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.sidebar-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav a:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.sidebar-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 600;
}

.sidebar-nav a .nav-icon {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.sidebar-nav a .nav-label {
  transition: opacity 0.2s ease;
}
.sidebar-error-badge,
.sidebar-alert-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  color: #fff;
  font-size: 0.675rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  letter-spacing: 0.01em;
  box-sizing: border-box;
  flex-shrink: 0;
}
.sidebar-error-badge {
  margin-left: auto;
  background: #ef4444;
  box-shadow: 0 1px 4px rgba(239, 68, 68, 0.35);
}
.sidebar-alert-badge {
  margin-left: 5px;
  background: #f59e0b;
  box-shadow: 0 1px 4px rgba(245, 158, 11, 0.35);
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-footer .user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-secondary);
  font-size: 0.825rem;
}

.sidebar-footer .logout-btn {
  background: linear-gradient(135deg, #fb7185, #f43f5e);
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 0.35rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-family);
  transition: all var(--transition);
  min-width: 20px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.2);
}

.sidebar-footer .logout-btn:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.3);
  transform: translateY(-1px);
}

/* ---------- Sidebar Collapsed State ---------- */
.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-logo {
  justify-content: center;
  padding: 1.375rem 0.75rem;
  position: relative;
}

.sidebar.collapsed .sidebar-logo .logo-icon img {
  width: 47px;
  height: 47px;
}

.sidebar.collapsed .sidebar-logo .logo-text {
  opacity: 0;
  width: 0;
  overflow: hidden;
  position: absolute;
}

.sidebar.collapsed .sidebar-toggle {
  display: none;
}

.sidebar.collapsed .sidebar-nav a {
  justify-content: center;
  padding: 0.75rem 0;
  border-left: 3px solid transparent;
}

.sidebar.collapsed .sidebar-nav a .nav-icon {
  font-size: 1.15rem;
}

.sidebar.collapsed .sidebar-nav a .nav-label {
  opacity: 0;
  width: 0;
  overflow: hidden;
  position: absolute;
}
.sidebar.collapsed .sidebar-error-badge,
.sidebar.collapsed .sidebar-alert-badge {
  position: absolute;
  margin-left: 0;
  min-width: 16px;
  height: 16px;
  font-size: 0.6rem;
  padding: 0 4px;
  border-radius: 8px;
}
.sidebar.collapsed .sidebar-error-badge {
  top: 2px;
  right: 2px;
}
.sidebar.collapsed .sidebar-alert-badge {
  top: 2px;
  right: 20px;
}

.sidebar.collapsed .nav-section-label {
  font-size: 0;
  padding: 0;
  margin: 0;
  border: none;
  height: 0;
  overflow: hidden;
}

.sidebar.collapsed .nav-section-label:not(:first-child) {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  border-top: 1px solid var(--border-color);
  height: auto;
}

.sidebar.collapsed .sidebar-footer {
  padding: 1rem 0.5rem;
  text-align: center;
}

.sidebar.collapsed .sidebar-footer .nav-label {
  display: none;
}

.sidebar.collapsed .sidebar-footer .logout-btn .logout-label {
  display: none;
}

.sidebar.collapsed .sidebar-footer .logout-btn {
  padding: 0.35rem;
}

.sidebar.collapsed .sidebar-footer .user-info {
  justify-content: center;
}

.sidebar.collapsed + .main-content {
  margin-left: var(--sidebar-collapsed-width);
}

/* ---------- Main Content ---------- */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.page-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}

.page-header h1 {
  font-size: 1.375rem;
  font-weight: 700;
}

.page-header .page-description {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.25rem;
}

.page-body {
  padding: 1.5rem 2rem;
}

/* ---------- Stat Cards ---------- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all var(--transition);
  box-shadow: var(--shadow);
}

.stat-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  transform: translateY(-2px);
}

.stat-card .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-card .stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.375rem;
}

.stat-card.success .stat-value { color: #10b981; }
.stat-card.warning .stat-value { color: #f59e0b; }
.stat-card.error .stat-value { color: #f87171; }
.stat-card.info .stat-value { color: var(--accent); }

/* ---------- Error Tracker Widget ---------- */
.err-tracker-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
  border-left: 3px solid #ef4444;
}
.err-tracker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.err-tracker-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text-primary);
}
.err-tracker-label {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 500;
}
.err-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  color: #fff;
}
.err-badge-server { background: #ef4444; }
.err-badge-client { background: #f59e0b; }
.err-row {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}
.err-row:last-child { border-bottom: none; }
.err-row-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.err-src {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: #fff;
  flex-shrink: 0;
}
.err-src-server { background: #ef4444; }
.err-src-client { background: #f59e0b; }
.err-test-btn {
  margin-left: 0.75rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.675rem;
  font-weight: 600;
  border: 1px dashed #94a3b8;
  border-radius: 4px;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all 0.15s;
}
.err-test-btn:hover {
  border-color: #ef4444;
  color: #ef4444;
}
.err-endpoint {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-primary);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}
.err-time {
  font-size: 0.75rem;
  color: #94a3b8;
  margin-left: auto;
}
.err-msg {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 0.2rem;
  line-height: 1.4;
  word-break: break-word;
}
.err-detail-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  cursor: pointer;
  margin-left: 0.5rem;
  transition: all 0.15s;
}
.err-detail-btn:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.err-action-btn {
  padding: 0.2rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  transition: all 0.15s ease;
  margin-left: 0.25rem;
}
.err-action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.err-done-btn {
  background: #10b981;
  color: #fff;
}
.err-done-btn:hover:not(:disabled) {
  background: #34d399;
}
.err-dismiss-btn {
  background: var(--bg-body);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.err-dismiss-btn:hover:not(:disabled) {
  background: var(--border-color);
}

.err-detail {
  display: none;
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: var(--bg-body, #f8fafc);
  border-radius: 6px;
  border: 1px solid var(--border-color);
}
.err-detail.err-detail-open {
  display: block;
  animation: errFadeIn 0.15s ease;
}
@keyframes errFadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.err-detail-grid {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 0.25rem 0.75rem;
  font-size: 0.78rem;
  margin-bottom: 0.5rem;
}
.err-detail-label {
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  white-space: nowrap;
}
.err-detail-value {
  color: var(--text-primary);
  word-break: break-all;
}
.err-detail-ua {
  font-size: 0.72rem;
  color: #94a3b8;
}
.err-detail-stack-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  margin-bottom: 0.3rem;
}
.err-detail-stack {
  font-size: 0.72rem;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.6rem 0.75rem;
  border-radius: 4px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 12rem;
  line-height: 1.5;
  margin: 0;
}

/* ---------- Send Quota Widget ---------- */
.sq-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.sq-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.sq-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.sq-title svg { color: var(--primary); opacity: 0.7; }
.sq-tier {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  background: rgba(99,102,241,0.1);
  color: var(--primary);
}
.sq-tier-free { background: rgba(148,163,184,0.12); color: #64748b; }
.sq-tier-starter { background: rgba(99,102,241,0.1); color: var(--primary); }
.sq-tier-pro { background: rgba(16,185,129,0.1); color: #10b981; }
.sq-tier-business { background: rgba(245,158,11,0.1); color: #f59e0b; }
.sq-tier-enterprise { background: rgba(239,68,68,0.08); color: #ef4444; }
.sq-bar-wrap {
  height: 8px;
  background: var(--bg-body);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}
.sq-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--primary);
  transition: width 0.6s ease;
  min-width: 0;
}
.sq-bar.sq-warning { background: #f59e0b; }
.sq-bar.sq-danger { background: #ef4444; }
.sq-stats {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.sq-remaining {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--text-muted, #94a3b8);
}

/* ---------- Quality Score Widget ---------- */
.quality-score-section {
  margin-bottom: 1.5rem;
}
.quality-score-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
}
.quality-score-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.quality-score-ring-wrap {
  flex-shrink: 0;
}
.quality-score-ring {
  width: 100px;
  height: 100px;
}
.quality-score-ring .ring-bg {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 8;
}
.quality-score-ring .ring-fill {
  fill: none;
  stroke: #84cc16;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s ease, stroke 0.3s;
}
.quality-score-ring .ring-value {
  fill: var(--text-primary);
  font-size: 26px;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: auto;
  font-family: var(--font-family);
}
.quality-score-ring .ring-label {
  fill: var(--text-muted);
  font-size: 10px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: hanging;
  letter-spacing: 0.12em;
  font-family: var(--font-family);
}
.quality-score-info {
  flex: 1;
}
.quality-score-level {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 2px;
}
.quality-score-level.level-good { color: #84cc16; }
.quality-score-level.level-warning { color: #f59e0b; }
.quality-score-level.level-poor { color: #f87171; }
.quality-score-level.level-critical { color: #dc2626; }
.quality-score-window {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.quality-score-stats {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}
.quality-score-stats .qs-stat {
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.quality-score-stats .qs-stat strong {
  color: var(--text-primary);
  font-weight: 600;
}
.quality-score-breakdown {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}
.qs-breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.qs-breakdown-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.qs-breakdown-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  overflow: hidden;
}
.qs-breakdown-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.8s ease;
}
.qs-breakdown-value {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 500;
  font-family: var(--font-mono, monospace);
}
.quality-score-tips {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: rgba(251, 191, 36, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.quality-score-tips .qs-tip {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
  line-height: 1.5;
}
.quality-score-tips .qs-tip:last-child { margin-bottom: 0; }
.quality-score-tips .qs-tip::before {
  content: "⚠ ";
}
.qs-nodata {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Charts ---------- */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.chart-card-full {
  position: relative;
}

.chart-card-full canvas {
  width: 100% !important;
  height: 340px !important;
}

.chart-legend {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.5rem 0 0.25rem;
  flex-wrap: wrap;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: #475569;
  user-select: none;
}

.chart-legend-item.hidden {
  opacity: 0.4;
  text-decoration: line-through;
}

.chart-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid transparent;
  flex-shrink: 0;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.chart-toolbar h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chart-select {
  appearance: none;
  -webkit-appearance: none;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 2rem 0.35rem 0.6rem;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
  transition: border-color 0.15s;
}
.chart-select:hover { border-color: var(--accent); }
.chart-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15); }

.chart-toggle {
  display: inline-flex;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
}

.chart-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  color: var(--text-tertiary);
  transition: background 0.15s, color 0.15s;
}
.chart-toggle-btn:not(:last-child) {
  border-right: 1px solid var(--border-color);
}
.chart-toggle-btn:hover { color: var(--text-primary); }
.chart-toggle-btn.active {
  background: var(--accent);
  color: #fff;
}

.chart-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.chart-card canvas {
  width: 100% !important;
  max-height: 280px;
}

/* ---------- Activity Feed ---------- */
.activity-section {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.activity-feed {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.activity-feed h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.activity-item:last-child {
  border-bottom: none;
}

.activity-item .activity-time {
  color: var(--text-muted);
  font-size: 0.75rem;
  white-space: nowrap;
  font-family: var(--font-mono);
}

.activity-item .activity-status {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.activity-item .activity-status.sent { background: var(--success); box-shadow: 0 0 6px rgba(52, 211, 153, 0.5); }
.activity-item .activity-status.failed { background: var(--error); box-shadow: 0 0 6px rgba(248, 113, 113, 0.5); }
.activity-item .activity-status.fallback { background: #fdba74; box-shadow: 0 0 6px rgba(253, 186, 116, 0.5); }
.activity-item .activity-status.queued { background: var(--info); box-shadow: 0 0 6px rgba(96, 165, 250, 0.5); }

.activity-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 9999px;
  flex-shrink: 0;
  line-height: 1;
}
.activity-badge.sent { background: rgba(52, 211, 153, 0.12); color: #059669; }
.activity-badge.failed { background: rgba(248, 113, 113, 0.12); color: #dc2626; }
.activity-badge.fallback { background: rgba(253, 186, 116, 0.12); color: #d97706; }
.activity-badge.queued { background: rgba(96, 165, 250, 0.12); color: #2563eb; }

.activity-item .activity-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Health Indicators ---------- */
.health-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.health-panel h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text-secondary);
}

.health-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}

.health-item:last-child {
  border-bottom: none;
}

.health-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.health-dot.ok { background: var(--success); box-shadow: 0 0 8px rgba(52, 211, 153, 0.5); }
.health-dot.warn { background: var(--warning); box-shadow: 0 0 8px rgba(251, 191, 36, 0.5); }
.health-dot.error { background: var(--error); box-shadow: 0 0 8px rgba(248, 113, 113, 0.5); }
.health-dot.unknown { background: var(--text-muted); }

/* ---------- Domain Alerts ---------- */
.domain-alerts-panel {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  margin-top: 0;
  margin-bottom: 0.75rem;
}
.domain-alerts-panel h3 {
  font-size: 0.8rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.alert-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--error);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
}

/* ── Modern Alert Cards ── */
.da-card {
  position: relative;
  background: var(--bg-card);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}
.da-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  border-color: #cbd5e1;
}
.da-card.da-sev-error {
  border-color: rgba(239, 68, 68, 0.25);
}
.da-card.da-sev-warn {
  border-color: rgba(245, 158, 11, 0.3);
}
.da-card.da-sev-info {
  border-color: rgba(59, 130, 246, 0.25);
}

/* Top row */
.da-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}
.da-top-left {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.da-sev-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
}
.da-sev-error .da-sev-icon {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.da-sev-warn .da-sev-icon {
  background: rgba(245, 158, 11, 0.1);
  color: #d97706;
}
.da-sev-info .da-sev-icon {
  background: rgba(59, 130, 246, 0.1);
  color: #2563eb;
}
.da-domain {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.da-time {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

/* Message */
.da-msg {
  font-size: 0.78rem;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 0.4rem;
}

/* Remediation row */
.da-remediation {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.45rem;
}
.da-rem-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 6px;
}
.da-sev-error .da-rem-badge {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}
.da-sev-warn .da-rem-badge {
  background: rgba(245, 158, 11, 0.1);
  color: #b45309;
}
.da-sev-info .da-rem-badge {
  background: rgba(59, 130, 246, 0.1);
  color: #1d4ed8;
}
.da-rem-ip {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.65rem;
  font-weight: 600;
  color: #475569;
  background: #f1f5f9;
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}
.da-rem-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s;
}
.da-rem-link:hover { color: var(--primary-hover); text-decoration: underline; }

/* Actions row */
.da-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.da-btn {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.da-btn-detail {
  background: #f1f5f9;
  color: #334155;
}
.da-btn-detail:hover {
  background: #e2e8f0;
  color: #1e293b;
}
.da-btn-dismiss {
  background: transparent;
  color: #94a3b8;
}
.da-btn-dismiss:hover {
  background: #fee2e2;
  color: #dc2626;
}
.da-btn-done {
  background: transparent;
  color: #10b981;
  font-weight: 600;
}
.da-btn-done:hover {
  background: rgba(16,185,129,0.1);
  color: #059669;
}

/* Legacy — keep for alert-detail page */
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s;
}
.btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}

/* ---------- Alert Detail Page ---------- */
.alert-detail-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.alert-detail-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* -- Summary card (ad-*) -- */
.ad-summary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.ad-summary-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.ad-summary-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.ad-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ad-badge.sev-error { background: rgba(248,113,113,0.15); color: #ef4444; }
.ad-badge.sev-warn  { background: rgba(251,191,36,0.15);  color: #d97706; }
.ad-badge.sev-info  { background: rgba(96,165,250,0.15);  color: #3b82f6; }
.ad-badge.status-active   { background: rgba(248,113,113,0.12); color: #ef4444; }
.ad-badge.status-resolved { background: rgba(16,185,129,0.12);  color: #10b981; }
.ad-type-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}
.ad-domain {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0.25rem 0;
}
.ad-message {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0.5rem 0;
}
.ad-checks {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.ad-check {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border-radius: 6px;
  background: var(--bg-main);
}
.ad-check.check-pass { color: #10b981; }
.ad-check.check-fail { color: #ef4444; }
.ad-errors {
  margin-top: 0.75rem;
}
.ad-error-item {
  font-size: 0.8rem;
  color: #ef4444;
  padding: 0.3rem 0;
  border-bottom: 1px solid rgba(248,113,113,0.1);
}
.ad-error-item:last-child { border-bottom: none; }

/* -- Remediation card (ad-rem-*) -- */
.ad-rem-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.ad-rem-header {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}
.ad-rem-icon-wrap {
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.ad-rem-title {
  font-weight: 650;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.ad-rem-subtitle {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  line-height: 1.45;
}
.ad-rem-steps {
  list-style: none;
  counter-reset: rem-step;
  padding: 0;
  margin: 0;
}
.ad-rem-step {
  counter-increment: rem-step;
  position: relative;
  padding: 0.625rem 0 0.625rem 2.5rem;
  border-bottom: 1px solid var(--border-color);
}
.ad-rem-step:last-child { border-bottom: none; }
.ad-rem-step::before {
  content: counter(rem-step);
  position: absolute;
  left: 0;
  top: 0.625rem;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-rem-step-label {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.ad-rem-link {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8rem;
  margin-left: 0.25rem;
}
.ad-rem-link:hover { text-decoration: underline; }
.ad-rem-prefill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.4rem;
}
.ad-rem-value {
  display: inline-block;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.3rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  user-select: all;
  word-break: break-all;
  max-width: 100%;
  flex: 1;
  min-width: 0;
}
.ad-copy-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}
.ad-copy-btn:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.ad-copy-btn .ad-check-icon { display: none; }
.ad-copy-btn.ad-copy-done {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  color: #10b981;
}
.ad-copy-btn.ad-copy-done .ad-copy-icon { display: none; }
.ad-copy-btn.ad-copy-done .ad-check-icon { display: inline; }
.ad-rem-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.ad-rem-footer {
  margin-top: 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}
.ad-rem-postmaster {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.15s;
}
.ad-rem-postmaster:hover { color: var(--accent); }

/* -- Action bar (ad-action-*) -- */
.ad-action-bar {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}
.ad-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s;
}
.ad-btn-done {
  background: #10b981;
  color: #fff;
  border-color: #10b981;
}
.ad-btn-done:hover {
  background: #059669;
  border-color: #059669;
}
.ad-btn-dismiss {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-color);
}
.ad-btn-dismiss:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
  color: var(--text-primary);
}
.ad-resolved-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 8px;
  color: #10b981;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Meta grid */
.alert-detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.alert-meta-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  box-shadow: var(--shadow);
}
.alert-meta-icon {
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: 0.1rem;
}
.alert-meta-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.alert-meta-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  word-break: break-word;
}
.alert-meta-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  word-break: break-word;
  line-height: 1.4;
}

/* Auto-resolve section */
.auto-resolve-status {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.auto-resolve-status.resolve-success {
  background: rgba(16,185,129,0.08);
  border: 1px solid rgba(16,185,129,0.2);
  color: #10b981;
}
.auto-resolve-status.resolve-fail {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  color: #ef4444;
}
.auto-resolve-time {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.auto-resolve-message {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

/* Timeline */
.alert-timeline {
  position: relative;
  padding-left: 1.5rem;
}
.timeline-item {
  position: relative;
  padding-bottom: 1.25rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border-color);
}
.timeline-item.timeline-last {
  border-left-color: transparent;
}
.timeline-dot {
  position: absolute;
  left: -0.7rem;
  top: 0.1rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
}
.timeline-dot.dot-created   { border-color: #f59e0b; color: #f59e0b; }
.timeline-dot.dot-escalated { border-color: #ef4444; color: #ef4444; }
.timeline-dot.dot-auto-resolve { border-color: #6366f1; color: #6366f1; }
.timeline-dot.dot-success   { border-color: #10b981; color: #10b981; }
.timeline-dot.dot-fail      { border-color: #ef4444; color: #ef4444; }
.timeline-dot.dot-resolved  { border-color: #10b981; color: #10b981; background: rgba(16,185,129,0.1); }
.timeline-dot.dot-info      { border-color: #3b82f6; color: #3b82f6; }
.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.timeline-type {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
}
.timeline-time {
  font-size: 0.7rem;
  color: var(--text-muted);
}
.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}
.timeline-details {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}
.detail-tag {
  font-size: 0.7rem;
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  color: var(--text-secondary);
  font-family: 'JetBrains Mono', monospace;
}

/* Raw JSON */
.alert-raw-json {
  background: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

/* ---------- Tables ---------- */
.data-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.data-table-toolbar {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table-toolbar .filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.data-table-toolbar .filter-group label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  white-space: nowrap;
}

.data-table-toolbar .filter-group select,
.data-table-toolbar .filter-group input {
  height: 32px;
  padding: 0 0.5rem;
  font-size: 0.8rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  width: auto;
  min-width: 0;
  box-sizing: border-box;
}

.data-table-toolbar .filter-group select {
  padding-right: 1.5rem;
  background-position: right 0.4rem center;
}

/* ── Inline apply button for text filter inputs ── */
.filter-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.filter-input-wrap input {
  padding-right: 1.75rem !important;
  width: 100% !important;
}
.filter-input-apply {
  position: absolute;
  right: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}
.filter-input-apply:hover {
  background: var(--accent-hover, #4f46e5);
}

/* ── Clear-filters button (red, thin, modern) ── */
.btn-clear-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  line-height: 1;
  align-self: flex-end;
  margin-bottom: 0.15rem;
}
.btn-clear-filters:hover {
  background: rgba(239, 68, 68, 0.16);
  border-color: rgba(239, 68, 68, 0.45);
  color: #dc2626;
}
.btn-clear-filters svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

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

table.data-table td {
  padding: 0.625rem 1rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-secondary);
  white-space: nowrap;
}

table.data-table tr:hover td {
  background: var(--bg-hover);
}

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

/* ---------- Status Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.2rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-sent { background: #d1fae5; color: #059669; }
.badge-queued { background: #dbeafe; color: #3b82f6; }
.badge-sending { background: #ede9fe; color: #7c3aed; }
.badge-retrying { background: #fff7ed; color: #ea580c; }
.badge-failed { background: #fee2e2; color: #dc2626; }
.badge-bounced { background: #fce7f3; color: #be185d; }
.badge-soft_bounced { background: #fff7ed; color: #ea580c; }
.badge-fallback_sent { background: #d1fae5; color: #059669; }
.badge-fallback_failed { background: #fee2e2; color: #dc2626; }

.badge-self { background: #d1fae5; color: #059669; }
.badge-mailgun { background: #ecfccb; color: #4d7c0f; } /* SecondPath path badge */
.badge-sm { padding: 0.1rem 0.4rem; font-size: 0.65rem; }
.badge-muted { background: #f1f5f9; color: #64748b; }

/* ---------- Searchable Select ---------- */
.searchable-select {
  position: relative;
  min-width: 0;
}
.searchable-select-btn {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
  height: 32px;
  padding: 0 0.5rem !important;
  font-size: 0.8rem !important;
  box-sizing: border-box;
}
.searchable-select-btn svg {
  flex-shrink: 0;
  opacity: 0.5;
}
.searchable-select-label {
  overflow: hidden;
  text-overflow: ellipsis;
}
.searchable-select-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 100%;
  max-width: 320px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 100;
  overflow: hidden;
}
.searchable-select-dropdown.open {
  display: block;
}
.searchable-select-search {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  font-size: 0.8rem;
  color: var(--text-primary);
  outline: none;
}
.searchable-select-search::placeholder {
  color: var(--text-muted);
}
.searchable-select-options {
  max-height: 200px;
  overflow-y: auto;
}
.searchable-select-option {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.1s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.searchable-select-option:hover {
  background: #e2e8f0;
}
.searchable-select-option.selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

/* ---------- Date Range Filter ---------- */
.date-range-wrapper {
  position: relative;
  min-width: 0;
}
.date-range-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 200px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 100;
  overflow: hidden;
}
.date-range-dropdown.open {
  display: block;
}
.date-range-presets {
  padding: 0.25rem 0;
}
.date-range-preset {
  padding: 0.45rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.1s;
}
.date-range-preset:hover {
  background: #e2e8f0;
}
.date-range-preset.selected {
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}
.date-range-custom {
  padding: 0.5rem 0.75rem 0.65rem;
  border-top: 1px solid var(--border-color);
}
.date-range-custom-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.date-range-custom-row label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 32px;
}
.date-range-custom-row input[type="date"] {
  flex: 1;
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
}

/* ---------- Row Chevron ---------- */
.row-chevron {
  color: var(--text-muted);
  opacity: 0.4;
  transition: opacity 0.15s, color 0.15s;
  text-align: center;
  padding: 0 0.25rem !important;
}
tr:hover .row-chevron {
  opacity: 1;
  color: var(--accent);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.825rem;
  color: var(--text-secondary);
}

.pagination-buttons {
  display: flex;
  gap: 0.375rem;
}

.pagination-buttons button {
  padding: 0.375rem 0.75rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
}

.pagination-buttons button:hover:not(:disabled) {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.pagination-buttons button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ---------- Domain DNS Cards ---------- */
.domain-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 0;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.domain-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.domain-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
}

.domain-card-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

/* Header right group: reputation + chevron */
.domain-card-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

/* Domain reputation indicator */
.domain-rep {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: var(--font-mono);
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  white-space: nowrap;
}
.domain-rep.rep-excellent {
  color: #15803d;
  background: #dcfce7;
}
.domain-rep.rep-good {
  color: #3b82f6;
  background: #dbeafe;
}
.domain-rep.rep-fair {
  color: #d97706;
  background: #fef3c7;
}
.domain-rep.rep-poor {
  color: #dc2626;
  background: #fee2e2;
}
.domain-rep.rep-none {
  color: var(--text-muted);
  background: var(--bg-hover);
}

.domain-card.collapsed .domain-card-chevron {
  transform: rotate(0deg);
}

.domain-card:not(.collapsed) .domain-card-chevron {
  transform: rotate(180deg);
}

.domain-card-body {
  padding: 0 1.25rem 1.25rem;
}

.domain-card.collapsed .domain-card-body {
  display: none;
}

/* "Requires attention" red badge — only visible when collapsed */
.badge-attention {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15em 0.55em;
  border-radius: 4px;
  display: none;
}
.domain-card.collapsed .badge-attention {
  display: inline-flex;
}

/* ── Domain search bar ── */
.domain-search-bar {
  position: relative;
  margin-bottom: 1rem;
}
.domain-search-bar .domain-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.domain-search-bar .form-control {
  padding-left: 40px;
  height: 40px;
  font-size: 0.875rem;
}

.domain-card-static {
  padding: 1.25rem;
}

.domain-card h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ── Card sections (numbered) ── */
.card-section {
  border-top: 1px solid var(--border-color);
  padding: 0.85rem 0 0.5rem;
}
.card-section:first-of-type {
  border-top: none;
  padding-top: 0.5rem;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
}
.section-heading-collapsible {
  cursor: pointer;
  user-select: none;
}
.section-heading-collapsible:hover {
  color: var(--text-primary);
}
.section-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 1px;
}
.section-heading strong {
  font-size: 0.88rem;
}
.section-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.15rem 0 0;
  line-height: 1.45;
  font-weight: 400;
}
.section-tag {
  font-size: 0.65rem;
  background: var(--accent-light);
  color: var(--accent);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 600;
  vertical-align: middle;
  margin-left: 0.25rem;
}
.section-chevron {
  margin-left: auto;
  color: var(--text-muted);
  flex-shrink: 0;
  padding-top: 0.15rem;
  transition: transform 0.2s ease;
}
.section-chevron.open {
  transform: rotate(180deg);
}

.dns-explain {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

/* ── Domain actions (bottom) ── */
.domain-actions {
  border-top: 1px solid var(--border-color);
  padding-top: 0.75rem;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
}
.domain-actions:empty {
  display: none;
}
.btn-outline-danger-sm {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline-danger-sm:hover {
  border-color: #fca5a5;
  color: #dc2626;
  background: #fef2f2;
}
.domain-action-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
}

.btn-outline-muted {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-outline-muted:hover {
  border-color: var(--text-secondary);
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.badge-paused {
  background: var(--warning-bg);
  color: #b45309;
}

.dns-record {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  font-size: 0.85rem;
}

/* ── Compact DNS chip grid ── */
.dns-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.dns-grid-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0.5rem 0 0;
  line-height: 1.45;
}
.dns-grid-hint strong {
  color: var(--warning);
}
.dns-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.55rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-secondary);
}
.dns-chip-ok { background: var(--success-bg); border-color: var(--success); color: #047857; }
.dns-chip-fail { background: var(--error-bg); border-color: var(--error); color: #b91c1c; }
.dns-chip-warn { background: var(--warning-bg); border-color: var(--warning); color: #92400e; }
.dns-chip-unknown { background: var(--bg-hover); border-color: var(--border-color); color: var(--text-muted); }
.dns-chip-pending { background: #ede9fe; border-color: #c4b5fd; color: #6d28d9; }
.pending-countdown {
  font-family: 'JetBrains Mono', 'SF Mono', monospace;
  font-size: 0.68rem;
  margin-left: 0.15rem;
  opacity: 0.85;
}
/* Copy clear instructions button */
.copy-instructions-wrap {
  margin-top: 1.25rem;
}
.copy-instructions-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, rgba(99,102,241,0.08), rgba(139,92,246,0.08));
  color: var(--primary, #6366f1);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  letter-spacing: 0.01em;
}
.copy-instructions-btn .ci-icon {
  flex-shrink: 0;
}
.copy-instructions-btn:hover {
  background: linear-gradient(135deg, rgba(99,102,241,0.15), rgba(139,92,246,0.15));
  border-color: rgba(99,102,241,0.45);
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(99,102,241,0.12);
  transform: translateY(-1px);
}
.copy-instructions-btn:active {
  transform: translateY(0);
  box-shadow: none;
}
.copy-instructions-btn.copied {
  background: linear-gradient(135deg, rgba(16,185,129,0.1), rgba(5,150,105,0.1));
  border-color: rgba(16,185,129,0.35);
  color: #059669;
  box-shadow: 0 2px 8px rgba(16,185,129,0.12);
}

/* Mark as Done button */
.mark-done-wrap { margin-top: 1.5rem; }
.mark-done-btn {
  display: block;
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: #7c3aed;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
  text-align: center;
}
.mark-done-btn:hover:not(:disabled) {
  background: #6d28d9;
  box-shadow: 0 2px 12px rgba(124, 58, 237, 0.3);
}
@keyframes markDoneGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(167, 139, 250, 0.6); }
  50% { box-shadow: 0 0 20px 6px rgba(167, 139, 250, 0.4); }
}
.mark-done-btn.checking {
  background: #a78bfa;
  cursor: default;
  animation: markDoneGlow 1.5s ease-in-out infinite;
}
.mark-done-btn.countdown {
  background: #a78bfa;
  cursor: default;
}
.mark-done-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
  text-align: center;
}
.dns-chip .dns-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}
.dns-chip .dns-ico svg {
  width: 100%;
  height: 100%;
}
.dns-chip .dns-help-btn {
  width: 18px;
  height: 18px;
  margin-left: 0.1rem;
}
.dns-chip .dns-help-btn svg {
  width: 11px;
  height: 11px;
}

/* ── Feature → Requirement grid ── */

/* Toggle switch inside grid rows */
.frg-tgl {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.frg-tgl input {
  opacity: 0;
  width: 0;
  height: 0;
}
.frg-tgl-s {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #cbd5e1;
  border-radius: 22px;
  transition: background 0.25s;
}
.frg-tgl-s:before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 3px rgba(0,0,0,.15);
}
.frg-tgl input:checked + .frg-tgl-s {
  background: var(--success);
}
.frg-tgl input:checked + .frg-tgl-s:before {
  transform: translateX(18px);
}

/* Footer row (Refresh DNS Check + timestamp) */
.frg-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.frg-checked {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* Requirement warning (inline within reqs column) */
.frg-req-warn {
  font-size: 0.78rem;
  font-weight: 500;
  color: #dc2626;
  padding: 0.25rem 0 0;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.frg-req-warn-pending {
  font-size: 0.78rem;
  font-weight: 500;
  color: #6d28d9;
  padding: 0.25rem 0 0;
  line-height: 1.3;
  letter-spacing: 0.01em;
}

/* Inline mode select (ghost dropdown — barely visible) */
.frg-mode-select {
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: none;
  padding: 0 0.15rem 0 0;
  cursor: pointer;
  outline: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M1 1l3 3 3-3' fill='none' stroke='%231e293b' stroke-width='1.3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  padding-right: 14px;
}
.frg-mode-select:focus {
  color: var(--text-primary);
}
.frg-mode-select:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.frg-no-req {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  font-style: italic;
}

/* Save Settings bar */
.frg-save-bar {
  margin-top: 0.85rem;
  padding: 0.75rem 0;
  border-top: 2px solid var(--border-color);
  display: flex;
  justify-content: center;
}
.frg-save-bar .btn {
  padding: 0.75rem 3rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

/* DNS chip shake / highlight on validation error */
@keyframes chipShake {
  0%, 100% { transform: translateX(0); }
  15% { transform: translateX(-4px); }
  30% { transform: translateX(4px); }
  45% { transform: translateX(-3px); }
  60% { transform: translateX(3px); }
  75% { transform: translateX(-2px); }
  90% { transform: translateX(1px); }
}
.dns-chip-shake {
  animation: chipShake 0.5s ease;
  box-shadow: 0 0 0 2px var(--error), 0 0 8px rgba(248,113,113,.35);
}

.feat-req-grid {
  display: grid;
  grid-template-columns: 1fr 36px 1fr;
  gap: 0;
}
.frg-header {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding-bottom: 0.45rem;
  border-bottom: 2px solid var(--border-color);
}
.frg-header-req {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.frg-dns-refresh {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.68rem;
  margin-left: auto;
}
.frg-header-mid {
  border-bottom: 2px solid var(--border-color);
}
.frg-feat {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid rgba(0,0,0,.04);
  transition: opacity 0.25s;
}
.frg-feat.off {
  opacity: 0.55;
}
/* Spinner for DNS check loading */
.frg-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: frgSpin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes frgSpin {
  to { transform: rotate(360deg); }
}
.dns-chip-loading {
  border-color: var(--border-color);
  color: var(--text-muted);
  opacity: 0.7;
}

/* Indented sub-feature rows */
.frg-feat.frg-indent {
  padding-left: 1.6rem;
}
.frg-feat-name {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.frg-feat-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 0.08rem;
  line-height: 1.4;
}
.frg-chev {
  padding: 0.85rem 0.15rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
  display: flex;
  align-items: center;
  justify-content: center;
}
.frg-chev svg {
  width: 10px;
  height: 12px;
}
.frg-chev .chev-path {
  fill: none;
  stroke: var(--border-color);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.25s;
}
.frg-chev.on .chev-path {
  stroke: var(--accent);
}
.frg-chev.off {
  opacity: 0;
}
.frg-reqs {
  padding: 0.85rem 0 0.85rem 0.55rem;
  border-bottom: 1px solid rgba(0,0,0,.04);
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  align-items: center;
  transition: opacity 0.25s;
}
.frg-reqs.dim {
  opacity: 0.3;
}
@media (max-width: 640px) {
  .feat-req-grid {
    grid-template-columns: 1fr;
  }
  .feat-req-grid .frg-chev,
  .feat-req-grid .frg-header-mid {
    display: none;
  }
}

.btn-xs {
  padding: 0.25rem 0.55rem;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.dns-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.dns-help-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

.dns-status { font-size: 1rem; }

.dns-record code {
  background: var(--bg-input);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-secondary);
  word-break: break-all;
  border: 1px solid var(--border-color);
}

/* ---------- Alerts / Toasts ---------- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid var(--error); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); border: 1px solid var(--info); }

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  animation: slideIn 300ms ease-out;
  max-width: 400px;
}
.toast.alert-error   { background: #fde8e8; color: #991b1b; border: 1px solid #f87171; }
.toast.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #34d399; }
.toast.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fbbf24; }
.toast.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #60a5fa; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ---------- Slide-out Panel ---------- */
.slide-panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.3);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
}

.slide-panel-overlay.open {
  display: block;
}

.slide-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 500px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border-color);
  z-index: 201;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 300ms ease;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.08);
}

.slide-panel.open {
  transform: translateX(0);
}

/* ---------- Preview Panel (sits left of detail panel) ---------- */
.preview-panel {
  position: fixed;
  top: 0;
  right: 500px;
  width: 945px;
  max-width: calc(100vw - 520px);
  height: 100vh;
  background: var(--bg-primary);
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
  z-index: 202;
  overflow-y: auto;
  transform: translateX(120%);
  transition: transform 300ms ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.06);
  display: none;
  flex-direction: column;
}
.preview-panel.open {
  display: flex;
  transform: translateX(0);
}
.preview-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}
.preview-panel-header h2 {
  font-size: 1rem;
  font-weight: 600;
}
.preview-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.preview-source-wrapper {
  position: relative;
  min-height: 100%;
}
.preview-copy-btn {
  position: sticky;
  top: 0;
  float: right;
  margin: 0.75rem 0.75rem 0 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.72rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: #94a3b8;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 6px;
  cursor: pointer;
  z-index: 2;
  transition: all 0.15s;
  backdrop-filter: blur(4px);
}
.preview-copy-btn:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.18);
}
.preview-copy-btn.copied {
  color: #34d399;
  border-color: rgba(52,211,153,0.3);
  background: rgba(52,211,153,0.1);
}
.preview-copy-btn svg { display: block; }
.preview-source {
  margin: 0;
  padding: 1rem 1.25rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.6;
  background: #1e1e2e;
  color: #cdd6f4;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 100%;
}
.preview-email-header {
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
}
.preview-email-subject {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.35;
  margin-bottom: 0.35rem;
}
.preview-email-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.preview-email-from {
  color: var(--text-secondary);
  font-weight: 500;
}
.preview-email-to {
  color: var(--text-muted);
}
.preview-email-body {
  padding: 1.5rem;
  overflow: auto;
  background: #e8ecf0;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.preview-email-body .preview-email-inner {
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06), 0 0 0 1px rgba(0,0,0,0.03);
  padding: 2rem 1.75rem;
  max-width: 680px;
  margin: 0 auto;
  min-height: 200px;
  overflow: auto;
}

@media (max-width: 1100px) {
  .preview-panel {
    right: 0;
    width: 100%;
    max-width: 90vw;
    z-index: 203;
  }
}

.slide-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.slide-panel-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.slide-panel-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
}

.slide-panel-body {
  padding: 1.25rem;
}

/* ---------- Detail Panel Fields ---------- */
.detail-section {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
}
.detail-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.detail-field {
  margin-bottom: 0.65rem;
}
.detail-field:last-child {
  margin-bottom: 0;
}
.detail-label {
  display: block;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.15rem;
}
.detail-value {
  display: block;
  color: var(--text-primary);
  font-size: 0.88rem;
  word-break: break-word;
  line-height: 1.4;
}
.detail-value-strong {
  font-weight: 600;
}
.tier-select {
  font-family: var(--font-family);
  font-size: 0.82rem;
  padding: 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s;
}
.tier-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.15);
}
.detail-field-row {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 0.65rem;
}
.detail-field-row .detail-field {
  margin-bottom: 0;
}
.detail-mono {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  word-break: break-all;
  margin-bottom: 0.35rem;
}
.detail-body-preview {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
  max-height: 5.5rem;
  overflow: hidden;
  font-style: italic;
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-outline:hover {
  background: var(--bg-secondary);
  border-color: var(--primary);
  color: var(--primary);
}
.btn-violet {
  background: #7c3aed;
  border: 1px solid #7c3aed;
  color: #fff;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-violet:hover {
  background: #6d28d9;
  border-color: #6d28d9;
}
.btn-violet-outline {
  background: transparent;
  border: 1px solid #7c3aed;
  color: #7c3aed;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-violet-outline:hover {
  background: #f5f3ff;
  border-color: #6d28d9;
  color: #6d28d9;
}

/* ---------- Event Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline .timeline-item {
  position: relative;
  margin-bottom: 1rem;
  padding-left: 1rem;
  border-left: none;
}

.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.5rem;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-color);
  border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 2px var(--border-color);
}

.timeline-item.sent::before { background: var(--success); }
.timeline-item.failed::before { background: var(--error); }
.timeline-item.queued::before { background: var(--info); }
.timeline-item.sending::before { background: var(--info); }
.timeline-item.fallback_sent::before { background: var(--warning); }
.timeline-item.fallback_failed::before { background: var(--error); }
.timeline-item.fallback_attempt::before { background: var(--warning); }
.timeline-item.retrying::before { background: var(--warning); }
.timeline-item.tracking-open::before { background: #8b5cf6; }
.timeline-item.tracking-click::before { background: #0ea5e9; }

.tracking-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.35rem;
  cursor: default;
}
.tracking-icon svg {
  display: block;
}
.tracking-icon-open { color: #8b5cf6; }
.tracking-icon-click { color: #0ea5e9; }

/* ---------- Bounce Type Indicators ---------- */
.bounce-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.35rem;
  cursor: default;
}
.bounce-icon svg { display: block; }
.bounce-icon-soft { color: #d97706; }
.bounce-icon-hard { color: #dc2626; }
.bounce-icon-recovered { color: #9ca3af; }

/* ---------- Bouncer pre-check source icon (logs) ---------- */
.bouncer-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  cursor: default;
}
.bouncer-icon svg { display: block; }
.bouncer-icon-self { color: #0d9488; }      /* Huppmail ran the check */
.bouncer-icon-flagged { color: #7c3aed; }   /* sender pre-flagged it */

/* ---------- Bouncer source chip (detail view) ---------- */
.bouncer-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  margin-left: 0.5rem;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
.bouncer-chip svg { display: block; flex-shrink: 0; }
.bouncer-chip-self { background: rgba(13, 148, 136, 0.10); color: #0d9488; }
.bouncer-chip-flagged { background: rgba(124, 58, 237, 0.10); color: #7c3aed; }

.bounce-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  margin-left: 0.5rem;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
.bounce-chip svg { display: block; flex-shrink: 0; }
.bounce-chip-soft { background: rgba(217, 119, 6, 0.10); color: #b45309; }
.bounce-chip-hard { background: rgba(220, 38, 38, 0.10); color: #dc2626; }
.bounce-chip-recovered { background: rgba(34, 197, 94, 0.08); color: #16a34a; }

/* ---------- Email Type Icons (table rows) ---------- */
.td-email-type {
  width: 28px;
  padding-left: 0 !important;
  padding-right: 0 !important;
  text-align: center;
}
.email-type-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  cursor: default;
}
.email-type-icon svg { display: block; }
.email-type-transactional { color: #6366f1; }
.email-type-bulk { color: #f59e0b; }

/* ---------- Email Type Chips (detail view) ---------- */
.email-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  margin-left: 0.5rem;
  letter-spacing: 0.01em;
  vertical-align: middle;
}
.email-type-chip svg { display: block; flex-shrink: 0; }
.email-type-chip-transactional { background: rgba(99, 102, 241, 0.10); color: #6366f1; }
.email-type-chip-bulk { background: rgba(245, 158, 11, 0.10); color: #d97706; }
.email-type-chip-default { background: rgba(148, 163, 184, 0.10); color: #64748b; }

/* ---------- Bypass Icon column (table rows) ---------- */
.td-bypass-col { width: 28px; padding: 0 !important; }
.td-bypass-cell {
  width: 28px;
  padding: 0 !important;
  text-align: center;
  vertical-align: middle;
}
.bypass-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-right: 0;
  cursor: default;
  color: #0ea5e9;
}
.bypass-icon svg { display: block; }

/* ---------- Bypass Chip (detail view) ---------- */
.bypass-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 6px;
  margin-left: 0.5rem;
  letter-spacing: 0.01em;
  vertical-align: middle;
  background: rgba(14, 165, 233, 0.10);
  color: #0284c7;
}
.bypass-chip svg { display: block; flex-shrink: 0; }

/* ---------- Warmup Throttle Icon + Chip (logs) ---------- */
.warmup-throttle-icon { color: #f97316; }
.warmup-throttle-chip {
  background: rgba(249, 115, 22, 0.10);
  color: #ea580c;
}

/* ---------- Pool Exhausted Icon + Chip (logs) ---------- */
.pool-exhausted-icon { color: #eab308; }
.pool-exhausted-chip {
  background: rgba(234, 179, 8, 0.10);
  color: #ca8a04;
}

/* ---------- Fallback Icon + Chip (SMTP failed → SecondPath) ---------- */
.fallback-icon { color: #ef4444; }
.fallback-chip {
  background: rgba(239, 68, 68, 0.10);
  color: #dc2626;
}

/* ---------- Remediation Card (email detail + alert detail) ---------- */
.remediation-card {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.04) 0%, rgba(234, 179, 8, 0.04) 100%);
  border: 1px solid rgba(239, 68, 68, 0.20);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin: 1rem 0;
}
.remediation-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}
.remediation-header-left {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
}
.remediation-icon {
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 0.125rem;
}
.remediation-title {
  font-weight: 650;
  font-size: 0.9375rem;
  color: var(--text-primary);
  line-height: 1.3;
}
.remediation-subtitle {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.45;
}
.remediation-steps {
  list-style: none;
  counter-reset: rem-step;
  padding: 0;
  margin: 0.75rem 0 0;
}
.remediation-step {
  counter-increment: rem-step;
  position: relative;
  padding: 0.5rem 0 0.5rem 2.25rem;
  border-bottom: 1px solid rgba(239, 68, 68, 0.08);
}
.remediation-step:last-child {
  border-bottom: none;
}
.remediation-step::before {
  content: counter(rem-step);
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: rgba(239, 68, 68, 0.10);
  color: #ef4444;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.remediation-step-label {
  font-size: 0.8125rem;
  color: var(--text-primary);
  line-height: 1.5;
}
.remediation-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
  margin-left: 0.25rem;
}
.remediation-link:hover {
  text-decoration: underline;
}
.remediation-prefill {
  margin-top: 0.375rem;
}
.remediation-prefill-value {
  display: inline-block;
  background: var(--bg-tertiary, #f3f4f6);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.25rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-primary);
  cursor: pointer;
  user-select: all;
  transition: background 0.15s, border-color 0.15s;
  max-width: 100%;
  word-break: break-all;
}
.remediation-prefill-value:hover {
  background: rgba(99, 102, 241, 0.08);
  border-color: var(--accent);
}
.remediation-prefill-value.copied {
  background: rgba(34, 197, 94, 0.12);
  border-color: #22c55e;
}
.remediation-step-detail {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 0.25rem;
  line-height: 1.4;
}
.remediation-footer {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(239, 68, 68, 0.12);
}
.remediation-postmaster-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  text-decoration: none;
  transition: color 0.15s;
}
.remediation-postmaster-link:hover {
  color: var(--accent);
}

/* ---------- Remediation in Dashboard Alert Cards (legacy — kept for alert-detail page) ---------- */
.domain-alert-remediation {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed rgba(239, 68, 68, 0.15);
}
.remediation-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ef4444;
  background: rgba(239, 68, 68, 0.08);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius);
}
.remediation-ip-badge {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  background: var(--bg-tertiary, #f3f4f6);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
}

/* ---------- Feature-Requirement Grid: Sub-feature row ---------- */
.frg-feat.frg-feat-sub {
  padding-left: 2.75rem;
  border-top: 1px dashed var(--border-color);
}
.frg-chev.frg-chev-sub {
  border-top: 1px dashed var(--border-color);
}
.frg-reqs.frg-reqs-sub {
  border-top: 1px dashed var(--border-color);
}
.frg-no-req.frg-no-req-muted {
  color: #64748b;
  opacity: 1;
}

.timeline-event {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.timeline-details {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.125rem;
}

.timeline-fail-details {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1.55;
  color: #dc2626;
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: 6px;
  padding: 0.5rem 0.625rem;
  margin-top: 0.375rem;
  word-break: break-word;
  white-space: pre-wrap;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

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

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-color);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
  display: inline-block;
}

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

.loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  gap: 0.75rem;
  color: var(--text-secondary);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .activity-section {
    grid-template-columns: 1fr;
  }
  .chart-card-full canvas {
    height: 260px !important;
  }
  .chart-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .response-cols {
    grid-template-columns: 1fr;
  }
}

/* ---------- Mobile Menu Button (inline in page-header) ---------- */
.mobile-menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--transition);
}
.mobile-menu-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- Sidebar Close Button (mobile only) ---------- */
.sidebar-close-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.sidebar-close-btn:hover {
  background: var(--error-bg);
  color: var(--error);
  border-color: var(--error);
}

/* ---------- Sidebar Overlay (mobile) ---------- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99;
  opacity: 0;
  pointer-events: none;
  transition: opacity 300ms ease;
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 300ms ease;
    width: var(--sidebar-width);
  }
  .sidebar.collapsed {
    width: var(--sidebar-width);
  }
  .sidebar.collapsed .sidebar-logo { justify-content: flex-start; padding: 1.375rem 1.25rem; position: static; }
  .sidebar.collapsed .sidebar-logo .logo-icon img { width: 55px; height: 55px; }
  .sidebar.collapsed .sidebar-logo .logo-text { opacity: 1; width: auto; overflow: visible; position: static; }
  .sidebar.collapsed .sidebar-toggle { display: flex; }
  .sidebar.collapsed .sidebar-nav a { justify-content: flex-start; padding: 0.625rem 1.5rem; }
  .sidebar.collapsed .sidebar-nav a .nav-label { opacity: 1; width: auto; overflow: visible; position: static; }
  .sidebar.collapsed .nav-section-label { font-size: 0.65rem; padding: 0.5rem 1.5rem 0.25rem; height: auto; }
  .sidebar.collapsed .sidebar-footer { padding: 1rem 1.5rem; text-align: left; }
  .sidebar.collapsed .sidebar-footer .nav-label { display: inline; }
  .sidebar.collapsed .sidebar-footer .logout-btn .logout-label { display: inline; }
  .sidebar.collapsed .sidebar-footer .logout-btn { padding: 0.35rem 0.75rem; }
  .sidebar.collapsed .sidebar-footer .user-info { justify-content: space-between; }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar.collapsed + .main-content {
    margin-left: 0;
  }
  .main-content {
    margin-left: 0;
  }
  .page-header {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .page-header .mobile-menu-btn {
    margin-top: 2px;
  }
  .page-header-content {
    flex: 1;
    min-width: 0;
  }
  .page-body {
    padding: 1rem;
  }
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Mobile hamburger button — show inline in page-header */
  .mobile-menu-btn {
    display: flex;
  }

  /* Sidebar close button — show inside sidebar */
  .sidebar-close-btn {
    display: flex;
  }

  /* Sidebar overlay */
  .sidebar-overlay {
    display: block;
  }
  .sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Hide desktop sidebar-toggle on mobile */
  .sidebar-toggle {
    display: none;
  }
}

/* ---------- Integration Page ---------- */
.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);

/* -- API Key create bar -- */
}
.apikey-create {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.apikey-name-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  background: var(--bg-input);
  color: var(--text-primary);
  font-family: var(--font-family);
  transition: border-color var(--transition);
}
.apikey-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.apikey-name-input::placeholder {
  color: var(--text-muted);
}

/* -- New key banner -- */
.apikey-new-key {
  background: var(--success-bg);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}
.apikey-new-key-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #059669;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}
.apikey-new-key-value {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}
.apikey-new-key-value code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  flex: 1;
  line-height: 1.5;
}
.apikey-new-key-warning {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* -- Key list -- */
.apikey-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.apikey-list-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.apikey-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
  background: var(--bg-input);
  transition: opacity 0.2s, transform 0.2s;
}
.apikey-row:last-child {
  margin-bottom: 0;
}
.apikey-row-info {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
  flex: 1;
}
.apikey-row-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apikey-row-prefix {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  white-space: nowrap;
}
.apikey-row-meta {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.apikey-row-dot {
  color: var(--border-color);
}
.apikey-revoke-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}
.apikey-revoke-btn:hover {
  background: var(--error-bg);
  border-color: var(--error);
  color: var(--error);
}

.integration-card h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Expandable integration cards (details/summary) */
details.integration-expandable > summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-right: 2rem;
}
details.integration-expandable > summary::-webkit-details-marker { display: none; }
details.integration-expandable > summary::after {
  content: "\25B6";
  position: absolute;
  right: 0;
  top: 0.1rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
details[open].integration-expandable > summary::after {
  transform: rotate(90deg);
}
details.integration-expandable > summary h3 {
  margin-bottom: 0;
}

/* Credential rows */
.cred-grid {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.cred-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.cred-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  width: 100px;
  flex-shrink: 0;
}

.cred-value-wrap {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  flex: 1;
  min-width: 0;
}

.cred-value {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.375rem 0.625rem;
  font-family: var(--font-mono);
  font-size: 0.825rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.cred-value.masked {
  color: var(--text-muted);
}

.copy-btn {
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--text-secondary);
  transition: all var(--transition);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.copy-btn svg {
  display: block;
}

.copy-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* Code blocks */
.code-block-wrap {
  position: relative;
}

.code-block-wrap .code-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  opacity: 0;
  transition: opacity var(--transition);
}

.code-block-wrap:hover .code-copy {
  opacity: 1;
}

.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.65;
  color: var(--text-primary);
  overflow-x: auto;
  white-space: pre;
  margin: 0;
}

.code-block.mini {
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  margin-top: 0.375rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0;
}

.tab {
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: var(--font-family);
  font-size: 0.825rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text-primary);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.hidden {
  display: none !important;
}

/* Response columns */
.response-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ---------- API Reference Table ---------- */
/* ---------- API Fields (compact reference list) ---------- */
.api-fields {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.api-field {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text-secondary);
}
.api-field:last-child {
  border-bottom: none;
}
.api-field code {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.05rem 0.3rem;
}
.api-field-name {
  font-weight: 700;
  color: var(--text-primary);
  background: none !important;
  border: none !important;
  padding: 0 !important;
  font-size: 0.84rem;
}
.api-field-type {
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
  margin-right: 0.15rem;
}
.api-req {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-light);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 0.15rem;
}
.api-req-half {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  color: #d97706;
  background: rgba(245, 158, 11, 0.1);
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 0.15rem;
}
.api-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ---------- Quick Start Builder Controls ---------- */
/* ── Builder v3: compact side-by-side layout ── */
.builder-split {
  display: flex;
  gap: 0.75rem;
  align-items: stretch;
}
.builder-panel {
  flex: 0 0 33%;
  max-width: 33%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0;
  overflow: visible;
}
.builder-code-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.builder-code-col .code-block-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.builder-code-col .code-block {
  flex: 1;
  max-height: none;
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.45;
}

/* ── Code flash highlight for changed lines ── */

/* Additions: instant highlight, slow 4s fade-out */
@keyframes codeFlashAdd {
  0%   { background: rgba(99,102,241,0.26); }
  100% { background: transparent; }
}
.code-flash {
  display: inline-block;
  width: 100%;
  border-radius: 3px;
  animation: codeFlashAdd 4.2s ease-out forwards;
}

/* Removals: slow red highlight fade-in, hold, then fast text+highlight fade-out + collapse */
@keyframes codeFlashRemove {
  0%   { background: transparent; opacity: 1; line-height: 1.45; max-height: 1.6em; }
  50%  { background: rgba(239,68,68,0.20); opacity: 1; line-height: 1.45; max-height: 1.6em; }
  80%  { background: rgba(239,68,68,0.20); opacity: 1; line-height: 1.45; max-height: 1.6em; }
  95%  { background: transparent; opacity: 0; line-height: 0; max-height: 0; }
  100% { background: transparent; opacity: 0; line-height: 0; max-height: 0; }
}
.code-flash-remove {
  display: block;
  width: 100%;
  border-radius: 3px;
  text-decoration: line-through;
  text-decoration-color: rgba(239,68,68,0.35);
  overflow: hidden;
  animation: codeFlashRemove 2.8s ease-in-out forwards;
}
@media (max-width: 860px) {
  .builder-split { flex-direction: column; }
  .builder-panel { flex: none; max-width: none; }
}
.builder-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  transition: background 0.12s ease;
}
.builder-row:hover {
  background: rgba(99,102,241,0.03);
}
.builder-row-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}
.builder-row-controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.2rem;
  flex-shrink: 0;
}
.builder-sep {
  height: 1px;
  background: var(--border-color);
  margin: 0.1rem 0.75rem;
}

/* Pill radio buttons */
.builder-pill {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}
.builder-pill input { position: absolute; opacity: 0; pointer-events: none; }
.builder-pill span {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 500;
  border-radius: 100px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  line-height: 1.4;
  white-space: nowrap;
}
.builder-pill:hover span {
  border-color: var(--accent);
  color: var(--accent);
}
.builder-pill input:checked + span {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99,102,241,0.25);
}
.builder-pill input:focus-visible + span {
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* Tooltip bubble (?) */
.builder-tt {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 700;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
}
.builder-tt:hover {
  background: var(--accent);
  color: #fff;
}
.builder-tt::after {
  content: attr(data-tip);
  position: absolute;
  right: -8px;
  left: auto;
  bottom: calc(100% + 8px);
  transform: none;
  width: max-content;
  max-width: min(480px, 60vw);
  min-width: 200px;
  padding: 0.625rem 0.75rem;
  border-radius: 8px;
  background: #fff;
  color: #334155;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.55;
  letter-spacing: -0.01em;
  white-space: normal;
  word-wrap: break-word;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13), 0 0 0 1px rgba(0,0,0,0.06);
  text-transform: none;
}
.builder-tt::before {
  content: "";
  position: absolute;
  right: 2px;
  left: auto;
  bottom: calc(100% + 2px);
  transform: none;
  border: 5px solid transparent;
  border-top-color: #fff;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 10000;
}
.builder-tt:hover::after,
.builder-tt:hover::before {
  opacity: 1;
}
.builder-tt:hover::after {
  opacity: 1;
}

/* Type hint inline message */
.builder-type-hint {
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.45;
  padding: 0.35rem 0.75rem;
  margin: 0.1rem 0.75rem 0.25rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 0;
  transition: all 0.18s ease;
}
.builder-type-hint:empty {
  padding: 0;
  margin: 0;
}
.builder-type-hint.hint-tx {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.builder-type-hint.hint-bulk {
  background: var(--accent-light);
  color: var(--accent);
}

/* Active-options counter badge */
.builder-counter {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  background: var(--bg-input);
  color: var(--text-muted);
  margin-left: 0.5rem;
  vertical-align: middle;
  transition: all 0.25s ease;
}
.builder-counter.counter-active {
  background: var(--accent-light);
  color: var(--accent);
}

/* ── Rate Limits & Quotas card ── */
.limits-card h3 svg {
  color: var(--warning-color, #f59e0b);
}
.limits-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.625rem;
}
@media (max-width: 900px) {
  .limits-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .limits-grid { grid-template-columns: 1fr; }
}
.limits-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  border: 1px solid transparent;
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.limits-item:hover {
  border-color: var(--border-color);
}
.limits-item.limits-highlight {
  border-color: var(--border-color);
  background: var(--bg-card);
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.limits-icon {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent-light);
  color: var(--accent);
  margin-top: 1px;
}
.limits-highlight .limits-icon {
  background: rgba(245,158,11,0.10);
  color: #f59e0b;
}
.limits-body {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.limits-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.limits-highlight .limits-value {
  color: #f59e0b;
}
.limits-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.limits-detail {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.15rem;
}

/* ---------- DNS Setup Guide ---------- */
.dns-guide-record {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.dns-guide-record h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0.25rem 0 0.5rem;
  color: var(--text-primary);
}

.dns-guide-step {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}

.dns-guide-why {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.55;
  margin: 0 0 1rem;
}

.dns-guide-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.dns-field-row {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
}

.dns-field-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.dns-field-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.dns-field-value {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.dns-field-code {
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 0.4rem 0.6rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.75rem;
  line-height: 1.5;
  word-break: break-all;
  flex: 1;
  color: var(--text-primary);
}

.dns-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  padding: 0.3rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
  line-height: 1;
}

.dns-copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
}
.dns-copy-btn.copied {
  border-color: #10b981;
  color: #059669;
  background: rgba(16,185,129,0.08);
}

.dns-field-explain {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.dns-field-explain strong {
  color: var(--text-secondary);
}

.dns-field-explain code {
  background: var(--bg-hover);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}

.dns-guide-note {
  margin-top: 0.75rem;
  background: #eff6ff;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.dns-guide-note code {
  background: rgba(0,0,0,0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ── SPF Builder ── */
.spf-builder {
  margin: 1.25rem 0 0.75rem;
  padding: 1.25rem;
  background: var(--bg-hover);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.spf-builder-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
  align-self: flex-start;
}
.spf-builder-hint {
  font-size: 0.76rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.4;
  align-self: flex-start;
}
.spf-mech-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: opacity 0.2s, background 0.2s;
  width: fit-content;
  min-width: 25%;
  max-width: 80%;
}
.spf-mech-row.spf-mech-mandatory {
  background: #f8f9fa;
  border-color: #d1d5db;
}
.spf-mech-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0.1rem 0 0 0;
  line-height: 1.3;
  text-align: center;
}
.spf-mech-row.spf-mech-disabled {
  opacity: 0.4;
  background: var(--bg-hover);
}
.spf-mech-row.spf-mech-disabled code {
  text-decoration: line-through;
}
.spf-mech-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  cursor: pointer;
  flex: 1;
  min-width: 0;
}
.spf-mech-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.spf-mech-label code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spf-mech-tag {
  font-size: 0.68rem;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}
.spf-mech-locked {
  background: #e5e7eb;
  color: #4b5563;
  font-weight: 600;
}
.spf-mech-existing {
  background: #e0e7ff;
  color: #3730a3;
}
.spf-connector {
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.15rem 0;
  line-height: 1;
}
.spf-arrow {
  font-size: 1.1rem;
  color: var(--accent);
  padding: 0.3rem 0 0.2rem;
}

.spf-result {
  background: var(--bg-card);
  border: 2px solid var(--accent);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  position: relative;
  width: 100%;
  align-self: stretch;
}
.spf-result-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.35rem;
}
.spf-result-code {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-primary);
  word-break: break-all;
  padding-right: 3.5rem;
}
.spf-copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

/* ---------- SecondPath Status Tables ---------- */
.mg-status-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-top: 0.75rem;
}
.mg-status-table td {
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.mg-status-table tr:last-child td {
  border-bottom: none;
}
.mg-status-icon {
  width: 1.5rem;
  text-align: center;
  font-size: 0.9rem;
}
.mg-status-detail {
  color: var(--text-muted);
  text-align: right;
}
.mg-records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  margin-top: 0.5rem;
}
.mg-records-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem;
  border-bottom: 2px solid var(--border-color);
}
.mg-records-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}
.mg-records-table tr:last-child td {
  border-bottom: none;
}
.mg-rec-name code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  background: var(--bg-hover);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  word-break: break-all;
}
.mg-rec-valid {
  color: #10b981;
  font-weight: 600;
}
.mg-rec-pending {
  color: #f59e0b;
  font-weight: 600;
}

/* ---------- Tracking Section ---------- */
.tracking-status-line {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 600;
  margin: 0.25rem 0 0;
}

.tracking-body {
  padding: 0.75rem 0 0.25rem;
}

.tracking-group {
  margin-bottom: 1rem;
}

.tracking-group h4 {
  font-size: 0.84rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
}

.tracking-group h5 {
  font-size: 0.82rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
  color: var(--text-primary);
}

.field-hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.tracking-explainer {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin: 0.2rem 0 0.15rem;
  line-height: 1.4;
  font-style: italic;
}

.tracking-custom-box {
  background: var(--bg-hover);
  border-radius: 8px;
  padding: 0.85rem;
  margin-top: 0.35rem;
}

.tracking-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.65rem;
  line-height: 1.4;
}

.tracking-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.tracking-field {
  margin-bottom: 0.25rem;
}

.tracking-field > label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.2rem;
  color: var(--text-secondary);
}

.tracking-field select,
.tracking-field input[type="text"] {
  width: 100%;
  max-width: 100%;
  padding: 0.45rem 0.65rem;
  font-size: 0.82rem;
}

.tracking-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0.35rem 0;
}
.tracking-checkbox-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.tracking-field-inline {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.tracking-field-inline label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 500;
}

.tracking-field-inline input[type="checkbox"] {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.tracking-note {
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  font-size: 0.78rem;
  line-height: 1.6;
  margin-top: 0.5rem;
  color: var(--text-secondary);
}

.tracking-note code {
  background: rgba(0,0,0,0.06);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
}

/* ── Tracking subdomain verification ── */
.tracking-subdomain-status {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.75rem 0 0.5rem;
  flex-wrap: wrap;
}
.tracking-subdomain-status .dns-chip {
  font-size: 0.8rem;
  padding: 0.3rem 0.7rem;
}
.tracking-verify-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.5rem 0;
}
.tracking-verify-status {
  font-size: 0.8rem;
  font-weight: 600;
}
.tracking-verify-status.verified { color: var(--success); }
.tracking-verify-status.unverified { color: var(--error); }
.tracking-verify-status.pending { color: var(--warning); }

.tracking-verify-checks {
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 0.6rem 0.85rem;
  margin: 0.4rem 0 0.6rem;
  font-size: 0.8rem;
}
.verify-check {
  padding: 0.15rem 0;
}
.verify-errors {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-color);
}
.verify-error {
  font-size: 0.78rem;
  color: var(--error);
  padding: 0.1rem 0;
}

/* ---------- Custom Tooltip ---------- */
.custom-tooltip {
  position: fixed;
  z-index: 10000;
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
  background: #1e293b;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s;
  white-space: nowrap;
}
.custom-tooltip-rich {
  white-space: normal;
  max-width: 420px;
  line-height: 1.5;
}
.custom-tooltip-rich .subject-tip-preview {
  display: block;
  margin-top: 0.3rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-weight: 400;
  font-size: 0.72rem;
  color: rgba(255,255,255,0.7);
}
.custom-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Admin Users ---------- */
.users-toolbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.users-search-wrap {
  position: relative;
  flex: 1;
  max-width: 360px;
}
.users-search-wrap svg {
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.users-search-wrap .form-control {
  padding-left: 2.2rem;
}
.users-count {
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Users table */
.users-table-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.users-table {
  width: 100%;
  border-collapse: collapse;
}
.users-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-input);
  user-select: none;
  white-space: nowrap;
}
.users-table thead th.ut-sortable {
  cursor: pointer;
}
.users-table thead th.ut-sortable:hover {
  color: var(--text-primary);
}
.sort-icon {
  vertical-align: middle;
  margin-left: 0.2rem;
  opacity: 0.7;
}
.sort-icon.sort-none {
  opacity: 0.3;
}
.ut-row {
  cursor: pointer;
  transition: background var(--transition);
}
.ut-row:hover {
  background: var(--bg-hover);
}
.ut-row td {
  padding: 0.625rem 1rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.ut-row:last-child td {
  border-bottom: none;
}
.ut-email {
  font-weight: 600;
}
.ut-name {
  color: var(--text-secondary);
}
.ut-num {
  text-align: right !important;
  font-variant-numeric: tabular-nums;
}
.ut-date {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Right chevron column */
.ut-chevron-col {
  width: 2rem;
}
.ut-chevron-cell {
  width: 2rem;
  text-align: center;
  color: var(--text-muted);
  padding: 0 0.25rem !important;
}
.ut-row:hover .ut-chevron-cell {
  color: var(--text-primary);
}

/* Affinity cell in users table */
.affinity-cell {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  cursor: help;
}
.affinity-cell-score {
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
}
.affinity-cell-conf {
  font-size: 0.65rem;
  line-height: 1;
}

/* Info icon in group header */
.ut-info-icon {
  vertical-align: middle;
  margin-left: 0.2rem;
  opacity: 0.5;
}
.ut-group-has-info {
  cursor: help;
}
.ut-group-has-info:hover .ut-info-icon {
  opacity: 1;
}

/* Detail panel hint text */
.detail-section-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin: -0.25rem 0 0.75rem 0;
}

/* Reputation score colours */
.rep-good { color: #16a34a; }
.rep-warn { color: #d97706; }
.rep-poor { color: #dc2626; }
.rep-na   { color: var(--text-muted); font-size: 0.85rem; }

/* Confidence level colours */
.conf-high { color: #16a34a; font-weight: 600; }
.conf-mid  { color: #d97706; }
.conf-low  { color: var(--text-muted); }

/* IP Affinity block in user detail panel */
.affinity-type-block {
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg-secondary, #f8f9fa);
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}
.affinity-type-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.affinity-metrics {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.affinity-metric {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.affinity-metric-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.affinity-metric-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.affinity-bar-wrap {
  margin-top: 0.25rem;
}
.affinity-bar-bg {
  position: relative;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: visible;
}
.affinity-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease;
}
.affinity-bar-fill.conf-high { background: #16a34a; }
.affinity-bar-fill.conf-mid  { background: #d97706; }
.affinity-bar-fill.conf-low  { background: #d1d5db; }
.affinity-bar-neutral {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 12px;
  background: var(--text-muted);
  border-radius: 1px;
  z-index: 1;
}
.affinity-bar-meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* Users table group header row */
.ut-group-row th {
  padding: 8px 1rem 0.15rem 1rem !important;
  border-bottom: none !important;
  font-size: 0;
  line-height: 0;
}
.ut-group-label {
  font-size: 0.65rem !important;
  line-height: 1 !important;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
  text-align: center !important;
  border-bottom: 2px solid var(--border) !important;
  padding: 0 1.5rem 0.15rem 1.5rem !important;
}

.badge-admin {
  background: #ede9fe;
  color: #7c3aed;
}
.badge-ip-dedicated {
  background: rgba(139,92,246,0.10);
  color: #8b5cf6;
  font-weight: 700;
}

.btn-impersonate {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: #ecfccb;
  color: #3f6212;
  border: 1px solid #bef264;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-impersonate:hover {
  background: #d9f99d;
  border-color: #a3e635;
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-danger-outline:hover {
  background: #fee2e2;
  border-color: #f87171;
}

/* ---------- Impersonation Sidebar Section ---------- */
.nav-section-label-impersonate {
  color: #3f6212 !important;
  background: #f7fee7;
  margin: 0.5rem 0.75rem 0;
  padding: 0.5rem 0.75rem 0.25rem !important;
  border-radius: 6px 6px 0 0;
  border-top: 2px solid #bef264;
}
a.nav-link-impersonate {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 1.5rem;
  margin: 0 0.75rem;
  background: #f7fee7;
  color: #4d7c0f;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition);
  border-left: 3px solid transparent;
  white-space: nowrap;
  overflow: hidden;
  text-decoration: none;
}
a.nav-link-impersonate:last-of-type {
  border-radius: 0 0 6px 6px;
}
a.nav-link-impersonate:hover {
  background: #ecfccb;
  color: #3f6212;
}
a.nav-link-impersonate.active {
  background: #ecfccb;
  color: #3f6212;
  border-left-color: #65a30d;
  font-weight: 600;
}
a.nav-link-impersonate .nav-icon {
  width: 20px;
  min-width: 20px;
  text-align: center;
  font-size: 0.9rem;
}
.btn-stop-impersonate {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0 0.75rem 0.25rem;
  padding: 0.4rem;
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 0 0 6px 6px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  width: calc(100% - 1.5rem);
}
.btn-stop-impersonate:hover {
  background: #fee2e2;
  border-color: #f87171;
}

/* ═══════════ REPUTATION PAGE ═══════════ */
.rep-score-row {
  display: flex;
  align-items: stretch;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.rep-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  min-width: 140px;
  text-align: center;
  border: 2px solid var(--border-color);
  transition: border-color var(--transition);
}
.rep-score-card.score-excellent { border-color: #10b981; }
.rep-score-card.score-good { border-color: #6366f1; }
.rep-score-card.score-fair { border-color: #f59e0b; }
.rep-score-card.score-poor { border-color: #f87171; }

.rep-score-ring-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 0.5rem;
}
.rep-score-ring-wrap canvas {
  display: block;
}
.rep-score-number {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}
.rep-score-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 600;
  margin-top: 0.15rem;
}

.rep-stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  flex: 1;
}
.rep-stat-cards .stat-card {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
}
.rep-stat-cards .stat-card.success .stat-value { color: #10b981; }
.rep-stat-cards .stat-card.warning .stat-value { color: #f59e0b; }
.rep-stat-cards .stat-card.error .stat-value { color: #f87171; }

.rep-stat-cards .stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
.rep-stat-cards .stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
}
.rep-stat-cards .stat-sub {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.rep-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.rep-actions .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}
.rep-actions .btn.checking {
  opacity: 0.7;
  pointer-events: none;
}
.rep-days-select {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 0.85rem;
  color: var(--text-primary);
  cursor: pointer;
}
.rep-last-check {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.rep-bl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.rep-bl-header h3 { margin: 0; }
.rep-bl-header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.rep-ip-badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 0.78rem;
  font-family: monospace;
  color: var(--text-secondary);
}

/* Multi-IP blacklist — compact one-liner rows */
.rep-ip-row {
  padding: 0.65rem 0;
  border-bottom: 1px solid #f1f5f9;
}
.rep-ip-row:last-child { border-bottom: none; }
.rep-ip-row-listed { background: #fef2f2; border-radius: 8px; padding: 0.65rem 0.75rem; margin-bottom: 0.25rem; }

/* Blacklist IP row loading shimmer */
.rep-ip-row-loading {
  position: relative;
  overflow: hidden;
}
.rep-ip-row-loading > * {
  opacity: 0.18;
  transition: opacity 0.3s ease;
}
.rep-ip-row-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: repRowShimmer 1.4s ease-in-out infinite;
}
@keyframes repRowShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Blacklist IP row reveal animation */
.rep-ip-row-reveal {
  animation: repRowReveal 0.35s ease-out;
}
@keyframes repRowReveal {
  0% { opacity: 0.25; transform: translateY(4px); }
  60% { transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(0); }
}

.rep-ip-row-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}
.rep-ip-row-addr {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
}
.rep-ip-row-meta {
  font-size: 0.7rem;
  color: var(--text-tertiary);
  margin-left: auto;
}
.rep-ip-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.12rem 0.5rem;
  border-radius: 20px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.rep-ip-status-clean {
  background: #ecfdf5;
  color: #059669;
}
.rep-ip-status-listed {
  background: #fee2e2;
  color: #991b1b;
}

.rep-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.rep-chart-wrap {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.rep-chart-wrap h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}
.rep-chart-container {
  height: 260px;
  position: relative;
}

.rep-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.rep-section h3 {
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: var(--text-primary);
}

/* Blacklist compact pills */
.rep-bl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.rep-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 500;
  cursor: default;
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
  white-space: nowrap;
}
.rep-pill-clean {
  background: #ecfdf5;
  color: #059669;
}
.rep-pill-listed {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}
.rep-pill-timeout {
  background: #fffbeb;
  color: #b45309;
}
.rep-pill-error {
  background: #fff1f2;
  color: #e11d48;
}

/* Shimmer loading animation */
.rep-pill-loading {
  color: transparent !important;
  position: relative;
  overflow: hidden;
  background: #f1f5f9;
}
.rep-pill-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.6) 50%, transparent 100%);
  animation: repPillShimmer 1.4s ease-in-out infinite;
}
@keyframes repPillShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Staggered reveal pop */
.rep-pill-reveal {
  animation: repPillPop 0.3s ease-out;
}
@keyframes repPillPop {
  0% { opacity: 0.3; transform: scale(0.92); }
  60% { transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}

.rep-ip-status-timeout {
  background: #fef3c7;
  color: #92400e;
}
.rep-ip-status-error {
  background: #ffe4e6;
  color: #9f1239;
}

/* Pool status badges */
.rep-ip-pool-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.rep-ip-pool-active { background: #ecfdf5; color: #059669; }
.rep-ip-pool-warming { background: #fffbeb; color: #b45309; }
.rep-ip-pool-disabled { background: #f1f5f9; color: #94a3b8; }
.rep-ip-pool-unassigned { background: #f8fafc; color: #cbd5e1; }

/* Debug log button */
.rep-debug-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.rep-debug-btn:hover {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-color: #94a3b8;
}

/* Debug log panel */
.rep-debug-panel {
  margin: 0.75rem 0;
  padding: 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  overflow-x: auto;
}
.rep-debug-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  font-family: 'SF Mono', 'Fira Code', monospace;
}
.rep-debug-table {
  width: 100%;
  font-size: 0.72rem;
  border-collapse: collapse;
}
.rep-debug-table th {
  text-align: left;
  padding: 0.4rem 0.6rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  white-space: nowrap;
}
.rep-debug-table td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
  color: var(--text-primary);
}
.rep-debug-table code {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 0.68rem;
  background: #e2e8f0;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.rep-debug-query {
  word-break: break-all;
}
.rep-debug-zone {
  font-size: 0.66rem;
  color: var(--text-tertiary);
  font-family: monospace;
}
.rep-debug-nxdomain {
  color: #16a34a;
  font-size: 0.68rem;
}
.rep-debug-listed {
  color: #dc2626;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.rep-debug-error {
  color: #e11d48;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.rep-debug-timeout {
  color: #b45309;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.rep-debug-row-listed td { background: #fef2f2; }
.rep-debug-row-error td { background: #fff1f2; }
.rep-debug-row-timeout td { background: #fffbeb; }
.rep-bl-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Data tables */
.rep-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
.rep-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.rep-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
}
th.rep-sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.35rem;
  transition: color 0.15s;
}
th.rep-sortable:hover {
  color: var(--text-primary);
}
th.rep-sortable::after {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-bottom-color: var(--text-muted);
  opacity: 0.3;
  margin-top: -3px;
}
th.rep-sortable::before {
  content: "";
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: 4px solid transparent;
  border-top-color: var(--text-muted);
  opacity: 0.3;
  margin-top: 3px;
}
th.rep-sortable.sort-asc::after {
  border-bottom-color: var(--accent);
  opacity: 1;
}
th.rep-sortable.sort-asc::before {
  opacity: 0.15;
}
th.rep-sortable.sort-desc::before {
  border-top-color: var(--accent);
  opacity: 1;
}
th.rep-sortable.sort-desc::after {
  opacity: 0.15;
}
.rep-table td {
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}
.rep-table tr:last-child td {
  border-bottom: none;
}
.rep-table td code {
  padding: 0.15rem 0.4rem;
  background: #f1f5f9;
  border-radius: 4px;
  font-size: 0.8rem;
}
.rep-fail-high {
  color: #dc2626 !important;
  font-weight: 700;
}
.rep-fail-med {
  color: #f59e0b !important;
  font-weight: 600;
}
.rep-rate-good { color: #059669 !important; font-weight: 600; }
.rep-rate-warn { color: #d97706 !important; font-weight: 600; }
.rep-rate-bad  { color: #dc2626 !important; font-weight: 700; }
.rep-error-msg {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.78rem;
}
.rep-empty {
  text-align: center;
  color: var(--text-secondary);
  padding: 1.5rem !important;
}

@media (max-width: 900px) {
  .rep-score-row { flex-direction: column; }
  .rep-charts-grid { grid-template-columns: 1fr; }
  .rep-two-col { grid-template-columns: 1fr; }
  .rep-bl-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ═══════════ WEBHOOKS PAGE ═══════════ */

/* Stats Bar */
.wh-stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.wh-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.75rem;
  min-width: 120px;
}
.wh-stat-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
}
.wh-stat-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-secondary);
  margin-top: 0.15rem;
}

/* Action Bar */
.wh-action-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.wh-view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
  margin-left: auto;
}
.wh-view-btn {
  padding: 0.45rem 1rem;
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.wh-view-btn.active {
  background: var(--accent);
  color: #fff;
}
.wh-view-btn:hover:not(.active) {
  background: var(--bg-page);
}

/* Webhook Card List */
.wh-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.wh-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  transition: all var(--transition);
  border-left: 4px solid #10b981;
}
.wh-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.wh-card.wh-inactive {
  border-left-color: var(--border-color);
  opacity: 0.7;
}
.wh-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}
.wh-card-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}
.wh-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wh-dot-active { background: #10b981; }
.wh-dot-inactive { background: #cbd5e1; }
.wh-card-name {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wh-failure-warn {
  font-size: 0.72rem;
  color: #f59e0b;
  font-weight: 600;
  white-space: nowrap;
}
.wh-card-actions {
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}
.wh-icon-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition);
}
.wh-icon-btn:hover { background: var(--bg-page); }
.wh-icon-btn.wh-icon-danger:hover { background: #fef2f2; }
.wh-card-url {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.5rem;
}
.wh-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.wh-meta-sep { color: var(--border-color); }

/* HTTP Status Badges */
.wh-http-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.wh-http-ok { background: #ecfdf5; color: #059669; }
.wh-http-err { background: #fef2f2; color: #dc2626; }

/* Empty State */
.wh-empty {
  text-align: center;
  padding: 3rem 1rem;
}
.wh-empty-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}
.wh-empty h3 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: var(--text-primary);
}
.wh-empty p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin: 0 0 1.25rem;
}

/* Activity table */
.wh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}
.wh-table th {
  text-align: left;
  padding: 0.6rem 0.75rem;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
}
.wh-table td {
  padding: 0.55rem 0.75rem;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}
.wh-table tr:last-child td { border-bottom: none; }
.wh-table-empty {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-secondary);
}
.wh-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  overflow-x: auto;
}
.wh-event-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Detail Slide-Over Panel */
.wh-detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.25);
  z-index: 900;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.wh-detail-overlay.open { opacity: 1; pointer-events: auto; }
.wh-detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 520px;
  max-width: 90vw;
  height: 100vh;
  background: var(--bg-page);
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
  z-index: 901;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.wh-detail-panel.open { transform: translateX(0); }
.wh-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}
.wh-detail-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.wh-detail-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  line-height: 1;
}
.wh-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}
.wh-detail-section {
  margin-bottom: 1.5rem;
}
.wh-detail-section h4 {
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
}
.wh-detail-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.wh-detail-row:last-child { border-bottom: none; }
.wh-detail-label {
  font-weight: 600;
  color: var(--text-secondary);
}
.wh-detail-url {
  font-size: 0.78rem;
  word-break: break-all;
  max-width: 300px;
  text-align: right;
}
.wh-detail-events {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.wh-detail-events .wh-event-badge {
  padding: 0.25rem 0.6rem;
  background: #f1f5f9;
  border-radius: 6px;
  font-size: 0.75rem;
}
.wh-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.wh-detail-no-logs {
  text-align: center;
  color: var(--text-secondary);
  padding: 1.5rem;
  font-size: 0.85rem;
}
.wh-detail-loading {
  text-align: center;
  color: var(--text-secondary);
  padding: 3rem;
}
.wh-detail-log-table {
  font-size: 0.78rem;
}
.wh-badge-active {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #ecfdf5;
  color: #059669;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}
.wh-badge-inactive {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  background: #f1f5f9;
  color: #64748b;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* Create/Edit Modal */
.wh-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.wh-modal-overlay.open { opacity: 1; pointer-events: auto; }
.wh-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  z-index: 1001;
  width: 560px;
  max-width: 92vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.wh-modal.open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.wh-modal-sm { width: 480px; }
.wh-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
}
.wh-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}
.wh-modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 0.25rem;
  line-height: 1;
}
.wh-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}
.wh-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
}

/* Form fields */
.wh-field {
  margin-bottom: 1.25rem;
}
.wh-field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
}
.wh-field input[type="text"],
.wh-field input[type="url"],
.wh-field input[type="number"],
.wh-field select,
.wh-field textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.wh-field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L0.575 3.4 1.4 2.575 6 7.175 10.6 2.575 11.425 3.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
.wh-field input:focus,
.wh-field select:focus,
.wh-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Event checkboxes grid */
.wh-events-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.wh-event-check {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 0.82rem;
}
.wh-event-check:hover {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.03);
}
.wh-event-check:has(input:checked) {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.04);
}

/* Custom checkbox — replaces tiny native checkbox */
.wh-event-check input[type="checkbox"],
.wh-toggle-label input[type="checkbox"],
.wh-domain-toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid #cbd5e1;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  margin: 0;
}
.wh-event-check input[type="checkbox"]:checked,
.wh-toggle-label input[type="checkbox"]:checked,
.wh-domain-toggle input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}
.wh-event-check input[type="checkbox"]:checked::after,
.wh-toggle-label input[type="checkbox"]:checked::after,
.wh-domain-toggle input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 4.5px;
  top: 1.5px;
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.wh-event-check input[type="checkbox"]:hover,
.wh-toggle-label input[type="checkbox"]:hover,
.wh-domain-toggle input[type="checkbox"]:hover {
  border-color: var(--accent);
}
.wh-event-icon {
  font-size: 1rem;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wh-event-icon svg {
  width: 18px;
  height: 18px;
}
.wh-event-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.wh-event-name {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
}
.wh-event-desc {
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wh-events-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 0.5rem;
}
.wh-events-toggle {
  font-size: 0.75rem;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}
.wh-events-toggle:hover {
  text-decoration: underline;
}

/* Toggle label */
.wh-toggle-label {
  display: flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

/* Secret modal */
.wh-secret-info {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
}
.wh-secret-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-bottom: 1.25rem;
}
.wh-secret-box code {
  flex: 1;
  font-size: 0.78rem;
  word-break: break-all;
  color: var(--text-primary);
  font-family: 'JetBrains Mono', monospace;
}
.wh-code-example {
  background: #1e293b;
  border-radius: 8px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
}
.wh-code-title {
  font-size: 0.75rem;
  color: #94a3b8;
  margin: 0 0 0.5rem;
  font-weight: 600;
}
.wh-code-example pre {
  margin: 0;
}
.wh-code-example code {
  font-size: 0.75rem;
  color: #e2e8f0;
  font-family: 'JetBrains Mono', monospace;
  line-height: 1.5;
}

/* Log row status coloring */
.wh-log-err td:nth-child(4) .wh-http-badge { background: #fef2f2; color: #dc2626; }

@media (max-width: 768px) {
  .wh-stats-bar { flex-direction: column; gap: 0.75rem; }
  .wh-stat { flex-direction: row; gap: 0.75rem; padding: 0.75rem 1rem; }
  .wh-events-grid { grid-template-columns: 1fr; }
  .wh-detail-panel { width: 100%; }
  .wh-action-bar { flex-direction: column; align-items: stretch; }
  .wh-view-toggle { margin-left: 0; }
}

/* ============================================================
   SUPPRESSIONS
   ============================================================ */

/* Stats bar */
.sup-stats-bar {
  display: flex; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap;
}
.sup-stat {
  flex: 1; min-width: 120px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 12px; padding: 1rem 1.25rem; display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
}
.sup-stat-val {
  font-size: 1.5rem; font-weight: 700; color: var(--text);
}
.sup-stat-label {
  font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}

/* Action bar */
.sup-action-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.sup-action-left {
  display: flex; gap: 0.5rem; align-items: center;
}
.sup-action-right {
  display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
}
.sup-search {
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text); font-size: 0.875rem; width: 200px;
}
.sup-search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1); }
.sup-filter {
  padding: 0.5rem 0.75rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-card); color: var(--text); font-size: 0.8rem; cursor: pointer;
}

/* Bulk bar */
.sup-bulk-bar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.625rem 1rem;
  background: #fef3c7; border: 1px solid #fbbf24; border-radius: 8px;
  margin-bottom: 1rem; font-size: 0.875rem; color: #92400e;
}

/* Pending-approval panel (admin-gated domains) */
.mb-pending-panel {
  border: 1px solid #f5dfba; background: #fffaf2; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 20px;
}
.mb-pending-head { display: flex; align-items: center; gap: 8px; color: #b45309; }
.mb-pending-head h2 { font-size: 15px; margin: 0; }
.mb-pending-sub { font-size: 13px; color: var(--text-soft, #6b7280); margin: 6px 0 14px; }
.mb-pending-actions { white-space: nowrap; }

/* Table */
.sup-table-wrap { overflow-x: auto; }
.sup-table {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
}
.sup-table th {
  background: var(--bg-page); color: var(--text-muted); font-size: 0.75rem;
  text-transform: uppercase; letter-spacing: 0.5px; padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap;
}
.sup-table td {
  padding: 0.625rem 1rem; border-bottom: 1px solid var(--border);
  font-size: 0.875rem; color: var(--text); vertical-align: middle;
}
.sup-table tr:last-child td { border-bottom: none; }
.sup-table tr:hover td { background: var(--bg-page); }
.sup-th-check { width: 40px; }
.sup-cell-value { font-weight: 600; font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }
.sup-detail-link { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: 0.35rem; }
.sup-detail-link:hover { color: var(--primary); text-decoration: underline; }
.sup-cell-actions { white-space: nowrap; }

.sup-act-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 0.25rem 0.5rem; cursor: pointer; font-size: 0.85rem; color: var(--text-muted);
  margin-right: 0.25rem; transition: all 0.15s;
}
.sup-act-btn:hover { border-color: var(--primary); color: var(--primary); background: rgba(99,102,241,0.05); }
.sup-act-del:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.05); }

/* Badges */
.sup-badge {
  display: inline-block; padding: 0.15rem 0.5rem; border-radius: 999px;
  font-size: 0.7rem; font-weight: 600; text-transform: capitalize;
}
.sup-badge-type {
  background: rgba(99,102,241,0.1); color: var(--primary); border: 1px solid rgba(99,102,241,0.2);
}
.sup-badge-domain {
  background: rgba(59,130,246,0.08); color: #2563eb; border: 1px solid rgba(59,130,246,0.18);
  font-family: var(--font-mono, monospace); font-size: 0.68rem; letter-spacing: 0.01em;
}
.sup-domain-select {
  min-width: 160px; font-weight: 500;
}
.sup-badge-active { background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.2); }
.sup-badge-inactive { background: rgba(156,163,175,0.1); color: #6b7280; border: 1px solid rgba(156,163,175,0.2); }

/* Empty state */
.sup-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 4rem 2rem; text-align: center; color: var(--text-muted);
}
.sup-empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }
.sup-empty h3 { color: var(--text); margin-bottom: 0.5rem; }
.sup-empty p { margin-bottom: 1.5rem; max-width: 400px; line-height: 1.6; }

/* Pagination */
.sup-pagination {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 1rem; flex-wrap: wrap; gap: 0.5rem;
}
.sup-page-info { font-size: 0.8rem; color: var(--text-muted); }
.sup-page-btns { display: flex; gap: 0.25rem; }
.sup-page-btn {
  padding: 0.375rem 0.75rem; border: 1px solid var(--border); border-radius: 6px;
  background: var(--bg-card); color: var(--text); font-size: 0.8rem; cursor: pointer;
  transition: all 0.15s;
}
.sup-page-btn:hover { border-color: var(--primary); color: var(--primary); }
.sup-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* Modals (shared) */
.sup-modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 900;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.sup-modal-overlay.active { opacity: 1; pointer-events: all; }
.sup-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.95);
  background: var(--bg-card); border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  z-index: 901; width: 480px; max-height: 90vh; overflow-y: auto;
  opacity: 0; pointer-events: none; transition: all 0.25s;
}
.sup-modal.active { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }
.sup-modal-lg { width: 600px; }
.sup-modal-sm { width: 420px; }
.sup-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border);
}
.sup-modal-header h2 { font-size: 1.1rem; font-weight: 700; }
.sup-modal-close {
  background: none; border: none; font-size: 1.5rem; color: var(--text-muted);
  cursor: pointer; line-height: 1;
}
.sup-modal-close:hover { color: var(--text); }
.sup-modal-body { padding: 1.5rem; }
.sup-modal-footer {
  display: flex; justify-content: flex-end; gap: 0.75rem;
  padding: 1rem 1.5rem; border-top: 1px solid var(--border);
}

/* Fields inside modals */
.sup-field { margin-bottom: 1.25rem; }
.sup-field label {
  display: block; font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); margin-bottom: 0.375rem; text-transform: uppercase; letter-spacing: 0.5px;
}
.sup-field input[type="text"],
.sup-field input[type="email"],
.sup-field select,
.sup-field textarea {
  width: 100%; padding: 0.625rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--bg-page); color: var(--text);
  font-size: 0.875rem; font-family: inherit;
}
.sup-field input:focus,
.sup-field select:focus,
.sup-field textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}
.sup-optional { font-weight: 400; color: var(--text-muted); text-transform: none; letter-spacing: 0; }

/* Type toggle */
.sup-type-toggle { display: flex; gap: 0.5rem; }
.sup-type-btn {
  flex: 1; padding: 0.625rem; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg-page); color: var(--text); font-size: 0.875rem;
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.sup-type-btn:hover { border-color: var(--primary); }
.sup-type-btn.active {
  background: rgba(99,102,241,0.1); color: var(--primary);
  border-color: var(--primary); font-weight: 600;
}

/* Import helpers */
.sup-import-info {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5;
}
.sup-import-preview {
  padding: 0.5rem 0.75rem; background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2); border-radius: 8px;
  font-size: 0.85rem; color: #059669; font-weight: 600;
}

/* Check helpers */
.sup-check-info {
  font-size: 0.85rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5;
}
.sup-check-input-wrap { display: flex; gap: 0.5rem; }
.sup-check-input-wrap input { flex: 1; }
.sup-check-result {
  margin-top: 1rem; padding: 1rem; border-radius: 10px;
  display: flex; gap: 0.75rem; align-items: flex-start;
}
.sup-check-result code { padding: 0.1rem 0.4rem; background: rgba(0,0,0,0.06); border-radius: 4px; font-size: 0.8rem; }
.sup-check-blocked { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.sup-check-clear { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.sup-check-icon { font-size: 1.5rem; line-height: 1; }

/* Responsive */
@media (max-width: 768px) {
  .sup-stats-bar { flex-direction: column; gap: 0.5rem; }
  .sup-stat { flex-direction: row; gap: 0.75rem; padding: 0.75rem 1rem; }
  .sup-action-bar { flex-direction: column; align-items: stretch; }
  .sup-action-right { flex-direction: column; }
  .sup-search { width: 100%; }
  .sup-modal, .sup-modal-lg, .sup-modal-sm { width: calc(100% - 2rem); }
  .wl-header { flex-direction: column; align-items: stretch; gap: 0.75rem; }
  .wl-header-right { flex-wrap: wrap; }
}

/* ── Whitelist Section ── */
.wl-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}
.wl-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.5rem; flex-wrap: wrap; gap: 0.75rem;
}
.wl-header-left {
  display: flex; align-items: center; gap: 0.5rem;
}
.wl-header-left svg { color: #10b981; }
.wl-header-left h2 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.wl-count {
  font-size: 0.75rem; color: var(--text-muted); background: var(--bg-page);
  border: 1px solid var(--border); border-radius: 999px; padding: 0.15rem 0.6rem;
  font-weight: 600;
}
.wl-header-right {
  display: flex; align-items: center; gap: 0.5rem;
}
.wl-description {
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 1rem; line-height: 1.5;
}

/* Whitelist badge shown on suppression rows that are overridden */
.sup-badge-whitelisted {
  background: rgba(16,185,129,0.1); color: #059669; border: 1px solid rgba(16,185,129,0.25);
  font-size: 0.65rem; letter-spacing: 0.02em;
}
.sup-whitelisted-note {
  display: block; font-size: 0.7rem; color: #059669; margin-top: 0.15rem;
  font-weight: 500; font-style: italic;
}

/* ═══════════════════════════════════════════════════════════════════
   DNS Monitoring Panel
   ═══════════════════════════════════════════════════════════════════ */

/* Monitoring button in the grid header */
.frg-dns-monitor {
  margin-left: 0.25rem;
  gap: 0.35rem;
  display: inline-flex;
  align-items: center;
}
.btn-outline-accent {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 500;
}
.btn-outline-accent:hover {
  background: var(--accent);
  color: #fff;
}

/* Log area */
.dns-monitor-log-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dns-monitor-log-count {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-secondary);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border-color);
}
.dns-monitor-log {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 30vh;
  overflow-y: auto;
  padding: 0.5rem;
}
.dns-monitor-empty {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Individual log entries */
.dns-log-entry {
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  margin-bottom: 0.35rem;
  border-left: 3px solid transparent;
}
.dns-log-entry:last-child {
  margin-bottom: 0;
}
.dns-log-changed {
  background: #fef2f2;
  border-left-color: #ef4444;
}
.dns-log-violet {
  background: #f5f3ff;
  border-left-color: #7c3aed;
}
.dns-log-unchanged {
  background: #f0fdf4;
  border-left-color: #059669;
}
.dns-log-compact {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem 0.6rem;
  margin-bottom: 0.15rem;
  font-size: 0.7rem;
  line-height: 1.3;
  border-left-width: 2px;
}
.dns-log-compact .dns-monitor-badge {
  font-size: 0.55rem;
  padding: 0 0.35rem;
}
.dns-log-compact-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dns-log-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.3rem;
}
.dns-log-text {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
  margin: 0;
  padding: 0;
}

/* Badges for trigger type */
.dns-monitor-badge {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.1rem 0.45rem;
  border-radius: 3px;
  text-transform: uppercase;
}
.dns-monitor-badge.manual {
  background: rgba(99,102,241,0.1);
  color: #6366f1;
  border: 1px solid rgba(99,102,241,0.25);
}
.dns-monitor-badge.aggressive {
  background: rgba(5,150,105,0.1);
  color: #059669;
  border: 1px solid rgba(5,150,105,0.25);
}
.dns-monitor-badge.passive {
  background: rgba(107,114,128,0.1);
  color: #6b7280;
  border: 1px solid rgba(107,114,128,0.25);
}

/* ── DKIM File Monitoring separator ── */
.dkim-monitor-separator {
  margin: 2rem 0 1.5rem;
  border: none;
  border-top: 2px dashed var(--border);
  position: relative;
}


/* ═══════════════════════════════════════════════
   Compact Monitor Section Header (v2)
   ═══════════════════════════════════════════════ */
.monitor-section-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}
.monitor-section-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}
.monitor-section-count {
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0 0.4rem;
  line-height: 1.5;
  min-width: 1.4rem;
  text-align: center;
}

/* Snapshot button — compact */
.monitor-snapshot-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  line-height: 1.4;
}
.monitor-snapshot-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.10);
}
.monitor-snapshot-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Load older entries button */
.dns-monitor-load-more {
  text-align: center;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
  margin-bottom: 0.25rem;
}
.monitor-load-more-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.72rem;
  padding: 0.3rem 1rem;
  cursor: pointer;
  transition: all 0.15s;
}
.monitor-load-more-btn:hover {
  background: var(--accent-light, #f0f0ff);
  color: var(--accent);
  border-color: var(--accent);
}
.monitor-load-more-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auto-monitoring pill — compact */
.monitor-agg-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-color);
  border-radius: 999px;
  background: var(--bg-primary);
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  margin-left: auto;
}
.monitor-agg-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.monitor-agg-pill.active {
  border-color: #ef6c00;
  background: #fff3e0;
  color: #e65100;
  animation: aggPillBlink 1.2s ease-in-out infinite;
}
.monitor-agg-pill.active:hover {
  border-color: #dc2626;
  color: #dc2626;
  background: #fef2f2;
  animation: none;
}
@keyframes aggPillBlink {
  0%, 100% { opacity: 1; border-color: #ef6c00; background: #fff3e0; }
  50% { opacity: 0.65; border-color: #ff3d00; background: #fbe9e7; }
}
.monitor-agg-pill:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Auto-monitoring dot indicator */
.monitor-agg-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9e9e9e;
  flex-shrink: 0;
}
.monitor-agg-dot.on {
  background: #ef6c00;
  box-shadow: 0 0 6px rgba(239,108,0,0.6);
  animation: monitorDotPulse 1.2s ease-in-out infinite;
}
.monitor-agg-pill.active:hover .monitor-agg-dot.on {
  background: #dc2626;
  box-shadow: 0 0 4px rgba(220,38,38,0.5);
}
@keyframes monitorDotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Staging Environment Banner ---------- */

@keyframes stagingGradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes stagingGlow {
  0%, 100% { box-shadow: 0 2px 12px rgba(168, 130, 255, 0.25), 0 0 20px rgba(130, 200, 255, 0.10); }
  50%      { box-shadow: 0 2px 20px rgba(168, 130, 255, 0.45), 0 0 40px rgba(130, 200, 255, 0.20); }
}

#staging-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 25%;
  height: 32px;
  background: linear-gradient(135deg,
    rgba(186, 148, 255, 0.75),
    rgba(130, 200, 255, 0.70),
    rgba(255, 160, 210, 0.70),
    rgba(148, 220, 255, 0.75)
  );
  background-size: 300% 300%;
  animation: stagingGradientShift 8s ease infinite, stagingGlow 4s ease-in-out infinite;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255, 255, 255, 0.95);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(100, 60, 180, 0.4);
  user-select: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0 0 8px 8px;
}

/* Staging banner overlays on top — no layout shift */

/* Login page variant — centered at top, no sidebar */
#staging-banner.staging-banner-login {
  position: fixed;
  border-radius: 0;
}


/* ═══════════════════════════════════════════════
   IP Pool Management Page
   ═══════════════════════════════════════════════ */

.ip-pool-stats { margin-bottom: 1.25rem; }

.ipp-add-card { margin-bottom: 1rem; }
.ipp-add-card h3 { margin-bottom: 0.75rem; font-size: 0.95rem; }
.form-label-sm {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.25rem;
}

/* Server IPs discovery */
.ipp-server-ips-section {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
}
.ipp-server-ips-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0;
  transition: margin-bottom 0.2s;
}
.ipp-server-ips-section.expanded .ipp-server-ips-header {
  margin-bottom: 0.75rem;
}
.ipp-server-ips-header h3 {
  font-size: 0.95rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Chevron rotation for collapse/expand */
.ipp-server-chevron {
  transition: transform 0.2s;
  flex-shrink: 0;
}
.ipp-server-ips-section.expanded .ipp-server-chevron {
  transform: rotate(90deg);
}

/* Summary chips (visible when collapsed) */
.ipp-server-ips-summary {
  display: inline-flex;
  gap: 0.35rem;
  margin-left: 0.5rem;
}
.ipp-server-ips-section.expanded .ipp-server-ips-summary {
  display: none;
}

/* Refresh button: hidden when collapsed, visible when expanded */
.ipp-server-ips-refresh-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.ipp-server-ips-section.expanded .ipp-server-ips-refresh-btn {
  opacity: 1;
  pointer-events: auto;
}
.ipp-chip {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 6px;
  white-space: nowrap;
}
.ipp-chip.devvmail {
  background: #ede9fe;
  color: #7c3aed;
}
.ipp-chip.available {
  background: #dcfce7;
  color: #15803d;
}
.ipp-chip.external {
  background: #fce7f3;
  color: #be185d;
}

/* Collapsible body */
.ipp-server-ips-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 2000px;
  opacity: 1;
}
.ipp-server-ips-body.collapsed {
  max-height: 0;
  opacity: 0;
  pointer-events: none;
}

.ipp-server-ips-grid {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.ipp-server-ip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-main);
  transition: border-color 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

/* Category: available (green) */
.ipp-server-ip.available {
  border-color: #86efac;
  background: #f0fdf4;
}
/* Category: devvmail (violet) */
.ipp-server-ip.devvmail {
  border-color: #c4b5fd;
  background: #f5f3ff;
}
/* Category: external (red-pink) */
.ipp-server-ip.external {
  border-color: #fecdd3;
  background: #fff1f2;
}

.ipp-server-ip-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}
.ipp-server-ip.available .ipp-server-ip-icon { color: #16a34a; }
.ipp-server-ip.devvmail .ipp-server-ip-icon { color: #7c3aed; }
.ipp-server-ip.external .ipp-server-ip-icon { color: #e11d48; }
.ipp-server-ip-addr {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  flex-shrink: 0;
}
.ipp-server-ip-rdns {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  flex-shrink: 0;
}
.ipp-server-ip-detail {
  font-size: 0.7rem;
  color: var(--text-tertiary, #94a3b8);
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.ipp-server-ip-badge {
  flex-shrink: 0;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  text-transform: capitalize;
  margin-left: auto;
}
.ipp-server-ip-badge.available {
  background: #dcfce7;
  color: #15803d;
}
.ipp-server-ip-badge.devvmail {
  background: #ede9fe;
  color: #7c3aed;
}
.ipp-server-ip-badge.devvmail.warming {
  background: #fef3c7;
  color: #92400e;
}
.ipp-server-ip-badge.devvmail.disabled {
  background: #f1f5f9;
  color: #64748b;
}
.ipp-server-ip-badge.devvmail.cooldown {
  background: #fee2e2;
  color: #991b1b;
}
.ipp-server-ip-tags {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.25rem;
  margin-left: auto;
}
.ipp-server-ip-pool-tag {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: #ede9fe;
  color: #7c3aed;
}
.ipp-server-ip-badge.external {
  background: #fce7f3;
  color: #be185d;
}
.ipp-server-ip-add {
  flex-shrink: 0;
}

/* Server IP row loading shimmer */
.ipp-server-ip-loading {
  position: relative;
  overflow: hidden;
}
.ipp-server-ip-loading > * {
  opacity: 0.25;
  transition: opacity 0.3s ease;
}
.ipp-server-ip-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.5) 50%, transparent 100%);
  animation: ippShimmer 1.4s ease-in-out infinite;
}
@keyframes ippShimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Server IP row reveal animation */
.ipp-server-ip-reveal {
  animation: ippReveal 0.35s ease-out;
}
@keyframes ippReveal {
  0% { opacity: 0.3; transform: translateY(4px); }
  60% { transform: translateY(-1px); }
  100% { opacity: 1; transform: translateY(0); }
}
.ipp-server-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0;
  padding: 0.25rem 0;
}

.ipp-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.ipp-count {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Table */
.ipp-table td { vertical-align: middle; }
.ipp-row { cursor: pointer; }

/* Blacklist badge in IP pool table */
/* Blacklist detail table in IP detail panel */
.ipp-bl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
}
.ipp-bl-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-color);
}
.ipp-bl-table td {
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border-light, #f1f5f9);
}
.ipp-bl-row-listed td {
  background: #fef2f2;
}
.ipp-bl-checked-at {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.ipp-bl-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  font-size: 0.7rem;
  font-weight: 600;
}
.ipp-bl-clean { background: #d1fae5; color: #065f46; }
.ipp-bl-listed { background: #fee2e2; color: #991b1b; }

.ipp-status-badge {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  white-space: nowrap;
}

.ipp-pool-label,
.ipp-dedicated-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.18rem 0.55rem;
  border-radius: 9999px;
  line-height: 1.4;
  white-space: nowrap;
}
.ipp-pool-label {
  background: rgba(59,130,246,0.10);
  color: #3b82f6;
}
.ipp-dedicated-label {
  background: rgba(139,92,246,0.10);
  color: #8b5cf6;
}

.font-mono { font-family: 'JetBrains Mono', monospace; }
.text-sm { font-size: 0.82rem; }
.text-center { text-align: center; }
.text-right { text-align: right; }

.btn-xs {
  padding: 0.2rem 0.55rem;
  font-size: 0.72rem;
  border-radius: 4px;
}

/* ── Detail panel (v2 — hero + pill layout) ── */

/* Hero gradient card */
.ipp-hero {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ipp-hero-left h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.1rem;
}
.ipp-hero-sub {
  font-size: 0.82rem;
  opacity: 0.8;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ipp-hero-sub .ipp-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.ipp-hero-sub .ipp-status-dot.warming { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,0.5); }
.ipp-hero-sub .ipp-status-dot.active  { background: #34d399; box-shadow: 0 0 6px rgba(52,211,153,0.5); }
.ipp-hero-sub .ipp-status-dot.disabled,
.ipp-hero-sub .ipp-status-dot.cooldown,
.ipp-hero-sub .ipp-status-dot.blacklisted { background: #94a3b8; }
/* ── IP-pool DNS chips (shared base) ── */
.ipp-chip-hero,
.ipp-chip-sm {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid transparent;
}
.ipp-chip-ico {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.ipp-chip-ico svg { width: 100%; height: 100%; }

/* Hero variant — sits on purple gradient */
.ipp-chip-hero {
  font-size: 0.76rem;
  padding: 0.25rem 0.55rem;
  margin-left: 0.35rem;
}
.ipp-chip-hero .ipp-chip-ico { width: 14px; height: 14px; }
.ipp-chip-hero.ipp-chip-ok {
  background: rgba(5, 150, 105, 0.3);
  border-color: rgba(52, 211, 153, 0.6);
  color: #bbf7d0;
}
.ipp-chip-hero.ipp-chip-fail {
  background: rgba(220, 38, 38, 0.35);
  border-color: rgba(252, 165, 165, 0.6);
  color: #fecaca;
}

/* Discovery listing variant */
.ipp-chip-sm {
  font-size: 0.74rem;
  padding: 0.22rem 0.5rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.ipp-chip-sm .ipp-chip-ico { width: 14px; height: 14px; }
.ipp-chip-sm.ipp-chip-ok {
  background: #d1fae5;
  border-color: #059669;
  color: #047857;
}
.ipp-chip-sm.ipp-chip-fail {
  background: #fee2e2;
  border-color: #dc2626;
  color: #b91c1c;
}
.ipp-hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
}
.ipp-hero-stats {
  display: flex;
  gap: 0.6rem;
}
.ipp-hero-stat {
  text-align: center;
}
.ipp-hero-stat-val {
  font-size: 1.15rem;
  font-weight: 800;
  line-height: 1.1;
}
.ipp-hero-stat-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  opacity: 0.7;
  font-weight: 600;
}
.ipp-hero-actions {
  display: flex;
  gap: 0.4rem;
}
.ipp-hero-actions .btn {
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 500;
  transition: all 200ms ease;
}
.ipp-hero-actions .btn:hover { background: rgba(255,255,255,0.15); }
.ipp-hero-actions .btn-danger { border-color: rgba(255,200,200,0.3); color: rgba(255,200,200,0.9); }
.ipp-hero-actions .btn-danger:hover { background: rgba(255,100,100,0.15); }

/* Cooldown reason (shown below hero when applicable) */
/* ── Inline toast banner (below hero) ── */
.ipp-toast {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  transition: opacity 300ms ease;
}
.ipp-toast-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #b91c1c;
}
.ipp-toast-success {
  background: #f0fdf4;
  border: 1px solid #86efac;
  color: #166534;
}
.ipp-toast-ico {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.ipp-toast-msg { flex: 1; }
.ipp-toast-close {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0 0.25rem;
  line-height: 1;
}
.ipp-toast-close:hover { opacity: 1; }
.ipp-toast-fix {
  margin-left: 0.5rem;
  white-space: nowrap;
  vertical-align: middle;
}

.ipp-cooldown-banner {
  margin-top: -0.5rem;
  margin-bottom: 1rem;
  padding: 0.4rem 0.75rem;
  background: rgba(234,88,12,0.08);
  border: 1px solid rgba(234,88,12,0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: #ea580c;
  font-style: italic;
}

/* Section titles */
.ipp-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  margin-top: 0.25rem;
}

/* Config pill stack */
.ipp-config-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.ipp-config-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  min-height: 40px;
}
.ipp-pill-label-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ipp-pill-label {
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.ipp-pill-value {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ipp-pill-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-weight: 500;
}

/* Pill inputs */
.ipp-pill-input {
  width: 68px;
  padding: 0.25rem 0.4rem;
  font-size: 0.88rem;
  text-align: right;
  font-family: var(--font-mono);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color 200ms ease;
}
.ipp-pill-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.12);
}
.ipp-pill-input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ipp-pill-input.wide { width: 56px; }
.ipp-pill-checkbox {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* Unlimited toggle */
.ipp-unlimited-wrap {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.ipp-unlimited-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-weight: 500;
  cursor: pointer;
  user-select: none;
}
.ipp-unlimited-label.active {
  color: var(--accent);
  font-weight: 600;
}

/* Custom tooltip */
.ipp-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--border-color);
  color: var(--text-muted);
  font-size: 0.6rem;
  font-weight: 700;
  cursor: help;
  position: relative;
  flex-shrink: 0;
  transition: all 200ms ease;
  line-height: 1;
}
.ipp-tip:hover {
  background: rgba(99,102,241,0.10);
  color: var(--accent);
}
.ipp-tip .ipp-tip-box {
  display: none;
  position: fixed;
  background: var(--text-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 400;
  line-height: 1.45;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  width: max-content;
  max-width: 240px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 99999;
  pointer-events: none;
  white-space: normal;
  text-align: left;
  letter-spacing: 0;
  text-transform: none;
}
.ipp-tip .ipp-tip-box::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--text-primary);
}
.ipp-tip:hover .ipp-tip-box {
  display: block;
}

/* Section divider */
.ipp-divider {
  border: none;
  border-top: 1px solid var(--border-color);
  margin: 0.75rem 0;
}

/* Dedication pill (full-width compound rows) */
.ipp-dedication-pill {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
  position: relative;
}
.ipp-dedication-pill .ipp-pill-label-wrap {
  margin-bottom: 0.35rem;
}

/* Searchable dropdown */
.ipp-search-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
  margin-top: 0.3rem;
}
.ipp-search-input {
  width: 100%;
  padding: 0.35rem 0.5rem;
  font-size: 0.88rem;
  font-family: var(--font-family);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-primary);
  outline: none;
  transition: border-color 200ms ease;
}
.ipp-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99,102,241,0.12);
}
.ipp-search-input::placeholder { color: var(--text-muted); }
.ipp-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
  max-height: 160px;
  overflow-y: auto;
  z-index: 99999;
}
.ipp-dropdown.open { display: block; }
.ipp-dropdown-item {
  padding: 0.4rem 0.6rem;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 200ms ease;
}
.ipp-dropdown-item:hover { background: rgba(99,102,241,0.10); color: var(--accent); }
.ipp-dropdown-item.selected { background: rgba(99,102,241,0.10); color: var(--accent); font-weight: 600; }
.ipp-dropdown-item .ipp-item-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
}
.ipp-dropdown-clear {
  padding: 0.35rem 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  border-top: 1px solid var(--border-color);
  font-style: italic;
}
.ipp-dropdown-clear:hover { background: rgba(220,38,38,0.10); color: #dc2626; }

/* Domain tags */
.ipp-dtag-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.4rem;
  min-height: 0;
}
.ipp-dtag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.45rem;
  background: rgba(99,102,241,0.10);
  color: var(--accent);
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 500;
}
.ipp-dtag-x {
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.6;
  transition: opacity 200ms ease;
}
.ipp-dtag-x:hover { opacity: 1; }

/* Domain section slide animation */
.ipp-domain-slide {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 300ms ease, opacity 200ms ease, margin 200ms ease;
  margin-top: 0;
}
.ipp-domain-slide.visible {
  max-height: 300px;
  opacity: 1;
  margin-top: 0.5rem;
  overflow: visible;
}

/* 24h compact stats bar */
.ipp-compact-stats {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.75rem;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
}
.ipp-compact-stats-title {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-right: 0.1rem;
}
.ipp-compact-stat {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.ipp-compact-stat-val {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 0.88rem;
}
.ipp-compact-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ipp-compact-stat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Timestamps footer */
.ipp-detail-timestamps {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

/* Section save button (hidden by default, shown on change) */
.ipp-section-save {
  display: none;
  width: 100%;
  padding: 0.5rem 1rem;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-family);
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 200ms ease, opacity 200ms ease;
}
.ipp-section-save:hover { background: #4f46e5; }
.ipp-section-save.visible {
  display: block;
  animation: ippSavePulse 2s ease-in-out infinite;
}
@keyframes ippSavePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(99,102,241,0.5); }
  50%      { box-shadow: 0 0 0 8px rgba(99,102,241,0); }
}

/* 7-day breakdown table (kept) */
.ipp-stats-table {
  width: 100%;
  font-size: 0.8rem;
  border-collapse: collapse;
  margin-top: 0.5rem;
}
.ipp-stats-table th {
  text-align: left;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-color);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ipp-stats-table td {
  padding: 0.35rem 0.5rem;
  border-bottom: 1px solid var(--border-color);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

/* ── Log table: truncate long content columns ── */
.td-subject,
.td-from,
.td-to {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.td-sending-ip {
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  font-size: 0.78rem;
  white-space: nowrap;
  color: var(--text-secondary);
}

/* ── PTR lookup status indicator ── */
.ipp-ptr-status {
  font-size: 0.7rem;
  font-weight: 500;
  margin-left: 0.35rem;
}
.ipp-ptr-loading { color: var(--text-muted); }
.ipp-ptr-ok { color: #059669; }
.ipp-ptr-warn { color: #d97706; }
.ipp-ptr-err { color: #ef4444; }

/* ── PTR ticket template ── */
.ipp-ptr-ticket {
  margin-top: 0.75rem;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  position: relative;
}
.ipp-ptr-ticket-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #92400e;
  margin-bottom: 0.5rem;
}
.ipp-ptr-explanation {
  font-size: 0.82rem;
  line-height: 1.55;
  color: #78350f;
  margin-bottom: 0.75rem;
}
.ipp-ptr-explanation strong {
  color: #92400e;
}
.ipp-ptr-explanation code {
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  font-size: 0.78rem;
  background: rgba(255,255,255,0.55);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.ipp-ptr-ticket-body {
  font-family: var(--font-mono, 'SFMono-Regular', Consolas, monospace);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #78350f;
  background: rgba(255,255,255,0.5);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.75rem;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
#ipp-ptr-ticket-copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  font-size: 0.75rem;
  color: #92400e;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Hostname display (read-only, auto-filled from PTR) ── */
.ipp-hostname-display {
  display: block;
  padding: 0.45rem 0.625rem;
  font-size: 0.85rem;
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  min-height: 2.1rem;
  line-height: 1.2;
  opacity: 0.85;
}



/* ═══════════ USER REPUTATION PAGE ═══════════ */
.urep-top-row {
  display: flex;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.urep-score-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  min-width: 170px;
  position: relative;
  box-shadow: var(--shadow);
}
.urep-score-card canvas {
  margin-bottom: 0.5rem;
}
.urep-score-number {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -62%);
}
.urep-score-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-top: 0.25rem;
}
/* Level border accents */
.urep-level-good    { border-left: 3px solid #16a34a; }
.urep-level-warning { border-left: 3px solid #d97706; }
.urep-level-poor    { border-left: 3px solid #ea580c; }
.urep-level-critical{ border-left: 3px solid #dc2626; }

.urep-stat-cards {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

/* Toolbar (time range select) */
.urep-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

/* Type breakdown cards */
.urep-type-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}
.urep-type-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.urep-type-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.urep-type-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}
.urep-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.urep-type-icon-tx {
  background: #ede9fe;
  color: #7c3aed;
}
.urep-type-icon-bulk {
  background: #dbeafe;
  color: #2563eb;
}
.urep-type-body {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.urep-type-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.urep-type-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}
.urep-type-stat-value {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.urep-type-rate {
  grid-column: 1 / -1;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.urep-type-rate-value {
  font-size: 1.5rem;
  font-weight: 700;
}
.urep-type-rate-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Rate color classes */
.urep-rate-excellent { color: #16a34a; }
.urep-rate-good      { color: #2563eb; }
.urep-rate-fair      { color: #d97706; }
.urep-rate-poor      { color: #dc2626; }

/* Tips / Insights — inline banners */
.urep-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.45;
  margin-bottom: 1.25rem;
}
.urep-banner svg {
  flex-shrink: 0;
}
.urep-banner-good {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  color: #15803d;
  border-left: 3px solid #22c55e;
}
.urep-banner-good svg { color: #16a34a; }
.urep-banner-warn {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  color: #92400e;
  border-left: 3px solid #f59e0b;
}
.urep-banner-warn svg { color: #d97706; }
.urep-banner-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.urep-banner-group .urep-banner {
  margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
  .urep-top-row {
    flex-direction: column;
  }
  .urep-score-card {
    min-width: auto;
  }
  .urep-stat-cards {
    grid-template-columns: 1fr;
  }
  .urep-type-cards {
    grid-template-columns: 1fr;
  }
  .urep-type-body {
    grid-template-columns: repeat(3, 1fr);
  }
}


/* ============================================================
   OPEN RATE CHART (user-reputation + admin reputation)
   ============================================================ */

.urep-openrate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.urep-openrate-left h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.urep-openrate-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.urep-or-select {
  font-size: 0.78rem;
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  cursor: pointer;
  height: 28px;
  line-height: 1;
}

.urep-or-select:focus {
  outline: none;
  border-color: var(--color-primary, #6366f1);
}

.rep-openrate-card {
  margin-top: 1rem;
}

/* ── Volume History chart: external tooltip + wrap + sparse-data notice ── */
.vh-chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
}
.vh-chart-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}
.vh-chart-tip {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 10;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
  width: 240px;
  max-height: 240px;
  overflow: hidden;
  pointer-events: none;
  visibility: hidden;
}
.vh-chart-tip.visible { visibility: visible; }
.vh-chart-tip-title { font-weight: 600; margin-bottom: 6px; font-size: 12px; }
.vh-chart-tip-row {
  display: flex; align-items: center; gap: 6px;
  font-variant-numeric: tabular-nums;
}
.vh-chart-tip-swatch {
  width: 10px; height: 10px; border-radius: 2px; flex: 0 0 10px;
}
.vh-chart-tip-label { flex: 1; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vh-chart-tip-val { font-weight: 600; }
.vh-chart-tip-after {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.vh-sparse-notice {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: var(--bg-secondary, #f8fafc);
  border: 1px solid var(--border-color, #e2e8f0);
  border-left: 3px solid var(--color-primary, #6366f1);
  border-radius: 6px;
  font-size: 0.82rem;
  color: var(--text-secondary, #475569);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.vh-sparse-switch {
  font-size: 0.78rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--color-primary, #6366f1);
  background: transparent;
  color: var(--color-primary, #6366f1);
  border-radius: 6px;
  cursor: pointer;
}
.vh-sparse-switch:hover {
  background: var(--color-primary, #6366f1);
  color: #fff;
}

@media (max-width: 600px) {
  .urep-openrate-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .urep-openrate-controls {
    width: 100%;
  }
  .urep-or-select {
    flex: 1 1 calc(50% - 0.2rem);
  }
}

/* ============================================================
   TEMPLATES PAGE
   ============================================================ */

/* ── Sections ── */
.tpl-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.tpl-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tpl-section-header h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.tpl-section-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.label-hint {
  font-weight: 400;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.label-hint code {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  background: var(--bg-secondary);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border-color);
}


/* ── Starter Gallery Grid ── */
.starter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.starter-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--bg-card);
}

.starter-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.12), var(--shadow);
  transform: translateY(-2px);
}

.starter-card-preview {
  position: relative;
  height: 140px;
  background: linear-gradient(135deg, #f8f9fb 0%, #eef1f5 100%);
  overflow: hidden;
  border-bottom: 1px solid var(--border-color);
}

.starter-card-thumb {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.starter-thumb-iframe {
  width: 600px;
  height: 800px;
  border: none;
  pointer-events: none;
  transform: scale(0.233);
  transform-origin: top left;
}

.starter-card-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.starter-card-body {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
}

.starter-card-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.starter-card-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.starter-card-info strong {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.starter-card-info span {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}


/* ── Editor + Preview Layout ── */
.tpl-editor-layout {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;
  min-height: 600px;
}

.tpl-editor-form {
  flex: 1;
  min-width: 0;
}

.tpl-editor-form .form-group {
  margin-bottom: 1rem;
}

.tpl-code-area {
  font-family: var(--font-mono, 'JetBrains Mono', 'Fira Code', monospace) !important;
  font-size: 0.82rem !important;
  line-height: 1.55 !important;
  tab-size: 2;
  white-space: pre;
  resize: vertical;
}

/* Flash animation when loading a starter template */
.tpl-loaded-flash {
  animation: tplLoadFlash 0.8s ease;
}

@keyframes tplLoadFlash {
  0%   { box-shadow: inset 0 0 0 2px var(--accent); }
  100% { box-shadow: inset 0 0 0 0px transparent; }
}


/* ── Live Preview Pane ── */
.tpl-preview-pane {
  flex: 1;
  min-width: 0;
  position: sticky;
  top: 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-self: stretch;
}

.tpl-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
}

.tpl-preview-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.tpl-preview-device-btns {
  display: flex;
  gap: 2px;
  background: var(--bg-secondary);
  border-radius: 6px;
  padding: 2px;
}

.tpl-device-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  border: none;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.tpl-device-btn:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.tpl-device-btn.active {
  color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}

.tpl-preview-frame-wrap {
  flex: 1;
  min-height: 500px;
  overflow: auto;
  background: #ffffff;
  display: flex;
  justify-content: center;
  padding: 0;
  transition: padding 0.2s ease, background 0.2s ease;
  position: relative;
}

.tpl-preview-click-guard {
  position: absolute;
  inset: 0;
  z-index: 2;
  cursor: default;
  pointer-events: none;
}

.tpl-preview-frame-wrap[data-device="desktop"] {
  padding: 0;
}

.tpl-preview-frame-wrap[data-device="desktop"] .tpl-preview-iframe {
  width: 100%;
  max-width: none;
}

.tpl-preview-frame-wrap[data-device="mobile"] {
  padding: 24px 16px;
  background: var(--bg-secondary);
  align-items: flex-start;
}

.tpl-preview-frame-wrap[data-device="mobile"] .tpl-preview-iframe {
  width: 375px;
  max-width: 375px;
  min-width: 375px;
  border-radius: 12px;
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(0,0,0,0.04);
  border: 1px solid var(--border-color);
}

.tpl-preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 0.75rem;
  text-align: center;
  padding: 2rem;
}

.tpl-preview-empty p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tpl-preview-iframe {
  width: 100%;
  min-height: 500px;
  border: none;
  display: none;
  background: #ffffff;
  transition: width 0.25s ease, max-width 0.25s ease, min-width 0.25s ease;
}


/* ── Variables Preview ── */
.tpl-vars-preview {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}

.tpl-vars-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0.4rem;
}

.tpl-var-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.78rem;
  font-family: var(--font-mono, monospace);
}

.tpl-var-badge-sm {
  display: inline-block;
  padding: 1px 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.73rem;
  font-family: var(--font-mono, monospace);
}


/* ── Template Count Badge ── */
.tpl-count {
  font-weight: 400;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}


/* ── Template List (Saved Templates) ── */
.tpl-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1rem;
}

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

.tpl-row-info {
  flex: 1;
  min-width: 0;
}

.tpl-row-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
}

.tpl-row-header strong {
  font-size: 0.95rem;
}

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

.tpl-row-subject {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}

.tpl-row-vars {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.tpl-row-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}


/* ── Empty State ── */
.tpl-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 2rem;
  text-align: center;
}

.tpl-empty p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  max-width: 400px;
  line-height: 1.5;
}


/* ── Responsive: Templates ── */

/* ── Test Email Panel ── */
.tpl-test-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: tpl-overlay-in 0.2s ease;
}
@keyframes tpl-overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.tpl-test-panel {
  background: var(--bg-card, #fff);
  border-radius: var(--radius, 14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.05);
  width: 440px;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  animation: tpl-panel-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes tpl-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tpl-test-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border-color, #e2e8f0);
}
.tpl-test-panel-header h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
}
.tpl-test-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}
.tpl-test-close:hover {
  background: var(--bg-primary, #f0f4f8);
  color: var(--text-primary, #1e293b);
}

.tpl-test-panel-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.tpl-test-var-group {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
.tpl-test-var-label {
  flex-shrink: 0;
  min-width: 120px;
}
.tpl-test-var-group .form-control {
  flex: 1;
}

.tpl-test-panel-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color, #e2e8f0);
}

/* Spin animation for send button loading */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.spin {
  animation: spin 0.7s linear infinite;
}

/* Outline variant for test button */
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-color, #e2e8f0);
  color: var(--text-secondary, #475569);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.btn-outline:hover {
  border-color: var(--accent, #6366f1);
  color: var(--accent, #6366f1);
  background: rgba(99, 102, 241, 0.04);
}
.btn-outline svg {
  vertical-align: -2px;
  margin-right: 3px;
}

@media (max-width: 1200px) {
  .starter-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 960px) {
  .tpl-editor-layout {
    flex-direction: column;
  }
  .tpl-preview-pane {
    position: static;
    width: 100%;
  }
  .starter-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .starter-grid {
    grid-template-columns: 1fr;
  }
  .tpl-section {
    padding: 1rem;
  }
  .tpl-row {
    flex-direction: column;
    gap: 0.75rem;
  }
  .tpl-row-actions {
    align-self: flex-end;
  }
}

/* ════════════════════════════════════════════════════════════════════
   Inbound Email — Routes & Logs pages
   ════════════════════════════════════════════════════════════════════ */

/* Select elements used in inbound modals & action rows */
.wh-select,
.ib-action-row input {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-page);
  color: var(--text-primary);
  transition: border-color var(--transition);
}
.wh-select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825L0.575 3.4 1.4 2.575 6 7.175 10.6 2.575 11.425 3.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
  cursor: pointer;
}
.wh-select:focus,
.ib-action-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Action row cards */
.ib-action-row {
  background: var(--bg-muted, #f8fafc);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin-bottom: 0.5rem;
}
.ib-action-top {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ib-action-top .ib-action-type {
  flex-shrink: 0;
  width: 110px;
}
.ib-action-top .ib-action-url,
.ib-action-top .ib-action-to {
  flex: 1;
  min-width: 0;
}
.ib-remove-action {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1;
  padding: 0;
}
.ib-remove-action:hover {
  background: var(--danger-bg, #fef2f2);
  border-color: var(--danger-border, #fecaca);
  color: var(--danger-color, #dc2626);
}

.ib-action-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  font-size: 0.78rem;
  background: var(--bg-muted, #f1f5f9);
  color: var(--text-secondary, #475569);
  border: 1px solid var(--border-color, #e2e8f0);
}

/* ── Inbound routes table layout ── */
.ib-routes-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
}
.ib-routes-table tr {
  transition: outline-color 200ms cubic-bezier(0.4, 0, 0.2, 1);
  outline: 1px solid transparent;
  border-radius: 10px;
}
.ib-routes-table tr:hover { outline: 1px solid #c7d2fe; }
.ib-routes-table td {
  padding: 0.5rem 0.6rem;
  background: var(--bg-card, #fff);
  border-top: 1px solid var(--border-color, #e2e8f0);
  border-bottom: 1px solid var(--border-color, #e2e8f0);
  vertical-align: middle;
}
.ib-routes-table td:first-child {
  border-left: 1px solid var(--border-color, #e2e8f0);
  border-radius: 10px 0 0 10px;
}
.ib-routes-table td:last-child {
  border-right: 1px solid var(--border-color, #e2e8f0);
  border-radius: 0 10px 10px 0;
}
.ib-routes-table .td-pri {
  width: 44px;
  text-align: center;
}
.ib-routes-table .td-pri span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.10);
  color: var(--accent, #6366f1);
  font-weight: 700;
  font-size: 0.82rem;
}
.ib-routes-table .td-name {
  width: 100px;
  font-weight: 600;
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ib-routes-table .td-rule .ib-mono {
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ib-routes-table .td-action svg.ib-action-icon {
  vertical-align: middle;
  color: var(--accent, #6366f1);
  margin-right: 3px;
}
.ib-routes-table .td-action .ib-target {
  font-size: 0.82rem;
  color: var(--accent, #6366f1);
  font-weight: 500;
}
.ib-routes-table .td-action .ib-action-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.ib-routes-table .td-action .ib-action-sep {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0 4px;
  font-weight: 600;
}
.ib-routes-table .td-sc {
  width: 40px;
  text-align: center;
  white-space: nowrap;
}
.ib-routes-table .td-status {
  width: 66px;
}
.ib-routes-table .td-ctrl {
  width: 64px;
  white-space: nowrap;
  text-align: right;
}
.ib-routes-table .td-ctrl .ib-btn-icon { display: inline-flex; }

/* Keyword tags (IF / THEN) */
.ib-kw {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 6px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
}
.ib-kw-if { background: #ede9fe; color: #7c3aed; }
.ib-kw-then { background: #dcfce7; color: #16a34a; }

/* Flow arrow between IF/THEN/Stop sections */
.ib-flow-arrow {
  display: inline-flex;
  align-items: center;
  margin: 0 4px;
  color: var(--text-muted, #94a3b8);
  flex-shrink: 0;
}

/* Stop/Continue icon */
.ib-sc-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.ib-sc-stop { color: var(--text-muted, #94a3b8); }
.ib-sc-cont { color: #3b82f6; }

/* Status badges (table variant) */
.ib-badge-active {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #059669;
  background: rgba(52, 211, 153, 0.12);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.ib-badge-disabled {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted, #94a3b8);
  background: var(--bg-muted, #f1f5f9);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Edit/Delete icon buttons */
.ib-btn-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: var(--text-muted, #94a3b8);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.ib-btn-icon:hover {
  background: var(--bg-muted, #f1f5f9);
  color: var(--text-secondary, #64748b);
}
.ib-btn-icon-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  color: #dc2626;
}

/* Inbound logs table */
#ib-msg-tbody tr:hover {
  background: var(--bg-muted, #f8fafc);
}

/* Detail slide-over */
.ib-detail-section {
  margin-bottom: 1.25rem;
}
.ib-detail-section h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.5rem;
}
.ib-detail-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.85rem;
}
.ib-detail-meta dt {
  color: var(--text-muted);
  font-weight: 500;
}

/* Filter bar */
.ib-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1rem;
}
.ib-filter-bar .form-control,
.ib-filter-bar select {
  max-width: 200px;
}

/* Signing key display */
.ib-key-display {
  font-family: var(--font-mono, monospace);
  background: var(--bg-muted, #f1f5f9);
  border: 1px solid var(--border-color, #e2e8f0);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  word-break: break-all;
  font-size: 0.85rem;
}

/* ── Inbound Logs ── */
.ib-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  overflow: hidden;
}
.ib-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border-color);
}
.ib-meta-row:last-child {
  border-bottom: none;
}
.ib-meta-label {
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 90px;
  flex-shrink: 0;
}
.ib-meta-value {
  text-align: right;
  word-break: break-all;
}
.ib-actions-table-wrap {
  overflow-x: auto;
}
.ib-actions-table {
  font-size: 0.83rem;
}
.ib-actions-table th,
.ib-actions-table td {
  padding: 0.4rem 0.6rem;
}
.td-nowrap {
  white-space: nowrap;
}
#ib-log-table .ib-row:hover {
  background: var(--bg-hover, rgba(0,0,0,0.03));
}

/* Forward mode toggle (inbound route config) */
.ib-fwd-mode-wrap {
  box-sizing: border-box;
  margin-top: 0.6rem;
}
.ib-fwd-mode-row {
  display: inline-flex;
  gap: 0;
  background: var(--bg-hover, #f1f5f9);
  border-radius: 8px;
  padding: 3px;
}
.ib-fwd-mode-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.75rem;
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border-radius: 6px;
  border: none;
  transition: all 0.15s;
  user-select: none;
}
.ib-fwd-mode-label:hover {
  color: var(--text-secondary);
}
.ib-fwd-mode-label input {
  display: none;
}
.ib-fwd-mode-label.active {
  background: var(--bg-card, #fff);
  color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.ib-fwd-mode-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
  line-height: 1.3;
}


/* ============================================================
   Blocked Forwards (/forward-refusals)
   Live status of the self-spoof relay gate. The verdict banner
   carries the whole answer, so it is deliberately the loudest
   thing on the page.
   ============================================================ */

.fr-verdict {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.25rem 1.4rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}

.fr-verdict-ok {
  border-color: rgba(52, 211, 153, 0.45);
  background: var(--success-bg);
}

.fr-verdict-bad {
  border-color: rgba(248, 113, 113, 0.5);
  background: var(--error-bg);
}

.fr-verdict-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
}

.fr-verdict-ok .fr-verdict-icon { color: #059669; }
.fr-verdict-bad .fr-verdict-icon { color: #dc2626; }
.fr-verdict-loading .fr-verdict-icon { color: var(--text-muted); }

.fr-verdict-text { min-width: 0; }

.fr-verdict-text h2 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 0 0 0.3rem;
  color: var(--text-primary);
}

.fr-verdict-text p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-secondary);
}

.fr-verdict-action:not(:empty) {
  margin-top: 0.5rem !important;
  font-weight: 600;
  color: var(--text-primary);
}

.fr-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.fr-meta-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.fr-meta-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  font-weight: 600;
}

.fr-meta-value {
  font-size: 1.25rem;
  font-weight: 650;
  color: var(--text-primary);
}

.fr-section-title {
  font-size: 0.95rem;
  font-weight: 650;
  margin: 0;
  color: var(--text-primary);
}

.fr-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.73rem;
  font-weight: 600;
  white-space: nowrap;
}

.fr-badge-ok {
  background: var(--success-bg);
  color: #047857;
}

.fr-badge-bad {
  background: var(--error-bg);
  color: #b91c1c;
}

.fr-subject {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
}

.fr-empty {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.86rem;
}

/* The timestamp column wraps to three lines at default width, which makes each
   row three times taller than it needs to be. Keep it on one line. */
.fr-when {
  white-space: nowrap;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.fr-window-label {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: none;
}

/* The refusal table is naturally wide (5 columns of addresses and subjects).
   Without min-width:0 it stretches .main-content on a phone and drags the
   whole layout sideways, so the header and banner scroll off too. Pinning the
   card's width keeps the horizontal scroll INSIDE the table card, which is
   what .wh-section's overflow-x:auto was always meant to do. */
.fr-table-wrap {
  min-width: 0;
  max-width: 100%;
}

/* .main-content is a flex item with flex:1 and a default min-width:auto, so a
   wide table stretches the whole column and drags the header and the verdict
   banner off-screen on a phone. Setting min-width:0 lets it shrink to the
   viewport, and the table then scrolls inside its own card (.wh-section
   already carries overflow-x:auto).

   Scoped behind .page-forward-refusals on <body> so ONLY this page is
   affected: .main-content is shared by every admin page and must not change
   underneath them. */
.page-forward-refusals .main-content {
  min-width: 0;
}

.fr-page-body {
  min-width: 0;
  max-width: 100%;
}

/* Huppmail wordmark in the sidebar. Replaces the old /img/logo.png, which does
   not exist on this install and rendered as a broken image (2026-09-12). The
   type treatment matches the public site at huppmail.com. */
.hupp-wordmark { font-weight: 600; font-size: 20px; letter-spacing: -0.02em; color: #fff; }
.hupp-wordmark em { font-style: normal; font-weight: 400; opacity: 0.72; }

/* ── Back to my mailbox (sidebar) ────────────────────────────────────────────
   The twin of the mail-server button in the webmail topbar. The crossing has
   to work in BOTH directions, so neither side is a dead end (asked 2026-09-13).
   It is deliberately quieter than a nav item: it leaves the dashboard rather
   than moving inside it, so it must not compete with the real menu. */
.back-to-mailbox {
  display: flex; align-items: center; gap: .75rem;
  margin: .5rem .75rem 0; padding: .6rem .85rem;
  border-radius: 8px; text-decoration: none;
  color: #64748b; font-size: .875rem; font-weight: 500;
  border: 1px solid transparent;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.back-to-mailbox:hover { background: #eef2ff; color: #4f46e5; border-color: #c7d2fe; }
.back-to-mailbox .nav-icon { display: inline-flex; flex: 0 0 auto; }
/* Collapsed rail: the label folds away and only the chevron remains. */
.sidebar.collapsed .back-to-mailbox { justify-content: center; padding: .6rem 0; margin-left: .4rem; margin-right: .4rem; }
.sidebar.collapsed .back-to-mailbox .nav-label { display: none; }
