:root {
  --tw-brand: #0040ff;
  --tw-brand-dark: #0029a6;
  --tw-bg: #f4f5f7;
  --tw-surface: #ffffff;
  --tw-border: #d7d8dd;
  --tw-text: #1f2430;
  --tw-muted: #6b7280;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--tw-bg);
  color: var(--tw-text);
  margin: 0;
}

a {
  color: var(--tw-brand);
}

.app-shell {
  display: flex;
  min-height: 100vh;
  background-color: var(--tw-bg);
}

.app-sidebar {
  width: 248px;
  background-color: var(--tw-surface);
  border-right: 1px solid var(--tw-border);
  padding: 1.5rem 1.25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.app-brand {
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: 0.05em;
  color: var(--tw-brand);
  margin-bottom: 2rem;
}

.sidebar-label {
  text-transform: uppercase;
  font-size: 0.75rem;
  color: var(--tw-muted);
  margin-bottom: 0.75rem;
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
  flex-grow: 1;
}

.sidebar-item {
  margin-bottom: 0.25rem;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.5rem;
  color: var(--tw-text);
  text-decoration: none;
  font-weight: 500;
}

.sidebar-item.is-active a {
  background-color: rgba(0, 64, 255, 0.12);
  color: var(--tw-brand);
}

.sidebar-item a:hover {
  background-color: rgba(0, 64, 255, 0.08);
}

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--tw-border);
  padding-top: 1rem;
  font-size: 0.9rem;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-topbar {
  background-color: var(--tw-surface);
  border-bottom: 1px solid var(--tw-border);
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar-links {
  gap: 0.5rem;
}

.topbar-link {
  font-size: 0.85rem;
  color: var(--tw-muted);
  text-decoration: none;
  padding: 0.25rem 0.9rem;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.topbar-link:hover {
  background-color: rgba(0, 64, 255, 0.08);
  color: var(--tw-text);
}

.topbar-link.is-active {
  background-color: rgba(0, 64, 255, 0.12);
  color: var(--tw-brand);
}

.app-topbar .breadcrumb {
  margin-bottom: 0;
}

.app-content {
  padding: 2rem;
}

.tw-card {
  border: 1px solid var(--tw-border);
  border-radius: 1rem;
  background-color: var(--tw-surface);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
}

.tw-card .card-header {
  border-bottom: 1px solid rgba(215, 216, 221, 0.7);
  background-color: transparent;
}

.tw-card .card-footer {
  border-top: 1px solid rgba(215, 216, 221, 0.7);
  background-color: transparent;
}

.tw-stats {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.tw-stats-title {
  font-size: 0.85rem;
  color: var(--tw-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tw-stats-value {
  font-size: 2rem;
  font-weight: 700;
}

.tw-table thead {
  background-color: #f8f9fb;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}

.tw-table th,
.tw-table td {
  border-color: var(--tw-border);
  vertical-align: middle;
}

.tw-alert {
  border-radius: 0.75rem;
  border: 1px solid var(--tw-border);
  background-color: #fff;
  padding: 1rem 1.25rem;
}

.tw-alert-info {
  border-color: rgba(0, 64, 255, 0.3);
  background-color: rgba(0, 64, 255, 0.05);
}

.tw-alert-danger {
  border-color: rgba(239, 68, 68, 0.4);
  background-color: rgba(239, 68, 68, 0.06);
}

.badge-pill {
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.75rem;
}

.auth-body {
  background: radial-gradient(circle at top, rgba(0, 64, 255, 0.05), transparent 50%), var(--tw-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Inter", sans-serif;
}

.auth-wrapper {
  width: 100%;
  max-width: 420px;
  padding: 2rem 1rem;
}

.auth-card {
  background-color: var(--tw-surface);
  border: 1px solid var(--tw-border);
  border-radius: 1rem;
  padding: 2rem;
}

.auth-brand {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tw-brand);
}

@media (max-width: 992px) {
  .app-shell {
    flex-direction: column;
  }

  .app-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
  }

  .sidebar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .sidebar-item {
    margin-bottom: 0;
  }

  .app-topbar,
  .app-content {
    padding: 1.25rem;
  }
  
  /* Disable collapse on mobile */
  .btn-sidebar-toggle {
    display: none;
  }
}

/* Sidebar Collapsed Mode (Desktop) */
@media (min-width: 993px) {
  body.sidebar-collapsed .app-sidebar {
    width: 72px;
    padding: 1.5rem 0.75rem;
    align-items: center;
  }

  body.sidebar-collapsed .app-brand {
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    text-align: center;
  }

  body.sidebar-collapsed .sidebar-label,
  body.sidebar-collapsed .sidebar-footer,
  body.sidebar-collapsed .sidebar-nav span {
    display: none;
  }

  body.sidebar-collapsed .sidebar-item a {
    justify-content: center;
    padding: 0.75rem;
  }

  body.sidebar-collapsed .sidebar-item i {
    margin-right: 0;
    font-size: 1.25rem;
  }
}

/* User Menu */
.user-menu-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background-color: var(--tw-brand);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
}
