:root {
  /* Dark theme (default) */
  --color-bg-page: #0a0e17;
  --color-bg-secondary: #1e293b;
  --color-bg-sidebar-start: #0f141f;
  --color-bg-sidebar-end: #0a0e17;
  --color-bg-placeholder-card: rgba(15, 23, 42, 0.6);
  --color-bg-form-section: rgba(15, 23, 42, 0.45);
  --color-bg-grid: rgba(59, 130, 246, 0.08);
  --color-bg-card: rgba(30, 41, 59, 0.85);
  --color-bg-card-hover: rgba(30, 41, 59, 0.95);
  --color-surface-muted: rgba(255, 255, 255, 0.04);
  --color-surface-input: rgba(255, 255, 255, 0.05);
  --color-border: rgba(59, 130, 246, 0.25);
  --color-border-hover: rgba(59, 130, 246, 0.45);
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-primary-glow: rgba(59, 130, 246, 0.25);
  --color-text-primary: #e2e8f0;
  --color-text-secondary: #94a3b8;
  --color-success: #10b981;
  --color-warning: #f59e0b;
  --color-error: #ef4444;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.3);
  --shadow-card-hover: 0 8px 30px rgba(59, 130, 246, 0.15);
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --sidebar-width: 64px;
}

/* Light theme */
[data-theme="light"] {
  --color-bg-page: #f8fafc;
  --color-bg-secondary: #e2e8f0;
  --color-bg-sidebar-start: #e2e8f0;
  --color-bg-sidebar-end: #cbd5e1;
  --color-bg-placeholder-card: rgba(241, 245, 249, 0.8);
  --color-bg-form-section: rgba(241, 245, 249, 0.6);
  --color-bg-grid: rgba(59, 130, 246, 0.05);
  --color-bg-card: rgba(255, 255, 255, 0.85);
  --color-bg-card-hover: rgba(255, 255, 255, 0.95);
  --color-surface-muted: rgba(15, 23, 42, 0.04);
  --color-surface-input: rgba(15, 23, 42, 0.05);
  --color-border: rgba(59, 130, 246, 0.20);
  --color-border-hover: rgba(59, 130, 246, 0.40);
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-glow: rgba(37, 99, 235, 0.20);
  --color-text-primary: #0f172a;
  --color-text-secondary: #475569;
  --color-success: #059669;
  --color-warning: #d97706;
  --color-error: #dc2626;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 8px 30px rgba(59, 130, 246, 0.1);
}

fluent-button[appearance="accent"]::part(control) {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: white;
}

fluent-button[appearance="accent"]::part(control):hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

fluent-button[appearance="danger"]::part(control) {
  background: var(--color-error);
  border-color: var(--color-error);
  color: white;
}

fluent-button[appearance="danger"]::part(control):hover {
  background: #dc2626;
  border-color: #dc2626;
}

fluent-button[appearance="light"]::part(control),
fluent-button[appearance="outline"]::part(control) {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--color-text-primary);
}

fluent-button[appearance="light"]::part(control):hover,
fluent-button[appearance="outline"]::part(control):hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}

[data-theme="light"] fluent-button[appearance="light"]::part(control),
[data-theme="light"] fluent-button[appearance="outline"]::part(control) {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.2);
  color: var(--color-text-primary);
}

[data-theme="light"] fluent-button[appearance="light"]::part(control):hover,
[data-theme="light"] fluent-button[appearance="outline"]::part(control):hover {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.35);
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--color-bg-page);
  color: var(--color-text-primary);
  font-family: 'Segoe UI', system-ui, sans-serif;
}

body {
  background-image:
    linear-gradient(var(--color-bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--color-bg-grid) 1px, transparent 1px);
  background-size: 20px 20px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.nav-sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--color-bg-sidebar-start) 0%, var(--color-bg-sidebar-end) 100%);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem 0;
  gap: 1rem;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
}

.nav-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35);
}

.nav-logo-icon {
  width: 22px;
  height: 22px;
  background-color: white;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' stroke-opacity='0.4'/%3E%3Cpath d='M8 3v18'/%3E%3Cpath d='M16 3v18'/%3E%3Cpath d='M3 8h5'/%3E%3Cpath d='M3 12h5'/%3E%3Cpath d='M3 16h5'/%3E%3Cpath d='M16 8h5'/%3E%3Cpath d='M16 12h5'/%3E%3Cpath d='M16 16h5'/%3E%3Ccircle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/%3E%3Cpath d='M10.5 12H8'/%3E%3Cpath d='M13.5 12H16'/%3E%3Cpath d='M12 10.5V8'/%3E%3Cpath d='M12 13.5V16'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' stroke-opacity='0.4'/%3E%3Cpath d='M8 3v18'/%3E%3Cpath d='M16 3v18'/%3E%3Cpath d='M3 8h5'/%3E%3Cpath d='M3 12h5'/%3E%3Cpath d='M3 16h5'/%3E%3Cpath d='M16 8h5'/%3E%3Cpath d='M16 12h5'/%3E%3Cpath d='M16 16h5'/%3E%3Ccircle cx='12' cy='12' r='1.5' fill='currentColor' stroke='none'/%3E%3Cpath d='M10.5 12H8'/%3E%3Cpath d='M13.5 12H16'/%3E%3Cpath d='M12 10.5V8'/%3E%3Cpath d='M12 13.5V16'/%3E%3C/svg%3E");
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-items,
.nav-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.nav-items {
  flex: 1;
}

.nav-link {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  text-decoration: none;
  background: transparent;
  border: 1px solid transparent;
  transition: all 0.2s ease;
  font-size: 0.875rem;
  font-weight: 600;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

.nav-logout-form {
  margin: 0;
  padding: 0;
}

.nav-logout-form .nav-link {
  width: 40px;
  height: 40px;
  padding: 0;
  cursor: pointer;
}

/* Missing nav icons */
.nav-icon-home {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
}

.nav-icon-devices {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2' ry='2'/%3E%3Cline x1='8' y1='21' x2='16' y2='21'/%3E%3Cline x1='12' y1='17' x2='12' y2='21'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='3' width='20' height='14' rx='2' ry='2'/%3E%3Cline x1='8' y1='21' x2='16' y2='21'/%3E%3Cline x1='12' y1='17' x2='12' y2='21'/%3E%3C/svg%3E");
}

.nav-icon-servers {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 16 22 16'/%3E%3Cpath d='M2 12 22 12'/%3E%3Cpath d='M5 20h14'/%3E%3Cpath d='M5 4h14'/%3E%3Crect x='2' y='4' width='20' height='12' rx='2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 16 22 16'/%3E%3Cpath d='M2 12 22 12'/%3E%3Cpath d='M5 20h14'/%3E%3Cpath d='M5 4h14'/%3E%3Crect x='2' y='4' width='20' height='12' rx='2'/%3E%3C/svg%3E");
}

.nav-icon-records {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='23 6 13.5 15.5 8.5 10.5 1 18'/%3E%3Cpolyline points='17 6 23 6 23 12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='23 6 13.5 15.5 8.5 10.5 1 18'/%3E%3Cpolyline points='17 6 23 6 23 12'/%3E%3C/svg%3E");
}

.nav-icon-images {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
}

/* Missing action/detail icons */
.icon-info {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpath d='M12 16v-4'/%3E%3Cpath d='M12 8h.01'/%3E%3C/svg%3E");
}

.icon-camera {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z'/%3E%3Ccircle cx='12' cy='13' r='3'/%3E%3C/svg%3E");
}

.icon-ruler {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.3 15.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0L2.7 20.7a2.41 2.41 0 0 0 3.4 3.4l10.6-10.6a2.4 2.4 0 0 0 3.4 0l1.2-1.2z'/%3E%3Cpath d='m13 13 3 3'/%3E%3Cpath d='m5.5 5.5 1 1'/%3E%3Cpath d='m8.5 8.5 1 1'/%3E%3Cpath d='m11.5 11.5 1 1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21.3 15.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0L2.7 20.7a2.41 2.41 0 0 0 3.4 3.4l10.6-10.6a2.4 2.4 0 0 0 3.4 0l1.2-1.2z'/%3E%3Cpath d='m13 13 3 3'/%3E%3Cpath d='m5.5 5.5 1 1'/%3E%3Cpath d='m8.5 8.5 1 1'/%3E%3Cpath d='m11.5 11.5 1 1'/%3E%3C/svg%3E");
}

.icon-cloud {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z'/%3E%3C/svg%3E");
}

.icon-arrow-right {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14'/%3E%3Cpath d='m12 5 7 7-7 7'/%3E%3C/svg%3E");
}

.device-icon {
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2' ry='2'/%3E%3Cline x1='12' y1='18' x2='12.01' y2='18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='2' width='14' height='20' rx='2' ry='2'/%3E%3Cline x1='12' y1='18' x2='12.01' y2='18'/%3E%3C/svg%3E");
}

/* Nav logout/login icons for NavMenu */
.icon-logout {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}

.icon-login {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E");
}

.icon-theme-moon {
  width: 20px;
  height: 20px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

.icon-nav {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3C/svg%3E");
}

.icon-chart {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-4l-3 9L9 3l-3 9H2'/%3E%3C/svg%3E");
}

.nav-icon-dashboard {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E");
}

.nav-icon-global-sources {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='2' y1='12' x2='22' y2='12'/%3E%3Cpath d='M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z'/%3E%3C/svg%3E");
}

.nav-icon-my-sources {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='5'/%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3C/svg%3E");
}

.nav-icon-shared-sources {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3Ccircle cx='6' cy='12' r='3'/%3E%3Ccircle cx='18' cy='19' r='3'/%3E%3Cline x1='8.59' y1='13.51' x2='15.42' y2='17.49'/%3E%3Cline x1='15.41' y1='6.51' x2='8.59' y2='10.49'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='18' cy='5' r='3'/%3E%3Ccircle cx='6' cy='12' r='3'/%3E%3Ccircle cx='18' cy='19' r='3'/%3E%3Cline x1='8.59' y1='13.51' x2='15.42' y2='17.49'/%3E%3Cline x1='15.41' y1='6.51' x2='8.59' y2='10.49'/%3E%3C/svg%3E");
}

.nav-icon-api-keys {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M12 15h9'/%3E%3Cpath d='M18 15v-3'/%3E%3Cpath d='M21 15v-2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='8' cy='15' r='4'/%3E%3Cpath d='M12 15h9'/%3E%3Cpath d='M18 15v-3'/%3E%3Cpath d='M21 15v-2'/%3E%3C/svg%3E");
}

.nav-icon-users {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='9' cy='7' r='4'/%3E%3Cpath d='M23 21v-2a4 4 0 0 0-3-3.87'/%3E%3Cpath d='M16 3.13a4 4 0 0 1 0 7.75'/%3E%3C/svg%3E");
}

.nav-icon-logs {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
}

.nav-icon-stats {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='m7 15 4-4 3 3 5-7'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3v18h18'/%3E%3Cpath d='m7 15 4-4 3 3 5-7'/%3E%3C/svg%3E");
}

.nav-icon-system {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z'/%3E%3C/svg%3E");
}

.nav-icon-password {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

.nav-icon-logout {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4'/%3E%3Cpolyline points='16 17 21 12 16 7'/%3E%3Cline x1='21' y1='12' x2='9' y2='12'/%3E%3C/svg%3E");
}

.nav-icon-login {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4'/%3E%3Cpolyline points='10 17 15 12 10 7'/%3E%3Cline x1='15' y1='12' x2='3' y2='12'/%3E%3C/svg%3E");
}

/* Theme toggle button */
.nav-theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.nav-theme-toggle:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-card);
  border-color: var(--color-border);
}

.nav-theme-toggle .nav-icon {
  position: absolute;
}

/* Show moon icon in dark mode (default), hide in light mode */
[data-theme="dark"] .nav-icon-theme-light {
  display: none;
}

[data-theme="dark"] .nav-icon-theme-dark {
  display: inline-block;
}

/* Show sun icon in light mode */
[data-theme="light"] .nav-icon-theme-dark {
  display: none;
}

[data-theme="light"] .nav-icon-theme-light {
  display: inline-block;
}

/* Fallback: show moon in dark mode by default (before JS runs) */
:root:not([data-theme]) .nav-icon-theme-light,
html:not([data-theme]) .nav-icon-theme-light {
  display: none;
}

:root:not([data-theme]) .nav-icon-theme-dark,
html:not([data-theme]) .nav-icon-theme-dark {
  display: inline-block;
}

/* Light mode: show sun, hide moon by default */
[data-theme="light"]:not(.dark) .nav-icon-theme-light,
[data-theme="light"] .nav-icon-theme-light {
  display: inline-block;
}

[data-theme="light"]:not(.dark) .nav-icon-theme-dark,
[data-theme="light"] .nav-icon-theme-dark {
  display: none;
}

/* Theme toggle icons */
.nav-icon-theme-dark {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

.nav-icon-theme-light {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
}

.nav-link-icon svg {
  display: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--color-text-primary);
  background: var(--color-bg-card);
  border-color: var(--color-border);
  box-shadow: var(--shadow-card-hover);
}

.app-main {
  flex: 1;
  padding: 1.5rem;
}

.page-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
}

.page-title {
  margin: 0 0 1rem 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.page-subtitle {
  margin: 0 0 1.5rem 0;
  color: var(--color-text-secondary);
}

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

.placeholder-card {
  min-height: 120px;
  background: var(--color-bg-placeholder-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

/* Common page container styles - used by all admin pages */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.page-header .page-title {
  margin: 0;
}

.page-header .page-subtitle {
  margin: 0;
}

.page-header fluent-button {
  align-self: flex-start;
}

/* Common loading styles */
.loading-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem;
  gap: 1rem;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(59, 130, 246, 0.2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loading-text {
  margin: 0;
  color: var(--color-text-secondary);
}

/* Common table styles */
.page-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-card);
}

.table-card {
  overflow-x: auto;
}

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

/* Generic table styles */
.generic-table {
  width: 100%;
  border-collapse: collapse;
}

.generic-table thead {
  border-bottom: 1px solid var(--color-border);
}

.generic-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 0.875rem;
}

.generic-table td {
  padding: 1rem 0.5rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  vertical-align: middle;
}

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

/* Aliases for backward compatibility */
.sources-table, .stats-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.sources-table thead, .stats-table thead {
  border-bottom: 1px solid var(--color-border);
}

.sources-table th, .stats-table th {
  text-align: left;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
  font-size: 0.875rem;
}

.sources-table td, .stats-table td {
  padding: 1rem 0.5rem;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  vertical-align: middle;
}

/* Actions wrapper for vertical alignment */
.sources-table td .actions,
.stats-table td .actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 32px;
}

.sources-table tbody tr:last-child td, .stats-table tbody tr:last-child td {
  border-bottom: none;
}

/* Actions column styles */
.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.actions-icons {
  gap: 0.25rem;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.icon-action svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-action:hover {
  background: var(--color-bg-card);
  border-color: var(--color-border-hover);
  color: var(--color-text-primary);
}

.icon-action:active {
  transform: scale(0.96);
}

.icon-action-success {
  color: var(--color-success);
}

.icon-action-success:hover {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Inline SVG icons via mask-image for reusability */
.icon-edit,
.icon-share,
.icon-enable,
.icon-disable,
.icon-delete,
.icon-copy,
.icon-export,
.icon-download,
.icon-route {
  width: 18px;
  height: 18px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
}

.icon-edit {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 1 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 1 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E");
}

.icon-share {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7'/%3E%3Cpath d='M16 6l-4-4-4 4'/%3E%3Cpath d='M12 2v14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12v7a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-7'/%3E%3Cpath d='M16 6l-4-4-4 4'/%3E%3Cpath d='M12 2v14'/%3E%3C/svg%3E");
}

.icon-enable {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 5 11 7-11 7z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m8 5 11 7-11 7z'/%3E%3C/svg%3E");
}

.icon-disable {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H6v16h4z'/%3E%3Cpath d='M18 4h-4v16h4z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 4H6v16h4z'/%3E%3Cpath d='M18 4h-4v16h4z'/%3E%3C/svg%3E");
}

.icon-delete {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18'/%3E%3Cpath d='M8 6V4h8v2'/%3E%3Cpath d='M19 6l-1 14H6L5 6'/%3E%3Cpath d='M10 11v6'/%3E%3Cpath d='M14 11v6'/%3E%3C/svg%3E");
}

.icon-copy {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='9' width='13' height='13' rx='2' ry='2'/%3E%3Cpath d='M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1'/%3E%3C/svg%3E");
}

.icon-export {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
}

.icon-download {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'/%3E%3Cpolyline points='7 10 12 15 17 10'/%3E%3Cline x1='12' y1='15' x2='12' y2='3'/%3E%3C/svg%3E");
}

.icon-view {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
}

.icon-settings {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 1-3 0 1.7 1.7 0 0 0-1-.6 1.7 1.7 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-.6-1 1.7 1.7 0 0 1 0-3 1.7 1.7 0 0 0 .6-1 1.7 1.7 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.7 1.7 0 0 0 9 4.6a1.7 1.7 0 0 0 1-.6 1.7 1.7 0 0 1 3 0 1.7 1.7 0 0 0 1 .6 1.7 1.7 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.7 1.7 0 0 0 19.4 9c0 .38.22.74.6 1a1.7 1.7 0 0 1 0 3 1.7 1.7 0 0 0-.6 1'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M19.4 15a1.7 1.7 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.7 1.7 0 0 0-1 .6 1.7 1.7 0 0 1-3 0 1.7 1.7 0 0 0-1-.6 1.7 1.7 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06A1.7 1.7 0 0 0 4.6 15a1.7 1.7 0 0 0-.6-1 1.7 1.7 0 0 1 0-3 1.7 1.7 0 0 0 .6-1 1.7 1.7 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.7 1.7 0 0 0 9 4.6a1.7 1.7 0 0 0 1-.6 1.7 1.7 0 0 1 3 0 1.7 1.7 0 0 0 1 .6 1.7 1.7 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.7 1.7 0 0 0 19.4 9c0 .38.22.74.6 1a1.7 1.7 0 0 1 0 3 1.7 1.7 0 0 0-.6 1'/%3E%3C/svg%3E");
}

.icon-route {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolygon points='16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cpolygon points='16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76'/%3E%3C/svg%3E");
}

.icon-reset {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7'/%3E%3Cpath d='M3 3v6h6'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7'/%3E%3Cpath d='M3 3v6h6'/%3E%3C/svg%3E");
}

.icon-password {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z'/%3E%3Cpath d='m9 12 2 2 4-4'/%3E%3C/svg%3E");
}

.icon-action[class*="icon-"] {
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: 18px;
  mask-size: 18px;
}

.icon-action[class*="icon-"] svg,
.icon-action[class*="icon-"] img {
  display: none;
}

.icon-action-warning {
  color: var(--color-warning);
}

.icon-action-warning:hover {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.4);
}

.icon-action-danger:hover {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
  color: var(--color-error);
}

/* Common form input styles */
.form-group {
  margin-bottom: 1rem;
}

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

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

.form-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  transition: all 0.2s;
  box-sizing: border-box;
}

.form-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

select.form-input {
  cursor: pointer;
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

select.form-input option {
  background-color: var(--color-bg-secondary);
  color: var(--color-text-primary);
}

/* Model configuration list styles */
.model-config-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.model-config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 1rem;
  max-height: 70vh;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Model configuration table styles */
.model-config-table-container {
  overflow-x: auto;
  max-height: 65vh;
  overflow-y: auto;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.model-config-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.model-config-table th,
.model-config-table td {
  padding: 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.model-config-table th {
  background: var(--color-bg-secondary);
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.model-config-table td {
  background: var(--color-bg-card);
}

.model-config-table tr:hover td {
  background: var(--color-bg-card-hover);
}

.model-config-table .col-enabled { width: 60px; text-align: center; vertical-align: middle; }
.model-config-table .col-default { width: 60px; text-align: center; vertical-align: middle; }
.model-config-table .col-actions { width: 70px; text-align: center; vertical-align: middle; }
.model-config-table .col-upstream { min-width: 140px; }
.model-config-table .col-normalized { min-width: 140px; }
.model-config-table .col-aliases { min-width: 200px; }
.model-config-table .col-effort { min-width: 100px; }
.model-config-table .col-capabilities { min-width: 180px; }

.table-checkbox,
.table-radio {
  width: 16px;
  height: 16px;
  cursor: pointer;
  margin: 0;
  vertical-align: middle;
}

.table-checkbox:disabled,
.table-radio:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.table-input {
  width: 100%;
  padding: 0.375rem 0.5rem;
  background: var(--color-surface-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
}

.table-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.table-select {
  width: 100%;
  padding: 0.375rem 0.5rem;
  background: var(--color-surface-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  font-size: 0.8125rem;
  cursor: pointer;
}

/* <option> elements are rendered by the OS and don't inherit CSS variables;
   we need opaque, theme-aware colours so they're readable in dark mode. */
.table-select option {
  background-color: #1e293b;
  color: #e2e8f0;
}

[data-theme="light"] .table-select option {
  background-color: #f8fafc;
  color: #0f172a;
}

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

.capabilities-inline {
  display: flex;
  gap: 0.25rem;
}

.cap-label {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  font-size: 0.75rem;
  padding: 0.125rem 0.25rem;
  background: var(--color-surface-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.cap-label input {
  margin: 0;
  width: 12px;
  height: 12px;
}

/* Table icon buttons and capability icons */
.cap-icon-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  position: relative;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.cap-icon-label:hover {
  background: var(--color-surface-muted);
}

.cap-icon-label input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}

.cap-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: var(--color-text-secondary);
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
  opacity: 0.4;
  transition: opacity 0.15s;
}

.cap-icon-label input:checked + .cap-icon {
  opacity: 1;
  background-color: var(--color-primary);
}

/* Capability icons - SVG data URIs */
.cap-icon-text {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E");
}

.cap-icon-image {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
}

.cap-icon-video {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'/%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='23 7 16 12 23 17 23 7'/%3E%3Crect x='1' y='5' width='15' height='14' rx='2' ry='2'/%3E%3C/svg%3E");
}

.cap-icon-audio {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M9 18V5l12-2v13'/%3E%3Ccircle cx='6' cy='18' r='3'/%3E%3Ccircle cx='18' cy='16' r='3'/%3E%3C/svg%3E");
}

.cap-icon-document {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z'/%3E%3Cpolyline points='14 2 14 8 20 8'/%3E%3Cline x1='16' y1='13' x2='8' y2='13'/%3E%3Cline x1='16' y1='17' x2='8' y2='17'/%3E%3Cpolyline points='10 9 9 9 8 9'/%3E%3C/svg%3E");
}

.cap-icon-tts {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolygon points='11 5 6 9 2 9 2 15 6 15 11 19 11 5'/%3E%3Cpath d='M19.07 4.93a10 10 0 0 1 0 14.14M15.54 8.46a5 5 0 0 1 0 7.07'/%3E%3C/svg%3E");
}

.cap-icon-asr {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M12 1a3 3 0 0 0-3 3v8a3 3 0 0 0 6 0V4a3 3 0 0 0-3-3z'/%3E%3Cpath d='M19 10v2a7 7 0 0 1-14 0v-2'/%3E%3Cline x1='12' y1='19' x2='12' y2='23'/%3E%3Cline x1='8' y1='23' x2='16' y2='23'/%3E%3C/svg%3E");
}

/* Delete icon button in table */
.icon-delete-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  margin: 0 auto;
}

.icon-delete-btn:hover {
  background: var(--color-surface-muted);
}

.icon-delete {
  width: 16px;
  height: 16px;
  display: inline-block;
  background-color: var(--color-error);
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpolyline points='3 6 5 6 21 6'/%3E%3Cpath d='M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2'/%3E%3Cline x1='10' y1='11' x2='10' y2='17'/%3E%3Cline x1='14' y1='11' x2='14' y2='17'/%3E%3C/svg%3E");
}

.model-config-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

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

.model-default-toggle {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
}

.model-config-body.two-column {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  padding-left: 0;
}

.column-span-2 {
  grid-column: 1 / -1;
}

.model-config-body {
  padding-left: 1.5rem;
}

.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

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

/* Dialog overlay and container styles */
.dialog-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  z-index: 1000;
  padding: 2rem 1rem;
  overflow-y: auto;
}

.dialog {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  min-width: 400px;
  max-width: 90vw;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: auto;
}

.dialog.dialog-wide {
  min-width: 540px;
}

.dialog.dialog-x-wide {
  min-width: 780px;
  max-width: 95vw;
}

.dialog.dialog-xx-wide {
  min-width: 980px;
  max-width: 98vw;
}

.dialog.dialog-tall {
  min-height: 400px;
}

.dialog-header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--color-border);
  overflow: hidden;
  flex-shrink: 0;
}

.dialog-header h3 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.dialog-body {
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
}

.dialog-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

.form-textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  transition: all 0.2s;
  box-sizing: border-box;
  resize: vertical;
}

.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

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

.error-message {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

.field-help {
  margin-top: 0.35rem;
  color: var(--color-text-secondary);
  font-size: 0.8rem;
}

.service-source-layout {
  display: grid;
  gap: 1rem;
}

.form-section-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem;
  background: var(--color-bg-form-section);
}

.form-section-header {
  margin-bottom: 1rem;
}

.form-section-header h4 {
  margin: 0 0 0.35rem 0;
}

.form-section-header p {
  margin: 0;
  color: var(--color-text-secondary);
  font-size: 0.9rem;
}

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

.form-grid {
  display: grid;
  gap: 0.9rem 1rem;
}

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

.form-grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.form-span-2 {
  grid-column: 1 / -1;
}

.capabilities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, max-content));
  gap: 0.75rem 1rem;
}

.inline-checkbox-row {
  margin-bottom: 0;
}

.checkbox-inline {
  display: inline-flex !important;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
}

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

.model-summary-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  background: rgba(59, 130, 246, 0.06);
}

.model-summary-card-wide {
  grid-column: span 2;
}

.model-summary-label {
  color: var(--color-text-secondary);
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
}

.model-summary-value {
  font-size: 1.35rem;
  font-weight: 700;
}

.model-summary-text {
  font-weight: 600;
  word-break: break-word;
}

.model-chip-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.model-chip-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.03);
}

.model-chip-name {
  font-weight: 600;
}

.empty-inline-state {
  margin-top: 1rem;
  padding: 1rem;
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
}

.model-config-toolbar {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.model-config-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: var(--color-success);
}

.badge-muted {
  background: rgba(148, 163, 184, 0.12);
  color: var(--color-text-secondary);
  opacity: 0.7;
}

@media (max-width: 900px) {
  .dialog.dialog-x-wide {
    min-width: 0;
    max-width: 96vw;
  }

  .form-section-header-inline {
    flex-direction: column;
  }

  .model-summary-card-wide {
    grid-column: auto;
  }

  .model-config-grid {
    grid-template-columns: 1fr;
  }

  .model-config-body.two-column {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .dialog-body,
  .dialog-header,
  .dialog-footer {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

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

.source-desc {
  margin-top: 0.25rem;
  color: var(--color-text-secondary);
  font-size: 0.85rem;
}

.shared-count {
  color: var(--color-text-primary);
}

.shared-count.none {
  color: var(--color-text-secondary);
}

.actions fluent-button {
  flex-shrink: 0;
}

.validation-message,
.validation-errors,
.validation-summary-errors {
  color: #fca5a5;
}

.validation-summary-valid {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--color-text-primary);
  cursor: pointer;
}

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

.btn.btn-secondary {
  background: rgba(59, 130, 246, 0.12);
}

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

.btn.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.35);
}

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

.form-group.half {
  margin-bottom: 0;
}

.form-section {
  margin-top: 1.25rem;
}

.form-section h4 {
  margin: 0 0 0.75rem 0;
}

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

.dialog-body .validation-summary-errors ul {
  margin: 0.75rem 0 0 1rem;
}

.dialog-body .validation-summary-errors li {
  margin-bottom: 0.25rem;
}

.model-config-body {
  padding-left: 0;
}

.model-config-header > label {
  margin-bottom: 0;
}

.model-default-toggle {
  margin-bottom: 0;
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.checkbox-group label input {
  margin: 0;
}

.form-group label.checkbox-inline {
  margin-bottom: 0;
}

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

.dialog-footer fluent-button:first-child {
  margin-right: auto;
}

.editform-validation-spacer {
  height: 0;
}

.dialog-overlay fluent-button,
.dialog-overlay button,
.dialog-overlay input,
.dialog-overlay select,
.dialog-overlay textarea {
  font: inherit;
}

.dialog-body small {
  color: var(--color-text-secondary);
}

.dialog-body * {
  min-width: 0;
}

.dialog-body {
  scrollbar-gutter: stable;
}

.model-config-item strong {
  word-break: break-word;
}

.model-config-grid::-webkit-scrollbar,
.dialog-body::-webkit-scrollbar,
.model-config-list::-webkit-scrollbar {
  width: 10px;
}

.model-config-grid::-webkit-scrollbar-thumb,
.dialog-body::-webkit-scrollbar-thumb,
.model-config-list::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 999px;
}

.model-config-grid::-webkit-scrollbar-track,
.dialog-body::-webkit-scrollbar-track,
.model-config-list::-webkit-scrollbar-track {
  background: transparent;
}

.dialog-body fluent-button + fluent-button {
  margin-left: 0;
}

.form-group > .checkbox-group {
  margin-top: 0.25rem;
}

.form-section-card + .form-section-card {
  margin-top: 0;
}

.dialog-footer .spacer {
  flex: 1;
}

.dialog-footer {
  flex-wrap: wrap;
}

.dialog-footer > * {
  flex-shrink: 0;
}

.dialog-body .field-validation-error {
  color: #fca5a5;
}

.dialog-body .input-validation-error {
  border-color: rgba(239, 68, 68, 0.6);
}

.dialog-body .input-validation-error:focus {
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.16);
}

.dialog-body .validation-summary-errors {
  margin-top: 1rem;
}

.dialog-body .validation-summary-errors ul li::marker {
  color: #fca5a5;
}

.dialog-body .model-config-toolbar + .form-group {
  margin-top: 0;
}

.dialog-body .empty-inline-state + .validation-summary-errors {
  margin-top: 1rem;
}

.dialog-body .model-chip-item .badge {
  margin-left: 0;
}

.dialog-body .model-config-actions .model-default-toggle {
  font-size: 0.85rem;
}

.dialog-body .model-config-actions fluent-button {
  --accent-fill-rest: rgba(255,255,255,0.04);
}

.dialog-body .form-section-card .form-group:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout > .form-section-card:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout {
  margin-bottom: 0.25rem;
}

.dialog-body .model-summary-grid + .model-chip-list,
.dialog-body .model-summary-grid + .empty-inline-state {
  margin-top: 1rem;
}

.dialog-body .capabilities-grid label {
  margin-bottom: 0;
}

.dialog-body .checkbox-inline strong {
  font-weight: 600;
}

.dialog-body .model-config-item .form-group {
  margin-bottom: 0.85rem;
}

.dialog-body .model-config-item .form-group:last-child {
  margin-bottom: 0;
}

.dialog-body .model-config-item .column-span-2:last-child {
  margin-bottom: 0;
}

.dialog-body .model-config-header {
  align-items: flex-start;
}

.dialog-body .model-config-actions {
  justify-content: flex-end;
}

.dialog-body .model-config-grid {
  padding-right: 0.25rem;
}

.dialog-body .model-chip-item .badge-default {
  background: var(--color-primary);
  color: white;
}

.dialog-body .model-summary-value,
.dialog-body .model-summary-text {
  color: var(--color-text-primary);
}

.dialog-body .empty-inline-state,
.dialog-body .field-help,
.dialog-body .source-desc {
  line-height: 1.45;
}

.dialog-body .form-grid .form-group {
  margin-bottom: 0;
}

.dialog-body .form-grid + .form-group {
  margin-top: 1rem;
}

.dialog-body .inline-checkbox-row {
  margin-top: 1rem;
}

.dialog-body .form-section-header + .form-grid,
.dialog-body .form-section-header + .model-summary-grid,
.dialog-body .form-section-header + .model-config-toolbar {
  margin-top: 0;
}

.dialog-body .model-summary-card,
.dialog-body .model-chip-item,
.dialog-body .empty-inline-state,
.dialog-body .model-config-item,
.dialog-body .form-section-card {
  backdrop-filter: blur(6px);
}

.dialog-body .model-config-item {
  min-height: 100%;
}

.dialog-body .form-section-card p,
.dialog-body .form-section-card h4 {
  min-width: 0;
}

.dialog-body .form-section-card .model-chip-name {
  word-break: break-word;
}

.dialog-body .model-summary-grid {
  align-items: stretch;
}

.dialog-body .model-summary-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.dialog-body .service-source-layout {
  align-items: start;
}

.dialog-body .checkbox-group.capabilities-grid {
  align-items: center;
}

.dialog-body .form-section-header-inline fluent-button {
  align-self: flex-start;
}

.dialog-body .model-config-actions .checkbox-inline {
  white-space: nowrap;
}

.dialog-body .model-config-actions fluent-button,
.dialog-body .model-config-actions .model-default-toggle {
  margin-top: 0;
}

.dialog-body .model-config-header .checkbox-inline {
  flex: 1;
}

.dialog-body .model-config-header .checkbox-inline strong {
  display: inline-block;
}

.dialog-body .model-config-toolbar fluent-button {
  flex-shrink: 0;
}

.dialog-body .form-section-header-inline > div {
  flex: 1;
}

.dialog-body .form-section-card {
  overflow: hidden;
}

.dialog-body .model-summary-grid,
.dialog-body .model-chip-list,
.dialog-body .form-grid,
.dialog-body .capabilities-grid {
  width: 100%;
}

.dialog-body .model-config-item .checkbox-group {
  width: 100%;
}

.dialog-body .service-source-layout .validation-summary-errors {
  grid-column: 1 / -1;
}

.dialog-body .validation-summary-errors ul {
  padding-left: 1rem;
}

.dialog-body .validation-summary-errors li:last-child {
  margin-bottom: 0;
}

.dialog-body .form-grid .form-span-2 {
  min-width: 0;
}

.dialog-body .model-summary-card-wide {
  min-width: 0;
}

.dialog-body .model-config-grid .column-span-2 {
  min-width: 0;
}

.dialog-body .form-textarea,
.dialog-body .form-input {
  min-width: 0;
}

.dialog-body .model-config-actions .model-default-toggle input,
.dialog-body .checkbox-inline input {
  flex-shrink: 0;
}

.dialog-body .model-chip-item .badge {
  white-space: nowrap;
}

.dialog-body .form-section-card .empty-inline-state {
  margin-bottom: 0;
}

.dialog-body .model-config-toolbar + .error-message,
.dialog-body .error-message + .model-config-grid,
.dialog-body .error-message + .empty-inline-state,
.dialog-body .form-group + .error-message {
  margin-top: 1rem;
}

.dialog-body .error-message + .form-group {
  margin-top: 1rem;
}

.dialog-body .form-section-card .model-summary-grid {
  margin-bottom: 0;
}

.dialog-body .model-chip-item .badge-success,
.dialog-body .model-chip-item .badge-muted {
  font-size: 0.75rem;
}

.dialog-body .model-config-item .field-help {
  margin-bottom: 0;
}

.dialog-body .service-source-layout > .validation-summary-errors {
  margin-top: 0;
}

.dialog-body .form-section-card .checkbox-group label {
  color: var(--color-text-primary);
}

.dialog-body .model-config-item .checkbox-group label {
  color: var(--color-text-primary);
}

.dialog-body .model-summary-card .model-summary-label,
.dialog-body .model-summary-card .model-summary-text,
.dialog-body .model-summary-card .model-summary-value {
  min-width: 0;
}

.dialog-body .form-section-card .checkbox-inline,
.dialog-body .model-config-item .checkbox-inline {
  color: var(--color-text-primary);
}

.dialog-body .model-config-toolbar,
.dialog-body .model-config-grid,
.dialog-body .model-chip-list,
.dialog-body .model-summary-grid {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card {
  min-width: 0;
}

.dialog-body .service-source-layout {
  min-width: 0;
}

.dialog-body .model-config-grid .model-config-item {
  min-width: 0;
}

.dialog-body .model-config-actions fluent-button::part(control) {
  min-height: 30px;
}

.dialog-body .form-section-header-inline fluent-button::part(control),
.dialog-footer fluent-button::part(control) {
  white-space: nowrap;
}

.dialog-body .model-config-toolbar fluent-button::part(control) {
  white-space: nowrap;
}

.dialog-body .form-section-card,
.dialog-body .model-config-item,
.dialog-body .model-summary-card,
.dialog-body .model-chip-item,
.dialog-body .empty-inline-state {
  box-shadow: none;
}

.dialog-body .model-config-item:hover,
.dialog-body .model-chip-item:hover,
.dialog-body .model-summary-card:hover {
  border-color: var(--color-border-hover);
}

.dialog-body .model-config-item,
.dialog-body .model-chip-item,
.dialog-body .model-summary-card {
  transition: border-color 0.2s ease;
}

.dialog-body .form-section-card + .validation-summary-errors {
  margin-top: 1rem;
}

.dialog-body .service-source-layout > * {
  min-width: 0;
}

.dialog-body .model-config-item .form-group > label,
.dialog-body .form-section-card .form-group > label {
  word-break: break-word;
}

.dialog-body .model-summary-text,
.dialog-body .model-chip-name,
.dialog-body .field-help {
  overflow-wrap: anywhere;
}

.dialog-body .model-config-header .checkbox-inline {
  align-items: flex-start;
}

.dialog-body .model-config-header .checkbox-inline input {
  margin-top: 0.15rem;
}

.dialog-body .service-source-layout .form-section-card:first-child {
  margin-top: 0;
}

.dialog-body .service-source-layout .form-section-card:last-child {
  margin-bottom: 0;
}

.dialog-body .error-message {
  overflow-wrap: anywhere;
  word-break: break-all;
  max-height: 10rem;
  overflow-y: auto;
}

.dialog-body .model-config-item .field-help,
.dialog-body .form-section-header p {
  overflow-wrap: anywhere;
}

.dialog-body .form-group input[type="number"] {
  appearance: textfield;
}

.dialog-body .form-group input[type="number"]::-webkit-outer-spin-button,
.dialog-body .form-group input[type="number"]::-webkit-inner-spin-button {
  margin: 0;
}

.dialog-body .form-group select.form-input {
  min-height: 38px;
}

.dialog-body .model-config-toolbar + .form-group label {
  margin-bottom: 0.5rem;
}

.dialog-body .model-config-toolbar + .form-group {
  margin-bottom: 0;
}

.dialog-body .model-config-toolbar + .form-group + .error-message {
  margin-top: 1rem;
}

.dialog-body .model-config-item .column-span-2 .checkbox-group {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .form-grid .form-group:last-child {
  margin-bottom: 0;
}

.dialog-body .model-config-header {
  min-width: 0;
}

.dialog-body .model-config-actions {
  min-width: 0;
}

.dialog-body .model-config-header .checkbox-inline strong,
.dialog-body .model-config-header .checkbox-inline {
  min-width: 0;
}

.dialog-body .checkbox-group label {
  user-select: none;
}

.dialog-body .model-config-grid {
  margin-top: 1rem;
}

.dialog-body .validation-summary-errors + .form-section-card {
  margin-top: 1rem;
}

.dialog-body .dialog-note {
  color: var(--color-text-secondary);
}

.dialog-body .form-grid-2 > .form-group,
.dialog-body .capabilities-grid > label,
.dialog-body .model-summary-grid > .model-summary-card,
.dialog-body .model-chip-list > .model-chip-item {
  min-width: 0;
}

.dialog-body .model-config-item .form-group.column-span-2 {
  width: 100%;
}

.dialog-body .form-section-card .form-grid-2 {
  align-items: start;
}

.dialog-body .service-source-layout .form-section-card {
  position: relative;
}

.dialog-body .service-source-layout .form-section-card::after {
  content: "";
  display: block;
  clear: both;
}

.dialog-body .model-config-toolbar,
.dialog-body .form-section-header-inline {
  position: relative;
  z-index: 1;
}

.dialog-body .model-config-grid {
  position: relative;
}

.dialog-body .service-source-layout .form-section-card .field-help:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .empty-inline-state:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .model-chip-list:last-child,
.dialog-body .service-source-layout .form-section-card .model-summary-grid:last-child,
.dialog-body .service-source-layout .form-section-card .form-grid:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .inline-checkbox-row:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .checkbox-group:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .form-group:last-child .field-help:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .form-group:last-child .checkbox-group:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .form-group:last-child .form-input:last-child,
.dialog-body .service-source-layout .form-section-card .form-group:last-child .form-textarea:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout .form-section-card .form-section-header:last-child {
  margin-bottom: 0;
}

.dialog-body .service-source-layout {
  grid-auto-rows: auto;
}

.dialog-body .service-source-layout .form-section-card .model-chip-item {
  align-items: center;
}

.dialog-body .service-source-layout .form-section-card .model-summary-card-wide {
  display: flex;
}

.dialog-body .service-source-layout .form-section-card .model-summary-card-wide .model-summary-text {
  flex: 1;
}

.dialog-body .service-source-layout .form-section-card .checkbox-inline input,
.dialog-body .service-source-layout .form-section-card .model-default-toggle input {
  accent-color: var(--color-primary);
}

.dialog-body .service-source-layout .form-section-card .form-input::placeholder,
.dialog-body .service-source-layout .form-section-card .form-textarea::placeholder {
  color: var(--color-text-secondary);
}

.dialog-body .service-source-layout .form-section-card .form-input,
.dialog-body .service-source-layout .form-section-card .form-textarea {
  color-scheme: dark;
}

.dialog-body .service-source-layout .form-section-card .form-input option {
  color-scheme: dark;
}

.dialog-body .service-source-layout .form-section-card .form-group,
.dialog-body .model-config-item .form-group {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .form-group > * {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .model-summary-card,
.dialog-body .service-source-layout .form-section-card .model-chip-item {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .model-summary-grid,
.dialog-body .service-source-layout .form-section-card .model-chip-list {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .checkbox-group label,
.dialog-body .model-config-item .checkbox-group label {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .checkbox-group label,
.dialog-body .service-source-layout .form-section-card .checkbox-inline,
.dialog-body .model-config-item .checkbox-group label,
.dialog-body .model-config-item .checkbox-inline {
  line-height: 1.25;
}

/* Login page theme toggle */
.login-container {
  position: relative;
}

.login-theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 100;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

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

.theme-icon {
  position: absolute;
  width: 24px;
  height: 24px;
  display: inline-block;
  background-color: currentColor;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  -webkit-mask-size: contain;
  mask-size: contain;
}

/* Show moon icon in dark mode */
[data-theme="dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark {
  display: inline-block;
}

/* Show sun icon in light mode */
[data-theme="light"] .theme-icon-dark {
  display: none;
}

[data-theme="light"] .theme-icon-light {
  display: inline-block;
}

/* Default fallback: show moon */
:root:not([data-theme]) .theme-icon-light,
html:not([data-theme]) .theme-icon-light {
  display: none;
}

:root:not([data-theme]) .theme-icon-dark,
html:not([data-theme]) .theme-icon-dark {
  display: inline-block;
}

.theme-icon-dark {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E");
}

.theme-icon-light {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='5'/%3E%3Cline x1='12' y1='1' x2='12' y2='3'/%3E%3Cline x1='12' y1='21' x2='12' y2='23'/%3E%3Cline x1='4.22' y1='4.22' x2='5.64' y2='5.64'/%3E%3Cline x1='18.36' y1='18.36' x2='19.78' y2='19.78'/%3E%3Cline x1='1' y1='12' x2='3' y2='12'/%3E%3Cline x1='21' y1='12' x2='23' y2='12'/%3E%3Cline x1='4.22' y1='19.78' x2='5.64' y2='18.36'/%3E%3Cline x1='18.36' y1='5.64' x2='19.78' y2='4.22'/%3E%3C/svg%3E");
}

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

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

.login-title {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.login-subtitle {
  margin: 0 0 1.5rem 0;
  color: var(--color-text-secondary);
}

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

.field-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface-input);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
  transition: all 0.2s;
  box-sizing: border-box;
}

.field-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-glow);
}

.error-box {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
}

.login-button {
  margin-top: 1.5rem;
}

.primary-button {
  width: 100%;
  padding: 0.75rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.primary-button:hover {
  opacity: 0.9;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.validation-message {
  margin-top: 0.25rem;
  color: #fca5a5;
  font-size: 0.875rem;
}

.dialog-body .service-source-layout .form-section-card .form-grid,
.dialog-body .service-source-layout .form-section-card .form-grid-2 {
  min-width: 0;
}

.dialog-body .service-source-layout .form-section-card .form-grid-2 .form-span-2 {
  width: 100%;
}

.dialog-body .service-source-layout .form-section-card .form-grid-2 textarea {
  min-height: 72px;
}

.dialog-body .service-source-layout .form-section-card .form-section-header-inline fluent-button {
  flex-shrink: 0;
}

.dialog-body .service-source-layout .form-section-card .model-chip-item .badge {
  align-self: center;
}

.dialog-body .service-source-layout .form-section-card .empty-inline-state {
  font-size: 0.92rem;
}

.dialog-body .service-source-layout .form-section-card .model-summary-card .model-summary-value {
  line-height: 1.1;
}

.dialog-body .service-source-layout .form-section-card .model-summary-card .model-summary-text {
  line-height: 1.35;
}

.dialog-body .service-source-layout .form-section-card .model-chip-list {
  align-items: stretch;
}

.dialog-body .service-source-layout .form-section-card .model-chip-item {
  min-height: 52px;
}

.key-created-notice {
  text-align: center;
}

.key-created-notice p {
  margin-bottom: 0.5rem;
}

.key-display {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
}

.key-display code {
  flex: 1;
  font-family: monospace;
  font-size: 0.9rem;
  word-break: break-all;
}

.copy-btn {
  padding: 0.35rem 0.75rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s;
}

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

.export-actions {
  margin-top: 1rem;
}

.key-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.key-code {
  font-size: 0.85rem;
  font-family: monospace;
  white-space: nowrap;
}

.key-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  z-index: 9999;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.toast-success {
  background: var(--color-success);
  color: white;
}

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

.export-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

.export-label {
  font-size: 0.9rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

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

.dialog-small {
  max-width: 400px;
}

.export-options {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.export-option-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.export-option-label {
  font-weight: 500;
  color: var(--color-text-primary);
  margin-bottom: 0.25rem;
}

/* Routing Path Dialog */
.routing-preview {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.preview-section {
  background: var(--color-surface-muted);
  border-radius: var(--radius-lg);
  padding: 1rem;
}

.preview-section h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.config-grid {
  display: grid;
  gap: 0.5rem;
}

.config-item {
  display: flex;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.config-label {
  color: var(--color-text-secondary);
  min-width: 120px;
}

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

.preview-section .form-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.preview-section .form-input {
  flex: 1;
}

.preview-section .btn-secondary {
  padding: 0.5rem 1rem;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
}

.preview-section .btn-secondary:hover {
  background: var(--color-primary-hover);
}

.routing-result {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.result-header {
  margin-bottom: 0.5rem;
}

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

.priority-group {
  margin-bottom: 0.75rem;
}

.priority-badge {
  display: inline-block;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

.candidate-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 0.5rem;
}

.candidate-card.selected {
  border-color: var(--color-success);
  background: rgba(16, 185, 129, 0.1);
}

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

.candidate-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.selected-badge {
  background: var(--color-success);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.fallback-badge {
  background: var(--color-warning);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.candidate-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  font-size: 0.8rem;
}

.candidate-details .detail-row span:first-child {
  color: var(--color-text-secondary);
}

.candidate-details .detail-row span:last-child {
  color: var(--color-text-primary);
}

.routing-result.fallback .fallback-notice {
  background: rgba(245, 158, 11, 0.15);
  color: var(--color-warning);
  padding: 0.5rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.no-match {
  text-align: center;
  padding: 1rem;
  color: var(--color-text-secondary);
}

.no-match .hint {
  font-size: 0.85rem;
  color: var(--color-warning);
  margin-top: 0.5rem;
}

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

.source-item {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.source-item.unavailable {
  opacity: 0.6;
  border-color: var(--color-error);
}

.source-item.no-model-match {
  border-color: var(--color-warning);
}

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

.source-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.source-badges {
  display: flex;
  gap: 0.4rem;
}

.badge {
  font-size: 0.7rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

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

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

.badge-default {
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
}

.source-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.25rem;
  font-size: 0.8rem;
}

.detail-row {
  display: flex;
  gap: 0.5rem;
}

.detail-row span:first-child {
  color: var(--color-text-secondary);
}

.detail-row span:last-child {
  color: var(--color-text-primary);
}

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

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

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

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

.source-models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
  padding-top: 0.6rem;
  border-top: 1px solid var(--color-border);
}

.model-tag {
  display: inline-block;
  background: var(--color-surface-muted);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  font-family: var(--font-mono, monospace);
}

.model-tag.model-tag-matched {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-success);
  border-color: var(--color-success);
  font-weight: 500;
}

/* Custom nav icons for Hydrologic */
.nav-icon-home {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3Cpolyline points='9 22 9 12 15 12 15 22'/%3E%3C/svg%3E");
}

.nav-icon-images {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2' ry='2'/%3E%3Ccircle cx='8.5' cy='8.5' r='1.5'/%3E%3Cpolyline points='21 15 16 10 5 21'/%3E%3C/svg%3E");
}

.nav-icon-devices {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2' ry='2'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3Cline x1='9' y1='1' x2='9' y2='4'/%3E%3Cline x1='15' y1='1' x2='15' y2='4'/%3E%3Cline x1='9' y1='20' x2='9' y2='23'/%3E%3Cline x1='15' y1='20' x2='15' y2='23'/%3E%3Cline x1='20' y1='9' x2='23' y2='9'/%3E%3Cline x1='20' y1='14' x2='23' y2='14'/%3E%3Cline x1='1' y1='9' x2='4' y2='9'/%3E%3Cline x1='1' y1='14' x2='4' y2='14'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='4' width='16' height='16' rx='2' ry='2'/%3E%3Crect x='9' y='9' width='6' height='6'/%3E%3Cline x1='9' y1='1' x2='9' y2='4'/%3E%3Cline x1='15' y1='1' x2='15' y2='4'/%3E%3Cline x1='9' y1='20' x2='9' y2='23'/%3E%3Cline x1='15' y1='20' x2='15' y2='23'/%3E%3Cline x1='20' y1='9' x2='23' y2='9'/%3E%3Cline x1='20' y1='14' x2='23' y2='14'/%3E%3Cline x1='1' y1='9' x2='4' y2='9'/%3E%3Cline x1='1' y1='14' x2='4' y2='14'/%3E%3C/svg%3E");
}

.nav-icon-servers {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='20' height='8' rx='2' ry='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2' ry='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='2' y='2' width='20' height='8' rx='2' ry='2'/%3E%3Crect x='2' y='14' width='20' height='8' rx='2' ry='2'/%3E%3Cline x1='6' y1='6' x2='6.01' y2='6'/%3E%3Cline x1='6' y1='18' x2='6.01' y2='18'/%3E%3C/svg%3E");
}

/* Stat Card styles */
.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  backdrop-filter: blur(10px);
  transition: all 0.2s ease;
}

.stat-card:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-card-hover);
}

.stat-title {
  font-size: 0.875rem;
  color: var(--color-text-secondary);
  margin-bottom: 0.5rem;
}

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

.stat-subtitle {
  font-size: 0.75rem;
  color: var(--color-text-secondary);
  margin-top: 0.25rem;
}

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

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1.5rem;
}

.chart-card, .top-models-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  backdrop-filter: blur(10px);
}

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

.chart-container {
  min-height: 200px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 180px;
}

.chart-bar-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.chart-bar-wrapper {
  width: 100%;
  height: 150px;
  display: flex;
  align-items: flex-end;
}

.chart-bar {
  width: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  min-height: 4px;
  transition: height 0.3s ease;
}

.chart-label {
  font-size: 0.7rem;
  color: var(--color-text-secondary);
}

.chart-value {
  font-size: 0.65rem;
  color: var(--color-text-secondary);
}

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

.model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
}

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

.model-info {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.model-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

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

.model-tokens {
  font-size: 0.875rem;
  color: var(--color-text-primary);
  font-weight: 500;
}