:root {
  --bg-dark: #0f172a;
  --bg-surface: #1e293b;
  --bg-card: #1e293b;
  --bg-card-hover: #334155;
  --bg-input: #0f172a;
  --border-color: #334155;
  --border-accent: rgba(255, 255, 255, 0.1);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.15);
  
  --accent: #f59e0b;
  --accent-light: rgba(245, 158, 11, 0.15);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.15);
  --warning: #f59e0b;
  --info: #0ea5e9;
  --danger: #ef4444;

  --sidebar-width: 300px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
  
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -1px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Layout */
.app-layout {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.brand {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.brand-text h2 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text span {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-actions {
  padding: 0.85rem 1rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-box {
  margin: 0.4rem 1rem;
  position: relative;
  display: flex;
  align-items: center;
}

.search-box i {
  position: absolute;
  left: 0.85rem;
  color: var(--text-dim);
  font-size: 0.85rem;
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.85rem 0.55rem 2.2rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.82rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.directory-header {
  padding: 0.65rem 1rem 0.4rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.directory-header button {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.directory-header button:hover {
  color: var(--danger);
  background-color: rgba(239, 68, 68, 0.1);
}

.employee-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.employee-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

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

.employee-item.active {
  background-color: var(--primary-light);
  border-color: rgba(99, 102, 241, 0.4);
}

.employee-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-full);
  object-fit: cover;
  background-color: var(--bg-dark);
  border: 2px solid var(--border-color);
  flex-shrink: 0;
}

.employee-item.active .employee-avatar {
  border-color: var(--primary);
}

.employee-meta {
  flex: 1;
  min-width: 0;
}

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

.employee-role {
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.employee-sub {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  margin-top: 2px;
}

.employee-id-tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.65rem;
  padding: 1px 5px;
  border-radius: 4px;
  background-color: var(--bg-dark);
  color: var(--accent);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background-color: var(--bg-dark);
  height: 100vh;
}

.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-state i {
  font-size: 4rem;
  color: var(--text-dim);
}

.empty-state h3 {
  font-size: 1.5rem;
  color: var(--text-main);
}

.profile-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: 100%;
}

/* Hero Header Fix */
.profile-hero {
  position: relative;
  padding: 1.5rem 2rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  overflow: hidden;
  background-color: var(--bg-surface);
  flex-shrink: 0;
}

.hero-cover-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-size: cover;
  background-position: center;
  filter: blur(25px) opacity(0.25);
  transform: scale(1.1);
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to bottom, rgba(15, 23, 42, 0.5), var(--bg-surface));
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.avatar-wrapper {
  position: relative;
  flex-shrink: 0;
}

.hero-avatar {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  border: 3px solid var(--bg-surface);
  box-shadow: var(--shadow-lg);
  background-color: var(--bg-dark);
}

.hero-status-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  background: var(--bg-surface);
  color: var(--success);
  font-size: 1rem;
  border-radius: var(--radius-full);
  line-height: 1;
}

.hero-info {
  flex: 1;
  min-width: 0;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-title-row h1 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-description {
  margin-top: 0.3rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  max-width: 700px;
}

.hero-meta-strip {
  display: flex;
  gap: 1.15rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.hero-meta-strip span {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.hero-meta-strip i {
  color: var(--primary);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.social-links {
  display: flex;
  gap: 0.4rem;
}

.social-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-accent);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  text-decoration: none;
  transition: var(--transition);
}

.social-btn:hover {
  background-color: var(--primary);
  color: white;
  transform: translateY(-2px);
}

/* Profile Tabs Bar */
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0 2rem;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  overflow-x: auto;
  flex-shrink: 0;
}

.tab-btn {
  padding: 0.75rem 1rem;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn:hover {
  color: var(--text-main);
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tab Content Container */
.tab-content-container {
  padding: 1.5rem 2rem 4rem;
  flex: 1;
}

.tab-pane {
  display: none;
}

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

/* Cards & Layouts */
.grid-layout {
  display: grid;
  gap: 1.25rem;
}

.grid-layout.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.grid-layout.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.col-span-2 {
  grid-column: span 2;
}

.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
}

.card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-main);
}

.card h3 i {
  color: var(--primary);
}

.card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.divider {
  height: 1px;
  background-color: var(--border-color);
  margin: 1rem 0;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.stat-box {
  background-color: var(--bg-dark);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  text-align: center;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* Tag Cloud */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  padding: 0.25rem 0.65rem;
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
}

.tag.accent {
  background-color: var(--accent-light);
  color: var(--accent);
  border-color: rgba(245, 158, 11, 0.3);
}

/* Consultation & Metadata Formatting Fix */
.consultation-box {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.consult-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: var(--bg-dark);
  border-radius: var(--radius-sm);
  gap: 0.5rem;
  word-break: break-all;
}

.consult-price {
  font-weight: 700;
  color: var(--success);
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
}

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

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

.tool-name {
  font-weight: 700;
  font-size: 0.88rem;
}

.tool-level-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--primary);
  font-family: 'JetBrains Mono', monospace;
}

.progress-bar-bg {
  height: 6px;
  background-color: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: var(--radius-full);
  transition: width 0.5s ease-in-out;
}

/* Buttons & Badges */
.btn {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
}

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

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background-color: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
}

.btn-glass {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(10px);
  color: var(--text-main);
  border: 1px solid var(--border-accent);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.15);
}

.badge {
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.badge-id {
  background-color: var(--accent-light);
  color: var(--accent);
  font-family: 'JetBrains Mono', monospace;
}

.badge-role {
  background-color: var(--primary-light);
  color: var(--primary);
}

/* Tasks Table */
.tasks-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.tasks-toolbar-right {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.select-input {
  padding: 0.45rem 0.75rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.8rem;
  outline: none;
  cursor: pointer;
}

.table-responsive {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.82rem;
}

.data-table th {
  background-color: var(--bg-dark);
  color: var(--text-muted);
  padding: 0.75rem 1rem;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-card);
}

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

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

.task-title {
  font-weight: 600;
  color: var(--text-main);
  display: block;
}

.task-desc-peek {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-status-pill {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-full);
  font-size: 0.68rem;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 1.5rem;
}

.modal-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 650px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

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

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
}

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

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

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  width: 100%;
  padding: 0.6rem 0.85rem;
  background-color: var(--bg-dark);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
}

.form-control:focus {
  border-color: var(--primary);
}

textarea.form-control {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  resize: vertical;
}

.alert-danger {
  padding: 0.75rem 1rem;
  background-color: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

.hidden {
  display: none !important;
}

/* Responsive Media Queries */
@media (max-width: 1024px) {
  .grid-layout.cols-2, .grid-layout.cols-3 {
    grid-template-columns: 1fr;
  }
  .col-span-2 {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    max-height: 250px;
  }
  .profile-hero {
    padding: 1.25rem;
  }
  .hero-content {
    flex-direction: column;
    align-items: flex-start;
  }
  .hero-actions {
    align-items: flex-start;
    flex-direction: row;
  }
}
