:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(18, 26, 47, 0.4);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --primary: #06b6d4; /* cyan */
  --primary-glow: rgba(6, 182, 212, 0.35);
  --accent: #8b5cf6; /* violet */
  --accent-glow: rgba(139, 92, 246, 0.35);
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Background effects */
.glass-bg {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(circle at 50% 120%, #151e36 0%, #0b0f19 80%);
  z-index: -2;
}

.glow-orb {
  position: fixed;
  width: 40vw;
  height: 40vw;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.25;
}

#orb1 {
  background: var(--primary);
  top: -10vw;
  right: -5vw;
}

#orb2 {
  background: var(--accent);
  bottom: -15vw;
  left: -5vw;
}

/* App structure */
.app-layout {
  display: flex;
  width: 95%;
  max-width: 1400px;
  min-height: 85vh;
  gap: 25px;
  margin: 40px 0;
  z-index: 1;
}

.app-sidebar {
  width: 280px;
  background: rgba(10, 15, 30, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 30px 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
}

.app-container {
  flex: 1;
  min-height: 85vh;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--panel-border);
  border-radius: 24px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
}

/* Sidebar Navigation */
.space-nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 25px;
  flex: 1;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid transparent;
  color: var(--text-muted);
  padding: 14px 20px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  gap: 15px;
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-align: left;
  width: 100%;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.05);
  transform: translateX(4px);
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border-color: rgba(6, 182, 212, 0.3);
  color: var(--text-main);
  box-shadow: 0 8px 20px -6px var(--primary-glow);
}

.nav-icon {
  font-size: 1.2rem;
}

.brand-text h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-ver {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--panel-border);
  margin-top: 25px;
  margin-bottom: 5px;
}

.avatar {
  background: rgba(255, 255, 255, 0.05);
  padding: 8px;
  border-radius: 50%;
  border: 1px solid var(--panel-border);
}

.username {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 25px;
  margin-bottom: 30px;
}

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

.logo-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.05);
  padding: 10px;
  border-radius: 16px;
  border: 1px solid var(--panel-border);
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, var(--text-main), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.system-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  padding: 8px 16px;
  border-radius: 30px;
  border: 1px solid var(--panel-border);
  font-size: 0.85rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  box-shadow: 0 0 10px currentColor;
}

.status-dot.green {
  color: var(--success);
  background-color: var(--success);
}

/* Grid Layout */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 30px;
  flex: 1;
}

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

.full-panel {
  grid-column: 1 / -1;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 30px;
}

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

.panel-header h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
}

.counter {
  background: rgba(255, 255, 255, 0.05);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  border: 1px solid var(--panel-border);
}

/* Policy Panel */
.overview-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 25px;
}

.policy-principles {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.principle-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  padding: 16px;
  border-radius: 14px;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.principle-card:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.2);
}

.principle-card h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
  color: var(--primary);
}

.principle-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Catalog Panel */
.catalog-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 25px;
}

.server-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Server Card */
.server-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.server-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--text-muted);
  transition: background 0.3s ease;
}

.server-card.active-server::before {
  background: var(--primary);
}

.server-card:hover {
  box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.3);
  border-color: rgba(255, 255, 255, 0.15);
}

.server-info {
  flex: 1;
  padding-right: 20px;
}

.server-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.server-title h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.1rem;
  font-weight: 700;
}

.server-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 15px;
  line-height: 1.4;
}

/* Badges */
.security-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 8px;
  font-weight: 600;
  border: 1px solid transparent;
}

.badge.net-restricted {
  background: rgba(245, 158, 11, 0.1);
  color: var(--warning);
  border-color: rgba(245, 158, 11, 0.2);
}

.badge.net-none {
  background: rgba(16, 185, 129, 0.1);
  color: var(--success);
  border-color: rgba(16, 185, 129, 0.2);
}

.badge.mount {
  background: rgba(6, 182, 212, 0.1);
  color: var(--primary);
  border-color: rgba(6, 182, 212, 0.2);
}

.badge.sandbox {
  background: rgba(139, 92, 246, 0.1);
  color: var(--accent);
  border-color: rgba(139, 92, 246, 0.2);
}

/* Projects Space */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.project-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 24px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 200px;
  position: relative;
  overflow: hidden;
}

.project-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.project-card:hover {
  transform: translateY(-5px);
  border-color: rgba(6, 182, 212, 0.3);
  box-shadow: 0 15px 30px -10px rgba(6, 182, 212, 0.15);
}

.project-card:hover::before {
  opacity: 1;
}

.project-card h3 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-main);
}

.project-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex: 1;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 15px;
  margin-top: auto;
}

.project-path {
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.2);
  padding: 4px 8px;
  border-radius: 6px;
  max-width: 60%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* World Clocks */
.clocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 25px;
  margin-top: 20px;
}

.clock-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 25px;
  text-align: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.clock-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 50%, rgba(6, 182, 212, 0.03) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.clock-card:hover {
  transform: scale(1.02);
  border-color: rgba(6, 182, 212, 0.25);
  box-shadow: 0 12px 25px -10px var(--primary-glow);
}

.clock-card:hover::before {
  opacity: 1;
}

.clock-card h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.time-display {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-main);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.1);
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}

.clock-card:hover .time-display {
  color: var(--primary);
  text-shadow: 0 0 20px var(--primary-glow);
}

.date-display {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.offset-display {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--primary);
  background: rgba(6, 182, 212, 0.15);
  padding: 4px 10px;
  border-radius: 8px;
}

/* World Clock Emoji Styling */
.clock-emoji-wrapper {
  margin: 15px auto;
  font-size: 4.5rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  filter: drop-shadow(0 0 10px rgba(6, 182, 212, 0.25));
}

.clock-emoji-wrapper.hidden {
  display: none;
}

/* ToDo Widget */
.todo-widget {
  max-width: 650px;
  margin: 20px auto 0 auto;
}

.todo-form {
  display: flex;
  gap: 12px;
  margin-bottom: 25px;
}

#todo-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  padding: 14px 20px;
  border-radius: 14px;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  font-size: 0.95rem;
  outline: none;
  transition: all 0.3s ease;
}

#todo-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: 14px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 15px -4px var(--primary-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 20px -4px var(--primary-glow);
}

.todo-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.todo-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  transition: all 0.3s ease;
}

.todo-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.todo-item.completed {
  opacity: 0.6;
}

.todo-item.completed .todo-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.todo-left {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.todo-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--panel-border);
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.todo-checkbox:checked {
  background: var(--success);
  border-color: var(--success);
}

.todo-checkbox:checked::after {
  content: '✓';
  position: absolute;
  color: white;
  font-size: 14px;
  font-weight: bold;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.todo-text {
  font-size: 0.95rem;
  color: var(--text-main);
  word-break: break-word;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 1px solid rgba(239, 68, 68, 0.2);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

/* Switch styling */
.switch-container {
  display: flex;
  align-items: center;
  height: 100%;
  padding-top: 5px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.1);
  transition: .3s;
  border-radius: 34px;
  border: 1px solid var(--panel-border);
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: var(--text-main);
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--primary);
  box-shadow: 0 0 10px var(--primary-glow);
}

input:focus + .slider {
  box-shadow: 0 0 1px var(--primary);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Spinner */
.loading-spinner {
  text-align: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .app-layout {
    flex-direction: column;
    width: 95%;
    margin: 20px 0;
  }
  
  .app-sidebar {
    width: 100%;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 20px 25px;
  }
  
  .space-nav {
    flex-direction: row;
    margin-top: 0;
    gap: 10px;
  }
  
  .user-profile {
    margin-top: 0;
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
  }
  
  .app-container {
    width: 100%;
    padding: 30px 20px;
  }
}

@media (max-width: 650px) {
  .app-sidebar {
    flex-direction: column;
    gap: 20px;
    align-items: stretch;
  }
  
  .space-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .user-profile {
    justify-content: center;
    border-top: 1px solid var(--panel-border);
    border-bottom: none;
    padding-top: 15px;
    padding-bottom: 0;
    margin-top: 0;
    margin-bottom: 0;
  }
  
  .todo-form {
    flex-direction: column;
  }
}

/* Footer */
.app-footer {
  margin-top: 30px;
  border-top: 1px solid var(--panel-border);
  padding-top: 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Logout Button */
.logout-btn {
  background: transparent;
  border: 1px solid rgba(255, 75, 75, 0.2);
  color: #ff4b4b;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

.logout-btn:hover {
  background: rgba(255, 75, 75, 0.1);
  border-color: rgba(255, 75, 75, 0.4);
}

/* Project card clickability */
.project-card {
  cursor: pointer;
}

/* File explorer */
.file-explorer-container {
  max-height: 500px;
  overflow-y: auto;
  padding: 10px 5px;
}

.file-node {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: all 0.2s ease;
  user-select: none;
}

.file-node:hover {
  background: rgba(255, 255, 255, 0.05);
}

.file-node.folder-node {
  font-weight: 600;
  color: var(--text-main);
}

.file-node.file-node-item {
  color: var(--text-muted);
}

.file-node.file-node-item:hover {
  color: var(--text-main);
}

.folder-toggle {
  font-size: 0.75rem;
  color: var(--text-muted);
  width: 12px;
  text-align: center;
  transition: transform 0.2s ease;
}

.folder-toggle.open {
  transform: rotate(90deg);
}

.file-icon {
  font-size: 1.1rem;
}

.folder-children {
  margin-left: 12px;
  border-left: 1px dashed rgba(255, 255, 255, 0.08);
  padding-left: 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Console Command Buttons */
.console-cmd-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.console-cmd-btn:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 0 10px var(--primary-glow);
}

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

/* Clone Button */
.btn-clone {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  margin-top: 15px;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.2);
}

.btn-clone:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

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

/* Tab Buttons inside Terminal Card */
.ws-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  padding: 6px 16px;
  border-radius: 8px;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.ws-tab-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.03);
}

.ws-tab-btn.active {
  color: var(--primary);
  background: rgba(6, 182, 212, 0.08);
  border-color: rgba(6, 182, 212, 0.2);
}

/* Chat Messages */
.chat-messages-container {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.chat-message {
  padding: 12px 16px;
  border-radius: 14px;
  max-width: 85%;
  line-height: 1.5;
  font-size: 0.9rem;
}

.chat-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  border: 1px solid rgba(6, 182, 212, 0.25);
  color: var(--text-main);
}

.chat-message.agent {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  color: #a7f3d0; /* emerald 200 */
}

.message-sender {
  font-weight: 700;
  display: block;
  margin-bottom: 4px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chat-message.user .message-sender {
  color: var(--accent);
  text-align: right;
}

.chat-message.agent .message-sender {
  color: var(--primary);
}

.message-text {
  margin: 0;
  white-space: pre-wrap;
}

/* Typing Indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 5px 10px;
}

.typing-indicator span {
  width: 6px;
  height: 6px;
  background-color: var(--primary);
  border-radius: 50%;
  display: inline-block;
  animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes bounce {
  0%, 80%, 100% { 
    transform: scale(0);
  } 40% { 
    transform: scale(1.0);
  }
}

/* Project Search Bar */
.search-container {
  position: relative;
  width: 280px;
}

#project-search {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  padding: 10px 16px;
  border-radius: 12px;
  color: var(--text-main);
  font-family: 'Outfit', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.3s ease;
}

#project-search:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

.console-git-action-btn:hover {
  filter: brightness(1.2);
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.console-git-action-btn:active {
  transform: scale(0.95);
}

/* Context Menu */
.context-menu ul li {
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s ease;
}

.context-menu ul li:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

.context-menu ul li.danger:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

/* Modal Overlay & Card animations */
.modal-overlay {
  display: none;
  animation: fadeIn 0.25s ease-out forwards;
}

.modal-card {
  animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

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

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

/* Custom Markdown Rendering inside preview pane */
#editor-preview-container h1, 
#editor-preview-container h2, 
#editor-preview-container h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--primary);
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

#editor-preview-container h1 { font-size: 1.4rem; }
#editor-preview-container h2 { font-size: 1.2rem; }
#editor-preview-container h3 { font-size: 1.1rem; }

#editor-preview-container p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: rgba(255,255,255,0.85);
}

#editor-preview-container code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #f472b6; /* pink 400 */
}

#editor-preview-container pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

#editor-preview-container pre code {
  background: transparent;
  padding: 0;
  color: #a7f3d0;
  font-size: 0.85rem;
}

#editor-preview-container li {
  margin-left: 20px;
  margin-bottom: 0.5rem;
  color: rgba(255,255,255,0.85);
}

/* Monaco Editor dynamic spaces and tabs */
.nav-section-title {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--text-muted);
}

.file-tab-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  padding-right: 12px;
}

.file-tab-btn .close-tab-btn {
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: all 0.2s ease;
  width: 20px;
  height: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  margin-left: 5px;
}

.file-tab-btn .close-tab-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.monaco-editor-workspace {
  grid-column: 1 / -1;
  display: flex;
  gap: 20px;
  height: 100%;
  min-height: 0;
}

.monaco-editor-container {
  flex: 1;
  background: rgba(5, 8, 16, 0.5);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow: hidden;
  height: 100%;
  min-height: 450px;
}

.monaco-preview-container {
  flex: 1;
  background: rgba(5, 8, 16, 0.3);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  padding: 25px;
  overflow-y: auto;
  color: var(--text-main);
  line-height: 1.6;
  font-size: 0.95rem;
  scrollbar-width: thin;
  height: 100%;
  min-height: 450px;
}

/* Rendered markdown formatting for Monaco Preview */
.monaco-preview-container h1,
.monaco-preview-container h2,
.monaco-preview-container h3 {
  font-family: 'Space Grotesk', sans-serif;
  color: var(--primary);
  margin-top: 1.2rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 4px;
}

.monaco-preview-container h1 { font-size: 1.45rem; }
.monaco-preview-container h2 { font-size: 1.25rem; }
.monaco-preview-container h3 { font-size: 1.15rem; }

.monaco-preview-container p {
  margin-bottom: 1rem;
  color: rgba(255,255,255,0.85);
}

.monaco-preview-container code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 5px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  color: #f472b6;
}

.monaco-preview-container pre {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1rem;
}

.monaco-preview-container pre code {
  background: transparent;
  padding: 0;
  color: #a7f3d0;
  font-size: 0.85rem;
}

.monaco-preview-container li {
  margin-left: 20px;
  margin-bottom: 0.5rem;
  color: rgba(255,255,255,0.85);
}

/* Admin Permissions Board Styles */
.admin-table th, .admin-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

.admin-table tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-table .badge {
  display: inline-block;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: #c084fc;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-right: 4px;
  margin-bottom: 4px;
}

.admin-table .badge.admin-badge {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.matrix-table th, .matrix-table td {
  padding: 12px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}

.matrix-table th:first-child, .matrix-table td:first-child {
  text-align: left;
  font-weight: 600;
  color: var(--text-main);
}

/* Custom checkbox wrapper for modal and grid */
.permission-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-main);
}

.permission-checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* ==========================================
   MULTI-SPACE PANEL LAYOUT & RESIZING STYLES
   ========================================== */

.app-layout.multi-space-active {
  width: 98vw;
  max-width: none;
  margin: 15px auto;
  height: calc(100vh - 30px);
  min-height: 0;
}

.app-layout.multi-space-active .app-sidebar {
  height: 100%;
  overflow-y: auto;
}

.app-layout.multi-space-active .app-container {
  padding: 20px;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#spaces-wrapper {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 0;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}

.space-resize-handle {
  width: 10px;
  background: rgba(255, 255, 255, 0.02);
  border-left: 1px solid var(--panel-border);
  border-right: 1px solid var(--panel-border);
  cursor: col-resize;
  transition: all 0.2s ease;
  position: relative;
  flex: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  user-select: none;
}

.space-resize-handle:hover,
.space-resize-handle.dragging {
  background: linear-gradient(to bottom, var(--primary), var(--accent));
  border-color: rgba(6, 182, 212, 0.5);
  box-shadow: 0 0 8px var(--primary-glow);
}

.space-resize-handle::after {
  content: '⋮';
  color: var(--text-muted);
  font-size: 14px;
  font-weight: bold;
  pointer-events: none;
}

.space-resize-handle:hover::after,
.space-resize-handle.dragging::after {
  color: white;
}

body.dragging-space-handle {
  cursor: col-resize !important;
  user-select: none;
}

.space-panel-header {
  display: none;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--panel-border);
  border-radius: 12px 12px 0 0;
  margin-bottom: 15px;
  flex-shrink: 0;
}

.app-layout.multi-space-active .space-panel-header {
  display: flex;
}

.space-panel-title {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.space-panel-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
}

.space-panel-close-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.app-layout.multi-space-active .dashboard-grid {
  display: none;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
  background: rgba(10, 15, 30, 0.35);
  border: 1px solid var(--panel-border);
  border-radius: 20px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 280px;
  height: 100%;
  flex: 1 1 0%;
  grid-template-columns: 1fr !important;
}

.app-layout.multi-space-active .dashboard-grid.active {
  display: flex;
}

/* Panel Scrollbars */
.app-layout.multi-space-active .dashboard-grid::-webkit-scrollbar {
  width: 6px;
}
.app-layout.multi-space-active .dashboard-grid::-webkit-scrollbar-track {
  background: transparent;
}
.app-layout.multi-space-active .dashboard-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
}
.app-layout.multi-space-active .dashboard-grid::-webkit-scrollbar-thumb:hover {
  background: rgba(6, 182, 212, 0.3);
}

.app-layout.multi-space-active .dashboard-grid > section {
  width: 100% !important;
  grid-column: 1 / -1 !important;
  margin-bottom: 0;
}

.app-layout.multi-space-active #space-content-network {
  height: 100% !important;
}

.app-layout.multi-space-active #space-content-permissions {
  grid-template-columns: 1fr !important;
}

/* Global chat layout tweaks */
.chat-container-global {
  display: flex;
  flex-direction: column;
}

#global-chat-log {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

#global-chat-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
  background: rgba(0, 0, 0, 0.4);
}

