* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  min-height: 100vh;
}

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

img {
  max-width: 100%;
  display: block;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 1rem;
  color: inherit;
}

::-webkit-scrollbar {
  width: 8px;
}
::-webkit-scrollbar-track {
  background: var(--muted);
}
::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--primary) 50%, transparent);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--primary) 70%, transparent);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: opacity 0.15s ease, background 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
}
.btn:active {
  transform: scale(0.98);
}
.btn-primary {
  background: var(--brand-gradient);
  color: #ffffff;
}
.btn-primary:hover {
  background: var(--brand-gradient-hover);
}
.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}
.btn-outline:hover {
  background: var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--foreground);
}
.btn-ghost:hover {
  background: var(--accent);
}
.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-full);
}
.btn-block {
  width: 100%;
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}

/* ---------- Form controls ---------- */
.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--muted-foreground);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  background: var(--background);
  border: 1px solid var(--input);
  border-radius: var(--radius);
  color: var(--foreground);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-blue) 25%, transparent);
}

/* ---------- Brand text ---------- */
.brand-gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--accent-foreground);
}
.badge-success {
  background: color-mix(in srgb, var(--success) 20%, transparent);
  color: var(--success);
}

/* ---------- Navbar ---------- */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--background) 80%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
}
.navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 1.05rem;
}
.navbar-logo img {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  object-fit: contain;
}
.navbar-links {
  display: flex;
  align-items: center;
  gap: 2rem;
}
.navbar-links a {
  color: var(--muted-foreground);
  font-weight: 500;
  transition: color 0.15s ease;
}
.navbar-links a:hover,
.navbar-links a.active {
  color: var(--foreground);
}
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ---------- Sidebar (dashboards) ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  padding-top: 0;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.5rem 1.5rem;
  font-weight: 700;
}
.sidebar-logo img {
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: var(--radius);
  color: var(--muted-foreground);
  font-weight: 500;
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}
.sidebar-nav a:hover {
  background: var(--accent);
  color: var(--foreground);
}
.sidebar-nav a.active {
  background: var(--accent);
  color: var(--foreground);
}
.main-content {
  flex: 1;
  padding: 2rem;
  max-width: 100%;
}

/* ---------- Footer ---------- */
.footer {
  background: color-mix(in srgb, var(--muted) 50%, transparent);
  border-top: 1px solid var(--border);
  padding: 3rem 0;
  margin-top: 4rem;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
}
.footer h4 {
  font-weight: 600;
  margin-bottom: 1rem;
}
.footer ul {
  list-style: none;
  color: var(--muted-foreground);
}
.footer li {
  margin-bottom: 0.5rem;
}
.footer li a:hover {
  color: var(--foreground);
}
.footer-bottom {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
  padding-top: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted-foreground);
  font-size: 0.9rem;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 2rem;
}
.pagination button {
  min-width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  cursor: pointer;
  font-size: 0.85rem;
}
.pagination button:hover:not(:disabled) {
  background: var(--accent);
}
.pagination button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pagination button.active {
  background: var(--brand-gradient);
  color: #fff;
  border-color: transparent;
}
.pagination-info {
  color: var(--muted-foreground);
  font-size: 0.82rem;
  text-align: center;
  margin-top: 0.5rem;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--muted-foreground); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-4 { margin-bottom: 2rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; } .gap-2 { gap: 1rem; }
.grid { display: grid; }
.hidden { display: none !important; }

/* ---------- Mobile topbar (admin/dashboard sidebar toggle) ---------- */
.mobile-topbar {
  display: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.mobile-topbar .hamburger-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--foreground);
  flex-shrink: 0;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 55;
}
.sidebar-backdrop.open { display: block; }

@media (max-width: 768px) {
  .mobile-topbar { display: flex; }
}

@media (max-width: 480px) {
  .flex.justify-between { flex-wrap: wrap; gap: .5rem; }
}

@media (max-width: 768px) {
  .navbar-links { display: none; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { position: fixed; left: -260px; z-index: 60; transition: left 0.2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { left: 0; }
  .main-content { padding: 1.25rem; }
}
