:root {
  --primary: #0b57d0;
  --primary-dark: #084a9e;
  --secondary: #f3f3f3;
  --text: #202124;
  --text-light: #5f6368;
  --border: #dadce0;
  --error: #d33b27;
  --success: #0d7d0d;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  background: #fff;
}

/* Static pages (FAQ, Contact) - ensure normal document flow */
body.static-page {
  display: block;
  height: auto;
  min-height: auto;
  overflow: auto;
}

body.static-page > main {
  margin-top: 0;
  padding-top: 0;
}

header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  height: 120px;
  padding: 0 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
}

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

.mods-logo {
  position: absolute;
  left: 2rem;
}

.mods-logo .logo-image {
  margin: 10px 0;
}

.brand-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-image {
  display: block;
  height: 100px;
  width: 100px;
  object-fit: contain;
}

.logo-text {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
}

nav a {
  margin-left: 2rem;
  text-decoration: none;
  color: var(--text);
}

nav a:hover {
  color: var(--primary);
}

nav {
  position: absolute;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
}

/* Hamburger menu button - hidden on desktop */
.nav-toggle {
  display: none;
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  position: relative;
  transition: background 0.2s ease;
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  width: 24px;
  height: 2px;
  background: var(--text);
  left: 0;
  transition: transform 0.3s ease, top 0.3s ease;
}

.hamburger::before {
  top: -7px;
}

.hamburger::after {
  top: 7px;
}

/* Hamburger animation when menu is open */
.nav-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  top: 0;
  transform: rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Responsive nav - tablet and mobile (1024px catches horizontal phones + iPad Mini) */
@media (max-width: 1024px) {
  .nav-toggle {
    display: block;
  }

  header {
    height: 80px;
    padding: 0 1rem;
  }

  .mods-logo {
    left: 1rem;
  }

  .mods-logo .logo-image {
    height: 60px;
    width: 60px;
  }

  .logo-image {
    height: 60px;
    width: 60px;
  }

  .brand-center {
    position: static;
    transform: none;
    flex: 1;
    text-align: center;
  }

  .logo-text {
    font-size: 1.25rem;
  }

  nav {
    position: fixed;
    top: 80px;
    right: 0;
    width: 100%;
    max-width: 300px;
    height: calc(100vh - 80px);
    background: #fff;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem 0;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  nav.open {
    transform: translateX(0);
  }

  nav a {
    margin: 0;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: block;
  }

  nav a:hover {
    background: var(--secondary);
  }

  .currency-nav-item {
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  .currency-nav-item label {
    font-size: 0.875rem;
    color: var(--text-light);
  }

  .currency-select-nav {
    width: 100%;
  }

  /* Overlay when menu is open */
  body.nav-open::before {
    content: '';
    position: fixed;
    top: 80px;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 999;
  }
}

/* Mobile - smaller adjustments */
@media (max-width: 480px) {
  header {
    height: 60px;
    padding: 0 0.75rem;
  }

  .mods-logo {
    left: 0.75rem;
  }

  .mods-logo .logo-image {
    height: 40px;
    width: 40px;
  }

  .logo-image {
    height: 40px;
    width: 40px;
  }

  .logo-text {
    font-size: 1rem;
  }

  .nav-toggle {
    right: 0.75rem;
  }

  nav {
    top: 60px;
    height: calc(100vh - 60px);
    max-width: 100%;
  }

  body.nav-open::before {
    top: 60px;
  }
}

.api-keys-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-top: 1.5rem;
  background: #fff;
}

.api-keys-panel + [data-upgrade-panel] {
  margin-top: 20px;
}

.api-keys-summary {
  list-style: none;
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
  cursor: pointer;
}

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

.api-keys-summary::before {
  content: '▶';
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-right: 0.5rem;
  margin-top: 0.1rem;
}

.api-keys-panel[open] .api-keys-summary::before {
  content: '▼';
}

.api-keys-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.api-keys-section-title {
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 0.25rem;
}

.api-keys-subtitle {
  margin: 0;
  color: var(--text-light);
}

.api-keys-toggle {
  display: none;
}

.api-keys-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
  margin-left: auto;
}

.api-keys-body {
  margin-top: 1rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Dashboard Layout - Responsive sidebar for Upgrade section
   ───────────────────────────────────────────────────────────────────────────── */

.dashboard-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 2rem 0;
}

.dashboard-main {
  min-width: 0;
}

.dashboard-sidebar {
  min-width: 0;
}

@media (min-width: 1200px) {
  .dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 2rem;
    align-items: start;
  }

  .dashboard-sidebar {
    position: sticky;
    top: 2rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Account Layout
   ───────────────────────────────────────────────────────────────────────────── */

.account-layout {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  margin: 2rem 0;
}

.account-main {
  min-width: 0;
}

.account-sidebar {
  min-width: 0;
}

.account-card {
  border: 1px solid var(--border);
  padding: 1.5rem;
  border-radius: 8px;
  background: var(--bg);
}

.account-card h3 {
  margin: 0 0 1rem;
}

.account-card .panel-title {
  font-weight: 700;
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
}

.account-card .panel-subtitle {
  margin: 0 0 1rem;
  color: var(--text-muted);
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.account-danger-zone {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.account-danger-zone p {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.account-danger-zone .btn-ghost,
.account-danger-zone-card .btn-ghost {
  color: var(--error);
}

.account-danger-zone .btn-ghost:hover,
.account-danger-zone-card .btn-ghost:hover {
  background: rgba(239, 68, 68, 0.1);
}

@media (min-width: 900px) {
  .account-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
  }

  .account-sidebar {
    position: sticky;
    top: 2rem;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   File Drop Zone
   ───────────────────────────────────────────────────────────────────────────── */

.file-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
  position: relative;
}

.file-drop-zone:hover,
.file-drop-zone.is-dragover {
  border-color: var(--primary);
  background: rgba(11, 87, 208, 0.04);
}

.file-drop-zone.has-file {
  border-style: solid;
  border-color: var(--success);
  background: rgba(13, 125, 13, 0.04);
}

.file-drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

/* Disable file input click when file is selected (so clear button works) */
.file-drop-zone.has-file input[type="file"] {
  pointer-events: none;
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  pointer-events: none;
}

.drop-zone-icon {
  font-size: 2.5rem;
}

.drop-zone-text {
  color: var(--text-light);
  font-size: 0.95rem;
}

.drop-zone-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  pointer-events: none;
}

.preview-filename {
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.preview-clear {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
  padding: 0.25rem;
  line-height: 1;
  pointer-events: auto;
}

.preview-clear:hover {
  color: var(--error);
}

/* Logo drop zone variant - smaller */
.file-drop-zone--logo {
  padding: 1rem;
}

.file-drop-zone--logo .drop-zone-icon {
  font-size: 1.75rem;
}

.file-drop-zone--logo .drop-zone-text {
  font-size: 0.85rem;
}

.drop-zone-hint {
  color: var(--text-lighter);
  font-size: 0.75rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Collapsible Options Sections
   ───────────────────────────────────────────────────────────────────────────── */

.options-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  background: #fafbfc;
}

.options-summary {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  gap: 0;
}

.options-summary::-webkit-details-marker {
  display: none;
}

.options-summary::before {
  content: '▶';
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-right: 0.5rem;
  margin-top: 0.15rem;
}

.options-title-group {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.options-title {
  font-weight: 700;
  font-size: 1.1rem;
}

.options-subtitle {
  font-size: 0.8rem;
  color: #5f6368;
  font-weight: 400;
  line-height: 1.3;
}

.options-subtitle:empty {
  display: none;
}

.options-subtitle.error {
  color: var(--danger);
}

.options-section[open] .options-subtitle {
  display: none;
}

.options-toggle {
  display: none;
}

.options-section[open] .options-summary::before {
  content: '▼';
}

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

.options-section[open] .options-body {
  animation: optionsSlideDown 0.2s ease;
}

@keyframes optionsSlideDown {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   Radio Group for Timestamp Placement
   ───────────────────────────────────────────────────────────────────────────── */

.radio-group {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  cursor: pointer;
  font-weight: 400;
  font-size: 0.95rem;
}

.radio-label input[type="radio"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}

/* ─────────────────────────────────────────────────────────────────────────────
   API Keys Count Preview (when collapsed)
   ───────────────────────────────────────────────────────────────────────────── */

.api-keys-count {
  font-size: 0.85rem;
  color: var(--text-light);
  margin: 0.35rem 0 0;
}

.api-keys-panel[open] .api-keys-count {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Credential Row with Copy Button
   ───────────────────────────────────────────────────────────────────────────── */

.credential-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  gap: 1rem;
}

.credential-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}

.credential-type {
  color: var(--text-light);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.credential-id {
  font-size: 0.8rem;
  color: var(--text-light);
  background: #f1f5f9;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-family: monospace;
}

.credential-last-used {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  margin-left: auto;
}

.copy-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.copy-btn:hover {
  border-color: var(--primary);
  background: rgba(11, 87, 208, 0.04);
}

.copy-btn.copied {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Info Icon Tooltips
   ───────────────────────────────────────────────────────────────────────────── */

.info-trigger {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-light);
  font-size: 0.7rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 0.35rem;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.info-trigger:hover {
  border-color: var(--primary);
  color: var(--primary);
}

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

.hero {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.feature-icon {
  width: 30px;
  height: 30px;
  object-fit: contain;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.hero p {
  font-size: 1.1rem;
  margin-bottom: 2rem;
}

.btn {
  padding: 0.75rem 1.5rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  text-decoration: none;
  display: inline-block;
}

.btn[disabled] {
  cursor: not-allowed;
  opacity: 0.7;
}

.btn.is-loading {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.6);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.btn-success {
  background: #28a745;
}

.btn-success:hover {
  background: #218838;
}

.btn:hover {
  background: var(--primary-dark);
}

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

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

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  grid-template-rows: 44px auto;
  column-gap: 2rem;
  row-gap: 1rem;
  padding: 2rem 0;
  align-items: stretch;
  align-content: start;
}

.price-card {
  align-self: stretch;
  display: flex;
  flex-direction: column;
}

/* Currency Selector (Nav) */
.currency-nav-item {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  color: var(--text);
  margin-left: 1.5rem;
}

.currency-nav-item label {
  font-size: 0.65rem;
  font-weight: 500;
  opacity: 0.7;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.currency-select-nav {
  padding: 0.2rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  min-width: auto;
}

.currency-select-nav:focus {
  outline: none;
  border-color: var(--primary);
}

.currency-select-nav option {
  background: var(--bg);
  color: var(--text);
}

.billing-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  height: 44px;
  line-height: 1;
  margin-bottom: 0;
}

.pricing-toggle-slot {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  align-self: start;
}

.toggle-left { grid-column: 1; grid-row: 1; }
.toggle-center { grid-column: 2; grid-row: 1; }
.toggle-right { grid-column: 3; grid-row: 1; }
.card-free { grid-column: 1; grid-row: 2; }
.card-center { grid-column: 2; grid-row: 2; }
.card-right { grid-column: 3; grid-row: 2; }

.billing-label {
  color: var(--text);
}

.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 32px;
  margin-bottom: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #cbd5f5;
  transition: 0.2s;
  border-radius: 999px;
}

.slider::before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  transition: 0.2s;
  border-radius: 50%;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.2);
}

.switch input:checked + .slider {
  background-color: var(--primary);
}

.switch input:checked + .slider::before {
  transform: translateX(28px);
}

@media (max-width: 1080px) {
  .pricing-grid {
    grid-template-columns: 1fr;
    row-gap: 1.5rem;
  }

  .toggle-left { order: 1; }
  .card-free { order: 2; }
  .toggle-center { order: 3; }
  .card-center { order: 4; }
  .toggle-right { order: 5; }
  .card-right { order: 6; }
}

.upgrade-billing-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 0;
}

.upgrade-options-grid {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.upgrade-options-stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1rem;
}

.upgrade-option-card {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.upgrade-option-card h4 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}

.upgrade-price-line {
  margin-bottom: 0.25rem;
}

.upgrade-price {
  font-size: 1.75rem;
  font-weight: bold;
  color: var(--primary);
}

.upgrade-price-suffix {
  font-size: 0.85rem;
  color: var(--text-light);
}

.upgrade-billed {
  font-size: 0.8rem;
  color: var(--text-light);
  margin-bottom: 0.75rem;
  min-height: 1.2em;
}

.upgrade-button {
  width: 100%;
  margin-bottom: 1rem;
}

.upgrade-list {
  list-style: none;
  text-align: left;
  width: 100%;
  margin: 0;
}

.upgrade-list li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

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

@media (max-width: 600px) {
  .upgrade-options-grid {
    flex-direction: column;
  }
}

/* Current Plan Indicator */
.current-plan-indicator {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.current-plan-label {
  color: var(--text-light);
}

.current-plan-value {
  font-weight: 600;
  color: var(--text);
}

.current-plan-value.is-premium {
  color: var(--primary);
}

/* Premium Badge Highlight - connects to upgrade */
.panel-badge {
  background: rgba(11, 87, 208, 0.12);
  color: var(--primary);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
  cursor: help;
  transition: background-color 0.15s ease;
}

.panel-badge:hover {
  background: rgba(11, 87, 208, 0.2);
}

.price-note {
  color: #0d7d0d;
  margin-bottom: 1rem;
  font-weight: 600;
}

.price-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
}

.price-card.featured {
  border: 2px solid var(--primary);
  box-shadow: 0 12px 24px rgba(11, 87, 208, 0.18);
}

.price-card h3 {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.price-card .price {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 1rem;
}

.price-card ul {
  list-style: none;
  text-align: left;
  margin-bottom: 2rem;
}

.price-card-footnote {
  margin-top: 1rem;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.4;
}

.price-card-footnote p {
  margin: 0.25rem 0;
}

.price-card li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.auth-form {
  max-width: 400px;
  margin: 2rem auto;
  padding: 2rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
}

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

.footer-options .footer-option-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

@media (max-width: 600px) {
  .footer-options .footer-option-row {
    grid-template-columns: 1fr;
  }
}

.footer-option {
  min-width: 0;
}

.footer-option span {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.footer-option select {
  width: 100%;
  font-size: 0.8rem;
}

.footer-alternate {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 1rem;
}

.info-tooltip {
  cursor: help;
  opacity: 0.6;
  font-size: 0.85em;
  margin-left: 0.25rem;
  position: relative;
}
.info-tooltip:hover {
  opacity: 1;
}
.info-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #333;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  white-space: pre;
  text-align: left;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 100;
  margin-bottom: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  border: 1px solid #ddd;
}
.info-tooltip:hover::after {
  opacity: 1;
}

#signupTerms {
  width:auto;
  vertical-align: baseline;
}

.social-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.social-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.social-btn:hover {
  border-color: rgba(11, 87, 208, 0.35);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.social-btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.social-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #f1f5f9;
  flex-shrink: 0;
}

.social-icon svg {
  width: 18px;
  height: 18px;
  display: block;
}

.social-divider {
  text-align: center;
  color: var(--text-light);
  margin: 2.45rem 0 0.75rem;
  font-size: calc(0.95rem + 2pt);
  font-weight: 600;
}


label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0;
  white-space: nowrap;
}

.checkbox-label input[type="checkbox"] {
  margin: 0;
}

.label-with-tooltip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.tooltip-trigger {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-light);
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-3px);
}

.tooltip-trigger:hover {
  color: var(--text);
  border-color: rgba(11, 87, 208, 0.3);
}

.tooltip-content {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.5rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  width: 240px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  display: none;
  z-index: 10;
}

.tooltip-content.is-open {
  display: block;
}

.tooltip-content p {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.tooltip-content ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-light);
  font-size: 0.85rem;
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: 6px;
}

.password-toggle:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.06);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: -0.5rem 0 1.5rem;
  flex-wrap: wrap;
}

.remember-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-light);
  font-size: 0.9rem;
  line-height: 1;
}

.remember-toggle input {
  display: none;
}

.toggle-track {
  width: 40px;
  height: 22px;
  border-radius: 999px;
  background: #e2e8f0;
  position: relative;
  transition: background 0.2s ease;
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}

.remember-toggle input:checked + .toggle-track {
  background: #22c55e;
}

.remember-toggle input:checked + .toggle-track::after {
  transform: translateX(18px);
}

.forgot-link {
  display: inline-flex;
  align-items: center;
  line-height: 1;
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  margin-top: -9px;
}

.remember-text {
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

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

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.1);
}

.tabs {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.tab-btn {
  padding: 0.95rem 1rem;
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--text-light);
}

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

.tab-content {
  display: none;
}

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

.conversion-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: stretch;
}

.conversion-form.has-premium-panel {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.conversion-main {
  min-width: 0;
}

.conversion-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  padding: 1.25rem;
}

.conversion-panel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  padding: 1.25rem;
  position: static;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.panel-title {
  font-weight: 700;
  margin: 0 0 0.15rem;
  font-size: 1rem;
}

.panel-subtitle {
  margin: 0;
  color: var(--text-light);
  font-size: 0.85rem;
}

.panel-badge {
  background: rgba(11, 87, 208, 0.12);
  color: var(--primary);
  font-weight: 600;
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
  white-space: nowrap;
}

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

.timestamp-options {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}

.helper-text {
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: block;
  margin-top: 0.35rem;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 768px) {
  .conversion-form.has-premium-panel {
    grid-template-columns: 1fr;
  }

  .conversion-panel {
    position: static;
  }
}

.loading {
  display: none;
  color: var(--text-light);
  margin-top: 1rem;
}

.success {
  color: var(--success);
  margin-top: 1rem;
}

.error {
  color: var(--error);
  margin-top: 1rem;
}

.message {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.terms-check {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.95rem;
  width: fit-content;
  margin: 0 auto;
}

.terms-check input {
  margin: 0;
}

.terms-check > * {
  flex: 0 0 auto;
}

.terms-check span,
.terms-check a {
  display: inline;
}


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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  max-width: 420px;
  width: 100%;
  border: 1px solid var(--border);
}

.terms-scroll {
  max-height: 220px;
  overflow-y: auto;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
  margin: 0.5rem 0 1rem;
  font-size: 0.95rem;
  color: var(--text);
}

.terms-scroll p {
  margin: 0 0 0.75rem;
}

.terms-instructions {
  font-size: 0.9rem;
  color: var(--text-light);
  margin-bottom: 1rem;
}

.modal h3 {
  margin-bottom: 0.5rem;
}

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

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

footer {
  background: var(--secondary);
  border-top: 1px solid var(--border);
  padding: 2rem;
  text-align: center;
  color: var(--text-light);
}

footer .footer-content {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

footer .footer-logo {
  width: 50px;
  height: 50px;
  object-fit: contain;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: radial-gradient(circle at top, rgba(11, 87, 208, 0.12), transparent 55%),
    radial-gradient(circle at 20% 80%, rgba(34, 197, 94, 0.12), transparent 50%),
    #f8fafc;
  z-index: 2000;
}

body.loading .loading-overlay {
  display: flex;
}

.loading-overlay.is-visible {
  display: flex;
}

.loading-card {
  width: min(420px, 90vw);
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 20px;
  padding: 2rem 2.25rem;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.15);
  text-align: center;
  backdrop-filter: blur(6px);
}

.loading-ring {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 3px solid rgba(148, 163, 184, 0.3);
  border-top-color: var(--primary);
  margin: 0 auto 1rem;
  animation: spin 0.9s linear infinite;
}

.loading-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.loading-timer {
  color: var(--text-light);
  font-size: 0.95rem;
}

.loading-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  margin-top: 1.2rem;
  overflow: hidden;
}

.loading-bar span {
  display: block;
  width: 40%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1b4ea8, #3aa0ff, #22c55e);
  animation: slide 1.4s ease-in-out infinite;
}

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

@keyframes slide {
  0% {
    transform: translateX(-60%);
  }
  50% {
    transform: translateX(60%);
  }
  100% {
    transform: translateX(160%);
  }
}

/* ==================== REUSABLE COMPONENTS ==================== */

/* Table Scroll Container - enables sticky headers */
.table-scroll-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.table-scroll-container .data-table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Admin panel needs flex layout for table scroll to work */
.admin-panel[data-admin-panel="users"] {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-panel[data-admin-panel="users"].active {
  display: flex;
}

/* Data Table Component */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  border: 1px solid var(--border);
}

.data-table thead {
  background: linear-gradient(to bottom, #f8f9fa, #f1f3f4);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-light);
  border-bottom: 2px solid var(--border);
  background: linear-gradient(to bottom, #f8f9fa, #f1f3f4);
}

.data-table td {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #eef0f2;
  font-size: 0.9rem;
  color: var(--text);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: #f8fafc;
}

.data-table tbody tr.selected {
  background: rgba(11, 87, 208, 0.06);
}

.data-table .cell-checkbox {
  width: 40px;
  text-align: center;
}

.data-table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

/* Custom Checkbox Component */
.checkbox-custom {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.checkbox-custom input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom .checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #c4c9d0;
  border-radius: 4px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.checkbox-custom:hover .checkmark {
  border-color: var(--primary);
}

.checkbox-custom input:checked + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-custom input:checked + .checkmark::after {
  content: '';
  width: 5px;
  height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}

.checkbox-custom input:indeterminate + .checkmark {
  background: var(--primary);
  border-color: var(--primary);
}

.checkbox-custom input:indeterminate + .checkmark::after {
  content: '';
  width: 8px;
  height: 2px;
  background: #fff;
  border: none;
  transform: none;
}

/* Badge Component */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 100px;
  text-transform: capitalize;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef3c7;
  color: #92400e;
}

.badge-error {
  background: #fee2e2;
  color: #991b1b;
}

.badge-info {
  background: #dbeafe;
  color: #1e40af;
}

.badge-neutral {
  background: #f3f4f6;
  color: #4b5563;
}

.badge-secondary {
  background: #e5e7eb;
  color: #6b7280;
}

.badge-admin {
  background: #fef3c7;
  color: #d97706;
  font-weight: 600;
}

/* Action Bar Component */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  gap: 1rem;
  flex-wrap: wrap;
}

.action-bar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.action-bar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.selection-info {
  font-size: 0.875rem;
  color: var(--text-light);
  padding: 0.5rem 0.75rem;
  background: #f1f5f9;
  border-radius: 6px;
  display: none;
}

.selection-info.visible {
  display: block;
}

.selection-info strong {
  color: var(--primary);
}

/* Button Variants */
.btn-sm {
  padding: 0.5rem 0.875rem;
  font-size: 0.8125rem;
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-danger:hover {
  background: #b91c1c;
}

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

.btn-ghost:hover {
  background: #f1f5f9;
}

.btn-icon {
  padding: 0.5rem;
  min-width: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Alert Component */
.alert {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.alert-success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.alert-warning {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

/* Confirmation Modal Enhancement */
.modal-danger .modal-title {
  color: #dc2626;
}

.modal-danger .btn-danger {
  background: #dc2626;
}

.modal-danger .btn-danger:hover {
  background: #b91c1c;
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.modal-body {
  color: var(--text-light);
  line-height: 1.5;
}

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

/* Responsive modal for mobile */
@media (max-width: 480px) {
  .modal {
    margin: 0.5rem;
    padding: 1rem;
    max-width: calc(100% - 1rem);
  }

  .modal-actions {
    flex-direction: column-reverse;
  }

  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

/* Password confirmation input in modal */
.modal .form-group {
  margin-bottom: 1rem;
}

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

.modal .form-group .input {
  width: 100%;
}

.modal .form-hint {
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.modal .input-error {
  border-color: var(--danger);
}

/* Input Validation States */
input.input-error {
  border-color: var(--danger) !important;
  background-color: rgba(220, 53, 69, 0.05);
}

input.input-valid {
  border-color: var(--success) !important;
}

input.input-validating {
  border-color: var(--primary) !important;
  background-image: linear-gradient(90deg, transparent, rgba(66, 133, 244, 0.1), transparent);
  background-size: 200% 100%;
  animation: validating-pulse 1.5s ease-in-out infinite;
}

@keyframes validating-pulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.repo-url-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

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

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

.empty-state-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.admin-header h1 {
  margin-bottom: 0.5rem;
}

.admin-header p {
  color: var(--text-light);
  max-width: 600px;
}

.admin-header {
  margin-bottom: 0.75rem;
  text-align: center;
}

.admin-header p {
  margin-left: auto;
  margin-right: auto;
}

.admin-tabs {
  display: flex;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.25rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.admin-stats {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  min-width: 140px;
}

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

.stat-label {
  font-size: 0.8rem;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* User Email Cell */
.user-email {
  font-weight: 500;
}

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

.stripe-id-cell {
  font-size: 0.75rem;
  font-family: monospace;
}

.stripe-id-cell a {
  color: var(--primary);
  text-decoration: none;
}

.stripe-id-cell a:hover {
  text-decoration: underline;
}

.admin-console {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Admin Sidebar Layout */
/* Admin layout - mobile first */
body:has(.admin-layout) {
  overflow: auto;
  height: auto;
}

.admin-layout {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  margin: 0;
  overflow: visible;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.25);
  background: #f8f9fa;
}

.admin-sidebar {
  width: 100%;
  background: linear-gradient(180deg, var(--primary) 0%, #1a3d7c 100%);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: row;
  padding: 0;
  position: relative;
  z-index: 100;
}

/* Mobile admin layout - dropdown navigation */
@media screen and (max-width: 1024px) {
  .admin-layout {
    min-height: auto !important;
  }

  .admin-sidebar {
    display: none !important;
  }

  .admin-nav-dropdown {
    display: block !important;
  }

  .admin-main {
    margin-left: 0 !important;
  }
}

/* Hide dropdown on desktop */
.admin-nav-dropdown {
  display: none;
  padding: 1rem;
  background: linear-gradient(180deg, var(--primary) 0%, #1a3d7c 100%);
}

.admin-nav-select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  cursor: pointer;
  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='white' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.admin-nav-select option {
  background: var(--primary);
  color: #fff;
}

/* Desktop admin layout */
@media (min-width: 1025px) {
  body:has(.admin-layout) {
    overflow: hidden;
    height: 100vh;
  }

  .admin-layout {
    flex-direction: row;
    height: calc(100vh - 120px);
    overflow: hidden;
    width: 100%;
  }

  .admin-sidebar {
    width: 240px;
    flex-direction: column;
    padding: 1.5rem 1rem;
    position: fixed;
    top: 120px;
    left: 0;
    height: calc(100vh - 120px);
  }
}

.admin-sidebar h2 {
  padding-left: 1rem;
  margin-bottom: 0.5rem;
}

.sidebar-nav {
  /* Override global nav positioning */
  position: static !important;
  right: auto !important;
  top: auto !important;
  transform: none !important;
  /* Sidebar nav styles - mobile first (horizontal) */
  display: flex;
  flex-direction: row;
  padding: 0 0.5rem;
  gap: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 1025px) {
  .sidebar-nav {
    flex-direction: column;
    padding: 1.25rem 0;
    gap: 0.5rem;
    overflow-x: visible;
  }
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  -webkit-appearance: none;
  appearance: none;
}

@media (min-width: 1025px) {
  .sidebar-nav-item {
    padding: 0.85rem 1rem 0.85rem 1.25rem;
    width: 100%;
    white-space: normal;
  }
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.sidebar-nav-item.active {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  border-bottom: 3px solid #fff;
}

@media (min-width: 1025px) {
  .sidebar-nav-item.active {
    border-bottom: none;
    border-left: 3px solid #fff;
    padding-left: calc(1.25rem - 3px);
  }
}

.sidebar-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  opacity: 0.9;
}

.sidebar-label {
  flex: 1;
}

.sidebar-version {
  display: none;
  margin-top: auto;
  padding: 1rem 1.25rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

@media (min-width: 1025px) {
  .sidebar-version {
    display: block;
  }
}

.admin-main {
  flex: 1;
  padding: 0;
  background: #f8f9fa;
  overflow: visible;
  position: relative;
  margin-left: 0;
  display: block;
}

@media (min-width: 1025px) {
  .admin-main {
    overflow: hidden;
    margin-left: 240px;
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
  }
}

.admin-main-header {
  flex-shrink: 0;
  background: #f8f9fa;
  z-index: 50;
  padding: 2rem 4rem 1rem;
  border-bottom: 1px solid var(--border);
}

.admin-main-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  padding: 1rem 4rem 3rem;
  display: flex;
  flex-direction: column;
}

.admin-panel {
  display: none;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.admin-panel.active {
  display: block;
}

/* Audit Log Panel */
.audit-log-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1.5rem;
  gap: 1rem;
}

.audit-log-header h2 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}

.audit-log-header p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

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

.audit-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--bg-alt);
  border-radius: 8px;
  border: 1px solid var(--border);
}

.audit-filters .filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 150px;
}

.audit-filters .filter-group .form-label {
  font-size: 0.75rem;
  margin: 0;
}

.audit-filters .filter-group .form-input,
.audit-filters .filter-group .form-select {
  padding: 0.4rem 0.6rem;
  font-size: 0.85rem;
}

.audit-log-table-container {
  flex: 1;
  min-height: 0;
  overflow: auto;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.audit-log-table-container .data-table {
  border: none;
  border-radius: 0;
  box-shadow: none;
}

/* Audit panel flex layout for table scroll */
.admin-panel[data-admin-panel="audit"] {
  display: none;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-panel[data-admin-panel="audit"].active {
  display: flex;
}

.audit-log-table {
  font-size: 0.85rem;
}

.audit-log-table th {
  white-space: nowrap;
}

.audit-log-table td {
  vertical-align: middle;
}

.audit-row:hover {
  background: var(--bg-alt);
}

.audit-action-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: capitalize;
}

.audit-action-badge.action-auth {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.audit-action-badge.action-account {
  background: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

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

.audit-action-badge.action-billing {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
}

.audit-action-badge.action-admin {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.audit-action-badge.action-api {
  background: rgba(6, 182, 212, 0.15);
  color: #06b6d4;
}

.audit-action-badge.action-callback {
  background: rgba(249, 115, 22, 0.15);
  color: #f97316;
}

.audit-action-badge.action-system {
  background: rgba(220, 38, 38, 0.15);
  color: #dc2626;
}

.audit-status {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
}

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

.audit-status.status-failure {
  color: var(--error);
}

.audit-ip {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
}

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

.audit-details.has-details {
  cursor: pointer;
  color: var(--primary);
}

.audit-details.has-details:hover {
  text-decoration: underline;
}

/* Audit Details Modal */
.audit-details-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
}

.audit-details-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.audit-details-modal-content {
  background: #fff;
  border-radius: 12px;
  max-width: 600px;
  width: 90%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

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

.audit-details-modal-header h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--text);
}

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

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

.audit-details-modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.audit-details-modal-body pre {
  background: var(--surface);
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  font-family: monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.audit-pagination #auditPageInfo {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .audit-log-header {
    flex-direction: column;
  }

  .audit-filters {
    flex-direction: column;
  }

  .audit-filters .filter-group {
    width: 100%;
  }
}

/* Admin layout - smaller mobile adjustments */
@media (max-width: 480px) {
  .admin-layout {
    min-height: calc(100vh - 60px);
  }

  .sidebar-nav-item {
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
  }

  .sidebar-icon {
    width: 16px;
    height: 16px;
  }

  .sidebar-icon svg {
    width: 14px;
    height: 14px;
  }
}

.admin-header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background: var(--border);
  color: var(--primary);
}

.admin-tab-panels {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.template-layout {
  display: flex;
  gap: 1.5rem;
}

.admin-email-card {
  position: fixed;
  top: 140px;
  right: 3rem;
  width: 400px;
  max-width: 90vw;
  max-height: calc(100vh - 160px);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  background: #fff;
  box-shadow: 0 30px 60px rgba(15, 23, 42, 0.25);
  z-index: 30;
  display: none;
  transform: translateY(-10px);
  transition: transform 0.2s ease, opacity 0.2s ease;
  overflow: hidden;
}

.admin-email-card.open {
  display: flex;
  flex-direction: column;
  transform: translateY(0);
}

.admin-email-card.dragging {
  transition: none;
  user-select: none;
}

.email-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.email-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  cursor: move;
}

.email-card-header:active {
  cursor: grabbing;
}

.email-card-preview {
  margin-top: 0.5rem;
}

.email-card-preview-iframe {
  width: 100%;
  height: 150px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.admin-email-card .form-textarea {
  resize: vertical;
  min-height: 80px;
  max-height: 200px;
}

.email-card-label {
  font-weight: 600;
  margin: 0;
}

.email-card-user {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.email-card-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.82rem;
  color: var(--text-light);
  flex-wrap: wrap;
}

.email-card-meta span {
  font-weight: 500;
  color: var(--text);
}

.email-card-template-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

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

.email-card-status {
  font-size: 0.9rem;
  color: var(--text-light);
}

.email-card-status.success {
  color: var(--success);
}

.email-card-status.error {
  color: var(--error);
}

.email-card-status-badge {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.email-card-plan {
  font-size: 0.85rem;
}

.email-card-actions .btn {
  flex: 0 0 auto;
}

@media (max-width: 960px) {
  .admin-email-card {
    position: fixed;
    top: 80px;
    right: 1rem;
    width: calc(100vw - 2rem);
  }
}

/* Campaign Styles */
.campaigns-page {
  padding: 2rem;
}

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

.campaigns-header h2 {
  margin: 0 0 0.5rem;
}

.campaigns-header p {
  margin: 0;
  color: var(--text-secondary);
}

.campaigns-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

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

.campaigns-list-section h3,
.campaign-detail-section h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
}

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

.campaign-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.2s;
}

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

.campaign-card.is-active {
  border-color: var(--primary);
  background: var(--primary-light);
}

.campaign-card-info strong {
  display: block;
  margin-bottom: 0.25rem;
}

.campaign-card-info span {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.campaign-card-status .badge {
  white-space: nowrap;
}

.campaign-detail-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.campaign-detail-header h3 {
  margin: 0;
}

.campaign-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-item {
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
}

.campaign-progress {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

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

.progress-fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 0.875rem;
  font-weight: 500;
  min-width: 45px;
}

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

.campaign-preview-stats {
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
}

/* Campaign status badges */
.badge-draft { background: #f3f4f6; color: #6b7280; }
.badge-sending { background: #dbeafe; color: #1e40af; }
.badge-paused { background: #fef3c7; color: #92400e; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-daily_limit_reached { background: #fef3c7; color: #92400e; }

.analytics-page {
  min-height: calc(100vh - 140px);
  padding: 3rem 4rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  background: #f8f9fa;
}

.admin-panel[data-admin-panel="analytics"] .analytics-page {
  padding: 0;
  min-height: auto;
  background: transparent;
}

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

.analytics-range {
  font-size: 0.95rem;
  color: var(--text-light);
}

.analytics-connection {
  font-size: 0.85rem;
  color: var(--success);
  margin-left: 0.5rem;
}

.analytics-alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: rgba(255, 99, 71, 0.1);
  color: #b33a2d;
  border: 1px solid rgba(255, 99, 71, 0.25);
}

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

.summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.summary-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--primary);
}

.summary-change {
  font-size: 0.85rem;
  color: var(--text-light);
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

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

/* Source badges for analytics cards */
.source-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 0.5rem;
}

.source-badge.source-ga {
  background: #f3e8ff;
  color: #7c3aed;
}

.source-badge.source-gsc {
  background: #dcfce7;
  color: #16a34a;
}

.source-badge.source-db {
  background: #e0f2fe;
  color: #0284c7;
}

.source-badge.source-gads {
  background: #fef3c7;
  color: #d97706;
}

.info-tooltip {
  display: inline-block;
  cursor: help;
  font-size: 0.9rem;
  color: #6b7280;
  margin-left: 0.5rem;
  vertical-align: middle;
}

.info-tooltip:hover {
  color: #374151;
}

.analytics-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.5rem;
  box-shadow: 0 15px 35px rgba(15, 23, 42, 0.08);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.analytics-card header h3 {
  margin: 0;
}

.analytics-card header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.channel-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.channel-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.6rem 0.4rem;
  border-bottom: 1px dashed var(--border);
}

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

.channel-name {
  font-weight: 600;
}

.channel-metrics,
.channel-extra {
  font-size: 0.85rem;
  color: var(--text-light);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.funnel-steps {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.funnel-step {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.funnel-step span {
  font-weight: 600;
}

.funnel-value {
  color: var(--primary);
}

.funnel-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}

.funnel-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #72b7ff);
  width: var(--value, 0%);
}

.retention-list,
.campaign-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.health-list {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}

@media (max-width: 768px) {
  .health-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .health-list {
    grid-template-columns: 1fr;
  }
}

.retention-item,
.campaign-card,
.health-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  background: #fafafa;
}

.health-detail {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 0.25rem;
}

.campaign-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.realtime-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.realtime-label {
  font-size: 0.8rem;
  color: var(--text-light);
  margin: 0;
}

.realtime-value {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0;
}

.analytics-card .placeholder {
  margin: 0;
  color: var(--text-light);
}

@media (max-width: 900px) {
  .analytics-page {
    padding: 2rem;
  }
  .analytics-header {
    flex-direction: column;
  }
  .realtime-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  }
}

.admin-email-card {
  display: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.15);
}

.admin-email-card.open {
  display: block;
}

.email-card-inner {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.email-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.email-card-label {
  font-weight: 600;
  margin: 0;
}

.email-card-user {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-light);
}

.email-card-meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.email-card-template-description {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.email-card-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.email-card-status {
  font-size: 0.9rem;
  color: var(--text-light);
}

.email-card-status.success {
  color: var(--success);
}

.email-card-status.error {
  color: var(--error);
}

.template-list-panel {
  flex: 0 0 280px;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 400px;
}

.template-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.template-section-label {
  margin: 0;
  font-weight: 600;
}

.template-section-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-light);
}

.template-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  overflow-y: auto;
  flex: 1;
}

.template-card {
  border: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 10px;
  padding: 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  cursor: pointer;
  transition: border 0.2s ease, transform 0.2s ease;
}

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

.template-card.is-active {
  border-color: var(--primary);
  background: #eef2ff;
}

.template-card strong {
  display: block;
  font-size: 0.95rem;
}

.template-card p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

.template-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
}

.template-var-chip {
  display: inline-block;
  background: var(--slate-100, #f1f5f9);
  color: var(--primary, #3b82f6);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.8rem;
  font-family: monospace;
}

.template-variables-info {
  background: var(--slate-50, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.template-variables-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.template-editor {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: 0 2px 4px rgba(15, 23, 42, 0.08);
}

.template-editor-header {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.template-editor-header input {
  flex: 1;
}

.template-status-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.status-pill-success {
  background: #ecfdf5;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.status-pill-draft {
  background: #f5f3ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
}

.admin-label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-weight: 600;
  font-size: 0.9rem;
}

.template-token-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.token-pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.token-pill {
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  font-size: 0.8rem;
  background: #f1f5f9;
}

.template-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.template-preview {
  border-top: 1px dashed var(--border);
  padding-top: 1rem;
}

.template-preview h4 {
  margin: 0;
  font-size: 1rem;
}

.preview-subject {
  margin: 0.4rem 0 0.2rem;
  font-weight: 600;
  color: var(--primary);
}

.preview-body {
  min-height: 80px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0.75rem;
  font-size: 0.9rem;
  background: #f8fafc;
  white-space: pre-wrap;
}

.template-preview-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  background: #f8fafc;
}

.template-preview-subject,
[data-template-preview-subject] {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--primary);
}

.template-preview-body,
[data-template-preview-body] {
  min-height: 60px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  color: var(--text);
}

.template-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.template-preview-toggle {
  display: flex;
  gap: 0.25rem;
}

.template-preview-toggle .btn {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
}

.template-preview-toggle .btn.active {
  background: var(--primary);
  color: #fff;
}

.template-preview-iframe {
  width: 100%;
  min-height: 200px;
  border: none;
  background: #fff;
  border-radius: 4px;
}

.template-preview-html {
  background: #fff;
}

@media (max-width: 900px) {
  .template-layout {
    flex-direction: column;
  }

  .template-list-panel {
    width: 100%;
  }
}
