:root {
  color-scheme: light;
  
  /* ========================================
     DESIGN TOKENS - AgilAdmin
     ======================================== */
  
  /* Brand Colors - Azul Marinho Base */
  --brand-900: #0B2348;
  --brand-700: #0f1f2e;
  --brand-500: #193247;
  --brand-300: #2a4a66;
  
  /* Ink (texto) - Corrigido para melhor contraste */
  --ink-900: #0d1117;
  --ink-700: #2b3440;
  --ink-500: #556273;
  --ink-300: #667085; /* Melhorado para contraste WCAG AA */
  --ink-muted: #8a96a5;
  
  /* Surfaces */
  --surface-900: #f5f7fa;
  --surface-800: #eef2f6;
  --surface-700: #e1e7ee;
  --surface-0: #ffffff;
  
  /* Accent - Teal/Ciano Tecnologico */
  --accent: #1f7a8c;
  --accent-hover: #186577;
  --accent-soft: #d7edf1;
  
  /* Agil Yellow/Green - Heranca da marca */
  --agil-yellow: #C7D400;
  --agil-yellow-hover: #b3bf00;
  
  /* Status */
  --success: #1f8f5f;
  --success-soft: rgba(31, 143, 95, 0.12);
  --warning: #cc7a19;
  --warning-soft: rgba(204, 122, 25, 0.12);
  --danger: #c0463a;
  --danger-soft: rgba(192, 70, 58, 0.12);
  
  /* Spacing Scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;
  
  /* Border Radius Scale */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-2xl: 24px;
  --radius-full: 999px;
  
  /* Typography Scale */
  --text-xs: 0.75rem;
  --text-sm: 0.85rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  
  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(11, 35, 72, 0.05);
  --shadow-sm: 0 4px 8px rgba(11, 35, 72, 0.06);
  --shadow-md: 0 8px 16px rgba(11, 35, 72, 0.08);
  --shadow-soft: 0 18px 40px rgba(11, 35, 72, 0.08);
  --shadow-card: 0 12px 30px rgba(11, 35, 72, 0.12);
  --shadow-lg: 0 24px 48px rgba(11, 35, 72, 0.16);
  
  /* Transitions */
  --transition-fast: 0.1s ease;
  --transition-normal: 0.2s ease;
  --transition-slow: 0.3s ease;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 15px;
}

@media (min-width: 992px) {
  html {
    font-size: 16px;
  }
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--ink-700);
  background: radial-gradient(circle at top right, #f5fbff 0%, #f7f9fc 35%, #f3f6f9 100%);
  min-height: 100vh;
}

/* ========================================
   ACCESSIBILITY - Skip Link & Focus
   ======================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-4);
  z-index: 9999;
  background: var(--accent);
  color: white;
  padding: var(--space-2) var(--space-4);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  font-weight: 500;
  transition: top var(--transition-normal);
}

.skip-link:focus {
  top: 0;
  color: white;
}

/* Focus indicators */
:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn:focus-visible,
.nav-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--surface-0), 0 0 0 4px var(--accent);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(160deg, var(--brand-900), var(--brand-700));
  color: #f5f7fa;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  display: grid;
  place-items: center;
  font-weight: 600;
  letter-spacing: 0.08em;
  overflow: hidden;
}

.brand-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand span {
  display: block;
  font-size: 0.85rem;
  color: rgba(245, 247, 250, 0.7);
}

.nav-link {
  color: rgba(245, 247, 250, 0.75);
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 6px;
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 0.8rem;
  color: rgba(245, 247, 250, 0.6);
}

.main-panel {
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--surface-0);
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--surface-700);
}

.topbar-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink-900);
}

.user-pill {
  background: var(--surface-800);
  color: var(--ink-700);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
}

.content {
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink-900);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  color: var(--ink-300);
  margin-bottom: 10px;
}

.subtitle {
  color: var(--ink-500);
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 12px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.metric-card {
  background: var(--surface-0);
  border-radius: var(--radius-xl);
  padding: var(--space-5) var(--space-6);
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

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

.metric-title {
  color: var(--ink-500);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

.metric-card h2 {
  margin: 0;
  color: var(--ink-900);
  font-size: var(--text-3xl);
}

.content-card {
  background: var(--surface-0);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-soft);
  padding: var(--space-6);
  transition: box-shadow var(--transition-normal);
}

.content-card:hover {
  box-shadow: var(--shadow-card);
}

/* Card variants */
.content-card--interactive {
  cursor: pointer;
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.content-card--interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.content-card--bordered {
  border: 1px solid var(--surface-700);
  box-shadow: none;
}

.content-card--compact {
  padding: var(--space-4);
}

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

.card-header h3 {
  margin-bottom: 4px;
  color: var(--ink-900);
}

.table-modern th {
  font-weight: 600;
  color: var(--ink-500);
  border-bottom: 1px solid var(--surface-700);
}

.table-modern td {
  vertical-align: middle;
  border-bottom: 1px solid var(--surface-700);
}

.binding-list {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.status-ok {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
}

.status-warning {
  background: rgba(204, 122, 25, 0.15);
  color: var(--warning);
}

.status-unknown {
  background: rgba(138, 150, 165, 0.15);
  color: var(--ink-500);
  border: 1px dashed var(--ink-300);
}

/* Permission Alert */
.permission-alert {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  background: linear-gradient(135deg, #fff8e6 0%, #fff4d9 100%);
  border: 1px solid #f5d67a;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(204, 122, 25, 0.1);
}

.permission-alert .alert-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: rgba(204, 122, 25, 0.15);
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: var(--warning);
}

.permission-alert .alert-content {
  flex: 1;
}

.permission-alert .alert-content strong {
  display: block;
  color: #8a5c00;
  font-size: 1rem;
  margin-bottom: 4px;
}

.permission-alert .alert-content p {
  margin: 0;
  color: #6b4a00;
  font-size: 0.9rem;
  line-height: 1.5;
}

.permission-alert .alert-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(204, 122, 25, 0.2);
}

.permission-alert .alert-details summary {
  cursor: pointer;
  font-weight: 500;
  color: #8a5c00;
  font-size: 0.85rem;
}

.permission-alert .alert-details summary:hover {
  color: #6b4a00;
}

.permission-alert .alert-details ol {
  margin: 12px 0 0 0;
  padding-left: 20px;
  color: #6b4a00;
  font-size: 0.85rem;
  line-height: 1.8;
}

.permission-alert .alert-details ol li {
  margin-bottom: 4px;
}

/* Metric card alert variant */
.metric-card-alert {
  border: 1px dashed var(--ink-300);
  background: rgba(138, 150, 165, 0.05);
}

.btn {
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-5);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

/* Ripple effect on click */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:active::after {
  opacity: 0.1;
}

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

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface-800);
  border: none;
  color: var(--ink-700);
}

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

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

.btn-ghost:hover {
  background: var(--surface-900);
  border-color: var(--ink-300);
}

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.form-text {
  color: var(--ink-300);
}

.auth-body {
  background: linear-gradient(140deg, var(--brand-900) 0%, var(--brand-700) 55%, var(--brand-500) 100%);
  color: #ffffff;
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(420px, 100%);
}

.auth-card {
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink-700);
  padding: 32px;
  border-radius: 20px;
  box-shadow: 0 30px 60px rgba(9, 21, 32, 0.35);
}

.auth-header h1 {
  color: var(--ink-900);
}

.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.auth-logo img {
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(11, 35, 72, 0.15);
}

/* ========================================
   RESPONSIVE - MOBILE NAVIGATION
   ======================================== */

/* Botao hamburger - escondido por padrao no desktop */
.hamburger-btn {
  display: none;
  background: transparent;
  border: none;
  padding: 8px;
  margin-right: 12px;
  cursor: pointer;
  color: var(--ink-700);
  border-radius: 8px;
  transition: background 0.2s;
}

.hamburger-btn:hover {
  background: var(--surface-800);
}

/* Sidebar desktop - visivel por padrao, escondido no mobile */
.sidebar.sidebar-desktop {
  display: flex;
  flex-direction: column;
}

/* Off-canvas customizado para sidebar mobile */
.sidebar-offcanvas {
  background: linear-gradient(160deg, var(--brand-900), var(--brand-700)) !important;
  width: 280px !important;
  border: none !important;
}

.sidebar-offcanvas-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-offcanvas-header .brand {
  flex: 1;
}

.sidebar-offcanvas-body {
  padding: 16px 24px 24px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 100px);
}

.sidebar-offcanvas-body .sidebar-nav {
  flex: 1;
}

.sidebar-offcanvas-body .sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

/* Tablets e menores (< 992px) - Colapsa sidebar */
@media (max-width: 991.98px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-title {
    font-size: 1.1rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .content {
    padding: 20px 16px;
  }

  /* Page header responsivo */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .header-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* User pill compacto */
  .user-pill-text {
    display: none;
  }

  .user-pill {
    padding: 8px 10px;
  }
}

/* Tablets portrait (< 768px) */
@media (max-width: 767.98px) {
  .content {
    padding: 16px 12px;
    gap: 16px;
  }

  .content-card {
    padding: 16px;
    border-radius: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .card-header h3 {
    font-size: 1rem;
  }

  /* Metricas grid */
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .metric-card {
    padding: 16px;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .metric-card h2 {
    font-size: 1.5rem;
  }

  /* Forms */
  .form-grid {
    grid-template-columns: 1fr;
  }

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

  .form-actions .btn {
    width: 100%;
  }

  /* Details grid */
  .details-grid {
    grid-template-columns: 1fr;
  }

  /* Danger zone */
  .danger-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .danger-actions {
    width: 100%;
  }

  .danger-actions .btn {
    flex: 1;
  }

  /* Modal responsivo */
  .modal-content {
    width: 95vw;
    max-height: 90vh;
    margin: 16px;
  }

  .modal-body {
    padding: 16px;
    max-height: calc(90vh - 140px);
    overflow-y: auto;
  }

  /* Confirm dialog */
  .confirm-dialog {
    width: 95%;
    padding: 24px;
  }

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

  .confirm-actions .btn {
    width: 100%;
  }
}

/* Mobile pequeno (< 576px) */
@media (max-width: 575.98px) {
  html {
    font-size: 14px;
  }

  .topbar {
    padding: 10px 12px;
  }

  .topbar-title {
    font-size: 1rem;
  }

  .content {
    padding: 12px;
    gap: 12px;
  }

  .page-header h1 {
    font-size: 1.25rem;
  }

  .eyebrow {
    font-size: 0.65rem;
  }

  /* Metricas em coluna unica */
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  /* Botoes */
  .btn {
    padding: 12px 16px;
    font-size: 0.9rem;
  }

  .btn-sm {
    padding: 10px 14px;
  }

  /* Header actions empilhados */
  .header-actions {
    flex-direction: column;
  }

  .header-actions .btn {
    width: 100%;
  }

  /* Toast container */
  #toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
    max-width: none;
  }

  .toast {
    width: 100%;
  }

  /* Action buttons */
  .action-buttons {
    flex-direction: column;
  }

  .action-buttons .btn {
    width: 100%;
  }

  /* Provider selector */
  .provider-selector {
    grid-template-columns: 1fr;
  }

  /* Binding form */
  .binding-form .form-row {
    flex-direction: column;
  }

  .binding-form .form-group {
    width: 100%;
  }
}

/* Details Page Styles */
.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.status-card,
.info-card {
  display: flex;
  flex-direction: column;
}

.status-details,
.info-list {
  flex: 1;
}

.status-row,
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface-700);
}

.status-row:last-child,
.info-row:last-child {
  border-bottom: none;
}

.status-row .label,
.info-row .label {
  color: var(--ink-500);
  font-size: 0.9rem;
}

.status-row .value,
.info-row .value {
  color: var(--ink-900);
  font-weight: 500;
}

.info-row .path {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.info-row .mono {
  font-family: 'SF Mono', 'Consolas', monospace;
}

.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--surface-700);
}

.inline-form {
  display: inline;
}

/* Button variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.btn-success {
  background: var(--success);
  color: white;
  border: none;
}

.btn-success:hover {
  background: #1a7a51;
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: white;
  border: none;
}

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

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

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

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

.btn-danger-full:hover {
  background: #a33d32;
}

/* Alerts */
.alert {
  padding: 14px 18px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 500;
}

.alert-success {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
  border: 1px solid rgba(31, 143, 95, 0.2);
}

.alert-danger {
  background: rgba(192, 70, 58, 0.12);
  color: var(--danger);
  border: 1px solid rgba(192, 70, 58, 0.2);
}

/* Bindings Table */
.bindings-table-container {
  margin-bottom: 24px;
}

.protocol-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.protocol-http {
  background: var(--surface-800);
  color: var(--ink-700);
}

.protocol-https {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
}

.protocol-badge-sm {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  margin-right: 4px;
}

.hostname {
  font-weight: 500;
  color: var(--ink-900);
}

.external-link {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  color: var(--ink-300);
  transition: color 0.2s;
}

.external-link:hover {
  color: var(--accent);
}

/* DNS Status */
.dns-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.dns-ok {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
}

.dns-warning {
  background: rgba(204, 122, 25, 0.15);
  color: var(--warning);
}

.dns-error {
  background: rgba(192, 70, 58, 0.12);
  color: var(--danger);
}

.dns-unknown,
.dns-na {
  background: var(--surface-800);
  color: var(--ink-500);
}

/* Add Binding Section */
.add-binding-section {
  padding-top: 20px;
  border-top: 1px solid var(--surface-700);
}

.add-binding-section h4 {
  margin-bottom: 16px;
  color: var(--ink-700);
  font-size: 0.95rem;
}

.binding-form .form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.binding-form .form-group {
  min-width: 100px;
}

.binding-form .flex-grow {
  flex: 1;
  min-width: 200px;
}

.binding-form .form-action {
  margin-bottom: 0;
}

/* Danger Zone */
.danger-zone {
  border: 1px solid rgba(192, 70, 58, 0.3);
}

.danger-zone .card-header h3 {
  color: var(--danger);
}

.danger-content {
  padding-top: 8px;
}

.danger-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.danger-info {
  flex: 1;
  min-width: 200px;
}

.danger-info strong {
  display: block;
  color: var(--ink-900);
  margin-bottom: 4px;
}

.danger-info p {
  color: var(--ink-500);
  font-size: 0.9rem;
  margin: 0;
}

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

/* Domain Groups (Index page) */
.domain-group {
  margin-bottom: 8px;
}

.domain-group .card-header {
  padding-bottom: 12px;
}

.domain-group .card-header h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.domain-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--surface-800);
  border-radius: 8px;
  color: var(--ink-500);
}

.site-count {
  font-size: 0.85rem;
  color: var(--ink-300);
  font-weight: normal;
}

.table-hover tbody tr {
  transition: background 0.15s ease;
}

.table-hover tbody tr:hover {
  background: var(--surface-900);
}

.clickable-row {
  cursor: pointer;
}

.app-pool-name {
  font-family: 'SF Mono', 'Consolas', monospace;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.binding-item {
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  color: var(--ink-500);
}

.binding-more {
  font-size: 0.8rem;
  color: var(--ink-300);
  font-style: italic;
}

.actions-cell {
  text-align: right;
}

.actions-cell .btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--ink-500);
}

.empty-state svg {
  margin-bottom: 16px;
  color: var(--ink-300);
}

.empty-state h3 {
  color: var(--ink-700);
  margin-bottom: 8px;
}

.empty-state p {
  margin-bottom: 24px;
}

/* Text utilities */
.text-success {
  color: var(--success) !important;
}

.text-warning {
  color: var(--warning) !important;
}

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

.text-muted {
  color: var(--ink-300) !important;
}

/* Form Check */
.form-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-check-input {
  width: 18px;
  height: 18px;
  margin: 0;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  margin: 0;
}

/* ========================================
   SIDEBAR IMPROVEMENTS
   ======================================== */
.nav-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(245, 247, 250, 0.4);
  padding: 16px 12px 8px;
  margin-top: 8px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-icon {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active .nav-icon,
.nav-link:hover .nav-icon {
  opacity: 1;
}

.logout-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(245, 247, 250, 0.7);
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.server-info {
  display: block;
  margin-top: 12px;
  font-size: 0.75rem;
  color: rgba(245, 247, 250, 0.4);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   PROVIDER BADGES & COLORS
   ======================================== */
.provider-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
}

.provider-azure {
  background: rgba(0, 120, 212, 0.12);
  color: #0078d4;
}

.provider-cloudflare {
  background: rgba(243, 128, 32, 0.12);
  color: #f38020;
}

.provider-manual {
  background: var(--surface-800);
  color: var(--ink-500);
}

.text-azure { color: #0078d4 !important; }
.text-cloudflare { color: #f38020 !important; }

/* ========================================
   DOMAIN NAME CELL
   ======================================== */
.domain-name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-azure { background: rgba(0, 120, 212, 0.12); color: #0078d4; }
.icon-cloudflare { background: rgba(243, 128, 32, 0.12); color: #f38020; }
.icon-manual { background: var(--surface-800); color: var(--ink-500); }

/* ========================================
   DNS TYPE BADGES
   ======================================== */
.dns-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 700;
  font-family: 'SF Mono', monospace;
}

.dns-type-a { background: #dbeafe; color: #1d4ed8; }
.dns-type-aaaa { background: #e0e7ff; color: #4338ca; }
.dns-type-cname { background: #fef3c7; color: #b45309; }
.dns-type-txt { background: #d1fae5; color: #047857; }
.dns-type-mx { background: #fce7f3; color: #be185d; }
.dns-type-ns { background: #f3e8ff; color: #7c3aed; }
.dns-type-srv { background: #fee2e2; color: #dc2626; }

/* ========================================
   PROXY BADGES
   ======================================== */
.proxy-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
}

.proxy-on { background: rgba(243, 128, 32, 0.12); color: #f38020; }
.proxy-off { background: var(--surface-800); color: var(--ink-300); }

/* ========================================
   RECORD VALUES
   ======================================== */
.record-name { font-family: 'SF Mono', monospace; font-size: 0.85rem; }
.record-value { font-family: 'SF Mono', monospace; font-size: 0.85rem; color: var(--ink-500); }

/* ========================================
   MODAL
   ======================================== */
.modal-backdrop {
  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: 1000;
}

.modal-content {
  background: var(--surface-0);
  border-radius: 16px;
  width: min(500px, 90vw);
  box-shadow: var(--shadow-card);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--surface-700);
}

.modal-header h3 { margin: 0; }

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--ink-300);
}

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

.modal-body { padding: 24px; }

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--surface-700);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */
#toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--surface-0);
  padding: 14px 20px;
  border-radius: 10px;
  box-shadow: var(--shadow-card);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

.toast-success { border-left: 4px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-error .toast-icon { color: var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info { border-left: 4px solid var(--accent); }
.toast-info .toast-icon { color: var(--accent); }

.toast-hiding { opacity: 0; transition: opacity 0.3s; }

.toast-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.toast-message {
  flex: 1;
  line-height: 1.4;
}

.toast-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--ink-300);
  margin-left: 8px;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.toast-close:hover {
  color: var(--ink-900);
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 0 0 10px 10px;
  overflow: hidden;
}

.toast-progress-bar {
  height: 100%;
  width: 100%;
  background: currentColor;
  opacity: 0.3;
}

.toast {
  position: relative;
  overflow: hidden;
}

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

/* ========================================
   LOADING OVERLAY
   ======================================== */
.loading-overlay {
  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: 9999;
  backdrop-filter: blur(4px);
}

.loading-content {
  background: var(--surface-800);
  padding: 40px 60px;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 400px;
}

.loading-content .loading-title {
  margin: 20px 0 8px;
  color: var(--ink-900);
  font-size: 1.25rem;
}

.loading-content .loading-message {
  margin: 0;
  color: var(--accent);
  font-family: 'SF Mono', monospace;
  font-size: 0.95rem;
}

.loading-content .loading-hint {
  margin-top: 12px;
  color: var(--ink-500);
  font-size: 0.8rem;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--surface-600);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin 1s linear infinite;
}

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

/* ========================================
   BUTTON LOADING STATE
   ======================================== */
.btn-loading {
  position: relative;
  pointer-events: none;
}

.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

.btn-loading-text {
  vertical-align: middle;
}

/* ========================================
   CONFIRMATION DIALOG
   ======================================== */
.confirm-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  backdrop-filter: blur(2px);
}

.confirm-dialog {
  background: var(--surface-800);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  max-width: 400px;
  width: 90%;
  text-align: center;
  animation: dialogIn 0.2s ease;
}

@keyframes dialogIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.confirm-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.confirm-icon-warning {
  background: rgba(204, 122, 25, 0.15);
  color: var(--warning);
}

.confirm-icon-danger {
  background: rgba(184, 68, 68, 0.15);
  color: var(--danger);
}

.confirm-icon-info {
  background: rgba(31, 122, 140, 0.15);
  color: var(--accent);
}

.confirm-title {
  margin: 0 0 8px;
  font-size: 1.25rem;
  color: var(--ink-900);
}

.confirm-message {
  margin: 0 0 24px;
  color: var(--ink-500);
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

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

/* ========================================
   FORM VALIDATION STYLES
   ======================================== */
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: var(--danger);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23b84444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23b84444' stroke='none'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(184, 68, 68, 0.15);
}

.form-control.is-valid,
.form-select.is-valid {
  border-color: var(--success);
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%232d8659' d='M2.3 6.73.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px 16px;
  padding-right: 36px;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
  border-color: var(--success);
  box-shadow: 0 0 0 3px rgba(45, 134, 89, 0.15);
}

.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.field-error::before {
  content: '';
  width: 12px;
  height: 12px;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23b84444'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath stroke-linejoin='round' d='M5.8 3.6h.4L6 6.5z'/%3e%3ccircle cx='6' cy='8.2' r='.6' fill='%23b84444' stroke='none'/%3e%3c/svg%3e");
  background-size: contain;
  flex-shrink: 0;
}

/* ========================================
   STEP BADGES
   ======================================== */
.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 600;
  margin-right: 10px;
}

/* ========================================
   PROVIDER SELECTOR
   ======================================== */
.provider-selector {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.provider-option {
  cursor: pointer;
}

.provider-option input { display: none; }

.provider-card {
  border: 2px solid var(--surface-700);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.provider-option input:checked + .provider-card {
  border-color: var(--accent);
  background: rgba(31, 122, 140, 0.05);
}

.provider-card:hover {
  border-color: var(--ink-300);
}

.provider-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.provider-info strong { display: block; margin-bottom: 4px; }
.provider-info span { font-size: 0.85rem; color: var(--ink-500); }

.config-help {
  color: var(--ink-500);
  margin-bottom: 20px;
}

.config-help a { color: var(--accent); }

.test-result { margin-left: 12px; }

/* ========================================
   METRIC CARD WITH ICONS
   ======================================== */
.metric-card {
  display: flex;
  align-items: center;
  gap: 16px;
}

.metric-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.metric-icon-total { background: rgba(31, 122, 140, 0.12); color: var(--accent); }
.metric-icon-azure { background: rgba(0, 120, 212, 0.12); color: #0078d4; }
.metric-icon-cloudflare { background: rgba(243, 128, 32, 0.12); color: #f38020; }
.metric-icon-manual { background: var(--surface-800); color: var(--ink-500); }

.metric-content { flex: 1; }

/* ========================================
   DOMAIN AUTOCOMPLETE
   ======================================== */
.domain-autocomplete {
  position: relative;
}

.domain-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-0);
  border: 1px solid var(--surface-700);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  margin-top: 4px;
}

.domain-suggestion {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--surface-700);
}

.domain-suggestion:last-child {
  border-bottom: none;
}

.domain-suggestion:hover {
  background: var(--surface-900);
}

.suggestion-domain {
  font-weight: 500;
  color: var(--ink-900);
}

/* ========================================
   QUICK SUGGESTION CHIPS
   ======================================== */
.quick-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.suggestion-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--surface-800);
  border: 1px solid var(--surface-700);
  border-radius: 20px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.suggestion-chip:hover {
  background: var(--surface-700);
  border-color: var(--ink-300);
}

.suggestion-chip .chip-provider {
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ========================================
   FORM SECTIONS
   ======================================== */
.form-section {
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--surface-700);
}

.form-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.form-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink-900);
}

/* ========================================
   CONFIG SECTIONS (collapsible)
   ======================================== */
.config-section {
  margin-top: 20px;
  padding: 20px;
  background: var(--surface-900);
  border-radius: 12px;
}

.config-section.hidden {
  display: none;
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--surface-700);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 12px;
  height: 12px;
  border-width: 1.5px;
}

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

/* ========================================
   LINK STYLES
   ======================================== */
.link {
  color: var(--accent);
  text-decoration: none;
}

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

/* ========================================
   MISC UTILITIES
   ======================================== */
.hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: 0.85rem; }
.text-xs { font-size: 0.75rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

/* ========================================
   DNS RECORDS - DELETE MODALS
   ======================================== */
.modal-danger .modal-header {
  background: linear-gradient(135deg, var(--danger), #a83a30);
  color: white;
}

.modal-danger .modal-header h3 {
  color: white;
}

.modal-danger .modal-close {
  color: white;
}

.delete-record-details {
  background: var(--surface-900);
  border-radius: 8px;
  padding: 16px;
  margin-top: 16px;
}

.delete-record-details .detail-row {
  display: flex;
  padding: 8px 0;
  border-bottom: 1px solid var(--surface-700);
}

.delete-record-details .detail-row:last-child {
  border-bottom: none;
}

.delete-record-details .detail-label {
  font-weight: 600;
  color: var(--ink-500);
  width: 80px;
  flex-shrink: 0;
}

.delete-record-details .detail-value {
  color: var(--ink-900);
  word-break: break-all;
}

.delete-records-list {
  background: var(--surface-900);
  border-radius: 8px;
  padding: 12px;
  margin-top: 16px;
  max-height: 300px;
  overflow-y: auto;
}

.delete-record-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface-0);
  border-radius: 6px;
  margin-bottom: 8px;
}

.delete-record-item:last-child {
  margin-bottom: 0;
}

.delete-record-item .record-name {
  font-weight: 500;
  color: var(--ink-900);
  min-width: 150px;
}

.delete-record-item .record-value {
  color: var(--ink-500);
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-warning {
  color: var(--warning);
  font-size: 0.9rem;
}

/* Header actions inline */
.header-actions-inline {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Checkbox styling */
.record-checkbox,
#selectAll {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* Ensure table content is left-aligned by default */
.table-modern th,
.table-modern td {
  text-align: left;
}

/* Table checkbox column - center when there's a checkbox */
.table-modern th:has(input[type="checkbox"]),
.table-modern td:has(input[type="checkbox"]),
.table-modern th.checkbox-col,
.table-modern td.checkbox-col {
  width: 40px;
  text-align: center;
}

/* Delete selected button animation */
#btnDeleteSelected {
  animation: fadeIn 0.2s ease;
}

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

/* ========================================
   SIDEBAR COLLAPSIBLE MENU (ADVANCED)
   ======================================== */
.nav-section-collapsible {
  margin-top: 8px;
}

.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px 12px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(245, 247, 250, 0.5);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color 0.2s, background 0.2s;
  border-radius: 8px;
}

.nav-section-toggle:hover {
  color: rgba(245, 247, 250, 0.7);
  background: rgba(255, 255, 255, 0.05);
}

.nav-toggle-icon {
  transition: transform 0.2s ease;
  opacity: 0.6;
}

.nav-section-collapsible.expanded .nav-toggle-icon {
  transform: rotate(180deg);
}

.nav-section-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease-out;
}

.nav-section-collapsible.expanded .nav-section-content {
  max-height: 200px;
}

.nav-section-content .nav-link {
  padding-left: 20px;
  margin-left: 8px;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 0 10px 10px 0;
}

.nav-section-content .nav-link:hover,
.nav-section-content .nav-link.active {
  border-left-color: var(--accent);
}

/* ========================================
   TABLE CARD MOBILE
   Transforma tabelas em cards no mobile
   ======================================== */
.table-card-mobile {
  width: 100%;
}

/* Desktop: tabela normal */
@media (min-width: 768px) {
  .table-card-mobile thead {
    display: table-header-group;
  }
  
  .table-card-mobile tbody {
    display: table-row-group;
  }
  
  .table-card-mobile tr {
    display: table-row;
  }
  
  .table-card-mobile td,
  .table-card-mobile th {
    display: table-cell;
  }
  
  .table-card-mobile td::before {
    display: none;
  }
}

/* Mobile: transforma em cards */
@media (max-width: 767.98px) {
  .table-card-mobile {
    border: none;
  }

  .table-card-mobile thead {
    display: none;
  }

  .table-card-mobile tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .table-card-mobile tr {
    display: flex;
    flex-direction: column;
    background: var(--surface-0);
    border: 1px solid var(--surface-700);
    border-radius: 12px;
    padding: 16px;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .table-card-mobile tr:hover {
    background: var(--surface-900);
  }

  .table-card-mobile td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 6px 0;
    border: none !important;
    gap: 12px;
  }

  .table-card-mobile td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--ink-500);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
    min-width: 100px;
  }

  .table-card-mobile td:last-child {
    border-top: 1px solid var(--surface-700) !important;
    padding-top: 12px;
    margin-top: 4px;
  }

  /* Celula de acoes especial */
  .table-card-mobile td.actions-cell {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .table-card-mobile td.actions-cell::before {
    display: none;
  }

  .table-card-mobile td.actions-cell .btn {
    flex: 1;
    min-width: 80px;
    justify-content: center;
  }

  /* Esconde checkbox column label no mobile */
  .table-card-mobile td[data-label=""]::before,
  .table-card-mobile td:first-child:has(input[type="checkbox"])::before {
    display: none;
  }

  /* Nome do site/item como titulo do card */
  .table-card-mobile td:first-child:not(.actions-cell),
  .table-card-mobile td[data-label="Nome"],
  .table-card-mobile td[data-label="Site"],
  .table-card-mobile td[data-label="Dominio"],
  .table-card-mobile td[data-label="Cliente"],
  .table-card-mobile td[data-label="Banco"] {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ink-900);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--surface-700) !important;
    margin-bottom: 4px;
  }

  .table-card-mobile td:first-child::before,
  .table-card-mobile td[data-label="Nome"]::before,
  .table-card-mobile td[data-label="Site"]::before,
  .table-card-mobile td[data-label="Dominio"]::before,
  .table-card-mobile td[data-label="Cliente"]::before,
  .table-card-mobile td[data-label="Banco"]::before {
    display: none;
  }

  /* Status badge no card */
  .table-card-mobile .status-badge {
    font-size: 0.7rem;
  }

  /* Binding list no card */
  .table-card-mobile .binding-list {
    text-align: right;
    align-items: flex-end;
  }

  /* App pool name */
  .table-card-mobile .app-pool-name {
    text-align: right;
    word-break: break-all;
  }

  /* Clickable row no mobile */
  .table-card-mobile .clickable-row {
    cursor: pointer;
  }
}

/* ========================================
   TOUCH FRIENDLY ENHANCEMENTS
   ======================================== */
@media (max-width: 991.98px) {
  /* Botoes com area de toque maior */
  .btn {
    min-height: 44px;
  }

  .btn-sm {
    min-height: 38px;
  }

  .btn-xs {
    min-height: 32px;
    padding: 6px 10px;
  }

  /* Links na navegacao */
  .nav-link {
    min-height: 44px;
    padding: 12px 14px;
  }

  /* Checkboxes e inputs */
  .form-check-input {
    width: 22px;
    height: 22px;
  }

  .record-checkbox,
  #selectAll {
    width: 22px;
    height: 22px;
  }

  /* Form controls */
  .form-control,
  .form-select {
    min-height: 44px;
    font-size: 16px; /* Previne zoom no iOS */
  }

  /* Status rows tocaveis */
  .status-row,
  .info-row {
    min-height: 44px;
    padding: 12px 0;
  }
}

/* ========================================
   SKELETON LOADING STATES
   ======================================== */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface-800) 0%,
    var(--surface-700) 50%,
    var(--surface-800) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1em;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 70%;
}

.skeleton-text-sm {
  height: 0.85em;
  width: 60%;
}

.skeleton-heading {
  height: 1.5em;
  width: 40%;
  margin-bottom: var(--space-3);
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-xl);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-button {
  height: 40px;
  width: 100px;
  border-radius: var(--radius-lg);
}

/* ========================================
   MICRO-ANIMATIONS & TRANSITIONS
   ======================================== */

/* Page entrance animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.content > .content-card,
.content > .metrics-grid,
.content > .page-header {
  animation: fadeInUp 0.4s ease-out backwards;
}

.content > *:nth-child(1) { animation-delay: 0ms; }
.content > *:nth-child(2) { animation-delay: 60ms; }
.content > *:nth-child(3) { animation-delay: 120ms; }
.content > *:nth-child(4) { animation-delay: 180ms; }
.content > *:nth-child(5) { animation-delay: 240ms; }

/* Status badge attention pulse */
.status-badge.pulse {
  animation: pulse 2s infinite;
}

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

/* Smooth fade for dynamic content */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* Scale in for modals/popovers */
@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.scale-in {
  animation: scaleIn 0.2s ease-out;
}

/* ========================================
   MODERN FORM CONTROLS
   ======================================== */
.form-control,
.form-select {
  background: var(--surface-0);
  border: 1px solid var(--surface-700);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-base);
  color: var(--ink-900);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:hover,
.form-select:hover {
  border-color: var(--ink-300);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(31, 122, 140, 0.15);
  outline: none;
}

.form-control::placeholder {
  color: var(--ink-muted);
}

/* Form labels */
.form-label {
  font-weight: 500;
  color: var(--ink-700);
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
}

/* Input groups */
.input-group {
  display: flex;
  align-items: stretch;
}

.input-group .form-control {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.input-group .btn {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ========================================
   ENHANCED TABLE STYLES
   ======================================== */
.table-modern {
  border-collapse: separate;
  border-spacing: 0;
}

.table-modern thead th {
  background: var(--surface-900);
  position: sticky;
  top: 0;
  z-index: 1;
}

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

.table-modern tbody tr:hover {
  background: var(--surface-900);
}

.table-modern.table-striped tbody tr:nth-child(even) {
  background: rgba(245, 247, 250, 0.5);
}

.table-modern.table-striped tbody tr:nth-child(even):hover {
  background: var(--surface-900);
}

/* Sortable columns */
.table-modern th[data-sortable] {
  cursor: pointer;
  user-select: none;
  transition: color var(--transition-fast);
}

.table-modern th[data-sortable]:hover {
  color: var(--accent);
}

/* ========================================
   BADGE IMPROVEMENTS
   ======================================== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1;
}

.badge-success {
  background: var(--success-soft);
  color: var(--success);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-info {
  background: var(--accent-soft);
  color: var(--accent);
}

.badge-neutral {
  background: var(--surface-800);
  color: var(--ink-500);
}

/* ========================================
   TOOLTIP STYLES (CSS only)
   ======================================== */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::before,
[data-tooltip]::after {
  position: absolute;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-fast), visibility var(--transition-fast);
  pointer-events: none;
  z-index: 100;
}

[data-tooltip]::before {
  content: attr(data-tooltip);
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-2) var(--space-3);
  background: var(--ink-900);
  color: white;
  font-size: var(--text-xs);
  white-space: nowrap;
  border-radius: var(--radius-sm);
}

[data-tooltip]::after {
  content: '';
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink-900);
}

[data-tooltip]:hover::before,
[data-tooltip]:hover::after {
  opacity: 1;
  visibility: visible;
}

/* ========================================
   DASHBOARD SPECIFIC STYLES
   ======================================== */

/* Metrics 4-column grid */
.metrics-4 {
  grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 600px) {
  .metrics-4 {
    grid-template-columns: 1fr;
  }
}

/* Metric card warning variant */
.metric-card-warning {
  border: 1px solid rgba(204, 122, 25, 0.3);
  background: linear-gradient(135deg, var(--surface-0) 0%, rgba(204, 122, 25, 0.05) 100%);
}

/* Metric icon variants */
.metric-icon-sites { background: rgba(31, 122, 140, 0.12); color: var(--accent); }
.metric-icon-bindings { background: rgba(124, 58, 237, 0.12); color: #7c3aed; }
.metric-icon-certs { background: rgba(31, 143, 95, 0.12); color: var(--success); }
.metric-icon-domains { background: rgba(59, 130, 246, 0.12); color: #3b82f6; }
.metric-icon-warning { background: rgba(204, 122, 25, 0.15); color: var(--warning); }

.metric-content h2 {
  margin: var(--space-1) 0;
  font-size: 1.75rem;
}

.metric-subtitle {
  font-size: var(--text-sm);
  margin: 0;
}

.text-cloudflare { color: #f38020; }
.text-azure { color: #0078d4; }

/* Quick Actions Bar */
.quick-actions-bar {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  padding: var(--space-4) var(--space-5);
  background: var(--surface-0);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
}

.quick-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-900);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ink-700);
  transition: all var(--transition-normal);
}

.quick-action:hover {
  background: var(--surface-800);
  color: var(--accent);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-5);
}

@media (max-width: 1000px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  
  .sites-card {
    grid-row: auto;
  }
}

/* Quick actions mobile */
@media (max-width: 767.98px) {
  .quick-actions-bar {
    padding: var(--space-3);
    gap: var(--space-2);
  }
  
  .quick-action {
    flex: 1;
    min-width: calc(50% - 4px);
    justify-content: center;
    padding: var(--space-3) var(--space-3);
    font-size: var(--text-sm);
  }
  
  .quick-action svg {
    width: 16px;
    height: 16px;
  }
  
  .site-item {
    padding: var(--space-3);
  }
  
  .site-pool {
    display: none;
  }
  
  .cert-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }
}

@media (max-width: 575.98px) {
  .quick-action {
    min-width: 100%;
  }
  
  .metric-content h2 {
    font-size: 1.5rem;
  }
  
  .metric-subtitle {
    font-size: var(--text-xs);
  }
  
  .activity-time {
    display: none;
  }
}

.sites-card {
  grid-row: span 2;
}

/* Sites List */
.sites-list {
  display: flex;
  flex-direction: column;
}

.site-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--surface-700);
  transition: background var(--transition-fast);
}

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

.site-item:hover {
  background: var(--surface-900);
}

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

.status-dot-ok {
  background: var(--success);
  box-shadow: 0 0 8px rgba(31, 143, 95, 0.4);
}

.status-dot-warning {
  background: var(--warning);
}

.site-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.site-name {
  font-weight: 600;
  color: var(--ink-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-binding {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--ink-500);
}

.binding-protocol {
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 3px;
  font-weight: 600;
}

.binding-protocol.https {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
}

.binding-protocol.http {
  background: var(--surface-800);
  color: var(--ink-500);
}

.site-pool {
  font-size: var(--text-sm);
  color: var(--ink-300);
  font-family: 'SF Mono', monospace;
}

.site-arrow {
  color: var(--ink-300);
  flex-shrink: 0;
}

/* Alert Card */
.alert-card {
  border: 1px solid rgba(204, 122, 25, 0.3);
}

.alert-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--warning);
}

.alert-header h3 {
  color: var(--warning);
  margin: 0;
}

.alert-header p {
  margin: 0;
  color: var(--ink-500);
  font-size: var(--text-sm);
}

/* Certificate List */
.cert-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-900);
  border-radius: var(--radius-md);
}

.cert-domain {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  font-weight: 500;
}

.cert-expiry {
  font-size: var(--text-sm);
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
}

.cert-warning {
  background: rgba(204, 122, 25, 0.15);
  color: var(--warning);
}

.cert-critical {
  background: rgba(192, 70, 58, 0.12);
  color: var(--danger);
}

/* Activity List */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--surface-700);
}

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

.activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.activity-icon-success {
  background: rgba(31, 143, 95, 0.12);
  color: var(--success);
}

.activity-icon-error {
  background: rgba(192, 70, 58, 0.12);
  color: var(--danger);
}

.activity-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.activity-action {
  font-size: var(--text-sm);
  color: var(--ink-700);
}

.activity-target {
  font-size: var(--text-sm);
  color: var(--ink-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-time {
  font-size: var(--text-xs);
  color: var(--ink-300);
  flex-shrink: 0;
}

.activity-failed .activity-action {
  color: var(--danger);
}

/* Empty States */
.empty-state h4 {
  color: var(--ink-700);
  margin-bottom: var(--space-2);
}

.empty-state-small {
  padding: var(--space-6);
  text-align: center;
  color: var(--ink-300);
}

/* ========================================
   CRITICAL: HIDE DESKTOP SIDEBAR ON MOBILE
   Must be at the end for highest priority
   ======================================== */
@media (max-width: 991.98px) {
  aside.sidebar.sidebar-desktop {
    display: none !important;
    visibility: hidden !important;
    width: 0 !important;
    overflow: hidden !important;
  }
}

/* ========================================
   MIGRATION MODE STYLES
   ======================================== */
.migration-active {
  border: 2px solid var(--warning);
  background: linear-gradient(135deg, var(--surface-0) 0%, rgba(204, 122, 25, 0.05) 100%);
}

.migration-content {
  padding: var(--space-4) var(--space-5);
}

.migration-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.migration-info {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.migration-info strong {
  color: var(--ink-900);
}

.migration-info p {
  color: var(--ink-500);
  font-size: var(--text-sm);
  line-height: 1.5;
}

/* Pulse animation for active migration badge */
@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(204, 122, 25, 0.4);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(204, 122, 25, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(204, 122, 25, 0);
  }
}

@media (max-width: 767.98px) {
  .migration-status {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .migration-status form {
    width: 100%;
  }
  
  .migration-status .btn {
    width: 100%;
    justify-content: center;
  }
}
