:root {
  /* Default Dark Theme */
  --bg: #0f172a;
  --bg-gradient: linear-gradient(180deg, #0b1021, #0f172a);
  --panel: #111827;
  --panel-bg: rgba(17, 24, 39, 0.8);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --danger: #ef4444;
  --success: #10b981;
  --border: #1f2937;
  --sidebar-width: 260px;
  --sidebar-bg: #0b1221;
  --header-bg: #0b1221;
  --input-bg: #0b1221;
  --hover-bg: rgba(255, 255, 255, 0.05);
  --active-bg: rgba(56, 189, 248, 0.1);
  --active-border: rgba(56, 189, 248, 0.2);
  --overlay: rgba(0, 0, 0, 0.5);
  --shadow-color: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-gradient: linear-gradient(180deg, #f1f5f9, #e2e8f0);
  --panel: #ffffff;
  --panel-bg: rgba(255, 255, 255, 0.9);
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-2: #7c3aed;
  --danger: #dc2626;
  --success: #059669;
  --border: #cbd5e1;
  --sidebar-bg: #ffffff;
  --header-bg: #ffffff;
  --input-bg: #f1f5f9;
  --hover-bg: rgba(0, 0, 0, 0.05);
  --active-bg: rgba(2, 132, 199, 0.1);
  --active-border: rgba(2, 132, 199, 0.2);
  --overlay: rgba(0, 0, 0, 0.2);
  --shadow-color: rgba(148, 163, 184, 0.25);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
}

/* Layout Grid */
.app-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* Sidebar Styles */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s ease, background-color 0.3s ease;
}

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

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

.nav-item {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--hover-bg);
  color: var(--text);
}

.nav-item.active {
  background: var(--active-bg);
  color: var(--accent);
  border-color: var(--active-border);
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 2rem;
  width: calc(100% - var(--sidebar-width));
}

/* Mobile Header */
.mobile-header {
  display: none;
  padding: 1rem;
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.5rem;
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--overlay);
  z-index: 45;
  backdrop-filter: blur(2px);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    width: 100%;
    padding: 1rem;
  }
  
  .mobile-header {
    display: flex;
  }
  
  .sidebar-overlay.open {
    display: block;
  }
  
  .app-layout {
    flex-direction: column;
  }
}

/* Reuse existing component styles */
.panel, .card {
  background: var(--panel-bg);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  box-shadow: 0 10px 40px var(--shadow-color);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  color: var(--muted);
  font-size: 0.9rem;
}

input, textarea, select, button {
  font: inherit;
}

input, textarea, select {
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  color: var(--text);
  width: 100%;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

button {
  border: none;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

button.primary {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #0b1021;
  font-weight: 700;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Feedback toast */
.feedback {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1rem;
  border-radius: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 8px 24px var(--shadow-color);
  z-index: 100;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Grid helpers */
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.gap-4 { gap: 1rem; }
.grid { display: grid; }

.hidden { display: none; }
