/* hallmark: dark-oled-dev | critique: precise developer console, strict tokens, zero horizontal scroll, mobile and desktop responsive */

:root,
html[data-theme="emerald"] {
  --color-primary: #0F172A;
  --color-on-primary: #FFFFFF;
  --color-secondary: #1E293B;
  --color-on-secondary: #FFFFFF;
  --color-accent: #10B981;
  --color-accent-hover: #059669;
  --color-on-accent: #022C22;
  --color-background: #020617;
  --color-surface: #0B1120;
  --color-foreground: #F8FAFC;
  --color-card: #0E1626;
  --color-card-hover: #142036;
  --color-muted: #1A2438;
  --color-muted-foreground: #94A3B8;
  --color-border: #1E293B;
  --color-border-subtle: #141D2E;
  --color-destructive: #EF4444;
  --color-destructive-hover: #DC2626;
  --color-on-destructive: #FFFFFF;
  --color-warning: #F59E0B;
  --color-on-warning: #0F172A;
  --color-ring: #10B981;
  --theme-glow: rgba(16, 185, 129, 0.25);
  --theme-border-glow: rgba(16, 185, 129, 0.4);
}

html[data-theme="violet"] {
  --color-primary: #181824;
  --color-on-primary: #FFFFFF;
  --color-secondary: #27273A;
  --color-on-secondary: #FFFFFF;
  --color-accent: #8B5CF6;
  --color-accent-hover: #7C3AED;
  --color-on-accent: #1E1035;
  --color-background: #09090B;
  --color-surface: #12121A;
  --color-foreground: #F4F4F5;
  --color-card: #141420;
  --color-card-hover: #1C1C2C;
  --color-muted: #202032;
  --color-muted-foreground: #A1A1AA;
  --color-border: #27273A;
  --color-border-subtle: #1C1C2B;
  --color-destructive: #EF4444;
  --color-destructive-hover: #DC2626;
  --color-on-destructive: #FFFFFF;
  --color-warning: #F59E0B;
  --color-on-warning: #0F172A;
  --color-ring: #8B5CF6;
  --theme-glow: rgba(139, 92, 246, 0.25);
  --theme-border-glow: rgba(139, 92, 246, 0.4);
}

html[data-theme="tokyo"] {
  --color-primary: #0A1220;
  --color-on-primary: #FFFFFF;
  --color-secondary: #12213A;
  --color-on-secondary: #FFFFFF;
  --color-accent: #06B6D4;
  --color-accent-hover: #0891B2;
  --color-on-accent: #042730;
  --color-background: #030712;
  --color-surface: #07101E;
  --color-foreground: #F0FDF4;
  --color-card: #0A1629;
  --color-card-hover: #0E1F3B;
  --color-muted: #112644;
  --color-muted-foreground: #7DD3FC;
  --color-border: #162842;
  --color-border-subtle: #0D1C30;
  --color-destructive: #F43F5E;
  --color-destructive-hover: #E11D48;
  --color-on-destructive: #FFFFFF;
  --color-warning: #FBBF24;
  --color-on-warning: #0F172A;
  --color-ring: #06B6D4;
  --theme-glow: rgba(6, 182, 212, 0.25);
  --theme-border-glow: rgba(6, 182, 212, 0.4);
}

html[data-theme="amber"] {
  --color-primary: #1C1917;
  --color-on-primary: #FFFFFF;
  --color-secondary: #292524;
  --color-on-secondary: #FFFFFF;
  --color-accent: #F59E0B;
  --color-accent-hover: #D97706;
  --color-on-accent: #261601;
  --color-background: #0C0A09;
  --color-surface: #141210;
  --color-foreground: #FAFAF9;
  --color-card: #1A1715;
  --color-card-hover: #24201D;
  --color-muted: #282420;
  --color-muted-foreground: #A8A29E;
  --color-border: #352F2D;
  --color-border-subtle: #24201E;
  --color-destructive: #EF4444;
  --color-destructive-hover: #DC2626;
  --color-on-destructive: #FFFFFF;
  --color-warning: #F59E0B;
  --color-on-warning: #0F172A;
  --color-ring: #F59E0B;
  --theme-glow: rgba(245, 158, 11, 0.25);
  --theme-border-glow: rgba(245, 158, 11, 0.4);
}

:root {

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-full: 9999px;

  --max-width: 1280px;
}

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

/* Bulletproof horizontal scroll prevention */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  background-color: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-style: normal;
}

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

/* Layout Container */
.app-container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: clamp(0.75rem, 3vw, 1.5rem);
  padding-bottom: calc(105px + env(safe-area-inset-bottom, 20px));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow-x: hidden;
}

/* Header */
.app-header {
  min-height: 56px;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-block: var(--space-2);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: var(--color-foreground);
}

.brand-icon {
  width: 24px;
  height: 24px;
  color: var(--color-accent);
  flex-shrink: 0;
}

.brand-title {
  font-size: clamp(1rem, 3vw, 1.125rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.brand-badge {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.security-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--color-muted-foreground);
  background-color: var(--color-muted);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  max-width: 100%;
}

.security-badge svg {
  width: 13px;
  height: 13px;
  color: var(--color-accent);
  flex-shrink: 0;
}

/* Metric Cards Grid: 2 columns on Mobile, 3 on Tablet, 5 on PC */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-block: var(--space-4);
}

@media (min-width: 640px) {
  .metrics-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
  }
}

@media (min-width: 1024px) {
  .metrics-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-4);
    margin-block: var(--space-6);
  }
}

.metric-card {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: clamp(0.75rem, 2vw, 1rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  overflow: hidden;
}

.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--color-muted-foreground);
  font-size: clamp(0.6875rem, 1.8vw, 0.75rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-header span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.metric-icon {
  width: 15px;
  height: 15px;
  color: var(--color-muted-foreground);
  flex-shrink: 0;
}

.metric-value {
  font-size: clamp(1.125rem, 3.5vw, 1.625rem);
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--color-foreground);
  letter-spacing: -0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-block: 2px;
}

.metric-sub {
  font-size: clamp(0.6875rem, 1.6vw, 0.75rem);
  color: var(--color-muted-foreground);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

/* Floating Bottom Navigation Dock (MotionSites Glassmorphism) */
.floating-dock-container {
  position: fixed;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 900;
  width: auto;
  max-width: calc(100vw - 24px);
  pointer-events: none;
}

.floating-dock {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(17, 24, 39, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-full);
  padding: 7px 10px;
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.08);
  white-space: nowrap;
  box-sizing: border-box;
}

.floating-dock .nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-full);
  color: var(--color-muted-foreground);
  text-decoration: none;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
  font-style: normal;
  position: relative;
  transition: transform 180ms cubic-bezier(0.4, 0, 0.2, 1), background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.floating-dock .nav-tab span {
  display: none !important;
}

.floating-dock .nav-tab:hover {
  color: var(--color-foreground);
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.floating-dock .nav-tab.active {
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  border-color: var(--theme-border-glow);
  box-shadow: 0 4px 18px var(--theme-glow);
  transform: scale(1.08);
}

.floating-dock .nav-tab svg {
  width: 22px;
  height: 22px;
  stroke-width: 2.2px;
  flex-shrink: 0;
  transition: transform 180ms ease;
}

@media (max-width: 480px) {
  .floating-dock-container {
    max-width: calc(100vw - 16px);
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .floating-dock {
    padding: 5px 6px;
    gap: 5px;
  }
  .floating-dock .nav-tab {
    width: 44px;
    height: 44px;
  }
  .floating-dock .nav-tab svg {
    width: 20px;
    height: 20px;
  }
}

@media (max-width: 360px) {
  .floating-dock {
    padding: 4px 5px;
    gap: 4px;
  }
  .floating-dock .nav-tab {
    width: 40px;
    height: 40px;
  }
  .floating-dock .nav-tab svg {
    width: 19px;
    height: 19px;
  }
}

/* Table Section & Panels */
.section-panel {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  min-width: 0;
}

.tab-content {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  min-width: 0;
}

.panel-header {
  padding: clamp(0.75rem, 2vw, 1rem);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  flex-wrap: wrap;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.panel-title {
  font-size: clamp(0.875rem, 2.5vw, 1rem);
  font-weight: 600;
  font-style: normal;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Panel Header Toolbar with perfect alignment */
.panel-header-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
}

.panel-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}

.panel-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.panel-search-wrapper {
  position: relative;
  width: 260px;
  max-width: 100%;
}

.panel-search-input {
  width: 100%;
  height: 32px;
  padding: 4px 10px 4px 30px;
  font-size: 0.8125rem;
  border-radius: var(--radius-sm);
  background: var(--color-background);
  border: 1px solid var(--color-border);
  color: var(--color-foreground);
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.panel-search-input:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 2px var(--theme-glow);
}

.panel-search-icon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  color: var(--color-muted-foreground);
  pointer-events: none;
}

@media (max-width: 640px) {
  .panel-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .panel-header-left {
    justify-content: space-between;
    width: 100%;
  }
  .panel-header-right {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .panel-search-wrapper {
    width: 100%;
    max-width: 100%;
    flex: 1;
  }
  .panel-search-input {
    height: 36px;
    font-size: 0.85rem;
  }
}

/* Responsive Bot Presentation & Mobile Card Layout */
.desktop-only-table {
  display: block;
}

.mobile-only-cards {
  display: none;
}

@media (max-width: 768px) {
  .desktop-only-table {
    display: none !important;
  }
  .mobile-only-cards {
    display: flex !important;
    flex-direction: column;
    gap: 12px;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
}

.bot-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: border-color 150ms ease;
}

.bot-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.bot-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.bot-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.bot-card-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-foreground);
  line-height: 1.3;
  word-break: break-word;
}

.bot-card-id-chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-muted-foreground);
  background: var(--color-muted);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-card-owner-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #38BDF8 !important;
  background: rgba(56, 189, 248, 0.12) !important;
  border: 1px solid rgba(56, 189, 248, 0.35) !important;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.bot-card-tg-chip {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--color-foreground) !important;
  background: var(--color-muted) !important;
  border: 1px solid var(--color-border) !important;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.bot-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background-color: var(--color-background);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.bot-card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.bot-card-metric-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted-foreground);
  font-weight: 600;
}

.bot-card-metric-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-foreground);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bot-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.bot-card-actions .btn {
  width: 100%;
  min-height: 34px;
  height: 34px;
  padding: 4px 6px;
  font-size: 0.76rem;
  font-weight: 600;
  box-sizing: border-box;
}

@media (max-width: 380px) {
  .bot-card-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Universal Mobile Cards for All Dashboard Tabs (Zero Horizontal Scrolling) */
.mobile-card {
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: border-color 150ms ease;
}

.mobile-card:hover {
  border-color: rgba(255, 255, 255, 0.16);
}

.mobile-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
}

.mobile-card-title-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 1;
}

.mobile-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-foreground);
  line-height: 1.3;
  word-break: break-word;
}

.mobile-card-subtitle {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--color-muted-foreground);
  word-break: break-all;
}

.mobile-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background-color: var(--color-background);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  width: 100%;
  box-sizing: border-box;
}

.mobile-card-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.mobile-card-metric-label {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted-foreground);
  font-weight: 600;
}

.mobile-card-metric-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--color-foreground);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mobile-card-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 100%;
}

.mobile-card-actions .btn {
  width: 100%;
  min-height: 34px;
  height: 34px;
  padding: 4px 6px;
  font-size: 0.76rem;
  font-weight: 600;
  box-sizing: border-box;
}

@media (max-width: 380px) {
  .mobile-card-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Horizontal scroll container strictly isolated to table body */
.table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.data-table {
  width: 100%;
  min-width: 580px;
  border-collapse: collapse;
  text-align: left;
}

.data-table th {
  background-color: var(--color-muted);
  color: var(--color-muted-foreground);
  padding: 8px 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  font-size: 0.8125rem;
  vertical-align: middle;
}

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

/* Status Badges */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 8px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  font-weight: 600;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.status-running {
  background-color: rgba(34, 197, 94, 0.12);
  color: #34d399;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.status-running::before {
  background-color: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.status-stopped {
  background-color: rgba(148, 163, 184, 0.1);
  color: var(--color-muted-foreground);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.status-stopped::before {
  background-color: #64748b;
}

.status-crashed {
  background-color: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-crashed::before {
  background-color: #ef4444;
  box-shadow: 0 0 6px #ef4444;
}

.status-restarting {
  background-color: rgba(245, 158, 11, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-restarting::before {
  background-color: #f59e0b;
  box-shadow: 0 0 6px #f59e0b;
  animation: pulse-dot 1.2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 11px;
  font-size: 0.78rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  font-style: normal;
  white-space: nowrap;
  transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, var(--color-accent) 0%, var(--color-accent-hover) 100%);
  color: var(--color-on-accent);
  font-weight: 600;
  border-color: var(--theme-border-glow);
  box-shadow: 0 2px 8px var(--theme-glow);
}

.btn-primary:hover {
  background: linear-gradient(180deg, var(--color-accent-hover) 0%, var(--color-accent) 100%);
  box-shadow: 0 4px 14px var(--theme-glow);
}

.btn-secondary {
  background: rgba(30, 41, 59, 0.6);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(6px);
}

.btn-secondary:hover {
  background: rgba(51, 65, 85, 0.8);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

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

.btn-destructive:hover, .btn-danger:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #dc2626;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 0.75rem;
  height: 32px;
  min-height: 32px;
  line-height: 1;
  box-sizing: border-box;
}

.data-table td .btn-sm {
  height: 28px;
  min-height: 28px;
  padding: 2px 8px;
  font-size: 0.72rem;
}

.btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke-width: 2px;
}

/* Terminal Console View */
.terminal-card {
  background-color: #05070B;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  display: flex;
  flex-direction: column;
  height: clamp(300px, 48vh, 520px);
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.terminal-header {
  background-color: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 6px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--color-muted-foreground);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.terminal-body {
  flex: 1;
  padding: var(--space-3);
  overflow-y: auto;
  overflow-x: hidden;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  line-height: 1.5;
  color: #D1D5DB;
  white-space: pre-wrap;
  word-break: break-all;
}

.terminal-line-system {
  color: var(--color-ring);
}

.terminal-line-stderr {
  color: var(--color-destructive);
}

.terminal-line-stdout {
  color: #E2E8F0;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 10000;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  -webkit-overflow-scrolling: touch;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(6px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-content {
  background-color: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  max-width: min(540px, 100%);
  width: 100%;
  margin: auto 0;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: clamp(1rem, 3vw, 1.5rem);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  box-sizing: border-box;
  animation: modalScaleIn 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Responsive Modal Grids (Prevents Mobile Horizontal Stretching) */
.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  width: 100%;
}

.modal-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  width: 100%;
}

@media (max-width: 580px) {
  .modal-grid-2,
  .modal-grid-3 {
    grid-template-columns: 1fr !important;
    gap: 10px;
  }
}

/* ============================================================
   Custom Enterprise Destructive Confirmation Box (10/10 Performance)
   GPU-Accelerated | Zero-Reflow | Clean System-UI Sans-Serif
   ============================================================ */

@keyframes dangerModalPopIn {
  0% {
    opacity: 0;
    transform: scale(0.93) translateY(12px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes dangerPulse {
  0%, 100% {
    box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
    border-color: rgba(239, 68, 68, 0.55);
    transform: scale(1);
  }
  50% {
    box-shadow: 0 0 32px rgba(239, 68, 68, 0.7);
    border-color: rgba(239, 68, 68, 0.95);
    transform: scale(1.04);
  }
}

@keyframes chipDotPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.35;
    transform: scale(0.85);
  }
}

#delete-confirm-modal {
  align-items: center !important;
  justify-content: center !important;
  padding: 16px !important;
}

.modal-content-danger {
  position: relative;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
  border-radius: 18px !important;
  border: 1px solid rgba(239, 68, 68, 0.38) !important;
  box-shadow: 0 32px 80px -16px rgba(0, 0, 0, 0.96), 0 0 36px -4px rgba(239, 68, 68, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12) !important;
  background: radial-gradient(ellipse at 50% -20%, rgba(220, 38, 38, 0.22) 0%, rgba(17, 24, 39, 0.98) 60%, rgba(10, 14, 23, 0.99) 100%) !important;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 18px 20px !important;
  display: flex;
  flex-direction: column;
  gap: 12px !important;
  max-width: 440px !important;
  max-height: calc(100vh - 32px) !important;
  margin: auto !important;
  animation: dangerModalPopIn 220ms cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  will-change: transform, opacity;
}

/* Strict sans-serif override to prevent serif/italic bleed on mobile engines */
.modal-content-danger,
.modal-content-danger *:not(code):not(.delete-target-id) {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-style: normal !important;
}

/* Top Neon Gradient Accent Bar */
.modal-danger-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #ef4444 0%, #f97316 45%, #dc2626 100%);
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.85);
  z-index: 2;
}

.modal-danger-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  padding-top: 4px;
}

.modal-danger-icon-badge {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 30%, rgba(239, 68, 68, 0.32) 0%, rgba(220, 38, 38, 0.1) 100%);
  border: 1px solid rgba(239, 68, 68, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ff4d4f;
  animation: dangerPulse 2.6s ease-in-out infinite;
  will-change: transform, box-shadow;
  box-shadow: 0 0 16px rgba(239, 68, 68, 0.35);
}

.modal-danger-icon-badge svg {
  width: 22px;
  height: 22px;
}

.modal-danger-headings {
  flex: 1;
  min-width: 0;
}

.modal-danger-title {
  font-size: 1.1875rem !important;
  font-weight: 700 !important;
  color: #ffffff !important;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.3;
}

.modal-danger-subtitle {
  font-size: 0.8125rem !important;
  color: #94a3b8 !important;
  margin-top: 4px;
  line-height: 1.45;
  font-weight: 400;
}

.modal-close-btn {
  background: rgba(255, 255, 255, 0.05);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.875rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.modal-close-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  border-color: rgba(239, 68, 68, 0.5);
  color: #ffffff;
  transform: scale(1.06);
}

.modal-close-btn svg {
  width: 14px;
  height: 14px;
  stroke-width: 2px;
}

/* Bespoke Target Specification HUD Card */
.delete-bot-target-card {
  background: rgba(8, 12, 22, 0.72) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 12px !important;
  padding: 12px 14px !important;
  display: flex;
  flex-direction: column;
  gap: 8px !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.target-card-header {
  display: flex;
  align-items: center;
  margin-bottom: 2px;
}

.target-card-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
  animation: chipDotPulse 2s ease-in-out infinite;
}

.delete-target-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.8125rem;
}

.delete-target-label {
  color: #64748b !important;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.delete-target-name {
  font-weight: 600 !important;
  color: #f1f5f9 !important;
  word-break: break-all;
  font-size: 0.875rem;
}

.delete-target-id {
  font-family: "JetBrains Mono", SFMono-Regular, Consolas, Monaco, monospace !important;
  font-size: 0.75rem !important;
  background: rgba(239, 68, 68, 0.12) !important;
  color: #fca5a5 !important;
  padding: 3px 8px !important;
  border-radius: 6px !important;
  border: 1px solid rgba(239, 68, 68, 0.28) !important;
  letter-spacing: 0.02em;
}

/* High-Contrast Left-Accent Danger Warning Box */
.delete-danger-warning-box {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.12) 0%, rgba(220, 38, 38, 0.04) 100%) !important;
  border: 1px solid rgba(239, 68, 68, 0.28) !important;
  border-left: 3px solid #ef4444 !important;
  border-radius: 8px !important;
  padding: 12px 14px !important;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  box-shadow: inset 0 0 16px rgba(239, 68, 68, 0.05);
}

.delete-danger-warning-box .warning-icon {
  width: 18px;
  height: 18px;
  color: #ef4444;
  flex-shrink: 0;
  margin-top: 2px;
}

.warning-text {
  color: #fecaca !important;
  font-size: 0.8125rem !important;
  line-height: 1.45;
}

.warning-text strong {
  color: #f87171 !important;
  font-weight: 700 !important;
}

/* Footer with High-Impact Ergonomic Buttons (>44px mobile touch targets) */
.modal-danger-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  width: 100%;
}

.btn-danger-cancel {
  flex: 1;
  min-height: 44px;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #cbd5e1 !important;
  border-radius: 10px !important;
  font-weight: 600 !important;
  font-size: 0.875rem !important;
  cursor: pointer;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-danger-cancel:hover {
  background: rgba(255, 255, 255, 0.09) !important;
  border-color: rgba(255, 255, 255, 0.22) !important;
  color: #ffffff !important;
}

.btn-danger-cancel:active {
  transform: scale(0.98);
}

.btn-danger-glow {
  flex: 1.25;
  min-height: 44px;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 60%, #b91c1c 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 120, 120, 0.45) !important;
  border-radius: 10px !important;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
  font-weight: 700 !important;
  font-size: 0.875rem !important;
  letter-spacing: 0.01em;
  transition: all 160ms cubic-bezier(0.16, 1, 0.3, 1) !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  will-change: transform, box-shadow;
}

.btn-danger-glow:hover {
  background: linear-gradient(135deg, #f87171 0%, #ef4444 60%, #dc2626 100%) !important;
  box-shadow: 0 6px 28px rgba(239, 68, 68, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
  transform: translateY(-1px);
}

.btn-danger-glow:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.4) !important;
}

.btn-ghost {
  background: transparent;
  color: var(--color-muted-foreground);
  border-color: transparent;
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-foreground);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--color-muted-foreground);
}

.form-input, .form-textarea {
  background-color: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--color-foreground);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  width: 100%;
  box-sizing: border-box;
}

.form-textarea {
  min-height: 140px;
  resize: vertical;
}

/* Login Page & Input Icons */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: radial-gradient(circle at 50% 15%, rgba(16, 185, 129, 0.08) 0%, rgba(9, 13, 22, 0) 65%), var(--color-background);
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: linear-gradient(180deg, rgba(20, 29, 48, 0.92) 0%, rgba(13, 20, 36, 0.98) 100%);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: clamp(1.5rem, 5vw, 2.25rem);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  box-sizing: border-box;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.05);
}

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

.login-brand-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  box-shadow: 0 0 16px rgba(16, 185, 129, 0.2);
  flex-shrink: 0;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--color-foreground);
}

.login-subtitle {
  color: var(--color-muted-foreground);
  font-size: 0.8125rem;
}

.login-security-badge {
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pulsing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulse-dot 1.8s infinite;
  flex-shrink: 0;
}

.login-error-alert {
  padding: 10px 12px;
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-sm);
  color: var(--color-destructive);
  font-size: 0.8125rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .input-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--color-muted-foreground);
  pointer-events: none;
}

.input-with-icon .form-input {
  padding-left: 36px;
  width: 100%;
}

.login-btn {
  justify-content: center;
  padding: 11px;
  font-size: 0.875rem;
  margin-top: 6px;
}

/* Theme Customizer Grid (MotionSites & UI/UX Pro Max) */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 12px;
}

@media (min-width: 640px) {
  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
}

@media (min-width: 1024px) {
  .theme-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }
}

.theme-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
}

.theme-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px var(--theme-glow);
}

.theme-card.active {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 1px var(--color-accent), 0 4px 16px var(--theme-glow);
}

.theme-card.active::after {
  content: '✓ ACTIVE';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  color: var(--color-on-accent);
  letter-spacing: 0.05em;
}

.theme-preview {
  height: 64px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.theme-preview-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px;
  border-radius: 3px;
}

.theme-preview-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.theme-preview-line {
  height: 4px;
  flex: 1;
  border-radius: 2px;
}

.theme-preview-body {
  display: flex;
  gap: 6px;
  flex: 1;
}

.theme-preview-box {
  flex: 1;
  border-radius: 3px;
  border: 1px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.65rem;
}

.theme-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.theme-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.theme-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-foreground);
}

.theme-badge {
  font-size: 0.625rem;
  padding: 1.5px 5px;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-weight: 600;
}

.theme-desc {
  font-size: 0.6875rem;
  color: var(--color-muted-foreground);
}

/* Cyber Toast Notification System (MotionSites & UI/UX Pro Max) */
.toast-container {
  position: fixed;
  top: clamp(14px, 3vw, 24px);
  right: clamp(14px, 3vw, 24px);
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  width: 380px;
  max-width: calc(100vw - 28px);
}

@media (max-width: 640px) {
  .toast-container {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: calc(100vw - 24px);
    top: 14px;
  }
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  background: rgba(14, 22, 38, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55), 0 0 1px rgba(255, 255, 255, 0.1);
  color: var(--color-foreground);
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.45;
  transition: all 220ms cubic-bezier(0.16, 1, 0.3, 1);
  animation: toastSlideIn 240ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.toast:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65);
}

.toast.toast-hiding {
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(-14px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-icon svg {
  width: 100%;
  height: 100%;
}

.toast-content {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.toast-title {
  font-weight: 600;
  font-size: 0.8125rem;
  margin-bottom: 2px;
  color: #FFFFFF;
}

.toast-message {
  color: var(--color-muted-foreground);
  font-size: 0.775rem;
  white-space: pre-line;
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--color-muted-foreground);
  cursor: pointer;
  padding: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.6;
  transition: opacity 120ms ease;
  flex-shrink: 0;
}

.toast-close:hover {
  opacity: 1;
  color: #FFFFFF;
}

.toast-close svg {
  width: 14px;
  height: 14px;
}

.toast-success {
  border-color: rgba(16, 185, 129, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 14px rgba(16, 185, 129, 0.2);
}
.toast-success .toast-icon {
  color: #10B981;
}

.toast-error, .toast-danger {
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 14px rgba(239, 68, 68, 0.22);
}
.toast-error .toast-icon, .toast-danger .toast-icon {
  color: #EF4444;
}

.toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 14px rgba(245, 158, 11, 0.2);
}
.toast-warning .toast-icon {
  color: #F59E0B;
}

.toast-info {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 14px rgba(56, 189, 248, 0.2);
}
.toast-info .toast-icon {
  color: #38BDF8;
}

.toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2.5px;
  background: var(--color-accent);
  width: 100%;
  animation: toastProgress linear forwards;
}

.toast-error .toast-progress, .toast-danger .toast-progress {
  background: #EF4444;
}
.toast-warning .toast-progress {
  background: #F59E0B;
}
.toast-info .toast-progress {
  background: #38BDF8;
}

@keyframes toastProgress {
  from { width: 100%; }
  to { width: 0%; }
}

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

/* ============================================================
   THEME 5 — MATERIAL BLUE (Material Design 3, blue / white)
   Light-first M3 palette: primary #0B57D0, container #D3E3FD.
   No blur, no neon glow, transform/opacity friendly for low-end.
   ============================================================ */
html[data-theme="material"] {
  --color-primary: #0B57D0;
  --color-on-primary: #FFFFFF;
  --color-secondary: #D3E3FD;
  --color-on-secondary: #041E49;
  --color-accent: #0B57D0;
  --color-accent-hover: #0842A0;
  --color-on-accent: #FFFFFF;
  --color-background: #F6F8FC;
  --color-surface: #FFFFFF;
  --color-foreground: #1B1B1F;
  --color-card: #FFFFFF;
  --color-card-hover: #F0F4FA;
  --color-muted: #EEF2F9;
  --color-muted-foreground: #5A6069;
  --color-border: #DDE3EC;
  --color-border-subtle: #E9EEF6;
  --color-destructive: #B3261E;
  --color-destructive-hover: #8C1D18;
  --color-on-destructive: #FFFFFF;
  --color-warning: #8A5100;
  --color-on-warning: #FFFFFF;
  --color-ring: #0B57D0;
  --theme-glow: rgba(11, 87, 208, 0.14);
  --theme-border-glow: rgba(11, 87, 208, 0.30);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --m3-elev-1: 0 1px 2px rgba(16, 24, 40, 0.05), 0 1px 3px rgba(16, 24, 40, 0.04);
  --m3-elev-2: 0 2px 6px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.05);
  --m3-elev-3: 0 6px 18px rgba(16, 24, 40, 0.10);
}

/* --- surfaces --- */
html[data-theme="material"] .metric-card,
html[data-theme="material"] .section-panel,
html[data-theme="material"] .theme-card {
  background-color: var(--color-card);
  border-color: var(--color-border);
  box-shadow: var(--m3-elev-1);
}
html[data-theme="material"] .section-panel { border-radius: var(--radius-lg); }
html[data-theme="material"] .brand-icon { color: var(--color-primary); }
html[data-theme="material"] .brand-badge,
html[data-theme="material"] .security-badge {
  background-color: var(--color-muted);
  border-color: var(--color-border-subtle);
  color: var(--color-muted-foreground);
}
html[data-theme="material"] .security-badge svg { color: var(--color-primary); }

/* --- metrics --- */
html[data-theme="material"] .metric-value,
html[data-theme="material"] .bot-card-metric-value,
html[data-theme="material"] .mobile-card-metric-value {
  font-family: var(--font-sans);
  font-weight: 600;
  letter-spacing: -0.02em;
}
html[data-theme="material"] .metric-header { letter-spacing: 0.02em; font-weight: 500; }
html[data-theme="material"] .metric-icon { color: var(--color-primary); }

/* --- bottom dock → M3 navigation bar --- */
html[data-theme="material"] .floating-dock {
  background-color: var(--color-surface);
  border-color: var(--color-border);
  box-shadow: var(--m3-elev-3);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .floating-dock .nav-tab:hover {
  background-color: var(--color-card-hover);
  color: var(--color-foreground);
  transform: none;
}
html[data-theme="material"] .floating-dock .nav-tab.active {
  background-color: var(--color-secondary);
  color: var(--color-on-secondary);
  border-color: transparent;
  box-shadow: none;
  transform: none;
}

/* --- cards --- */
html[data-theme="material"] .bot-card,
html[data-theme="material"] .mobile-card {
  background-color: var(--color-surface);
  box-shadow: var(--m3-elev-1);
}
html[data-theme="material"] .bot-card:hover,
html[data-theme="material"] .mobile-card:hover {
  border-color: #C9D6E8;
  box-shadow: var(--m3-elev-2);
}
html[data-theme="material"] .bot-card-grid,
html[data-theme="material"] .mobile-card-grid {
  background-color: #F7F9FD;
  border-color: var(--color-border-subtle);
}
html[data-theme="material"] .bot-card-owner-chip {
  color: #0B57D0 !important;
  background: #EAF1FE !important;
  border-color: #C9DBFB !important;
}

/* --- tables --- */
html[data-theme="material"] .data-table th {
  background-color: #F3F6FB;
  color: #5A6069;
}
html[data-theme="material"] .data-table td { border-bottom-color: var(--color-border-subtle); }
html[data-theme="material"] .data-table tr:hover td { background-color: var(--color-card-hover); }

/* --- status pills (light-surface contrast) --- */
html[data-theme="material"] .status-running {
  background-color: #E7F6EC;
  color: #146C2E;
  border-color: #BFE6CB;
}
html[data-theme="material"] .status-running::before { background-color: #1E8E3E; box-shadow: none; }
html[data-theme="material"] .status-stopped {
  background-color: #EEF2F9;
  color: #5A6069;
  border-color: #DDE3EC;
}
html[data-theme="material"] .status-stopped::before { background-color: #8E939B; box-shadow: none; }
html[data-theme="material"] .status-crashed {
  background-color: #FCEBEA;
  color: #B3261E;
  border-color: #F2C6C2;
}
html[data-theme="material"] .status-crashed::before { background-color: #B3261E; box-shadow: none; }
html[data-theme="material"] .status-restarting {
  background-color: #FFF3DC;
  color: #8A5100;
  border-color: #F7DFB0;
}
html[data-theme="material"] .status-restarting::before { background-color: #8A5100; box-shadow: none; }

/* --- buttons --- */
html[data-theme="material"] .btn {
  border-radius: var(--radius-full);
  font-weight: 600;
}
html[data-theme="material"] .btn:hover { transform: none; }
html[data-theme="material"] .btn:active { transform: scale(0.97); }
html[data-theme="material"] .btn-primary {
  background: var(--color-accent);
  border-color: transparent;
  box-shadow: 0 1px 2px rgba(11, 87, 208, 0.24);
}
html[data-theme="material"] .btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 2px 8px rgba(11, 87, 208, 0.28);
}
html[data-theme="material"] .btn-secondary {
  background: #EAF1FE;
  color: #0B57D0;
  border-color: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .btn-secondary:hover {
  background: #D3E3FD;
  color: #041E49;
  border-color: transparent;
}
html[data-theme="material"] .btn-destructive,
html[data-theme="material"] .btn-danger {
  background: #FCEBEA;
  color: #B3261E;
  border-color: #F2C6C2;
}
html[data-theme="material"] .btn-destructive:hover,
html[data-theme="material"] .btn-danger:hover {
  background: #B3261E;
  color: #FFFFFF;
  border-color: #B3261E;
  box-shadow: 0 2px 8px rgba(179, 38, 30, 0.28);
}
html[data-theme="material"] .btn-ghost { color: #5A6069; }
html[data-theme="material"] .btn-ghost:hover { background: var(--color-card-hover); color: #1B1B1F; }

/* --- inputs --- */
html[data-theme="material"] .panel-search-input,
html[data-theme="material"] .form-input,
html[data-theme="material"] .form-textarea {
  background-color: #FFFFFF;
  border-color: var(--color-border);
  border-radius: var(--radius-sm);
}
html[data-theme="material"] .panel-search-input:focus,
html[data-theme="material"] .form-input:focus,
html[data-theme="material"] .form-textarea:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(11, 87, 208, 0.14);
  outline: none;
}

/* --- terminal keeps its dark console identity --- */
html[data-theme="material"] .terminal-card {
  background-color: #0B1220;
  border-color: #223047;
}
html[data-theme="material"] .terminal-header {
  background-color: #101826;
  border-bottom-color: #223047;
}
html[data-theme="material"] .terminal-title { color: #93A4BF; }
html[data-theme="material"] .terminal-body { color: #C7D7F0; }
html[data-theme="material"] .terminal-line-stdout { color: #E3ECFF; }

/* --- modals --- */
html[data-theme="material"] .modal-backdrop {
  background-color: rgba(15, 23, 42, 0.42);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .modal-content {
  background-color: #FFFFFF;
  border-color: var(--color-border);
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.18);
}

/* danger modal → light surface, red accents */
html[data-theme="material"] .modal-content-danger {
  background: #FFFFFF !important;
  border: 1px solid #F2C6C2 !important;
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.18), 0 0 0 1px rgba(179, 38, 30, 0.06) !important;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .modal-danger-title { color: #1B1B1F !important; }
html[data-theme="material"] .modal-danger-subtitle { color: #5A6069 !important; }
html[data-theme="material"] .delete-bot-target-card {
  background: #F7F9FD !important;
  border-color: #E4EAF3 !important;
  box-shadow: none;
}
html[data-theme="material"] .target-card-chip { color: #5A6069; }
html[data-theme="material"] .delete-target-label { color: #6B7280 !important; }
html[data-theme="material"] .delete-target-name { color: #1B1B1F !important; }
html[data-theme="material"] .delete-target-id {
  background: #FCEBEA !important;
  color: #B3261E !important;
  border-color: #F2C6C2 !important;
}
html[data-theme="material"] .delete-danger-warning-box {
  background: #FEF3F2 !important;
  border-color: #F2C6C2 !important;
  border-left-color: #B3261E !important;
  box-shadow: none;
}
html[data-theme="material"] .warning-text { color: #7A2018 !important; }
html[data-theme="material"] .warning-text strong { color: #B3261E !important; }
html[data-theme="material"] .modal-close-btn {
  background: #F0F4FA;
  border-color: #E1E7F0;
  color: #5A6069;
}
html[data-theme="material"] .modal-close-btn:hover {
  background: #FCEBEA;
  border-color: #F2C6C2;
  color: #B3261E;
}
html[data-theme="material"] .btn-danger-cancel {
  background: #F0F4FA !important;
  border-color: #DDE3EC !important;
  color: #3C4043 !important;
}
html[data-theme="material"] .btn-danger-cancel:hover {
  background: #E5ECF6 !important;
  border-color: #C9D6E8 !important;
  color: #1B1B1F !important;
}
html[data-theme="material"] .modal-danger-icon-badge {
  background: radial-gradient(circle at 30% 30%, rgba(179, 38, 30, 0.12) 0%, rgba(179, 38, 30, 0.04) 100%);
  border-color: #F2C6C2;
  color: #B3261E;
  animation: none;
  box-shadow: none;
}
html[data-theme="material"] .modal-danger-top-bar {
  background: linear-gradient(90deg, #B3261E 0%, #DC362E 50%, #B3261E 100%);
  box-shadow: none;
}

/* --- login --- */
html[data-theme="material"] .login-wrapper {
  background: radial-gradient(circle at 50% 12%, rgba(11, 87, 208, 0.10) 0%, rgba(246, 248, 252, 0) 62%), var(--color-background);
}
html[data-theme="material"] .login-card {
  background: #FFFFFF;
  border-color: var(--color-border);
  box-shadow: 0 18px 48px rgba(16, 24, 40, 0.12);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .login-brand-badge {
  background: #D3E3FD;
  border-color: #C9DBFB;
  color: #0B57D0;
  box-shadow: none;
}
html[data-theme="material"] .login-security-badge {
  background: #F0F4FA;
  border-color: #E1E7F0;
  color: #5A6069;
}
html[data-theme="material"] .pulsing-dot { background: #1E8E3E; box-shadow: none; }
html[data-theme="material"] .login-error-alert {
  background: #FCEBEA;
  border-color: #F2C6C2;
  color: #B3261E;
}
html[data-theme="material"] .login-title { font-weight: 600; }

/* --- theme picker card --- */
html[data-theme="material"] .theme-card:hover {
  transform: none;
  border-color: var(--color-primary);
  box-shadow: var(--m3-elev-2);
}
html[data-theme="material"] .theme-card.active {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 1px var(--color-primary), var(--m3-elev-2);
}
html[data-theme="material"] .theme-card.active::after {
  background: var(--color-primary);
  color: #FFFFFF;
}
html[data-theme="material"] .theme-badge {
  background: #EAF1FE;
  color: #0B57D0;
  border-color: #C9DBFB;
}

/* --- toasts --- */
html[data-theme="material"] .toast {
  background: #FFFFFF;
  border-color: var(--color-border);
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
html[data-theme="material"] .toast:hover { box-shadow: 0 12px 30px rgba(16, 24, 40, 0.18); }
html[data-theme="material"] .toast-title { color: #1B1B1F; }
html[data-theme="material"] .toast-close:hover { color: #1B1B1F; }
html[data-theme="material"] .toast-success { border-color: #BFE6CB; box-shadow: 0 8px 24px rgba(20, 108, 46, 0.14); }
html[data-theme="material"] .toast-success .toast-icon { color: #146C2E; }
html[data-theme="material"] .toast-error,
html[data-theme="material"] .toast-danger { border-color: #F2C6C2; box-shadow: 0 8px 24px rgba(179, 38, 30, 0.14); }
html[data-theme="material"] .toast-warning { border-color: #F7DFB0; box-shadow: 0 8px 24px rgba(138, 81, 0, 0.14); }
html[data-theme="material"] .toast-info { border-color: #C9DBFB; box-shadow: 0 8px 24px rgba(11, 87, 208, 0.14); }
html[data-theme="material"] .toast-info .toast-icon { color: #0B57D0; }
