:root {
  --background: #ffffff;
  --foreground: #0a0a0a;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --card: #ffffff;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #dc2626;
  --success: #16a34a;
  --warning: #d97706;
  --info: #2563eb;
  --radius: 0.5rem;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.04);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.04);

  --bs-primary: var(--primary);
  --bs-primary-rgb: 24, 24, 27;
  --bs-border-color: var(--border);
  --bs-body-color: var(--foreground);
  --bs-body-bg: var(--background);
  --bs-secondary-color: var(--muted-foreground);
}

html, body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  color: var(--foreground);
  background: var(--background);
  letter-spacing: -0.005em;
  min-height: 100%;
}

body { min-height: 100vh; }

body.auth-shell { background: var(--muted); }
body.auth-shell .auth-wrapper { min-height: 100vh; align-items: center !important; }
body.auth-shell .auth-wrapper-inner { width: 100%; max-width: 440px; }

.auth-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 4px);
  padding: 2.25rem 2rem;
  box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.04), 0 10px 30px -10px rgb(0 0 0 / 0.08);
  width: 100%;
  max-width: 420px;
}
.auth-card-header {
  margin-bottom: 1.5rem;
}
.auth-logo {
  display: inline-block;
  width: 56px;
  height: auto;
  object-fit: contain;
  margin-bottom: 1rem;
}
.auth-title {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 0.375rem;
  color: var(--foreground);
}
.auth-subtitle {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
}

.auth-providers-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.auth-provider-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 2.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}
.auth-provider-btn svg {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
}
.auth-provider-btn:hover {
  background: var(--accent);
  border-color: var(--border-strong);
  color: var(--foreground);
  text-decoration: none;
}
.auth-provider-btn:active { transform: translateY(1px); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-form .form-group { margin-bottom: 1rem; }
.auth-form .form-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  margin-bottom: 0.375rem;
  display: block;
}
.auth-form .form-check {
  margin: 0.75rem 0 1.25rem;
  font-size: 0.85rem;
  color: var(--muted-foreground);
}
.auth-link-sm {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-decoration: none;
}
.auth-link-sm:hover { color: var(--foreground); text-decoration: underline; }
.auth-submit { padding: 0.55rem 1rem; font-size: 0.9rem; }

@media (max-width: 480px) {
  .auth-card { padding: 1.5rem 1.25rem; }
}

h1, h2, h3, h4, h5, h6 {
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* ─── App shell + sidebar (shadcn style) ─────────────────────────── */
:root {
  --sidebar-width: 248px;
  --sidebar-bg: #fafafa;
  --topbar-h: 56px;
}

.app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--background);
}

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  min-height: var(--topbar-h);
}
.sidebar-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--foreground);
  text-decoration: none;
  letter-spacing: -0.01em;
}
.sidebar-brand:hover { color: var(--foreground); }
.sidebar-close {
  background: transparent;
  border: 0;
  color: var(--muted-foreground);
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius);
  font-size: 1rem;
  cursor: pointer;
}
.sidebar-close:hover { background: var(--accent); color: var(--foreground); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}
.sidebar-section-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  padding: 0.5rem 0.625rem 0.375rem;
  font-weight: 600;
}
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: calc(var(--radius) - 1px);
  color: var(--foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 120ms ease, color 120ms ease;
}
.sidebar-link i {
  font-size: 1rem;
  color: var(--muted-foreground);
  width: 1.125rem;
  text-align: center;
}
.sidebar-link:hover {
  background: var(--accent);
  color: var(--foreground);
}
.sidebar-link.active {
  background: var(--primary);
  color: var(--primary-foreground);
}
.sidebar-link.active i {
  color: var(--primary-foreground);
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}
.sidebar-user-dropdown { position: relative; }
.sidebar-user {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  color: var(--foreground);
}
.sidebar-user:hover { background: var(--accent); }
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground);
  flex-shrink: 0;
}
.sidebar-user-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-email {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-chev {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.875rem;
  height: var(--topbar-h);
  background: var(--background);
  border-bottom: 1px solid var(--border);
}
.topbar-toggle {
  background: transparent;
  border: 0;
  color: var(--foreground);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
}
.topbar-toggle:hover { background: var(--accent); }
.topbar-brand {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--foreground);
  text-decoration: none;
}
.topbar-spacer { flex: 1; }

.app-content { flex: 1; }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 39;
  display: none;
}

/* Mobile */
@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    transform: translateX(-100%);
    transition: transform 220ms ease;
    box-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.25);
  }
  .sidebar.is-open { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-backdrop { display: block; }
  .app-main { width: 100%; }
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}
.card-header {
  background: var(--background) !important;
  border-bottom: 1px solid var(--border);
  color: var(--foreground) !important;
  font-weight: 600;
  padding: 0.875rem 1rem;
}
.card-header .card-title {
  font-size: 0.95rem;
  color: var(--foreground);
}
.card-body {
  padding: 1rem;
}

.btn {
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  padding: 0.4rem 0.875rem;
  transition: background-color 120ms ease, color 120ms ease, border-color 120ms ease;
  box-shadow: none !important;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: var(--primary-foreground);
}
.btn-primary:hover {
  background: #27272a;
  border-color: #27272a;
  color: var(--primary-foreground);
}
.btn-outline-primary {
  color: var(--foreground);
  border-color: var(--border-strong);
  background: var(--background);
}
.btn-outline-primary:hover {
  background: var(--accent);
  border-color: var(--border-strong);
  color: var(--foreground);
}
.btn-sm {
  padding: 0.3rem 0.625rem;
  font-size: 0.8125rem;
}

.table {
  --bs-table-bg: var(--card);
  margin-bottom: 0;
  color: var(--foreground);
}
.table > :not(caption) > * > * {
  padding: 0.75rem 1rem;
  background-color: transparent;
}
.table thead th {
  background: var(--muted) !important;
  color: var(--muted-foreground) !important;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  border-top: none;
}
.table tbody tr {
  border-bottom: 1px solid var(--border);
}
.table tbody tr:last-child {
  border-bottom: none;
}
.table-hover tbody tr:hover {
  background: var(--muted);
}
.table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: transparent;
  color: inherit;
}

.badge {
  font-weight: 500;
  font-size: 0.7rem;
  padding: 0.25rem 0.5rem;
  border-radius: 9999px;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.badge.bg-success { background: #dcfce7 !important; color: #15803d !important; border-color: #bbf7d0; }
.badge.bg-warning { background: #fef3c7 !important; color: #b45309 !important; border-color: #fde68a; }
.badge.bg-danger { background: #fee2e2 !important; color: #b91c1c !important; border-color: #fecaca; }
.badge.bg-info { background: #dbeafe !important; color: #1d4ed8 !important; border-color: #bfdbfe; }
.badge.bg-secondary { background: var(--muted) !important; color: var(--muted-foreground) !important; border-color: var(--border); }
.badge.bg-light { background: var(--muted) !important; color: var(--muted-foreground) !important; border-color: var(--border); }

.alert {
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.form-control, .form-select {
  border-radius: var(--radius);
  border-color: var(--border-strong);
  font-size: 0.875rem;
  padding: 0.45rem 0.75rem;
  background: var(--background);
}
.form-control:focus, .form-select:focus {
  border-color: var(--foreground);
  box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.08);
}

.dropdown-menu {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.25rem;
}
.dropdown-item {
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  padding: 0.4rem 0.625rem;
}
.dropdown-item:hover, .dropdown-item:focus {
  background: var(--accent);
}

.container, .container-fluid {
  --bs-gutter-x: 1.5rem;
}

a {
  color: var(--foreground);
}
a:hover {
  color: var(--muted-foreground);
}

.text-muted {
  color: var(--muted-foreground) !important;
}

body {
  background: #fafafa;
}
.container.py-4 > .card,
main > .container > .card {
  background: var(--card);
}
