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

.hidden {
  display: none !important;
}

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --primary-light: #818cf8;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;
  --bg-primary: #ffffff;
  --bg-secondary: #f9fafb;
  --bg-tertiary: #f3f4f6;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius: 12px;
  --radius-sm: 8px;
  --transition: all 0.2s ease;
}

html.theme-dark {
  --primary: #7c88ff;
  --primary-dark: #6366f1;
  --primary-light: #9aa4ff;
  --bg-primary: #0f172a;
  --bg-secondary: #020817;
  --bg-tertiary: #172033;
  --text-primary: #e5eefb;
  --text-secondary: #a8b3c9;
  --text-muted: #7e8aa3;
  --border: rgba(148, 163, 184, 0.2);
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow: 0 10px 30px rgba(2, 8, 23, 0.35);
  --shadow-lg: 0 25px 60px rgba(2, 8, 23, 0.45);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  color-scheme: light;
}

html.theme-dark body {
  color-scheme: dark;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.app-header {
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, 0.9);
}

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

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

.logo-icon {
  width: 32px;
  height: 32px;
  color: var(--primary);
}

.logo-icon + h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  padding-left: 0.25rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}

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

.status-text {
  color: var(--text-secondary);
}

/* Refresh Button */
.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.875rem;
}

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

.refresh-btn:active {
  transform: scale(0.95);
}

.refresh-btn.refreshing svg {
  animation: spin 1s linear infinite;
}

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

/* Main Content */
.app-main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Sections */
.config-section {
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}

.section-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
}

.section-header h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.section-subtitle {
  margin-top: 0.5rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Email Config */
.email-config {
  padding: 1.5rem;
}

.manager-preferences {
  padding: 1.5rem;
}

.preference-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.preference-copy {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-width: 720px;
}

.preference-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

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

.theme-mode-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 700;
}

.form-group {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-group label {
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.9375rem;
  min-width: 110px;
}

.form-group input[type="email"] {
  flex: 1;
  min-width: 250px;
  padding: 0.625rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: var(--transition);
}

.form-group input[type="email"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.help-text {
  margin-top: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  white-space: nowrap;
}

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

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

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

.btn-secondary:hover {
  background: #e5e7eb;
}

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

.btn-icon {
  padding: 0.5rem;
  background: transparent;
  color: var(--text-secondary);
}

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

/* Reports Grid */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
  gap: 1rem;
  padding: 1.5rem;
}

@media (max-width: 768px) {
  .reports-grid {
    grid-template-columns: 1fr;
  }
}

/* Report Card */
.report-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 1.25rem;
  transition: var(--transition);
}

.report-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
}

.report-card.enabled {
  border-left: 3px solid var(--success);
}

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

.report-title {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.report-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

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

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 48px;
  height: 26px;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--text-muted);
  transition: var(--transition);
  border-radius: 26px;
}

.toggle-slider:before {
  position: absolute;
  content: '';
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background: white;
  transition: var(--transition);
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--success);
}

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

.toggle-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Report Meta */
.report-meta {
  display: flex;
  gap: 1.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.meta-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

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

/* Status Badge */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 500;
}

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

.status-badge.inactive {
  background: rgba(107, 114, 128, 0.1);
  color: var(--text-secondary);
}

.status-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
}

.status-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* Report Actions */
.report-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Modal */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: none;
}

.modal.active {
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-primary);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-header h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.modal-close:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.modal-close svg {
  width: 20px;
  height: 20px;
}

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

/* Modal Form */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-row label {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
}

.form-row input[type="text"],
.form-row input[type="email"],
.form-row input[type="number"],
.form-row select {
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  transition: var(--transition);
}

.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-row select {
  background: var(--bg-primary);
  cursor: pointer;
}

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

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* System Status */
.system-status {
  padding: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

/* System Summary */
.system-summary {
  margin-bottom: 2rem;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.summary-icon svg {
  width: 48px;
  height: 48px;
  color: var(--success);
}

.summary-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

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

/* Services Container */
.services-container {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.services-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-bottom: 1rem;
}

.filter-btn {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

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

/* Services Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.service-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.service-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-sm);
}

.service-card.status-down {
  border-left: 3px solid var(--danger);
}

.service-card.status-running {
  border-left: 3px solid var(--success);
}

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

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

.service-icon {
  font-size: 2rem;
  line-height: 1;
}

.service-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: var(--text-primary);
}

.service-description {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

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

.service-url {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: monospace;
  background: var(--bg-primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
}

.service-port-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.service-port-chip {
  font-size: 0.6875rem;
  font-family: monospace;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-muted);
}

.service-port-chip.running {
  border-color: rgba(34, 197, 94, 0.35);
  color: var(--success);
}

.service-port-chip.down {
  border-color: rgba(239, 68, 68, 0.35);
  color: var(--danger);
}

/* Service Status Indicator */
.service-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-led {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  animation: led-pulse 2s infinite;
}

.status-led.on {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e, 0 0 4px rgba(0, 0, 0, 0.3);
}

.status-led.off {
  background: #374151;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.3);
}

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

.service-status-text {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.service-status-text.running {
  color: var(--success);
}

.service-status-text.down {
  color: var(--danger);
}

.service-pid {
  font-size: 0.6875rem;
  color: var(--text-muted);
  font-family: monospace;
  background: var(--bg-primary);
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
}

.service-action-btn {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

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

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

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

/* Category Stats */
.category-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.category-stat {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  flex: 1;
  min-width: 150px;
}

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

.category-stat-values {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

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

.category-stat-value.total {
  color: var(--text-secondary);
}

.category-stat-value.running {
  color: var(--success);
}

.category-stat-value.down {
  color: var(--danger);
}

.status-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.status-value {
  font-size: 1rem;
  color: var(--text-primary);
  font-weight: 600;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.toast {
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg), 0 4px 12px rgba(0, 0, 0, 0.3);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  animation: slideIn 0.3s ease;
  min-width: 320px;
  max-width: 450px;
  border: 2px solid var(--border);
}

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

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

.toast.success {
  border-left: 4px solid var(--success);
  border-color: var(--success);
}

.toast.error {
  border-left: 4px solid var(--danger);
  border-color: var(--danger);
}

.toast.warning {
  border-left: 4px solid var(--warning);
  border-color: var(--warning);
}

.toast.info {
  border-left: 4px solid var(--info);
  border-color: var(--info);
}

.toast-icon {
  width: 24px;
  height: 24px;
  font-size: 1.25rem;
  font-weight: bold;
}

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

.toast.error .toast-icon {
  color: var(--danger);
}

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

.toast.info .toast-icon {
  color: var(--info);
}

.toast-message {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-weight: 500;
  line-height: 1.4;
}

/* Responsive para móviles */
@media (max-width: 768px) {
  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
    width: 100%;
  }
}

/* Loading */
.loading {
  opacity: 0.5;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }

  .app-main {
    padding: 1rem;
  }

  .form-group {
    flex-direction: column;
    align-items: flex-start;
  }

  .form-group label {
    min-width: auto;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: none;
  }
}

/* Primary Tabs */
.primary-tabs {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.primary-tab {
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 0.75rem 1.125rem;
  border-radius: 999px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

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

.primary-tab-active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.25);
}

.tab-panel {
  display: none;
}

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

/* Shell */
.shell-section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.shell-intro-card {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  padding: 1.5rem;
  border-radius: 24px;
  border: 1px solid rgba(99, 102, 241, 0.16);
  background:
    radial-gradient(circle at top right, rgba(99, 102, 241, 0.12), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 255, 0.94));
  box-shadow: var(--shadow-lg);
}

.shell-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-dark);
  margin-bottom: 0.5rem;
}

.shell-intro-card h2,
.shell-intro-card h3 {
  font-size: 1.5rem;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.shell-intro-card p,
.shell-home-header p,
.launcher-overlay-header p,
.shell-toolbar-subtitle {
  color: var(--text-secondary);
}

.shell-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  justify-content: flex-end;
}

.shell-summary-pill,
.launcher-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.5rem 0.875rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid rgba(99, 102, 241, 0.12);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text-primary);
}

.shell-home {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.shell-home-hidden {
  display: none;
}

.shell-home-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-end;
}

.shell-family-filters {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.app-family-btn {
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  padding: 0.625rem 0.875rem;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.app-family-btn:hover {
  border-color: var(--primary-light);
  color: var(--text-primary);
}

.app-family-btn.active {
  border-color: transparent;
  background: rgba(99, 102, 241, 0.12);
  color: var(--primary-dark);
}

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

.launcher-grid-featured {
  grid-template-columns: minmax(0, 1fr);
}

.launcher-card {
  width: 100%;
  border: 1px solid rgba(99, 102, 241, 0.1);
  border-radius: 22px;
  padding: 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 255, 0.92));
  box-shadow: var(--shadow);
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.launcher-card:hover {
  transform: translateY(-2px);
  border-color: rgba(99, 102, 241, 0.3);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
}

.launcher-card.active {
  border-color: rgba(99, 102, 241, 0.45);
  box-shadow: 0 20px 48px rgba(99, 102, 241, 0.16);
}

.launcher-card.disabled {
  opacity: 0.74;
  cursor: not-allowed;
}

.launcher-card.disabled:hover {
  transform: none;
  border-color: rgba(99, 102, 241, 0.1);
  box-shadow: var(--shadow);
}

.launcher-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.launcher-card-icon,
.shell-toolbar-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 102, 241, 0.09);
  font-size: 1.4rem;
}

.launcher-card-statuses {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  align-items: flex-end;
}

.launcher-status,
.launcher-scope {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.625rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.launcher-status.running {
  background: rgba(16, 185, 129, 0.12);
  color: #047857;
}

.launcher-status.partial {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.launcher-status.down {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.launcher-scope.local,
.launcher-scope.remote {
  background: rgba(14, 165, 233, 0.1);
  color: #0369a1;
}

.launcher-scope.unavailable {
  background: rgba(107, 114, 128, 0.12);
  color: #4b5563;
}

.launcher-card-name {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-primary);
}

.launcher-card-description {
  color: var(--text-secondary);
  min-height: 2.7em;
}

.launcher-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.launcher-chip-warn {
  color: #9a3412;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.22);
}

.launcher-card-note {
  font-size: 0.82rem;
  color: #7c2d12;
  background: rgba(254, 243, 199, 0.72);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 14px;
  padding: 0.75rem;
}

.launcher-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  color: var(--primary-dark);
}

.launcher-card-arrow {
  font-size: 1.25rem;
}

.shell-workspace {
  display: none;
  flex-direction: column;
  gap: 1rem;
}

.shell-workspace.active {
  display: flex;
}

.shell-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.125rem;
  border-radius: 22px;
  border: 1px solid rgba(99, 102, 241, 0.1);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.shell-toolbar-meta,
.shell-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.shell-toolbar-title {
  font-size: 1rem;
  font-weight: 700;
}

.shell-frame-stage {
  position: relative;
  min-height: calc(100vh - 280px);
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background:
    radial-gradient(circle at top, rgba(99, 102, 241, 0.08), transparent 34%),
    linear-gradient(180deg, #eef2ff, #f8fafc);
  box-shadow: 0 25px 60px rgba(15, 23, 42, 0.12);
}

#appShellFrame {
  width: 100%;
  height: calc(100vh - 280px);
  min-height: 720px;
  border: none;
  display: block;
  background: #fff;
}

.shell-frame-placeholder {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(180deg, rgba(238, 242, 255, 0.92), rgba(248, 250, 252, 0.92));
}

.shell-frame-placeholder.active {
  display: flex;
}

.shell-frame-placeholder-card {
  max-width: 460px;
  padding: 1.5rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(99, 102, 241, 0.1);
  box-shadow: var(--shadow);
  text-align: center;
}

.shell-frame-placeholder-alert {
  border-color: rgba(245, 158, 11, 0.3);
}

.shell-inline-note {
  position: absolute;
  left: 1rem;
  right: 1rem;
  bottom: 1rem;
  display: none;
  gap: 0.625rem;
  align-items: flex-start;
  padding: 0.875rem 1rem;
  border-radius: 18px;
  background: rgba(17, 24, 39, 0.75);
  color: #f8fafc;
  backdrop-filter: blur(10px);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.24);
}

.shell-inline-note.active {
  display: inline-flex;
}

.orb-launcher {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.28);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 90;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.orb-launcher span {
  font-size: 1.15rem;
}

.orb-launcher.visible {
  display: inline-flex;
}

.orb-launcher:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(30, 41, 59, 0.82);
}

.launcher-overlay {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 95;
}

.launcher-overlay.active {
  display: block;
}

.launcher-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
}

.launcher-overlay-panel {
  position: absolute;
  inset: auto 1rem 1rem 1rem;
  max-height: min(78vh, 920px);
  overflow: auto;
  padding: 1.25rem;
  border-radius: 26px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.45);
  box-shadow: 0 35px 80px rgba(15, 23, 42, 0.26);
}

.launcher-overlay-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.launcher-overlay-actions {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.launcher-overlay-close {
  border: none;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text-primary);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 1rem;
}

.launcher-empty-state {
  border-radius: 22px;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  border: 1px dashed rgba(99, 102, 241, 0.24);
  color: var(--text-secondary);
}

html.theme-dark .app-header {
  background: rgba(15, 23, 42, 0.9);
  border-bottom-color: rgba(148, 163, 184, 0.14);
}

html.theme-dark .status-indicator,
html.theme-dark .btn-secondary,
html.theme-dark .filter-btn,
html.theme-dark .app-family-btn,
html.theme-dark .theme-mode-pill,
html.theme-dark .service-action-btn {
  background: rgba(15, 23, 42, 0.78);
  border-color: rgba(148, 163, 184, 0.16);
  color: var(--text-primary);
}

html.theme-dark .btn-secondary:hover,
html.theme-dark .filter-btn:hover,
html.theme-dark .app-family-btn:hover,
html.theme-dark .modal-close:hover,
html.theme-dark .service-action-btn:hover {
  background: rgba(30, 41, 59, 0.88);
}

html.theme-dark .primary-tab {
  background: rgba(15, 23, 42, 0.84);
  border-color: rgba(148, 163, 184, 0.18);
  color: var(--text-secondary);
}

html.theme-dark .primary-tab:hover {
  color: var(--text-primary);
  border-color: rgba(124, 136, 255, 0.38);
}

html.theme-dark .config-section,
html.theme-dark .summary-card,
html.theme-dark .service-card,
html.theme-dark .category-stats,
html.theme-dark .category-stat,
html.theme-dark .report-card,
html.theme-dark .modal-content,
html.theme-dark .shell-toolbar {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(148, 163, 184, 0.16);
}

html.theme-dark .service-url,
html.theme-dark .service-port-chip,
html.theme-dark .service-pid,
html.theme-dark .toast,
html.theme-dark .launcher-empty-state {
  background: rgba(15, 23, 42, 0.86);
}

html.theme-dark .form-group input[type="email"],
html.theme-dark .form-row input[type="text"],
html.theme-dark .form-row input[type="email"],
html.theme-dark .form-row input[type="number"],
html.theme-dark .form-row select {
  background: rgba(2, 8, 23, 0.92);
  color: var(--text-primary);
  border-color: rgba(148, 163, 184, 0.18);
}

html.theme-dark .shell-intro-card {
  border-color: rgba(124, 136, 255, 0.16);
  background:
    radial-gradient(circle at top right, rgba(124, 136, 255, 0.14), transparent 28%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.98), rgba(17, 24, 39, 0.94));
}

html.theme-dark .shell-summary-pill,
html.theme-dark .launcher-chip {
  background: rgba(15, 23, 42, 0.74);
  border-color: rgba(148, 163, 184, 0.14);
}

html.theme-dark .launcher-card {
  border-color: rgba(124, 136, 255, 0.12);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(17, 24, 39, 0.92));
  box-shadow: 0 18px 45px rgba(2, 8, 23, 0.32);
}

html.theme-dark .launcher-card:hover {
  border-color: rgba(124, 136, 255, 0.28);
  box-shadow: 0 22px 50px rgba(2, 8, 23, 0.42);
}

html.theme-dark .launcher-card.active {
  border-color: rgba(124, 136, 255, 0.4);
  box-shadow: 0 24px 54px rgba(76, 86, 255, 0.18);
}

html.theme-dark .launcher-card-icon,
html.theme-dark .shell-toolbar-icon {
  background: rgba(124, 136, 255, 0.12);
}

html.theme-dark .launcher-card-note {
  color: #facc15;
  background: rgba(113, 63, 18, 0.25);
  border-color: rgba(245, 158, 11, 0.2);
}

html.theme-dark .shell-frame-stage {
  border-color: rgba(148, 163, 184, 0.12);
  background:
    radial-gradient(circle at top, rgba(124, 136, 255, 0.12), transparent 34%),
    linear-gradient(180deg, #020817, #0f172a);
  box-shadow: 0 25px 60px rgba(2, 8, 23, 0.42);
}

html.theme-dark #appShellFrame {
  background: #020817;
}

html.theme-dark .shell-frame-placeholder {
  background: linear-gradient(180deg, rgba(2, 8, 23, 0.94), rgba(15, 23, 42, 0.94));
}

html.theme-dark .shell-frame-placeholder-card {
  background: rgba(15, 23, 42, 0.88);
  border-color: rgba(124, 136, 255, 0.14);
}

html.theme-dark .launcher-overlay-backdrop {
  background: rgba(2, 8, 23, 0.6);
}

html.theme-dark .launcher-overlay-panel {
  background: rgba(2, 8, 23, 0.94);
  border-color: rgba(148, 163, 184, 0.16);
  box-shadow: 0 35px 80px rgba(2, 8, 23, 0.52);
}

html.theme-dark .launcher-overlay-close {
  background: rgba(148, 163, 184, 0.12);
  color: var(--text-primary);
}

html.theme-dark .toast {
  border-color: rgba(148, 163, 184, 0.16);
}

body.immersive-shell-active {
  background: #050816;
  overflow: hidden;
}

body.immersive-shell-active .app-container {
  max-width: none;
  width: 100%;
  min-height: 100dvh;
}

body.immersive-shell-active .app-header,
body.immersive-shell-active .primary-tabs,
body.immersive-shell-active .shell-intro-card {
  display: none;
}

body.immersive-shell-active .app-main {
  padding: 0;
  gap: 0;
  min-height: 100dvh;
}

body.immersive-shell-active #appsPanel.tab-panel-active {
  display: block;
  min-height: 100dvh;
}

body.immersive-shell-active .shell-section {
  gap: 0;
  min-height: 100dvh;
}

body.immersive-shell-active .shell-home {
  display: none;
}

body.immersive-shell-active .shell-workspace,
body.immersive-shell-active .shell-workspace.active {
  display: flex;
  gap: 0;
  min-height: 100dvh;
}

body.immersive-shell-active .shell-toolbar {
  display: none;
}

body.immersive-shell-active .shell-frame-stage {
  min-height: 100dvh;
  height: 100dvh;
  border-radius: 0;
  border: none;
  box-shadow: none;
  background: #050816;
}

body.immersive-shell-active #appShellFrame {
  width: 100%;
  min-height: 100dvh;
  height: 100dvh;
}

body.immersive-shell-active .shell-inline-note {
  display: none !important;
}

body.immersive-shell-active .orb-launcher {
  top: 50%;
  right: -10px;
  bottom: auto;
  width: 48px;
  height: 48px;
  z-index: 110;
  opacity: 0.52;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(15, 23, 42, 0.48);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  transform: translateY(-50%);
}

body.immersive-shell-active .launcher-overlay-panel {
  inset: auto 1rem calc(env(safe-area-inset-bottom, 0px) + 1rem) 1rem;
  max-height: min(82vh, 980px);
}

body.immersive-shell-active .orb-launcher:hover,
body.immersive-shell-active .orb-launcher:focus-visible {
  opacity: 0.92;
  background: rgba(15, 23, 42, 0.72);
  transform: translate(-6px, -50%) scale(1.03);
}

body.immersive-shell-active .orb-launcher span {
  font-size: 0.95rem;
}

/* Mobile shell tuning */
@media (max-width: 980px) {
  .shell-intro-card,
  .shell-home-header,
  .shell-toolbar,
  .launcher-overlay-header,
  .launcher-overlay-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .shell-summary-pills,
  .shell-toolbar-actions {
    justify-content: flex-start;
  }

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

@media (max-width: 768px) {
  .app-main {
    gap: 1rem;
  }

  .primary-tabs {
    gap: 0.5rem;
  }

  .primary-tab {
    flex: 1 1 0;
    justify-content: center;
    text-align: center;
  }

  .shell-intro-card,
  .shell-toolbar,
  .launcher-card,
  .launcher-overlay-panel {
    border-radius: 20px;
  }

  .shell-intro-card {
    padding: 1.125rem;
  }

  .shell-frame-stage {
    min-height: calc(100vh - 240px);
    border-radius: 22px;
  }

  #appShellFrame {
    min-height: calc(100vh - 240px);
    height: calc(100vh - 240px);
  }

  .shell-inline-note {
    left: 0.75rem;
    right: 0.75rem;
    bottom: 0.75rem;
  }

  .launcher-overlay-panel {
    inset: auto 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.75rem) 0.75rem;
    padding: 1rem;
  }

  .orb-launcher {
    right: 0.875rem;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 0.875rem);
    width: 54px;
    height: 54px;
  }

  body.immersive-shell-active .launcher-overlay-panel {
    inset: auto 0.75rem calc(env(safe-area-inset-bottom, 0px) + 0.75rem) 0.75rem;
  }

  body.immersive-shell-active .orb-launcher {
    right: -8px;
    width: 44px;
    height: 44px;
  }

  .preference-row,
  .preference-actions {
    align-items: stretch;
  }

  .preference-actions {
    width: 100%;
  }

  .theme-mode-pill,
  #themeToggleBtn {
    justify-content: center;
  }
}

/* ============================================================================
   DRP (Disaster Recovery Plan) STYLES
   ============================================================================ */

/* DRP Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 1rem;
}

.stat-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1.25rem;
  text-align: center;
  transition: var(--transition);
}

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

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Backup Info */
.backup-info {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.backup-info h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.backup-details {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.backup-detail-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

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

.backup-value {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
  font-family: 'SF Mono', Monaco, monospace;
}

/* Terminal */
.terminal {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  font-family: 'SF Mono', Monaco, 'Courier New', monospace;
  font-size: 0.875rem;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

.terminal-line {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.terminal-prompt {
  color: var(--success);
  font-weight: 600;
  flex-shrink: 0;
}

.terminal-output {
  color: var(--text-secondary);
  word-break: break-all;
}

/* Action Buttons */
.action-buttons {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* DRP Modal Sizes */
.modal-large .modal-content {
  max-width: 900px;
  width: 90vw;
  max-height: 85vh;
}

.modal-large .modal-body {
  max-height: calc(85vh - 140px);
  overflow-y: auto;
}

.modal-full .modal-content {
  max-width: 1200px;
  width: 95vw;
  max-height: 90vh;
}

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

/* DRP Audit History Styles */
.audit-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.audit-count {
  font-weight: 600;
  color: var(--text-primary);
}

.audit-last-updated {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.audit-entry {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  transition: var(--transition);
}

.audit-entry:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-sm);
}

.audit-entry-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.audit-entry-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.audit-status {
  font-size: 1.25rem;
  flex-shrink: 0;
}

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

.audit-entry-date {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.audit-entry-summary {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

.audit-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
}

.audit-metric {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
}

.metric-label {
  color: var(--text-muted);
  font-weight: 500;
}

.metric-value {
  color: var(--text-primary);
  font-weight: 600;
}

.audit-highlights {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1rem;
}

.highlight-category {
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
}

.highlight-category-name {
  font-weight: 600;
  color: var(--text-primary);
  display: block;
  margin-bottom: 0.5rem;
}

.highlight-icon {
  margin-right: 0.5rem;
}

.highlight-items {
  margin: 0;
  padding-left: 1.5rem;
  list-style: disc;
}

.highlight-items li {
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

.audit-actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Full Audit Modal Styles */
.full-audit-content {
  max-width: 100%;
}

.audit-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
}

.audit-id {
  font-weight: 600;
  color: var(--text-primary);
}

.audit-timestamp {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.markdown-body {
  color: var(--text-primary);
  line-height: 1.7;
}

.markdown-body h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.markdown-body h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.markdown-body h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

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

.markdown-body strong {
  font-weight: 600;
  color: var(--text-primary);
}

.markdown-body em {
  font-style: italic;
}

.markdown-body code {
  background: var(--bg-tertiary);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.875rem;
  color: var(--primary);
}

.markdown-body pre {
  background: var(--bg-tertiary);
  padding: 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin-bottom: 1rem;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.markdown-body ul,
.markdown-body ol {
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.markdown-body li {
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.markdown-body blockquote {
  border-left: 3px solid var(--primary);
  padding-left: 1rem;
  margin-bottom: 1rem;
  color: var(--text-secondary);
  font-style: italic;
}

.markdown-body a {
  color: var(--primary);
  text-decoration: none;
}

.markdown-body a:hover {
  text-decoration: underline;
}

/* Audit Loading & Error States */
.audit-loading,
.audit-error,
.audit-empty {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-secondary);
}

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

.error-detail {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.empty-detail {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

/* Small button variant */
.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

/* Large button variant */
.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
}

/* ============================================================================
   DRP MODE TOGGLE
   ============================================================================ */

.drp-mode-toggle {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.mode-toggle-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

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

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

.mode-icon {
  font-size: 1.125rem;
}

.mode-label {
  font-size: 0.875rem;
}

/* DRP Mode Panels */
.drp-mode-panel {
  display: none;
}

.drp-mode-panel.drp-mode-panel-active {
  display: block;
}

/* Service List */
.service-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
}

.service-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.5rem;
}

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

.service-port {
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.service-status {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

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

.service-status.stopped {
  color: var(--danger);
}

/* Wizard Steps */
.wizard-steps {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  position: relative;
}

.wizard-steps::before {
  content: '';
  position: absolute;
  top: 1rem;
  left: 1rem;
  right: 1rem;
  height: 2px;
  background: var(--border);
  z-index: 0;
}

.wizard-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.step-number {
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border: 2px solid var(--border);
  border-radius: 50%;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-muted);
  transition: var(--transition);
}

.wizard-step.active .step-number {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.wizard-step.completed .step-number {
  background: var(--success);
  border-color: var(--success);
  color: white;
}

.step-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.wizard-step.active .step-label {
  color: var(--text-primary);
}

/* Progress Container */
.progress-container {
  margin-bottom: 1.5rem;
}

.progress-bar {
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

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

.progress-text {
  font-size: 0.875rem;
  color: var(--text-secondary);
  text-align: center;
}

/* Migration Components */
.migration-components {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.component-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.component-item svg {
  flex-shrink: 0;
  color: var(--text-secondary);
}

.component-item > div {
  flex: 1;
}

.component-title {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.component-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.component-status {
  font-size: 1.125rem;
  color: var(--success);
}

/* Button Variants */
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

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

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

.btn-success:hover {
  background: #059669;
  border-color: #059669;
}

/* ============================================================================
   CRITICAL CONFIGS ACCORDION
   ============================================================================ */

.critical-configs {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.config-accordion {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: var(--transition);
}

.config-accordion:hover {
  border-color: var(--border-hover);
}

.config-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  cursor: pointer;
  user-select: none;
  transition: var(--transition);
}

.config-accordion-header:hover {
  background: var(--bg-secondary);
}

.config-accordion-header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
}

.config-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.config-title {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.9375rem;
}

.config-status {
  font-size: 0.75rem;
  color: var(--success);
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  border-radius: 4px;
}

.accordion-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.3s ease;
}

.config-accordion.active .accordion-chevron {
  transform: rotate(180deg);
}

.config-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.config-accordion.active .config-accordion-content {
  max-height: 1000px;
}

.config-details {
  padding: 0 1rem 1rem 1rem;
  border-top: 1px solid var(--border);
}

.config-detail-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.config-detail-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 120px;
}

.config-detail-value {
  color: var(--text-primary);
  font-family: 'SF Mono', Monaco, monospace;
}

.config-detail-value.monospace {
  font-size: 0.8125rem;
}

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

.config-detail-section h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.config-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.config-list li {
  padding: 0.375rem 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.config-list.compact li {
  padding: 0.25rem 0;
  font-size: 0.8125rem;
}

.config-loading {
  padding: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.config-loading::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 0.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: config-loading-spin 0.8s linear infinite;
  vertical-align: middle;
}

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

/* ============================================================================
   MODELS TAB STYLES
   ============================================================================ */

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  min-height: 120px;
}

.model-loading {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
  font-size: 0.92rem;
}

.model-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}

.model-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.model-card-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
  background: linear-gradient(135deg, var(--bg-primary), rgba(99, 102, 241, 0.04));
}

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

.model-card-name {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge-llama { background: rgba(239, 68, 68, 0.12); color: #dc2626; }
.badge-qwen { background: rgba(59, 130, 246, 0.12); color: #2563eb; }
.badge-mistral { background: rgba(249, 115, 22, 0.12); color: #ea580c; }
.badge-gemma { background: rgba(16, 185, 129, 0.12); color: #059669; }
.badge-vision { background: rgba(168, 85, 247, 0.12); color: #7c3aed; }
.badge-embed { background: rgba(107, 114, 128, 0.12); color: #4b5563; }
.badge-default { background: rgba(99, 102, 241, 0.12); color: var(--primary); }

.model-card-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.model-card-meta span {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  padding: 2px 6px;
  border-radius: 4px;
}

.model-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* Provider tabs */
.model-provider-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.model-provider-tabs .provider-tab {
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.model-provider-tabs .provider-tab-active {
  background: var(--primary);
  color: #fff;
}
.model-provider-tabs .provider-tab:hover {
  background: var(--bg-secondary);
}

.provider-tab-active-text {
  font-size: 0.85rem;
}

/* Model card actions (delete button) */
.model-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 4px;
}

.model-delete-btn {
  width: 24px;
  height: 24px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.model-delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--danger);
  color: var(--danger);
}

/* Model storage info */
.model-storage-section {
  padding: 0;
  overflow: hidden;
}

.model-storage-grid {
  padding: 1.5rem;
}

.model-storage-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

.model-storage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.model-storage-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}

.model-storage-card h4 {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.model-storage-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 0.8rem;
}

.model-storage-label {
  color: var(--text-muted);
  font-weight: 500;
}

.model-storage-value {
  color: var(--text-primary);
  font-weight: 600;
  font-family: 'SF Mono', Monaco, monospace;
  font-size: 0.78rem;
}

.model-storage-format {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  line-height: 1.4;
}

html.theme-dark .model-delete-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

html.theme-dark .model-storage-card {
  background: var(--bg-tertiary);
}

.model-detail-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.model-info-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: grid;
  gap: 8px;
}

.model-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
}

.model-info-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 600;
}

.model-info-value {
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 700;
}

.model-system-prompt {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.system-prompt-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.system-prompt-note {
  margin: 4px 0 0;
  font-size: 0.76rem;
  line-height: 1.45;
  color: var(--text-muted);
}

.system-prompt-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.system-prompt-select {
  min-width: 180px;
  max-width: 220px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.78rem;
  padding: 8px 10px;
}

.system-prompt-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.system-prompt-icon-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
}

.system-prompt-icon-btn svg {
  width: 15px;
  height: 15px;
}

.model-system-input {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--text-primary);
  min-height: 140px;
  width: 100%;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
  resize: vertical;
  font-family: inherit;
}

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

.system-prompt-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.system-prompt-link {
  border: none;
  background: transparent;
  padding: 0;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.system-prompt-source {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* Benchmark */
.model-benchmark {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.benchmark-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.benchmark-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.benchmark-select {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.85rem;
  color: var(--text-primary);
}

.benchmark-results {
  margin-top: 8px;
}

.benchmark-running {
  color: var(--primary);
  font-size: 0.85rem;
  padding: 10px;
}

.benchmark-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.benchmark-table th,
.benchmark-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

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

.benchmark-table td strong {
  color: var(--success);
}

.benchmark-table td a strong {
  color: var(--success);
}

/* Chat playground */
.model-chat-col {
  display: flex;
  flex-direction: column;
}

.chat-container {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 460px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-placeholder {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 40px 16px;
}

.chat-msg {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 0.85rem;
  line-height: 1.65;
  max-width: 90%;
  word-break: break-word;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-msg-user {
  background: var(--primary);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.chat-msg-assistant {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  color: var(--text-primary);
  max-width: min(100%, 760px);
}

.chat-msg-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  align-self: flex-start;
  color: #b91c1c;
  max-width: min(100%, 760px);
}

.chat-msg-role {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 3px;
  opacity: 0.7;
}

.chat-msg-user .chat-msg-role {
  color: rgba(255, 255, 255, 0.7);
}

.chat-msg-assistant .chat-msg-role {
  color: var(--text-muted);
}

.chat-msg-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}

.chat-copy-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(99, 102, 241, 0.06);
}

.chat-copy-btn svg {
  width: 13px;
  height: 13px;
}

.chat-msg-content {
  user-select: text;
  cursor: text;
}

.chat-msg-content * {
  user-select: text;
}

.chat-msg-content p {
  margin: 0;
}

.chat-msg-content p + p {
  margin-top: 0.95em;
}

.chat-msg-content ul,
.chat-msg-content ol {
  margin: 0;
  padding-left: 1.15rem;
}

.chat-msg-content ul + p,
.chat-msg-content ol + p,
.chat-msg-content p + ul,
.chat-msg-content p + ol,
.chat-msg-content ul + ol,
.chat-msg-content ol + ul {
  margin-top: 0.85em;
}

.chat-msg-content li + li {
  margin-top: 0.3em;
}

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

.chat-cursor {
  animation: blink 0.8s infinite;
  font-weight: bold;
}

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

/* File attachments bar */
.chat-attachments-bar {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
  max-height: 140px;
  overflow-x: auto;
  overflow-y: hidden;
}

.chat-attachments-list {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
}

.chat-attachment-item {
  position: relative;
  flex-shrink: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-secondary);
  display: flex;
  flex-direction: column;
  width: 80px;
  height: 80px;
}

.chat-attachment-item img {
  width: 100%;
  height: 54px;
  object-fit: cover;
}

.chat-attachment-item-info {
  padding: 2px 4px;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  line-height: 1.2;
}

.chat-attachment-item-file {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: 4px;
  gap: 2px;
}

.chat-attachment-file-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.chat-attachment-file-name {
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  text-align: center;
}

.chat-attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  line-height: 1;
  padding: 0;
  transition: var(--transition);
}

.chat-attachment-remove:hover {
  background: var(--danger);
}

/* Voice recording status */
.chat-voice-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: rgba(239, 68, 68, 0.05);
}

.chat-voice-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ef4444;
  animation: voice-pulse 1.2s ease-in-out infinite;
}

@keyframes voice-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

.chat-voice-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* Chat input actions (attach + voice buttons) */
.chat-input-actions {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.chat-action-btn {
  width: 32px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: var(--transition);
  padding: 0;
}

.chat-action-btn:hover {
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
}

.chat-action-btn svg {
  width: 17px;
  height: 17px;
}

.chat-voice-btn.recording {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.chat-voice-btn.recording .mic-icon {
  display: none;
}

.chat-voice-btn.recording .stop-icon {
  display: block !important;
}

/* Attachment image in user message bubble */
.chat-msg-attachment-img {
  max-width: 200px;
  max-height: 160px;
  border-radius: 6px;
  cursor: pointer;
  margin-top: 4px;
}

.chat-msg-file-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.15);
  font-size: 0.72rem;
  margin-top: 4px;
}

html.theme-dark .chat-msg-file-badge {
  background: rgba(255, 255, 255, 0.08);
}

.chat-msg-user .chat-msg-file-badge {
  background: rgba(255, 255, 255, 0.2);
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-primary);
}

.chat-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 0.85rem;
  resize: none;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: inherit;
}

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

/* Parameter grid */
.param-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.param-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.param-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.param-value {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
  min-width: 48px;
  text-align: center;
}

.param-slider {
  width: 100%;
  height: 6px;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.param-slider::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--primary);
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.param-help {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.35;
}

/* Dark theme overrides for models */
html.theme-dark .model-card {
  background: var(--bg-secondary);
}

html.theme-dark .model-card-selected {
  background: linear-gradient(135deg, var(--bg-secondary), rgba(99, 102, 241, 0.08));
}

html.theme-dark .model-system-input {
  background: var(--bg-tertiary);
}

html.theme-dark .chat-msg-assistant {
  background: var(--bg-tertiary);
}

html.theme-dark .chat-input {
  background: var(--bg-tertiary);
}

html.theme-dark .param-item {
  background: var(--bg-tertiary);
}

html.theme-dark .benchmark-table td strong {
  color: #34d399;
}

/* Responsive */
@media (max-width: 900px) {
  .model-detail-split {
    grid-template-columns: 1fr;
  }
  .model-grid {
    grid-template-columns: 1fr;
  }
  .param-grid {
    grid-template-columns: 1fr;
  }
  .system-prompt-header {
    flex-direction: column;
  }
  .system-prompt-toolbar {
    width: 100%;
  }
  .system-prompt-select {
    flex: 1;
    max-width: none;
  }
  .chat-msg {
    max-width: 100%;
  }
}
