/* Reset and 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: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
}

/* App layout: sidebar + main */
.app {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-sidebar-active);
  letter-spacing: -0.02em;
}

.sidebar-brand .subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  padding: 8px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-left: 3px solid transparent;
  transition: all 0.15s ease;
}

.sidebar-nav a:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar-nav a.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
  width: 18px;
  text-align: center;
  font-size: 15px;
  opacity: 0.7;
}

.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-muted);
}

/* Main content area */
.main-content {
  flex: 1;
  margin-left: 220px;
  padding: 24px;
  min-height: 100vh;
  max-width: 1200px;
}

/* Panel container */
.panel {
  display: none;
}

.panel.active {
  display: block;
}

/* Panel header */
.panel-header {
  margin-bottom: 24px;
}

.panel-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.panel-header p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* Grid layouts for dashboard */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.grid-full {
  grid-column: 1 / -1;
}

/* Mobile sidebar toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--bg-sidebar);
  color: var(--text-sidebar-active);
  border: none;
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: var(--shadow-md);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

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