/* InboxRig - Dark Theme Design System */

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

:root {
  /* Dark theme colors */
  --bg-dark: #0a1929;
  --bg-card: #132f4c;
  --bg-card-hover: #1a3a5c;
  --bg-input: #0d2137;
  --primary: #2196f3;
  --primary-dark: #1976d2;
  --primary-light: #42a5f5;
  --success: #4cceac;
  --warning: #ffa726;
  --danger: #f44336;
  --text: #ffffff;
  --text-secondary: #b2bac2;
  --text-muted: #6b7a8a;
  --border: #1e4976;
  --border-focus: #2196f3;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 12px;
  --radius-sm: 6px;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================================================
   Navigation Header
   ============================================================================ */

.top-nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text);
  font-weight: 600;
  font-size: 1.25rem;
}

.nav-brand svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.nav-tabs {
  display: flex;
  gap: 0.25rem;
  height: 100%;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.nav-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 0 1.25rem;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

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

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

.nav-tab svg {
  width: 18px;
  height: 18px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-email {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.btn-logout {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}

.btn-logout:hover {
  border-color: var(--danger);
  color: var(--danger);
}

/* ============================================================================
   Main Container
   ============================================================================ */

.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Page header (for views without nav) */
header {
  text-align: center;
  margin-bottom: 2rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

header .subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* ============================================================================
   Login Page
   ============================================================================ */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

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

.login-header {
  text-align: center;
  margin-bottom: 2rem;
}

.login-header h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.login-header h1 svg {
  width: 28px;
  height: 28px;
  color: var(--primary);
}

.login-header p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.login-form .form-group {
  margin-bottom: 1.25rem;
}

.login-error {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--danger);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.login-error.show {
  display: block;
}

/* Auth Toggle (Login/Register) */
.auth-toggle {
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 1.5rem;
}

.auth-toggle-btn {
  flex: 1;
  padding: 0.6rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.auth-toggle-btn:hover {
  color: var(--text);
}

.auth-toggle-btn.active {
  background: var(--primary);
  color: white;
}

.register-success {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--success);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.register-success.show {
  display: block;
}

.success-message {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid var(--success);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  color: var(--success);
  font-size: 0.875rem;
  margin-bottom: 1rem;
  display: none;
}

.success-message.show {
  display: block;
}

/* ============================================================================
   Info Box
   ============================================================================ */

.info-box {
  background: rgba(33, 150, 243, 0.1);
  border: 1px solid var(--primary);
  border-left: 4px solid var(--primary);
  border-radius: var(--radius-sm);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-secondary);
}

.info-box strong {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--primary);
}

/* ============================================================================
   Form Sections (Cards)
   ============================================================================ */

.form-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.form-section h2 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* ============================================================================
   Form Elements
   ============================================================================ */

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

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text);
}

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

.optional {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.8rem;
}

.help-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

textarea,
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.15);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

select {
  cursor: pointer;
}

select option {
  background: var(--bg-card);
  color: var(--text);
}

textarea {
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  resize: vertical;
  min-height: 150px;
}

.user-count {
  font-size: 0.875rem;
  color: var(--primary);
  font-weight: 500;
  margin-top: 0.5rem;
}

/* ============================================================================
   Email Preview Box
   ============================================================================ */

.preview-box {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  max-height: 300px;
  overflow-y: auto;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.8rem;
}

.preview-email {
  padding: 0.375rem 0.625rem;
  margin: 0.125rem 0;
  background: rgba(76, 206, 172, 0.1);
  border-radius: var(--radius-sm);
  color: var(--success);
}

.preview-email:nth-child(odd) {
  background: rgba(33, 150, 243, 0.1);
  color: var(--primary-light);
}

/* ============================================================================
   Tenant Cards
   ============================================================================ */

.tenant-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.tenant-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.tenant-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--primary);
}

.remove-tenant-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}

#tenantsContainer:empty + #addTenantBtn {
  margin-top: 0;
}

/* ============================================================================
   Download Links
   ============================================================================ */

.download-link {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  margin: 0.5rem 0.5rem 0.5rem 0;
  background: var(--success);
  color: var(--bg-dark);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  transition: all 0.15s;
}

.download-link:hover {
  background: #3ab896;
  transform: translateY(-1px);
}

.download-link svg {
  width: 18px;
  height: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

/* ============================================================================
   CSV Upload Section
   ============================================================================ */

.csv-upload-section {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-input);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}

/* ============================================================================
   Checkbox Group
   ============================================================================ */

.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

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

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
}

.checkbox-label span:first-of-type {
  font-weight: 500;
}

.checkbox-label .help-text {
  flex-basis: 100%;
  margin-left: 26px;
  margin-top: 0;
}

/* ============================================================================
   File Upload
   ============================================================================ */

.file-upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  transition: border-color 0.15s, background-color 0.15s;
  cursor: pointer;
}

.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--primary);
  background: rgba(33, 150, 243, 0.05);
}

.file-upload-area.has-file {
  border-color: var(--success);
  background: rgba(76, 206, 172, 0.05);
}

.upload-icon {
  width: 48px;
  height: 48px;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.file-upload-area p {
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.link-button {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  text-decoration: underline;
  font-size: inherit;
}

.file-name {
  display: block;
  font-weight: 500;
  color: var(--success);
  margin-top: 0.5rem;
}

.upload-actions {
  margin-top: 0.75rem;
  text-align: center;
}

/* ============================================================================
   Collapsible Sections
   ============================================================================ */

.collapsible-header {
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.collapsible-header .chevron {
  width: 20px;
  height: 20px;
  transition: transform 0.2s;
  color: var(--text-secondary);
}

.collapsible .collapsible-content {
  display: none;
  padding-top: 1rem;
}

.collapsible.open .collapsible-content {
  display: block;
}

.collapsible.open .chevron {
  transform: rotate(180deg);
}

/* ============================================================================
   Buttons
   ============================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

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

.btn-icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #d32f2f;
}

.btn-warning {
  background: #f57c00;
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background: #ef6c00;
}

/* Failed Users List */
.failed-users-list {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

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

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

.failed-user-email {
  color: var(--text);
  font-family: monospace;
}

.failed-user-reason {
  color: var(--danger);
  font-size: 0.85rem;
}

.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8rem;
}

.btn-full {
  width: 100%;
}

.form-actions {
  display: flex;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* ============================================================================
   Log Section
   ============================================================================ */

.log-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.log-header h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.log-actions {
  display: flex;
  gap: 0.5rem;
}

.log-container {
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.8rem;
  padding: 1rem;
  height: 400px;
  overflow-y: auto;
  line-height: 1.6;
}

.log-placeholder {
  color: var(--text-muted);
  font-style: italic;
}

.log-line {
  margin: 0;
  padding: 2px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.log-line.info { color: #c9d1d9; }
.log-line.success { color: var(--success); }
.log-line.warn { color: var(--warning); }
.log-line.error { color: var(--danger); }
.log-line.command { color: var(--primary); font-style: italic; }

/* ============================================================================
   Status Bar
   ============================================================================ */

.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: var(--bg-input);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.status-indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
}

.status-indicator.running {
  background: var(--warning);
  animation: pulse 1.5s infinite;
}

.status-indicator.success {
  background: var(--success);
}

.status-indicator.error {
  background: var(--danger);
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* ============================================================================
   History Page
   ============================================================================ */

.history-container {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.history-empty {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.history-empty svg {
  width: 64px;
  height: 64px;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.history-empty h3 {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.job-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: all 0.15s;
  cursor: pointer;
}

.job-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.job-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.job-card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

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

.job-card-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.job-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.job-card-meta svg {
  width: 14px;
  height: 14px;
}

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

.status-badge.running {
  background: rgba(255, 167, 38, 0.15);
  color: var(--warning);
}

.status-badge.completed {
  background: rgba(76, 206, 172, 0.15);
  color: var(--success);
}

.status-badge.failed {
  background: rgba(244, 67, 54, 0.15);
  color: var(--danger);
}

/* Job Details Modal/Expanded */
.job-details {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.job-files {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.job-file-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.job-file-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.job-file-btn svg {
  width: 14px;
  height: 14px;
}

/* ============================================================================
   View Sections (Tab Content)
   ============================================================================ */

.view-section {
  display: none;
}

.view-section.active {
  display: block;
}

/* ============================================================================
   Footer
   ============================================================================ */

footer {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ============================================================================
   Utility Classes
   ============================================================================ */

.hidden {
  display: none !important;
}

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

.text-center {
  text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

/* ============================================================================
   Users Table
   ============================================================================ */

.users-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.users-table th,
.users-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.users-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  background: var(--bg-input);
}

.users-table td {
  font-size: 0.875rem;
  color: var(--text);
}

.users-table tbody tr:hover {
  background: var(--bg-input);
}

.users-table .user-email-cell {
  font-weight: 500;
}

.users-table .user-actions {
  display: flex;
  gap: 0.5rem;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.role-badge.superadmin {
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary);
}

.role-badge.user {
  background: rgba(107, 122, 138, 0.15);
  color: var(--text-secondary);
}

/* ============================================================================
   Modal
   ============================================================================ */

.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 450px;
  box-shadow: var(--shadow-lg);
  z-index: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  max-height: 60vh;
  overflow-y: auto;
}

/* ============================================================================
   Reconnect Dialog
   ============================================================================ */

.reconnect-dialog {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.reconnect-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  max-width: 400px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.reconnect-content h3 {
  color: var(--primary);
  margin-bottom: 0.75rem;
  font-size: 1.25rem;
}

.reconnect-content p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.reconnect-job-info {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1rem;
}

.reconnect-job-info strong {
  color: var(--text);
  display: block;
  margin-bottom: 0.25rem;
}

.reconnect-job-info small {
  color: var(--text-muted);
}

.reconnect-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.reconnect-actions .btn {
  min-width: 100px;
}

/* ============================================================================
   Responsive
   ============================================================================ */

@media (max-width: 768px) {
  .top-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0.5rem;
  }

  .nav-tabs {
    order: 3;
    width: 100%;
    justify-content: center;
    position: static;
    transform: none;
  }

  .nav-tab {
    padding: 0.75rem 1rem;
    border-bottom: none;
    border-radius: var(--radius-sm);
  }

  .nav-tab.active {
    background: rgba(33, 150, 243, 0.15);
  }

  .nav-user {
    gap: 0.5rem;
  }

  .user-email {
    display: none;
  }
}

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

  .form-section {
    padding: 1rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .log-container {
    height: 300px;
  }

  .login-card {
    padding: 1.5rem;
  }

  .job-card-header {
    flex-direction: column;
    gap: 0.5rem;
  }

  .job-card-meta {
    flex-wrap: wrap;
  }
}

/* ============================================================================
   Organization Switcher
   ============================================================================ */

.org-switcher {
  position: relative;
  margin-right: 1rem;
}

.org-switcher-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  cursor: pointer;
  font-size: 0.875rem;
  transition: all var(--transition);
}

.org-switcher-btn:hover {
  border-color: var(--primary);
}

.org-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 220px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 100;
}

.org-dropdown-header {
  padding: 0.75rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.org-dropdown-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: none;
  color: var(--text);
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition);
}

.org-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.org-dropdown-item.active {
  background: rgba(33, 150, 243, 0.1);
  color: var(--primary);
}

.org-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 0.5rem 0;
}

/* ============================================================================
   Organization Tabs
   ============================================================================ */

.org-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.org-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: calc(var(--radius) - 2px);
  transition: all var(--transition);
}

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

.org-tab.active {
  background: var(--primary);
  color: white;
}

.org-tab-content {
  display: none;
}

.org-tab-content.active {
  display: block;
}

/* ============================================================================
   Checkbox Group
   ============================================================================ */

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}

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

.checkbox-label input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--primary);
}

/* ============================================================================
   Webhook Card
   ============================================================================ */

.webhook-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.webhook-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.webhook-card-title {
  font-weight: 600;
  color: var(--text);
}

.webhook-card-url {
  font-size: 0.8rem;
  color: var(--text-muted);
  word-break: break-all;
}

.webhook-card-events {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-top: 0.75rem;
}

.webhook-event-tag {
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  background: rgba(33, 150, 243, 0.1);
  color: var(--primary);
  border-radius: 9999px;
}

.webhook-card-actions {
  display: flex;
  gap: 0.5rem;
}

/* ============================================================================
   Pagination
   ============================================================================ */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#auditPageInfo {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ============================================================================
   Audit Log Styles
   ============================================================================ */

.audit-action {
  font-family: monospace;
  font-size: 0.8rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.audit-details {
  font-size: 0.75rem;
  color: var(--text-muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================================
   Email Upload Feature
   ============================================================================ */

/* Config Row - Workspace selector with button */
.config-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.config-btn-wrapper {
  padding-top: 1.75rem; /* Align with select input (accounts for label height) */
  flex-shrink: 0;
}

/* Config List in Modal */
.config-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.config-item-info {
  display: flex;
  flex-direction: column;
}

.config-item-name {
  font-weight: 500;
  color: var(--text);
}

.config-item-provider {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: capitalize;
}

.config-item-actions {
  display: flex;
  gap: 0.5rem;
}

/* Job Selection List */
.job-select-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.job-select-card {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color 0.15s;
}

.job-select-card:hover {
  border-color: var(--primary);
}

.job-select-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.job-select-info {
  flex: 1;
}

.job-select-title {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

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

.job-select-files {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.job-file-checkbox {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s;
}

.job-file-checkbox:hover {
  border-color: var(--primary);
  background: var(--bg-card-hover);
}

.job-file-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.job-file-checkbox input[type="checkbox"]:checked + .job-file-name {
  color: var(--primary);
}

.job-file-name {
  flex: 1;
  font-weight: 500;
  color: var(--text);
}

.job-file-count {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
}

/* Upload Results Summary */
.upload-results-summary {
  margin-bottom: 1rem;
}

.upload-summary {
  display: flex;
  gap: 1.5rem;
  padding: 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.upload-summary.success {
  border-color: var(--success);
}

.upload-summary.warning {
  border-color: var(--warning);
}

.upload-summary.error {
  border-color: var(--danger);
}

.upload-summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.upload-summary-number {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}

.upload-summary-stat.success .upload-summary-number {
  color: var(--success);
}

.upload-summary-stat.error .upload-summary-number {
  color: var(--danger);
}

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

/* Upload Failed List */
.upload-failed-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.upload-failed-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid rgba(244, 67, 54, 0.3);
  border-radius: var(--radius-sm);
}

.upload-failed-email {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text);
}

.upload-failed-error {
  font-size: 0.75rem;
  color: var(--danger);
  max-width: 300px;
  text-align: right;
}

/* Upload History */
.upload-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.upload-history-item {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.upload-history-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.upload-history-info {
  flex: 1;
}

.upload-history-name {
  font-weight: 600;
  color: var(--text);
}

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

.upload-history-stats {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
}

.upload-history-stats .stat-item {
  color: var(--text-secondary);
}

.upload-history-stats .stat-item.success {
  color: var(--success);
}

.upload-history-stats .stat-item.error {
  color: var(--danger);
}

.upload-history-stats .stat-item strong {
  font-weight: 600;
}

/* Spin animation for loading button */
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Button icon styles */
.btn-icon {
  width: 18px;
  height: 18px;
  background: transparent;
  border: none;
  padding: 0.375rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}

.btn-icon:hover {
  color: var(--text);
}

.btn-icon.btn-danger {
  background: transparent;
}

.btn-icon.btn-danger:hover {
  color: var(--danger);
}

/* Role badges for email configs */
.role-badge.role-admin {
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary);
}

.role-badge.role-owner {
  background: rgba(156, 39, 176, 0.15);
  color: #ba68c8;
}

.role-badge.role-member {
  background: rgba(107, 122, 138, 0.15);
  color: var(--text-secondary);
}

/* Responsive adjustments for email upload */
@media (max-width: 600px) {
  .upload-summary {
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
  }

  .upload-summary-stat {
    flex: 0 0 calc(50% - 0.5rem);
  }

  .upload-failed-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .upload-failed-error {
    max-width: 100%;
    text-align: left;
  }

  .job-file-checkbox {
    flex-wrap: wrap;
  }

  .job-file-count {
    width: 100%;
    margin-top: 0.25rem;
    text-align: center;
  }
}

/* ============================================================================
   Multi-Domain & Feature Flags
   ============================================================================ */

.domain-entry {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.domain-entry-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.domain-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.add-domain-btn {
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.flag-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary-light);
  margin-left: 0.35rem;
  vertical-align: middle;
}

.feature-flags-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.checkbox-label input[type="checkbox"] {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
}

/* ============================================================================
   Plan Badges
   ============================================================================ */

.plan-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}

.plan-badge.plan-free {
  background: rgba(107, 122, 138, 0.15);
  color: var(--text-secondary);
}

.plan-badge.plan-pro {
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary-light);
}

.plan-badge.plan-enterprise {
  background: rgba(156, 39, 176, 0.15);
  color: #ce93d8;
}

.plan-badge.plan-trial {
  background: rgba(255, 152, 0, 0.15);
  color: #ffb74d;
}

.plan-badge.plan-starter {
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary-light);
}

.plan-badge.plan-growth {
  background: rgba(76, 175, 80, 0.15);
  color: #81c784;
}

.plan-badge.plan-scale {
  background: rgba(156, 39, 176, 0.15);
  color: #ce93d8;
}

/* ============================================================================
   Users Stats Bar
   ============================================================================ */

.users-stats-bar {
  display: flex;
  gap: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.users-stats-bar .stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

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

/* ============================================================================
   Users Search Bar
   ============================================================================ */

.users-search-bar {
  margin-bottom: 1.5rem;
}

.search-input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ============================================================================
   Plan Override Indicators
   ============================================================================ */

.plan-included-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: 0.25rem;
}

.flag-from-plan {
  opacity: 0.7;
}

/* ============================================================================
   Domain Management
   ============================================================================ */

.domains-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
}

.domains-header h1 {
  margin: 0;
}

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

.domains-stats-bar {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.domains-stat {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.domains-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
}

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

.domains-search-bar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.filter-select {
  padding: 0.75rem 1rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
  min-width: 140px;
}

.filter-select:focus {
  border-color: var(--border-focus);
}

/* Shared data table (reused across Domains, etc.) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.data-table th,
.data-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.data-table td {
  font-size: 0.875rem;
  color: var(--text);
}

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

/* Domain status badges */
.domain-status-badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
}

.domain-status-badge.status-active {
  background: rgba(76, 206, 172, 0.15);
  color: var(--success);
}

.domain-status-badge.status-provisioning {
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary);
}

.domain-status-badge.status-dns_pending {
  background: rgba(255, 167, 38, 0.15);
  color: var(--warning);
}

.domain-status-badge.status-error {
  background: rgba(244, 67, 54, 0.15);
  color: var(--danger);
}

.domain-status-badge.status-deleted {
  background: rgba(107, 122, 138, 0.15);
  color: var(--text-muted);
}

/* Domain progress bar */
.domain-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}

.domain-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.domain-progress-fill {
  height: 100%;
  background: var(--success);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.domain-progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Domain tags */
.domain-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
}

.domain-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  background: rgba(33, 150, 243, 0.12);
  color: var(--primary-light);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}

.domain-tag-remove {
  cursor: pointer;
  opacity: 0.6;
  font-size: 0.85rem;
  line-height: 1;
}

.domain-tag-remove:hover {
  opacity: 1;
}

.domain-tag-add {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.domain-tag-add:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Domain actions dropdown */
.domain-actions-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  font-size: 1.1rem;
  border-radius: var(--radius-sm);
}

.domain-actions-btn:hover {
  background: var(--bg-input);
  color: var(--text);
}

.domain-actions-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-width: 160px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 1000;
  padding: 0.25rem 0;
}

.domain-actions-item {
  display: block;
  width: 100%;
  padding: 0.5rem 1rem;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
}

.domain-actions-item:hover {
  background: var(--bg-input);
}

.domain-actions-item.danger {
  color: var(--danger);
}

/* Domain detail modal sections */
.domain-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.domain-detail-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.domain-detail-field label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.domain-detail-field span {
  font-size: 0.9rem;
  color: var(--text);
}

.dns-results {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.dns-record {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: var(--bg-input);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.dns-record-status {
  font-weight: 600;
}

.dns-record-status.found {
  color: var(--success);
}

.dns-record-status.missing {
  color: var(--danger);
}

.mailbox-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.5rem;
}

.mailbox-item {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

/* Health Check Results */
.health-check-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 0.25rem;
}
.health-check-table th {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.health-check-table td {
  padding: 0.35rem 0.4rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
}
.hc-pass { color: var(--success); font-weight: 600; }
.hc-fail { color: var(--danger); font-weight: 600; }
.hc-fixed { color: var(--success); font-weight: 600; text-decoration: underline; }
.hc-summary {
  margin-top: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}
.hc-summary.all-pass {
  background: rgba(76, 206, 172, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}
.hc-summary.has-issues {
  background: rgba(244, 67, 54, 0.1);
  border: 1px solid var(--danger);
  color: var(--text);
}

@media (max-width: 768px) {
  .domains-header {
    flex-direction: column;
    gap: 1rem;
  }
  .domains-search-bar {
    flex-direction: column;
  }
  .filter-select {
    min-width: 100%;
  }
  .domain-detail-grid {
    grid-template-columns: 1fr;
  }
}

/* Saved credentials notice in deploy form */
.saved-creds-notice {
  background: rgba(76, 175, 80, 0.1);
  border: 1px solid rgba(76, 175, 80, 0.3);
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--success);
  margin-bottom: 1rem;
}

/* ============================================================================
   Integration Cards (Settings)
   ============================================================================ */

.integration-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}

.integration-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.integration-header h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  color: var(--text);
}

.integration-status {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.integration-status.configured {
  color: var(--success);
}

.integration-form {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.integration-form .form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  align-items: center;
}

/* ============================================================================
   Subscription / Plan Card (Settings)
   ============================================================================ */

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.plan-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.plan-details {
  flex: 1;
}

.plan-usage {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

#domainUsageText {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.usage-bar {
  width: 100%;
  max-width: 200px;
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
}

.usage-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.usage-fill.warning {
  background: var(--warning, #ff9800);
}

.usage-fill.critical {
  background: var(--danger);
}

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

/* Domain usage indicator in header */
.domain-usage-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem;
  background: rgba(33, 150, 243, 0.1);
  border: 1px solid rgba(33, 150, 243, 0.2);
  border-radius: 6px;
  font-size: 0.75rem;
  color: var(--primary-light);
  font-weight: 600;
  white-space: nowrap;
}

.domain-usage-badge.warning {
  background: rgba(255, 152, 0, 0.1);
  border-color: rgba(255, 152, 0, 0.2);
  color: #ff9800;
}

.domain-usage-badge.critical {
  background: rgba(244, 67, 54, 0.1);
  border-color: rgba(244, 67, 54, 0.2);
  color: var(--danger);
}

/* ============================================================================
   Pricing Cards
   ============================================================================ */

.pricing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.pricing-container {
  background: var(--bg-secondary);
  border-radius: 12px;
  padding: 2rem;
  max-width: 900px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.pricing-container h2 {
  text-align: center;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.pricing-container .subtitle {
  text-align: center;
  margin-bottom: 2rem;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.pricing-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  transition: border-color 0.2s, transform 0.2s;
}

.pricing-card:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
}

.pricing-card.recommended {
  border-color: var(--primary);
  position: relative;
}

.pricing-card.recommended::before {
  content: 'Most Popular';
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  border-radius: 9999px;
  text-transform: uppercase;
}

.pricing-card h3 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.pricing-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-light);
}

.pricing-price span {
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--text-secondary);
}

.pricing-features {
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
  text-align: left;
}

.pricing-features li {
  padding: 0.35rem 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pricing-features li::before {
  content: '';
  width: 16px;
  height: 16px;
  background: rgba(76, 175, 80, 0.2);
  border-radius: 50%;
  flex-shrink: 0;
}

@media (max-width: 768px) {
  .pricing-grid {
    grid-template-columns: 1fr;
  }
  .plan-card {
    flex-direction: column;
    align-items: stretch;
  }
  .plan-actions {
    justify-content: flex-end;
  }
}

/* ============================================================================
   Empty States
   ============================================================================ */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-secondary);
}

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

.empty-state p {
  font-size: 0.9rem;
  max-width: 400px;
  margin: 0 auto;
}

/* ============================================================================
   Onboarding / Start Here
   ============================================================================ */

.onboarding-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 600px;
  margin: 0 auto;
}

.onboarding-step {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}

.onboarding-step.completed {
  border-color: rgba(76, 175, 80, 0.3);
}

.onboarding-step.completed .step-number {
  display: none;
}

.onboarding-step.completed .step-check {
  display: flex !important;
}

.step-indicator {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-number {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(33, 150, 243, 0.15);
  color: var(--primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.step-check {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-content h3 {
  font-size: 1rem;
  margin: 0 0 0.25rem 0;
}

.step-content p {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem 0;
}

.step-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.step-status {
  font-size: 0.8rem;
  color: var(--success);
  font-weight: 500;
}

/* ============================================================================
   Dashboard
   ============================================================================ */

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.dash-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.dash-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.dash-card-header h3 {
  font-size: 0.95rem;
  margin: 0;
}

.dash-usage {
  text-align: center;
}

.dash-usage-numbers {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
}

.dash-usage-current {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary-light);
}

.dash-usage-separator {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 300;
}

.dash-usage-limit {
  font-size: 1.5rem;
  color: var(--text-secondary);
  font-weight: 500;
}

.dash-usage-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: block;
  margin-top: 0.5rem;
}

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

.dash-actions .btn {
  justify-content: flex-start;
  gap: 0.5rem;
}

/* Recent jobs in dashboard */
.dash-job-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

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

.dash-job-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

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

.dash-job-status.completed { background: var(--success); }
.dash-job-status.failed { background: var(--danger); }
.dash-job-status.running { background: var(--primary); }

.dash-job-date {
  color: var(--text-secondary);
  font-size: 0.8rem;
}

/* Domain health summary */
.dash-health-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.dash-health-stat {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

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

.dash-health-dot.healthy { background: var(--success); }
.dash-health-dot.warning { background: #ff9800; }
.dash-health-dot.error { background: var(--danger); }

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .onboarding-step {
    flex-direction: column;
    align-items: flex-start;
  }
}
