/* =============================================================================
   shadcn/ui Design System — Dracula (Dark) / Alucard (Light)
   ============================================================================= */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap");

/* =============================================================================
   CSS Custom Properties — Light Mode (Alucard)
   ============================================================================= */
:root {
  --background: 48 100% 96%;
  --foreground: 0 0% 12%;
  --card: 0 0% 100%;
  --card-foreground: 0 0% 12%;
  --popover: 54 37% 90%;
  --popover-foreground: 0 0% 12%;
  --primary: 252 54% 54%;
  --primary-foreground: 0 0% 100%;
  --secondary: 46 25% 90%;
  --secondary-foreground: 0 0% 12%;
  --muted: 46 25% 90%;
  --muted-foreground: 49 18% 36%;
  --accent: 54 37% 90%;
  --accent-foreground: 0 0% 12%;
  --destructive: 6 66% 48%;
  --destructive-foreground: 0 0% 100%;
  --border: 51 13% 78%;
  --input: 51 13% 78%;
  --ring: 252 54% 54%;
  --radius: 0.5rem;

  --success: 114 84% 24%;
  --success-foreground: 0 0% 100%;
  --warning: 24 78% 36%;
  --warning-foreground: 0 0% 100%;
  --info: 198 96% 30%;
  --info-foreground: 0 0% 100%;

  --sidebar-background: 48 100% 96%;
  --sidebar-foreground: 0 0% 12%;
  --sidebar-border: 51 13% 78%;
  --sidebar-primary: 252 54% 54%;
  --sidebar-primary-foreground: 0 0% 100%;
  --sidebar-accent: 54 37% 90%;
  --sidebar-accent-foreground: 0 0% 12%;
  --sidebar-muted: 49 18% 36%;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  --gradient-primary: linear-gradient(
    135deg,
    hsl(252 54% 54%),
    hsl(336 78% 36%)
  );
  --gradient-accent: linear-gradient(
    135deg,
    hsl(198 96% 30%),
    hsl(252 54% 54%)
  );
  --gradient-success: linear-gradient(
    135deg,
    hsl(114 84% 24%),
    hsl(198 96% 30%)
  );
  --gradient-surface: linear-gradient(
    180deg,
    hsl(48 100% 96%),
    hsl(46 25% 92%)
  );
  --glow-primary: 0 0 20px hsl(252 54% 54% / 0.15);
  --glow-accent: 0 0 20px hsl(198 96% 30% / 0.1);
}

/* =============================================================================
   Dark Mode (Dracula)
   ============================================================================= */
.dark {
  --background: 231 15% 18%;
  --foreground: 60 30% 96%;
  --card: 230 15% 24%;
  --card-foreground: 60 30% 96%;
  --popover: 230 15% 24%;
  --popover-foreground: 60 30% 96%;
  --primary: 265 89% 78%;
  --primary-foreground: 231 15% 18%;
  --secondary: 232 14% 31%;
  --secondary-foreground: 60 30% 96%;
  --muted: 232 14% 31%;
  --muted-foreground: 225 30% 68%;
  --accent: 232 14% 31%;
  --accent-foreground: 60 30% 96%;
  --destructive: 0 100% 67%;
  --destructive-foreground: 60 30% 96%;
  --border: 232 14% 31%;
  --input: 232 14% 31%;
  --ring: 265 89% 78%;

  --success: 135 94% 65%;
  --success-foreground: 231 15% 18%;
  --warning: 31 100% 71%;
  --warning-foreground: 231 15% 18%;
  --info: 191 97% 77%;
  --info-foreground: 231 15% 18%;

  --sidebar-background: 235 14% 15%;
  --sidebar-foreground: 60 30% 96%;
  --sidebar-border: 232 14% 31%;
  --sidebar-primary: 265 89% 78%;
  --sidebar-primary-foreground: 231 15% 18%;
  --sidebar-accent: 232 14% 31%;
  --sidebar-accent-foreground: 60 30% 96%;
  --sidebar-muted: 225 30% 68%;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.4), 0 1px 2px -1px rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4), 0 2px 4px -2px rgb(0 0 0 / 0.4);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.5), 0 4px 6px -4px rgb(0 0 0 / 0.5);

  --gradient-primary: linear-gradient(135deg, #bd93f9, #ff79c6);
  --gradient-accent: linear-gradient(135deg, #8be9fd, #bd93f9);
  --gradient-success: linear-gradient(135deg, #50fa7b, #8be9fd);
  --gradient-surface: linear-gradient(
    180deg,
    hsl(231 15% 18%),
    hsl(235 14% 15%)
  );
  --glow-primary: 0 0 25px hsl(265 89% 78% / 0.2);
  --glow-accent: 0 0 20px hsl(191 97% 77% / 0.15);
}

/* =============================================================================
   Base Reset & Typography
   ============================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family:
    "Inter",
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  min-height: 100vh;
  transition:
    background-color 0.2s,
    color 0.2s;
}

a {
  color: hsl(var(--primary));
  text-decoration: none;
  transition: opacity 0.15s;
}
a:hover {
  opacity: 0.8;
}

code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.8em;
  background: hsl(var(--muted));
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
}

/* =============================================================================
   Layout
   ============================================================================= */
.layout {
  display: flex;
  min-height: 100vh;
}

.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s;
}

.content-area {
  flex: 1;
  padding: 1.5rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* =============================================================================
   Sidebar
   ============================================================================= */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 260px;
  background: var(--gradient-surface);
  border-right: 1px solid hsl(var(--sidebar-border) / 0.5);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform 0.2s;
  overflow-y: auto;
  backdrop-filter: blur(12px);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid hsl(var(--sidebar-border));
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  box-shadow: 0 0 10px hsl(var(--primary) / 0.2);
  transition: transform 0.2s;
}

.sidebar-logo:hover {
  transform: scale(1.1);
}

.sidebar-icon-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-primary);
  transition: transform 0.2s;
  flex-shrink: 0;
}

.sidebar-icon-logo:hover {
  transform: scale(1.1);
}

.sidebar-icon-logo .material-symbols-outlined {
  font-size: 20px;
  color: #fff;
}

.sidebar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: hsl(var(--sidebar-foreground));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  color: hsl(var(--sidebar-foreground));
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: none;
  transition:
    background 0.15s,
    color 0.15s;
  opacity: 1;
}

.sidebar-item:hover {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-accent-foreground));
  opacity: 1;
}

.sidebar-item-active {
  background: hsl(var(--sidebar-accent));
  color: hsl(var(--sidebar-primary));
  font-weight: 500;
  box-shadow: inset 3px 0 0 hsl(var(--sidebar-primary));
  border-radius: 0 var(--radius) var(--radius) 0;
}

.sidebar-item .material-symbols-outlined {
  font-size: 20px;
  color: hsl(var(--sidebar-muted));
}

.sidebar-item-active .material-symbols-outlined {
  color: hsl(var(--sidebar-primary));
}

.sidebar-separator {
  height: 1px;
  background: hsl(var(--sidebar-border));
  margin: 0.5rem 0.75rem;
}

.sidebar-footer {
  padding: 0.75rem 1rem;
  border-top: 1px solid hsl(var(--sidebar-border));
  font-size: 0.75rem;
  color: hsl(var(--sidebar-muted));
  text-align: center;
}

.sidebar-footer a {
  color: hsl(var(--sidebar-muted));
  font-weight: 500;
}
.sidebar-footer a:hover {
  color: hsl(var(--sidebar-primary));
}

.sidebar-footer-heart {
  color: hsl(var(--destructive));
}

/* =============================================================================
   Top Bar
   ============================================================================= */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: hsl(var(--background) / 0.8);
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.topbar-title {
  font-size: 1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.topbar-user .material-symbols-outlined {
  font-size: 20px;
}

#menuToggle {
  display: none;
}

/* =============================================================================
   Buttons
   ============================================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.25;
}

.btn:focus-visible {
  outline: 2px solid hsl(var(--ring));
  outline-offset: 2px;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn .material-symbols-outlined {
  font-size: 18px;
}

.btn-primary {
  background: var(--gradient-primary);
  color: hsl(var(--primary-foreground));
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  opacity: 0.9;
  box-shadow: var(--glow-primary), var(--shadow-md);
  transform: translateY(-1px);
}

.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--secondary));
}
.btn-secondary:hover {
  opacity: 0.8;
}

.btn-destructive {
  background: linear-gradient(
    135deg,
    hsl(var(--destructive)),
    hsl(var(--destructive) / 0.8)
  );
  color: hsl(var(--destructive-foreground));
  border-color: transparent;
}
.btn-destructive:hover {
  opacity: 0.9;
  box-shadow: 0 0 15px hsl(var(--destructive) / 0.3);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}
.btn-outline:hover {
  background: hsl(var(--accent));
  border-color: hsl(var(--primary) / 0.3);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: transparent;
}
.btn-ghost:hover {
  background: hsl(var(--accent));
  transform: translateY(-1px);
}

.btn-link {
  background: transparent;
  color: hsl(var(--primary));
  border-color: transparent;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.625rem 1.5rem;
  font-size: 0.95rem;
}

.btn-icon {
  padding: 0.5rem;
  width: 2.25rem;
  height: 2.25rem;
}

.btn-icon-sm {
  padding: 0.25rem;
  width: 1.75rem;
  height: 1.75rem;
}

.btn-full {
  width: 100%;
}

/* =============================================================================
   Cards
   ============================================================================= */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-sm);
  transition:
    box-shadow 0.25s,
    transform 0.25s,
    border-color 0.25s;
  overflow: hidden;
}

.card:hover {
  box-shadow: var(--shadow-md), var(--glow-accent);
  border-color: hsl(var(--border));
}

.card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
  flex-wrap: wrap;
  position: relative;
}

.card-header::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 1.5rem;
  right: 1.5rem;
  height: 1px;
  background: var(--gradient-primary);
  opacity: 0.3;
}

.card-header-icon {
  font-size: 22px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 600;
  flex: 1;
}

.card-description {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.card-content {
  padding: 1.5rem;
}

.card-content--flush {
  padding: 0;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid hsl(var(--border));
}

/* =============================================================================
   Form Elements
   ============================================================================= */
.form-field {
  margin-bottom: 1rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 0.375rem;
  color: hsl(var(--foreground));
}

.form-description {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  margin-top: 0.25rem;
}

.form-message {
  font-size: 0.8rem;
  color: hsl(var(--destructive));
  margin-top: 0.25rem;
}

.input,
.textarea,
.select {
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.75rem;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow:
    0 0 0 3px hsl(var(--ring) / 0.15),
    var(--glow-primary);
}

.input::placeholder,
.textarea::placeholder {
  color: hsl(var(--muted-foreground));
}

.textarea {
  resize: vertical;
  min-height: 5rem;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236272a4' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

.input-with-icon {
  position: relative;
}

.input-with-icon .material-symbols-outlined {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  color: hsl(var(--muted-foreground));
}

.input-with-icon .input {
  padding-left: 2.5rem;
}

/* =============================================================================
   Tables
   ============================================================================= */
.table-container {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
  border-bottom: 1px solid hsl(var(--border));
  white-space: nowrap;
}

.table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.table tbody tr:hover {
  background: hsl(var(--accent) / 0.5);
  box-shadow: inset 3px 0 0 hsl(var(--primary) / 0.5);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* =============================================================================
   Badges
   ============================================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: box-shadow 0.2s;
}

.badge .material-symbols-outlined {
  font-size: 14px;
}

.badge-default {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
}

.badge-primary {
  background: hsl(var(--primary) / 0.15);
  color: hsl(var(--primary));
  border-color: hsl(var(--primary) / 0.3);
}

.badge-success {
  background: hsl(var(--success) / 0.15);
  color: hsl(var(--success));
  border-color: hsl(var(--success) / 0.3);
}

.badge-destructive {
  background: hsl(var(--destructive) / 0.15);
  color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.3);
}

.badge-warning {
  background: hsl(var(--warning) / 0.15);
  color: hsl(var(--warning));
  border-color: hsl(var(--warning) / 0.3);
}

.badge-info {
  background: hsl(var(--info) / 0.15);
  color: hsl(var(--info));
  border-color: hsl(var(--info) / 0.3);
}

.badge-outline {
  background: transparent;
  color: hsl(var(--foreground));
  border-color: hsl(var(--border));
}

/* =============================================================================
   Alerts
   ============================================================================= */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  border-left: 3px solid hsl(var(--primary));
  margin-bottom: 1rem;
  font-size: 0.85rem;
  backdrop-filter: blur(4px);
}

.alert .material-symbols-outlined {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 0.0625rem;
}

.alert-destructive {
  border-color: hsl(var(--destructive) / 0.5);
  border-left-color: hsl(var(--destructive));
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.alert-warning {
  border-color: hsl(var(--warning) / 0.5);
  border-left-color: hsl(var(--warning));
  background: hsl(var(--warning) / 0.1);
  color: hsl(var(--warning));
}

.alert-success {
  border-color: hsl(var(--success) / 0.5);
  border-left-color: hsl(var(--success));
  background: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}

.alert-info {
  border-color: hsl(var(--info) / 0.5);
  border-left-color: hsl(var(--info));
  background: hsl(var(--info) / 0.1);
  color: hsl(var(--info));
}

/* =============================================================================
   Dialog / Modal
   ============================================================================= */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.dialog-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.dialog-content {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-lg), var(--glow-primary);
  padding: 1.5rem;
  width: 90%;
  max-width: 450px;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-overlay.active .dialog-content {
  transform: scale(1) translateY(0);
}

.dialog-header {
  margin-bottom: 1rem;
  text-align: center;
}

.dialog-header .material-symbols-outlined {
  font-size: 32px;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 0.5rem;
}

.dialog-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  margin-bottom: 0.5rem;
}

.dialog-description {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
  line-height: 1.5;
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* =============================================================================
   Empty State
   ============================================================================= */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  color: hsl(var(--muted-foreground));
  text-align: center;
}

.empty-state .material-symbols-outlined {
  font-size: 48px;
  margin-bottom: 1rem;
  opacity: 0.4;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.empty-state p {
  font-size: 0.9rem;
}

/* =============================================================================
   Separator
   ============================================================================= */
.separator {
  height: 1px;
  background: hsl(var(--border));
  margin: 1.5rem 0;
}

.separator-text {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.5rem 0;
  color: hsl(var(--muted-foreground));
  font-size: 0.8rem;
}

.separator-text::before,
.separator-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: hsl(var(--border));
}

/* =============================================================================
   Toast Notifications
   ============================================================================= */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-left: 3px solid hsl(var(--primary));
  transform: translateX(100%);
  opacity: 0;
  transition:
    transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.3s;
  max-width: 360px;
}

.toast-visible {
  transform: translateX(0);
  opacity: 1;
}

.toast-hiding {
  transform: translateX(100%);
  opacity: 0;
}

.toast-success {
  border-left-color: hsl(var(--success));
  border-color: hsl(var(--success) / 0.5);
  background: hsl(var(--success) / 0.1);
  color: hsl(var(--success));
}

.toast-destructive {
  border-left-color: hsl(var(--destructive));
  border-color: hsl(var(--destructive) / 0.5);
  background: hsl(var(--destructive) / 0.1);
  color: hsl(var(--destructive));
}

.toast-warning {
  border-left-color: hsl(var(--warning));
  border-color: hsl(var(--warning) / 0.5);
  background: hsl(var(--warning) / 0.1);
  color: hsl(var(--warning));
}

/* =============================================================================
   Theme Toggle
   ============================================================================= */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: transparent;
  color: hsl(var(--foreground));
  cursor: pointer;
  transition:
    background 0.15s,
    transform 0.2s,
    box-shadow 0.2s;
}

.theme-toggle:hover {
  background: hsl(var(--accent));
  transform: rotate(15deg);
  box-shadow: var(--glow-primary);
}

.theme-toggle .material-symbols-outlined {
  font-size: 20px;
  transition: transform 0.3s;
}

/* =============================================================================
   Helper & Utility Classes
   ============================================================================= */
.text-muted {
  color: hsl(var(--muted-foreground));
}
.text-primary {
  color: hsl(var(--primary));
}
.text-destructive {
  color: hsl(var(--destructive));
}
.text-success {
  color: hsl(var(--success));
}
.text-sm {
  font-size: 0.8rem;
}
.text-xs {
  font-size: 0.75rem;
}
.text-center {
  text-align: center;
}
.font-medium {
  font-weight: 500;
}
.font-semibold {
  font-weight: 600;
}

.flex {
  display: flex;
}
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.justify-end {
  justify-content: flex-end;
}
.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.gap-3 {
  gap: 0.75rem;
}
.gap-4 {
  gap: 1rem;
}
.mt-1 {
  margin-top: 0.25rem;
}
.mt-2 {
  margin-top: 0.5rem;
}
.mt-4 {
  margin-top: 1rem;
}
.mb-2 {
  margin-bottom: 0.5rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}
.w-full {
  width: 100%;
}
.max-w-lg {
  max-width: 600px;
}
.max-w-xl {
  max-width: 700px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

/* =============================================================================
   Login Page
   ============================================================================= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
  background: var(--gradient-surface);
  position: relative;
}

.login-body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(
      ellipse at top,
      hsl(var(--primary) / 0.08) 0%,
      transparent 60%
    ),
    radial-gradient(
      ellipse at bottom right,
      hsl(var(--info) / 0.05) 0%,
      transparent 50%
    );
  pointer-events: none;
}

.login-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.5);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--shadow-lg), var(--glow-primary);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
}

.login-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  display: block;
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: var(--glow-primary);
  transition: transform 0.3s;
}

.login-logo:hover {
  transform: scale(1.05) rotate(2deg);
}

.login-icon-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 1rem;
  border-radius: calc(var(--radius) * 1.5);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--glow-primary), var(--shadow-lg);
  transition:
    transform 0.3s,
    box-shadow 0.3s;
}

.login-icon-logo:hover {
  transform: scale(1.05) rotate(2deg);
  box-shadow:
    0 0 30px hsl(var(--primary) / 0.4),
    var(--shadow-lg);
}

.login-icon-logo .material-symbols-outlined {
  font-size: 32px;
  color: #fff;
}

.login-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.login-subtitle {
  font-size: 0.85rem;
  color: hsl(var(--muted-foreground));
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
}

.login-footer a {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: hsl(var(--muted-foreground));
}
.login-footer a:hover {
  color: hsl(var(--primary));
}

/* =============================================================================
   Mobile Responsive
   ============================================================================= */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(0 0 0 / 0.5);
  z-index: 45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.sidebar-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

  #menuToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius);
    border: none;
    background: transparent;
    color: hsl(var(--foreground));
    cursor: pointer;
  }

  #menuToggle:hover {
    background: hsl(var(--accent));
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  .content-area {
    padding: 1rem;
  }

  .topbar {
    padding: 0.75rem 1rem;
  }

  .topbar-user span:not(.material-symbols-outlined) {
    display: none;
  }

  .table {
    font-size: 0.8rem;
  }

  .table th,
  .table td {
    padding: 0.5rem 0.625rem;
  }
}

/* =============================================================================
   Analytics Components
   ============================================================================= */
.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border) / 0.6);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  position: relative;
  overflow: hidden;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
}

.stat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-accent);
  opacity: 0.6;
}

.stat-card:hover {
  box-shadow: var(--shadow-md), var(--glow-accent);
  transform: translateY(-2px);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: hsl(var(--muted-foreground));
}

.stat-icon {
  color: hsl(var(--primary));
}

.stat-icon .material-symbols-outlined {
  font-size: 20px;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: hsl(var(--foreground));
}

.grid-analytics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

@media (max-width: 1023px) {
  .grid-analytics {
    grid-template-columns: 1fr;
  }
}

.country-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.country-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.375rem 0;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 0.85rem;
}

.country-item:last-child {
  border-bottom: none;
}

.country-count {
  font-weight: 600;
  color: hsl(var(--primary));
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bar-label {
  font-size: 0.8rem;
  color: hsl(var(--muted-foreground));
  min-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: hsl(var(--muted));
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: var(--gradient-primary);
  border-radius: 4px;
  transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bar-value {
  font-size: 0.8rem;
  font-weight: 600;
  color: hsl(var(--foreground));
  min-width: 40px;
  text-align: right;
}

.client-map {
  width: 100%;
  height: 300px;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
  overflow: hidden;
}

/* Hourly Bar Chart */
.hourly-chart {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  padding-bottom: 1.25rem;
  position: relative;
}

.hourly-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.hourly-bar {
  width: 100%;
  min-height: 2px;
  background: var(--gradient-accent);
  border-radius: 2px 2px 0 0;
  transition:
    height 0.3s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 0.2s;
  opacity: 0.7;
}

.hourly-bar[data-peak="1"] {
  background: var(--gradient-primary);
  opacity: 1;
  box-shadow: 0 0 8px hsl(var(--primary) / 0.4);
}

.hourly-bar-wrap:hover .hourly-bar {
  opacity: 1;
}

.hourly-label {
  position: absolute;
  bottom: -1.25rem;
  font-size: 0.65rem;
  color: hsl(var(--muted-foreground));
}

/* Daily Bar Chart */
.daily-chart {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 80px;
  padding-bottom: 1.25rem;
  position: relative;
}

.daily-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: flex-end;
  position: relative;
}

.daily-bar {
  width: 100%;
  min-height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px 2px 0 0;
  transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  opacity: 0.8;
}

.daily-bar-wrap:hover .daily-bar {
  opacity: 1;
  box-shadow: 0 0 6px hsl(var(--primary) / 0.3);
}

.daily-label {
  position: absolute;
  bottom: -1.25rem;
  font-size: 0.6rem;
  color: hsl(var(--muted-foreground));
  white-space: nowrap;
}

/* Country list expanded */
.country-item-expanded {
  padding: 0.5rem 0;
  border-bottom: 1px solid hsl(var(--border) / 0.5);
}

.country-item-expanded:last-child {
  border-bottom: none;
}

.country-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}

.country-bar-track {
  height: 4px;
  background: hsl(var(--muted));
  border-radius: 2px;
  overflow: hidden;
}

.country-bar-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 2px;
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Window selector buttons */
.window-selector {
  display: flex;
  gap: 0.25rem;
}
