/* === LAYOUT — sidebar.md, layout.md, content.md === */

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background: var(--bg-page);
  color: var(--body);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.7;
}

a {
  text-decoration: none;
  color: inherit;
}

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

ul { list-style: none; }

/* === SIDEBAR === */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--neutral-primary-soft);
  border-right: 1px solid var(--border-default);
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform var(--transition-base);
}

.sidebar-logo {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo .logo-icon {
  width: 32px;
  height: 32px;
  border: 2px solid var(--brand);
  border-radius: var(--radius-default);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
}

.sidebar-logo .logo-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.sidebar-nav .nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-base);
  color: var(--body);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  text-decoration: none;
}

.sidebar-nav .nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--body);
  transition: color var(--transition-fast);
}

.sidebar-nav .nav-item .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav .nav-item:hover {
  background: var(--neutral-secondary-medium);
  color: var(--heading);
}

.sidebar-nav .nav-item:hover .nav-icon {
  color: var(--heading);
}

.sidebar-nav .nav-item.active {
  background: var(--neutral-secondary-strong);
  color: var(--fg-brand-strong);
}

.sidebar-nav .nav-item.active .nav-icon {
  color: var(--fg-brand);
}

.sidebar-nav .nav-item.active::before {
  content: '';
  position: absolute;
  left: -12px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--brand);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.sidebar-nav .nav-divider {
  height: 1px;
  background: var(--border-default);
  margin: var(--space-2) 0;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-default);
  margin-top: auto;
}

.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-base);
  transition: background var(--transition-fast);
}

.sidebar-user-card:hover {
  background: var(--neutral-secondary-medium);
}

.sidebar-user-card .avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-default);
  object-fit: cover;
  background: var(--neutral-quaternary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--body);
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}

.sidebar-user-card .user-info {
  flex: 1;
  min-width: 0;
}

.sidebar-user-card .user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-card .user-email {
  font-size: 12px;
  color: var(--body-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === TOPBAR === */
.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: var(--neutral-primary);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 var(--space-6);
  gap: var(--space-4);
  z-index: 80;
  transition: left var(--transition-base);
}

.topbar .hamburger {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-default);
  color: var(--body);
  transition: all var(--transition-fast);
}

.topbar .hamburger:hover {
  background: var(--neutral-secondary-medium);
  color: var(--heading);
}

.topbar .topbar-logo-mobile {
  display: none;
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 2px;
  text-transform: uppercase;
}

.topbar .topbar-page-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.5px;
}

.topbar .workspace-selector {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-default);
  font-size: 14px;
  font-weight: 500;
  color: var(--heading);
  border: 1px solid var(--border-default);
  background: var(--neutral-primary-medium);
  transition: all var(--transition-fast);
}

.topbar .workspace-selector:hover {
  border-color: var(--border-default-strong);
  background: var(--neutral-secondary-medium);
}

.topbar .search-bar {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.topbar .search-bar .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--body-subtle);
  pointer-events: none;
}

.topbar .search-bar input {
  width: 100%;
  padding: 10px 12px 10px 36px;
  background: var(--neutral-secondary-medium);
  border: 1px solid var(--border-default-medium);
  border-radius: var(--radius-base);
  color: var(--heading);
  font-size: 14px;
  font-family: var(--font-body);
  transition: all var(--transition-base);
}

.topbar .search-bar input::placeholder {
  color: var(--body);
}

.topbar .search-bar input:focus {
  outline: none;
  border-color: var(--border-brand);
  box-shadow: 0 0 0 1px var(--brand);
  background: var(--neutral-primary-medium);
}

.topbar .topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;
}

.topbar .btn-new {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px 16px;
  background: transparent;
  border: 2px solid var(--border-brand);
  border-radius: var(--radius-base);
  color: var(--fg-brand);
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.topbar .btn-new:hover {
  background: var(--brand);
  color: var(--black);
  box-shadow: var(--shadow-glow-brand);
}

.topbar .icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-default);
  color: var(--body);
  transition: all var(--transition-fast);
  position: relative;
}

.topbar .icon-btn:hover {
  background: var(--neutral-secondary-medium);
  color: var(--heading);
}

.topbar .icon-btn .badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background: var(--fg-danger);
  border-radius: var(--radius-full);
  border: 2px solid var(--neutral-primary);
}

.topbar .topbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: 2px solid var(--border-default);
  object-fit: cover;
  background: var(--neutral-quaternary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--body);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-left: var(--space-1);
}

/* === MAIN CONTENT === */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: var(--space-8) var(--space-6);
  min-height: calc(100vh - var(--topbar-height));
  transition: margin-left var(--transition-base);
}

.page-header {
  margin-bottom: var(--space-8);
  animation: fadeInUp 0.4s ease both;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 34px;
  font-weight: 700;
  color: var(--heading);
  letter-spacing: 0.5px;
  margin-bottom: var(--space-2);
}

.page-header p {
  font-size: 16px;
  color: var(--body);
}

/* === KPI GRID === */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

/* === PROGRESS GRID === */
.progress-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

/* === CHART SECTION === */
.chart-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-6);
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

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

@keyframes glowPulse {
  0%, 100% {
    box-shadow: 0 0 8px rgba(187, 243, 81, 0.1);
  }
  50% {
    box-shadow: 0 0 20px rgba(187, 243, 81, 0.25);
  }
}

@keyframes progressFill {
  from {
    width: 0%;
  }
}
