/* ============================================================
   LocalDeploy — Premium Dark-Theme Design System
   ============================================================
   A comprehensive CSS design system featuring glassmorphism,
   micro-animations, and a curated dark palette.
   ============================================================ */

/* ----------------------------------------------------------
   1. DESIGN TOKENS (CSS Custom Properties)
   ---------------------------------------------------------- */
:root {
  /* Backgrounds */
  --bg-primary: #050508;
  --bg-secondary: rgba(10, 10, 18, 0.45);
  --bg-tertiary: rgba(18, 18, 28, 0.55);
  --bg-card: rgba(255, 255, 255, 0.025);
  --bg-card-hover: rgba(255, 255, 255, 0.065);
  --bg-glass: rgba(255, 255, 255, 0.04);
  --bg-glass-heavy: rgba(255, 255, 255, 0.075);
  --bg-input: rgba(255, 255, 255, 0.03);

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-active: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(59, 130, 246, 0.5);

  /* Text */
  --text-primary: #e8e8ed;
  --text-secondary: #8b8b9e;
  --text-muted: #55556a;
  --text-inverse: #0a0a0f;

  /* Accent – Blue */
  --accent-blue: #3b82f6;
  --accent-blue-hover: #2563eb;
  --accent-blue-glow: rgba(59, 130, 246, 0.15);
  --accent-blue-ring: rgba(59, 130, 246, 0.35);

  /* Accent – Green */
  --accent-green: #22c55e;
  --accent-green-hover: #16a34a;
  --accent-green-glow: rgba(34, 197, 94, 0.15);

  /* Accent – Amber */
  --accent-amber: #f59e0b;
  --accent-amber-hover: #d97706;
  --accent-amber-glow: rgba(245, 158, 11, 0.15);

  /* Accent – Red */
  --accent-red: #ef4444;
  --accent-red-hover: #dc2626;
  --accent-red-glow: rgba(239, 68, 68, 0.15);

  /* Accent – Purple */
  --accent-purple: #8b5cf6;
  --accent-purple-hover: #7c3aed;
  --accent-purple-glow: rgba(139, 92, 246, 0.15);

  /* Accent – Cyan */
  --accent-cyan: #06b6d4;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Layout */
  --sidebar-width: 260px;
  --topbar-height: 60px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.2);

  /* Transitions */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Z-index scale */
  --z-sidebar: 100;
  --z-topbar: 200;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;
}

/* ----------------------------------------------------------
   2. CSS RESET / NORMALIZE
   ---------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 45%),
              radial-gradient(circle at 90% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 45%),
              var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  top: -10%;
  left: -10%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0) 70%);
  z-index: -2;
  filter: blur(50px);
  pointer-events: none;
}

body::after {
  content: "";
  position: fixed;
  bottom: -10%;
  right: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, rgba(139, 92, 246, 0) 70%);
  z-index: -2;
  filter: blur(60px);
  pointer-events: none;
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--accent-blue-hover);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   3. CUSTOM SCROLLBAR
   ---------------------------------------------------------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.18);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

/* ----------------------------------------------------------
   4. ROOT LAYOUT (#app)
   ---------------------------------------------------------- */
#app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  min-height: 100vh;
}

#main-content {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ----------------------------------------------------------
   5. SIDEBAR
   ---------------------------------------------------------- */
#sidebar,
.sidebar {
  position: sticky;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  z-index: var(--z-sidebar);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  overflow: hidden;
  transition: transform var(--duration-slow) var(--ease-out);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 17px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.3px;
}

/* Navigation */
.sidebar-nav {
  padding: 12px 10px;
  flex-shrink: 0;
}

.nav-section-label {
  padding: 8px 12px 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--duration-fast) var(--ease-out);
  position: relative;
  border-left: 3px solid transparent;
  cursor: pointer;
}

.nav-link:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-blue-glow);
  color: var(--accent-blue);
  border-left-color: var(--accent-blue);
}

.nav-link.active .nav-icon {
  color: var(--accent-blue);
}

.nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

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

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-blue-glow);
  color: var(--accent-blue);
  padding: 1px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

/* Projects List */
.sidebar-projects {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px;
  border-top: 1px solid var(--border-subtle);
}

.sidebar-projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
}

.sidebar-projects-title {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-muted);
}

.sidebar-project {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.sidebar-project:hover {
  background: var(--bg-glass);
  color: var(--text-primary);
}

.sidebar-project.active {
  background: var(--bg-glass-heavy);
  color: var(--text-primary);
}

.sidebar-project-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-project-dot.running {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green-glow);
}

.sidebar-project-dot.stopped {
  background: var(--text-muted);
}

.sidebar-project-dot.failed {
  background: var(--accent-red);
}

.sidebar-project-dot.building {
  background: var(--accent-amber);
  animation: pulse 2s infinite;
}

.sidebar-project-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* New project button */
.sidebar-new-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 8px 10px;
  padding: 9px;
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.sidebar-new-btn:hover {
  border-style: solid;
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--accent-blue-glow);
}

/* Sidebar footer */
.sidebar-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.sidebar-version {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: calc(var(--z-topbar) + 1);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  font-size: 18px;
  cursor: pointer;
}

/* ----------------------------------------------------------
   6. TOP BAR
   ---------------------------------------------------------- */
#top-bar,
.top-bar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  z-index: var(--z-topbar);
  flex-shrink: 0;
}

.top-bar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Connection Status */
.ws-status,
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
}

.connection-status.connected,
.ws-status.connected {
  color: var(--accent-green);
}

.connection-status.disconnected,
.ws-status.disconnected {
  color: var(--accent-red);
}

.connection-status.connecting,
.ws-status.connecting {
  color: var(--accent-amber);
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.connected .connection-dot {
  background: var(--accent-green);
  box-shadow: 0 0 6px var(--accent-green);
}

.disconnected .connection-dot {
  background: var(--accent-red);
  box-shadow: 0 0 6px var(--accent-red);
}

.connecting .connection-dot {
  background: var(--accent-amber);
  animation: pulse 1.5s infinite;
}

/* ----------------------------------------------------------
   7. BREADCRUMBS
   ---------------------------------------------------------- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-item {
  color: var(--text-secondary);
  transition: color var(--duration-fast) var(--ease-out);
}

.breadcrumb-item:hover {
  color: var(--text-primary);
}

.breadcrumb-separator {
  color: var(--text-muted);
  font-size: 11px;
  user-select: none;
}

.breadcrumb-separator::after {
  content: '›';
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

/* ----------------------------------------------------------
   8. PAGE CONTENT
   ---------------------------------------------------------- */
#page-content {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

/* ----------------------------------------------------------
   9. CARDS
   ---------------------------------------------------------- */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  transition: all 0.3s var(--ease-out);
  overflow: hidden;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--bg-card-hover);
  border-color: var(--border-active);
}

.card-no-hover:hover {
  transform: none;
  box-shadow: none;
  background: var(--bg-card);
  border-color: var(--border-subtle);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-header-title {
  font-size: 15px;
  font-weight: 600;
}

.card-body {
  padding: 22px;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border-subtle);
}

/* ----------------------------------------------------------
   10. STAT CARDS
   ---------------------------------------------------------- */
.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  position: relative;
  overflow: hidden;
  border-left: 3px solid var(--accent-blue);
  transition: all 0.3s var(--ease-out);
}

.stat-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card.green  { border-left-color: var(--accent-green); }
.stat-card.amber  { border-left-color: var(--accent-amber); }
.stat-card.red    { border-left-color: var(--accent-red); }
.stat-card.purple { border-left-color: var(--accent-purple); }

.stat-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.5px;
}

.stat-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  background: var(--bg-glass);
}

/* ----------------------------------------------------------
   11. BUTTONS
   ---------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  color: #fff;
  border-color: transparent;
}

.btn-primary:hover {
  box-shadow: var(--shadow-glow-blue);
  filter: brightness(1.1);
  transform: translateY(-1px);
}

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

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border-active);
}

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

.btn-danger {
  background: var(--accent-red);
  color: #fff;
}

.btn-danger:hover {
  background: var(--accent-red-hover);
  box-shadow: 0 0 16px var(--accent-red-glow);
  transform: translateY(-1px);
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: none;
  padding: 8px 12px;
}

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

.btn-success {
  background: var(--accent-green);
  color: #fff;
}

.btn-success:hover {
  background: var(--accent-green-hover);
  box-shadow: 0 0 16px var(--accent-green-glow);
}

/* Size variants */
.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
  border-radius: var(--radius-md);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: var(--radius-md);
  font-size: 16px;
}

.btn-icon.btn-sm {
  width: 30px;
  height: 30px;
  font-size: 14px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.4;
  pointer-events: none;
  cursor: not-allowed;
}

/* Loading state */
.btn-loading {
  pointer-events: none;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ----------------------------------------------------------
   12. STATUS BADGES
   ---------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.badge-running {
  background: var(--accent-green-glow);
  color: var(--accent-green);
}

.badge-building {
  background: var(--accent-amber-glow);
  color: var(--accent-amber);
}

.badge-failed {
  background: var(--accent-red-glow);
  color: var(--accent-red);
}

.badge-stopped {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
}

.badge-idle {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.badge-queued {
  background: var(--accent-purple-glow);
  color: var(--accent-purple);
}

/* Status dot */
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.running {
  background: var(--accent-green);
  animation: pulse 2s infinite;
}

.status-dot.building {
  background: var(--accent-amber);
  animation: pulse 1.5s infinite;
}

.status-dot.failed {
  background: var(--accent-red);
}

.status-dot.stopped {
  background: var(--text-muted);
}

.status-dot.idle {
  background: var(--text-muted);
  opacity: 0.5;
}

.status-dot.queued {
  background: var(--accent-purple);
  animation: pulse 2s infinite;
}

/* ----------------------------------------------------------
   13. FORM ELEMENTS
   ---------------------------------------------------------- */
.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: all var(--duration-fast) var(--ease-out);
  outline: none;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-ring);
  background: rgba(255, 255, 255, 0.06);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b8b9e' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  cursor: pointer;
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.5;
}

.form-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-error {
  font-size: 11.5px;
  color: var(--accent-red);
  margin-top: 5px;
  animation: shake 0.3s var(--ease-out);
}

/* Toggle switch */
.form-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  gap: 10px;
}

.form-toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.form-toggle-track {
  width: 40px;
  height: 22px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  position: relative;
  transition: background var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.form-toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: all var(--duration-fast) var(--ease-spring);
}

.form-toggle input:checked + .form-toggle-track {
  background: var(--accent-blue);
}

.form-toggle input:checked + .form-toggle-track::after {
  transform: translateX(18px);
  background: #fff;
}

.form-toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   14. MODAL
   ---------------------------------------------------------- */
#modal-overlay,
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

#modal-overlay.active,
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  max-width: 520px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.97);
  transition: transform var(--duration-normal) var(--ease-spring);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 18px;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

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

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-subtle);
}

/* ----------------------------------------------------------
   15. TOAST NOTIFICATIONS
   ---------------------------------------------------------- */
#toast-container,
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--bg-secondary);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideIn var(--duration-normal) var(--ease-spring);
  border-left: 3px solid var(--accent-blue);
}

.toast-success { border-left-color: var(--accent-green); }
.toast-error   { border-left-color: var(--accent-red); }
.toast-warning { border-left-color: var(--accent-amber); }
.toast-info    { border-left-color: var(--accent-blue); }

.toast-icon {
  font-size: 18px;
  flex-shrink: 0;
  line-height: 1;
  margin-top: 1px;
}

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

.toast-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 2px;
}

.toast-message {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.toast-close {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

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

.toast.dismissing {
  animation: fadeOut var(--duration-normal) var(--ease-out) forwards;
}

/* ----------------------------------------------------------
   16. TERMINAL / LOG VIEWER
   ---------------------------------------------------------- */
.log-viewer {
  background: #0d1117;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.65;
}

.log-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border-subtle);
}

.log-viewer-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-viewer-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.log-viewer-body {
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 0;
}

.log-line {
  display: flex;
  padding: 1px 16px;
  transition: background var(--duration-fast) var(--ease-out);
}

.log-line:hover {
  background: rgba(255, 255, 255, 0.03);
}

.log-line-number {
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
  margin-right: 16px;
  user-select: none;
  flex-shrink: 0;
}

.log-line-timestamp {
  color: var(--accent-blue);
  opacity: 0.6;
  margin-right: 12px;
  flex-shrink: 0;
  white-space: nowrap;
}

.log-line-content {
  flex: 1;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}

.log-viewer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 20px;
  color: var(--text-muted);
  gap: 8px;
}

.log-viewer-empty-icon {
  font-size: 28px;
  opacity: 0.4;
}

/* ANSI color classes */
.ansi-red     { color: #f85149; }
.ansi-green   { color: #3fb950; }
.ansi-yellow  { color: #d29922; }
.ansi-blue    { color: #58a6ff; }
.ansi-magenta { color: #bc8cff; }
.ansi-cyan    { color: #39c5cf; }
.ansi-white   { color: #e6edf3; }
.ansi-bold    { font-weight: 700; }
.ansi-dim     { opacity: 0.5; }

/* ----------------------------------------------------------
   17. TABLES
   ---------------------------------------------------------- */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  padding: 12px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table tbody td {
  padding: 12px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.data-table tbody tr {
  transition: background var(--duration-fast) var(--ease-out);
}

.data-table tbody tr:hover {
  background: var(--bg-glass);
}

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

/* ----------------------------------------------------------
   18. TABS
   ---------------------------------------------------------- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
  gap: 0;
  overflow-x: auto;
}

.tab, .tab-btn {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
  cursor: pointer;
  background: transparent;
  border-top: none;
  border-left: none;
  border-right: none;
}

.tab:hover, .tab-btn:hover {
  color: var(--text-primary);
  background: var(--bg-glass);
}

.tab.active, .tab-btn.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
}

.tab-content {
  padding-top: 20px;
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.tab-content:not(.active) {
  display: none !important;
}

/* Config tabs (inside a card) */
.config-tabs {
  border-bottom-color: var(--border-subtle);
}

.config-tabs .tab {
  padding: 10px 14px;
  font-size: 12.5px;
}

/* ----------------------------------------------------------
   19. LOADING SKELETON
   ---------------------------------------------------------- */
.skeleton {
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.04) 25%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 14px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
}

.skeleton-text:nth-child(1) { width: 100%; }
.skeleton-text:nth-child(2) { width: 80%; }
.skeleton-text:nth-child(3) { width: 60%; }

.skeleton-card {
  height: 140px;
  border-radius: var(--radius-lg);
}

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

/* ----------------------------------------------------------
   20. KEY-VALUE EDITOR
   ---------------------------------------------------------- */
.kv-editor {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kv-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kv-row .form-input {
  flex: 1;
}

.kv-row .form-input:first-child {
  max-width: 200px;
}

.kv-delete-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.kv-delete-btn:hover {
  background: var(--accent-red-glow);
  color: var(--accent-red);
}

.kv-value-toggle {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.kv-value-toggle:hover {
  background: var(--bg-glass);
  color: var(--text-secondary);
}

.kv-add-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border: 1px dashed var(--border-active);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.kv-add-btn:hover {
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  background: var(--accent-blue-glow);
}

/* ----------------------------------------------------------
   21. DEPLOYMENT TIMELINE
   ---------------------------------------------------------- */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border-subtle);
  border-radius: 1px;
}

.timeline-item {
  position: relative;
  padding-bottom: 24px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-dot {
  position: absolute;
  left: -24px;
  top: 4px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
  background: var(--text-muted);
  z-index: 1;
}

.timeline-dot.success { background: var(--accent-green); }
.timeline-dot.error   { background: var(--accent-red); }
.timeline-dot.running { background: var(--accent-blue); animation: pulse 2s infinite; }
.timeline-dot.pending { background: var(--text-muted); }

.timeline-content {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.timeline-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-description {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.timeline-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  font-family: var(--font-mono);
}

/* ----------------------------------------------------------
   22. PROJECT GRID
   ---------------------------------------------------------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

/* ----------------------------------------------------------
   23. STATS ROW
   ---------------------------------------------------------- */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

/* ----------------------------------------------------------
   24. EMPTY STATE
   ---------------------------------------------------------- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 18px;
  opacity: 0.6;
}

.empty-state-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.empty-state-description {
  font-size: 13.5px;
  color: var(--text-secondary);
  max-width: 400px;
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ----------------------------------------------------------
   25. TOOLTIPS
   ---------------------------------------------------------- */
.tooltip {
  position: relative;
}

.tooltip-text {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-out);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-subtle);
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--bg-tertiary);
}

.tooltip:hover .tooltip-text {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ----------------------------------------------------------
   26. PROGRESS BAR
   ---------------------------------------------------------- */
.progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-full);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
  border-radius: var(--radius-full);
  transition: width 0.6s var(--ease-out);
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.15) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
  background-size: 200% 100%;
}

.progress-bar-indeterminate .progress-bar-fill {
  width: 30% !important;
  animation: indeterminate 1.5s infinite var(--ease-out);
}

/* ----------------------------------------------------------
   27. ACTION BAR
   ---------------------------------------------------------- */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.action-bar-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.action-bar-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.action-bar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ----------------------------------------------------------
   28. STEP INDICATOR
   ---------------------------------------------------------- */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
}

.step {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  flex: 1;
}

.step:not(:last-child)::after {
  content: '';
  flex: 1;
  height: 2px;
  background: var(--border-subtle);
  margin: 0 12px;
}

.step:not(:last-child).completed::after {
  background: var(--accent-blue);
}

.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  background: var(--bg-glass);
  color: var(--text-muted);
  border: 2px solid var(--border-subtle);
  flex-shrink: 0;
  transition: all var(--duration-normal) var(--ease-out);
}

.step.active .step-number {
  background: var(--accent-blue-glow);
  color: var(--accent-blue);
  border-color: var(--accent-blue);
}

.step.completed .step-number {
  background: var(--accent-blue);
  color: #fff;
  border-color: var(--accent-blue);
}

.step-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

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

.step.completed .step-label {
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   29. ACCORDION
   ---------------------------------------------------------- */
.accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.accordion-item {
  border-bottom: 1px solid var(--border-subtle);
}

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

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
  user-select: none;
}

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

.accordion-chevron {
  font-size: 12px;
  color: var(--text-muted);
  transition: transform var(--duration-normal) var(--ease-out);
}

.accordion-item.open .accordion-chevron {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration-slow) var(--ease-out);
}

.accordion-item.open .accordion-body {
  max-height: 500px;
}

.accordion-body-inner {
  padding: 0 18px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ----------------------------------------------------------
   30. COPY BUTTON
   ---------------------------------------------------------- */
.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
}

.copy-btn:hover {
  background: var(--bg-glass);
  color: var(--text-secondary);
}

.copy-btn.copied {
  color: var(--accent-green);
}

/* ----------------------------------------------------------
   31. DANGER ZONE
   ---------------------------------------------------------- */
.danger-zone {
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 22px;
  background: rgba(239, 68, 68, 0.04);
}

.danger-zone-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.danger-zone-icon {
  font-size: 18px;
  color: var(--accent-red);
}

.danger-zone-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--accent-red);
}

.danger-zone-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* ----------------------------------------------------------
   32. KEYFRAME ANIMATIONS
   ---------------------------------------------------------- */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideRight {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

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

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%      { transform: translateX(-4px); }
  40%      { transform: translateX(4px); }
  60%      { transform: translateX(-3px); }
  80%      { transform: translateX(3px); }
}

@keyframes indeterminate {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(400%);
  }
}

/* Page enter transition */
.page-enter {
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

/* ----------------------------------------------------------
   33. RESPONSIVE DESIGN
   ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .stats-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .project-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .steps {
    flex-wrap: wrap;
    gap: 8px;
  }

  .step:not(:last-child)::after {
    display: none;
  }
}

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

  #sidebar,
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
  }

  #sidebar.open,
  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  #main-content {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: flex;
  }

  #page-content {
    padding: 20px 16px;
  }

  #top-bar,
  .top-bar {
    padding: 0 16px 0 56px;
  }

  .stats-row {
    grid-template-columns: 1fr 1fr;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .action-bar {
    flex-direction: column;
    align-items: flex-start;
  }

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

  .modal {
    width: 95%;
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }

  .kv-row {
    flex-wrap: wrap;
  }

  .kv-row .form-input:first-child {
    max-width: none;
  }

  .data-table thead th,
  .data-table tbody td {
    padding: 10px 12px;
    font-size: 12px;
  }
}

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

  .stat-value {
    font-size: 1.6rem;
  }

  .action-bar-title {
    font-size: 18px;
  }

  .tabs {
    gap: 0;
  }

  .tab {
    padding: 10px 12px;
    font-size: 12px;
  }

  .toast {
    min-width: unset;
    max-width: calc(100vw - 40px);
  }

  #toast-container,
  .toast-container {
    left: 20px;
    right: 20px;
  }

  .breadcrumb {
    font-size: 12px;
  }

  .log-viewer-body {
    max-height: 300px;
  }

  .log-line {
    padding: 1px 10px;
  }

  .log-line-number {
    min-width: 28px;
    margin-right: 10px;
  }

  .log-line-timestamp {
    display: none;
  }
}

/* ----------------------------------------------------------
   34. UTILITY CLASSES
   ---------------------------------------------------------- */

/* Text alignment */
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-left    { text-align: left; }

/* Margin top */
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

/* Margin bottom */
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

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

/* Flex */
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.flex-wrap       { flex-wrap: wrap; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.flex-1          { flex: 1; }

/* Visibility */
.hidden  { display: none !important; }
.visible { display: block; }

/* Truncate */
.truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Monospace */
.mono {
  font-family: var(--font-mono);
  font-size: 12.5px;
}

/* Gradient text */
.gradient-text {
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Full width */
.w-full { width: 100%; }

/* Relative positioning */
.relative { position: relative; }

/* No select */
.no-select { user-select: none; }

/* Cursor helpers */
.cursor-pointer { cursor: pointer; }

/* Opacity */
.opacity-50 { opacity: 0.5; }
.opacity-70 { opacity: 0.7; }

/* Separator */
.separator {
  height: 1px;
  background: var(--border-subtle);
  margin: 16px 0;
}

/* Inline code */
.inline-code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 7px;
  background: var(--bg-glass-heavy);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-blue);
}

/* Color helpers */
.text-green  { color: var(--accent-green); }
.text-red    { color: var(--accent-red); }
.text-amber  { color: var(--accent-amber); }
.text-blue   { color: var(--accent-blue); }
.text-purple { color: var(--accent-purple); }
.text-muted  { color: var(--text-muted); }

/* ----------------------------------------------------------
   35. SIDEBAR OVERLAY (Mobile)
   ---------------------------------------------------------- */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--z-sidebar) - 1);
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) var(--ease-out);
}

.sidebar-overlay.active {
  opacity: 1;
  visibility: visible;
}

/* ----------------------------------------------------------
   36. FOCUS & ACCESSIBILITY
   ---------------------------------------------------------- */
:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
  outline: none;
}

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

/* ----------------------------------------------------------
   37. PRINT STYLES
   ---------------------------------------------------------- */
@media print {
  #sidebar,
  .sidebar,
  #top-bar,
  .top-bar,
  #toast-container,
  .toast-container,
  #modal-overlay,
  .sidebar-toggle {
    display: none !important;
  }

  #app {
    grid-template-columns: 1fr;
  }

  body {
    background: #fff;
    color: #000;
  }

  .card {
    border: 1px solid #ddd;
    box-shadow: none;
    backdrop-filter: none;
  }
}

/* ----------------------------------------------------------
   38. MOBILE RESPONSIVE DESIGN
   ---------------------------------------------------------- */

/* ── Tablet (≤1024px) ── */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }

  .page-container { padding: 20px; }
  .stats-grid     { grid-template-columns: repeat(2, 1fr); }
  .projects-grid,
  .project-grid   { grid-template-columns: repeat(2, 1fr); }
}

/* ── Mobile (≤768px) ── */
@media (max-width: 768px) {
  :root {
    --sidebar-width: 280px;
    --topbar-height: 56px;
  }

  /* Layout: full-width, sidebar off-screen */
  #app {
    grid-template-columns: 1fr;
  }

  #sidebar,
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    z-index: var(--z-sidebar);
    box-shadow: var(--shadow-lg);
    transition: transform var(--duration-slow) var(--ease-out);
  }

  #sidebar.open,
  .sidebar.open {
    transform: translateX(0);
  }

  /* Hamburger visible on mobile */
  .sidebar-toggle {
    display: flex !important;
  }

  /* Top bar */
  .top-bar {
    height: var(--topbar-height);
    padding: 0 14px 0 60px;
  }

  /* Page */
  .page-container {
    padding: 14px;
    padding-bottom: 80px;
  }

  /* Page header: stack vertically */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .page-header-actions {
    width: 100%;
    flex-wrap: wrap;
    gap: 8px;
  }

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

  /* Stats */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card   { padding: 14px 12px; }
  .stat-value  { font-size: 26px; }

  /* Projects grid */
  .projects-grid,
  .project-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Tabs: horizontal scroll */
  .tabs,
  .config-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    gap: 4px;
    padding-bottom: 4px;
    scrollbar-width: none;
  }

  .tabs::-webkit-scrollbar,
  .config-tabs::-webkit-scrollbar { display: none; }

  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
  }

  /* Cards */
  .card { padding: 14px; }

  /* Tables: scroll horizontally */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Form grids collapse */
  .form-row,
  .form-grid {
    grid-template-columns: 1fr !important;
  }

  /* Button groups */
  .btn-group {
    flex-direction: column;
    width: 100%;
  }

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

  /* Modals: bottom sheet */
  .modal {
    padding: 20px 16px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
    position: fixed;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    max-height: 92vh;
    overflow-y: auto;
    max-width: 100% !important;
    transform: translateY(0) !important;
    margin: 0 !important;
  }

  /* Toast: bottom full-width */
  #toast-container {
    left: 10px;
    right: 10px;
    bottom: 10px;
    top: auto;
    align-items: stretch;
  }

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

  /* Log viewer */
  .log-viewer {
    font-size: 11px;
    padding: 10px;
    min-height: 180px;
    max-height: 50vh;
  }

  /* Hide connection text */
  .connection-text { display: none; }

  /* Breadcrumb */
  .breadcrumb { font-size: 12px; }

  /* Deployment rows */
  .deployment-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .deployment-meta { flex-wrap: wrap; }

  /* Analytics grid */
  .analytics-grid { grid-template-columns: 1fr; }

  /* Utility: hide / full-width */
  .hide-mobile  { display: none !important; }
  .full-mobile  { width: 100% !important; }
}

/* ── Small Mobile (≤480px) ── */
@media (max-width: 480px) {
  body { font-size: 13px; }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .stat-card   { padding: 12px 10px; }
  .stat-value  { font-size: 22px; }
  .stat-label  { font-size: 10px; }

  .card            { padding: 12px; }
  .page-container  { padding: 10px; }

  .btn {
    padding: 8px 14px;
    font-size: 12px;
  }

  .page-title    { font-size: 20px; }
  .section-title { font-size: 14px; }

  h1 { font-size: 20px; }
  h2 { font-size: 17px; }
  h3 { font-size: 15px; }
}

/* ── Mobile sidebar overlay (tap-outside to close) ── */
.mobile-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: calc(var(--z-sidebar) - 1);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: fadeInOverlay 200ms var(--ease-out);
}

.mobile-overlay.visible { display: block; }

/* ── Toast progress bar ── */
.toast-body {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast-progress {
  height: 3px;
  background: rgba(255,255,255,0.12);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}

.toast-progress-bar {
  height: 100%;
  background: currentColor;
  opacity: 0.5;
  border-radius: 2px;
  animation: toastProgressShrink linear forwards;
  transform-origin: left;
}

@keyframes toastProgressShrink {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   17. AUTHENTICATION & LOGIN SCREEN STYLES
   ============================================================ */

/* Enforce conditional layout based on authentication state */
body.authenticated #sidebar {
  display: flex;
}
body.authenticated #top-bar {
  display: flex;
}
body.authenticated #app {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
}

body:not(.authenticated) #sidebar {
  display: none;
}
body:not(.authenticated) #top-bar {
  display: none;
}
body:not(.authenticated) #app {
  display: block;
}

/* Glassmorphic Login Wrapper */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background: radial-gradient(circle at top right, rgba(139, 92, 246, 0.08), transparent 40%),
              radial-gradient(circle at bottom left, rgba(59, 130, 246, 0.08), transparent 40%),
              var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 40px;
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--shadow-lg), 0 0 40px rgba(59, 130, 246, 0.03);
  animation: fadeIn var(--duration-normal) var(--ease-out);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 16px;
  box-shadow: var(--shadow-glow-blue);
}

.login-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--text-secondary));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.4;
}

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

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

.form-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.2px;
}

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

.input-icon {
  position: absolute;
  left: 14px;
  font-size: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.form-control {
  width: 100%;
  height: 44px;
  padding: 10px 16px 10px 42px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 13.5px;
  color: var(--text-primary);
  transition: all var(--duration-fast) var(--ease-out);
}

.form-control:focus {
  outline: none;
  border-color: var(--accent-blue);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--accent-blue-ring);
}

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

.login-error-container {
  display: none;
  font-size: 13px;
  color: var(--accent-red);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  line-height: 1.4;
}

.login-error-container.visible {
  display: block;
  animation: shake 0.4s ease-in-out;
}

.btn-block {
  width: 100%;
}

.login-btn {
  height: 44px;
  font-size: 14.5px;
  font-weight: 600;
  margin-top: 10px;
}

.btn-spinner {
  margin-left: 8px;
  display: inline-block;
  animation: spin 1s linear infinite;
}

.hidden {
  display: none !important;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

/* ----------------------------------------------------------
   39. ADDITIONAL RESPONSIVE MOBILE / GRID FIXES
   ---------------------------------------------------------- */

/* Project card styles */
.project-card {
  background: var(--bg-card);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-top-color: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all var(--duration-normal) var(--ease-spring);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.project-card:hover {
  transform: translateY(-4px) scale(1.01);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3), 0 0 15px rgba(59, 130, 246, 0.1);
  background: var(--bg-card-hover);
  border-color: rgba(59, 130, 246, 0.3);
}

.project-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-card-name {
  font-size: 15.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 8px;
}

.project-card-commit-box {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin: 4px 0;
  font-size: 12px;
  word-break: break-all;
}

.project-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  flex-wrap: wrap;
}

/* Settings responsive grid style */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  align-items: start;
  margin-bottom: 24px;
}

.settings-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.settings-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* Key-value Editor Custom wrapper positioning */
.kv-value-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
}

.kv-value-wrapper .form-input {
  padding-right: 38px;
}

.kv-value-wrapper .kv-value-toggle {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  z-index: 2;
  transition: color var(--duration-fast);
}

.kv-value-wrapper .kv-value-toggle:hover {
  color: var(--text-secondary);
  background: transparent;
}

.kv-delete {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 14px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
}

.kv-delete:hover {
  background: var(--accent-red-glow);
  color: var(--accent-red);
}

/* Project type option selections grid inside New Project modal */
.project-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 6px;
}

.project-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 8px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  text-align: center;
  gap: 4px;
}

.project-type-option:hover {
  background: var(--bg-glass);
  border-color: var(--border-active);
}

.project-type-option.selected {
  background: var(--accent-blue-glow);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.1);
}

.project-type-icon {
  font-size: 18px;
}

.project-type-name {
  font-size: 11px;
  font-weight: 500;
}

/* Project Detail overview page template grid */
.project-overview-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}

/* Doughnut Chart Alignment */
.doughnut-chart-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 1.5rem;
  flex-grow: 1;
}

/* Table styles fallback support */
table.data-table {
  width: 100%;
  border-collapse: collapse;
}

table.data-table thead th {
  padding: 12px 18px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

table.data-table tbody td {
  padding: 12px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

table.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.01);
}

/* Media queries for smaller viewports */
@media (max-width: 768px) {
  #app,
  body.authenticated #app {
    grid-template-columns: 1fr;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .settings-form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-overview-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .project-type-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Environment variable rows grid layout stacking for mobile */
  .kv-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 12px;
    background: rgba(255,255,255,0.015);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
  }
  
  .kv-row .kv-key {
    grid-column: 1 / 2;
    max-width: none !important;
  }
  
  .kv-row .kv-value-wrapper {
    grid-column: 1 / 2;
  }
  
  .kv-row .kv-delete {
    grid-column: 2 / 3;
    grid-row: 1 / 3;
    height: 100%;
    align-self: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: rgba(239, 68, 68, 0.03);
  }
}

@media (max-width: 480px) {
  .settings-info-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .doughnut-chart-wrapper {
    flex-direction: column;
    gap: 1.25rem;
    align-items: center;
  }

  .doughnut-legend {
    width: 100%;
    grid-template-columns: repeat(2, 1fr);
  }
  
  .project-card {
    padding: 16px;
  }

  .login-card {
    padding: 24px 16px;
  }
}
