:root,
[data-theme='dark'] {
  --bg-base: #0a0e1a;
  --bg-surface: #111827;
  --bg-surface-hover: #1f2937;
  --bg-surface-active: #374151;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --accent-primary: #818cf8;
  --accent-primary-hover: #6366f1;
  --accent-danger: #f87171;
  --accent-danger-hover: #ef4444;
  --accent-success: #34d399;
  --border-color: rgba(255, 255, 255, 0.06);
  --sidebar-width: 260px;
  --sidebar-collapsed-width: 64px;
}

[data-theme='light'] {
  --bg-base: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-hover: #f1f5f9;
  --bg-surface-active: #e2e8f0;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-primary: #6366f1;
  --accent-primary-hover: #4f46e5;
  --accent-danger: #ef4444;
  --accent-danger-hover: #dc2626;
  --accent-success: #10b981;
  --border-color: rgba(0, 0, 0, 0.08);
}

.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  padding: 1.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
  transition: width 0.3s ease;
}

.sidebar.collapsed {
  width: var(--sidebar-collapsed-width);
  padding: 1.75rem 0.5rem;
}
.sidebar.collapsed .nav-item {
  justify-content: center;
  padding: 0.65rem;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  transition: justify-content 0.3s ease;
}
.sidebar.collapsed .sidebar-top {
  justify-content: center;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.4rem;
  border-radius: 8px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}
.btn-icon:hover {
  color: var(--text-primary);
  background: var(--bg-surface-hover);
}

.collapse-btn svg {
  transition: transform 0.3s ease;
}
.sidebar.collapsed .collapse-btn svg {
  transform: rotate(180deg);
}

.sidebar .logo-area h2 {
  font-size: 1.15rem;
  background: linear-gradient(135deg, var(--accent-primary), #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.sidebar .logo-area p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0;
}

.sidebar-bottom {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-top: 2rem;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.15s ease;
}
.nav-item:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(129, 140, 248, 0.12), rgba(99, 102, 241, 0.06));
  color: var(--accent-primary);
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  transition:
    margin-left 0.3s ease,
    width 0.3s ease;
}
.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed-width);
  width: calc(100% - var(--sidebar-collapsed-width));
}

.page-container {
  padding: 2.5rem 3rem;
  max-width: 1100px;
  width: 100%;
  flex: 1;
}

.app-header {
  padding: 1.25rem 3rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-footer {
  padding: 1.5rem 3rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: auto;
}
.footer-links {
  display: flex;
  gap: 1.5rem;
}
.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
}
.footer-links a:hover {
  color: var(--text-primary);
}
.workspace-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.75rem;
  margin-bottom: 1.5rem;
}
.card-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}
.card-header h2 {
  margin-bottom: 0.25rem;
}
.card-header p {
  font-size: 0.85rem;
  margin-bottom: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  white-space: nowrap;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #6366f1);
  color: white;
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.1);
}
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background: var(--bg-surface-hover);
  color: var(--text-primary);
}

.btn-icon-only {
  justify-content: center;
  padding: 0.65rem;
}
.btn-icon-only span {
  display: none;
}
.btn-icon-only svg {
  flex-shrink: 0;
}

.btn-danger {
  background: transparent;
  color: var(--accent-danger);
  border: 1px solid rgba(248, 113, 113, 0.3);
}
.btn-danger:hover:not(:disabled) {
  background: var(--accent-danger);
  border-color: var(--accent-danger);
  color: white;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.25rem;
}
.info-item {
  padding: 0.75rem 0;
}
.info-value {
  font-size: 0.95rem;
  color: var(--text-primary);
  word-break: break-word;
}
.form-group {
  margin-bottom: 1.35rem;
}
.form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 0.45rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.form-input {
  width: 100%;
  padding: 0.7rem 0.9rem;
  background: var(--bg-base);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.92rem;
}
.form-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}
.form-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.avatar-placeholder {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-surface-hover);
  flex-shrink: 0;
}
.avatar-sm {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}
.avatar-lg {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-color);
}
.text-sm {
  font-size: 0.85rem;
}
.text-muted {
  color: var(--text-muted);
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mt-8 {
  margin-top: 2rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.w-full {
  width: 100%;
}

.loader {
  border: 3px solid var(--bg-surface-hover);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface-hover) 25%, var(--bg-surface-active) 50%, var(--bg-surface-hover) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}
