:root {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --fg: #f8fafc;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-alt: #f472b6;
  --border: #334155;
}

[data-theme='light'] {
  --bg: #f5f7fb;
  --bg-alt: #ffffff;
  --fg: #0f172a;
  --muted: #475569;
  --accent: #2563eb;
  --accent-alt: #0ea5e9;
  --border: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  display: flex;
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
}

.layout {
  display: flex;
  width: 100%;
}

.sidebar {
  width: 280px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.sidebar header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar nav {
  flex: 1;
  overflow-y: auto;
}

.sidebar nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar nav li {
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid transparent;
  border-radius: 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.sidebar nav li.active {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.15);
}

.sidebar nav li:hover {
  border-color: var(--accent-alt);
}

.main {
  flex: 1;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.5rem;
}

.card h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--muted);
}

.card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.75rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.button {
  border: none;
  border-radius: 999px;
  padding: 0.75rem 1.25rem;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
}

.button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--fg);
}

.button:hover {
  opacity: 0.85;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  z-index: 999;
}

.toast {
  padding: 0.85rem 1rem;
  border-radius: 0.75rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  min-width: 240px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 998;
}

.modal {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 2rem;
  width: min(500px, 90vw);
}

.theme-toggle {
  background: none;
  color: inherit;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 1rem;
}

@media (max-width: 960px) {
  body {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .layout {
    flex-direction: column;
  }
}
