/* ============================================
   Redirect Manager — Design System
   Premium dark theme with glassmorphism
   ============================================ */

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

/* --- Custom Properties --- */
:root {
  /* Surface Colors */
  --bg-root: #06060b;
  --bg-primary: #0a0a12;
  --bg-secondary: #0f0f1a;
  --bg-tertiary: #141422;
  --bg-elevated: #1a1a2e;
  --bg-hover: rgba(255, 255, 255, 0.03);
  --bg-active: rgba(255, 255, 255, 0.06);

  /* Glass */
  --glass-bg: rgba(15, 15, 28, 0.65);
  --glass-border: rgba(255, 255, 255, 0.06);
  --glass-blur: 20px;
  --glass-bg-strong: rgba(15, 15, 28, 0.85);

  /* Text */
  --text-primary: #ececf1;
  --text-secondary: #8b8ba3;
  --text-tertiary: #5a5a72;
  --text-inverse: #06060b;

  /* Accent */
  --accent-primary: #7c5cfc;
  --accent-primary-hover: #8e72ff;
  --accent-primary-muted: rgba(124, 92, 252, 0.12);
  --accent-primary-subtle: rgba(124, 92, 252, 0.06);
  --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #5e8bff 100%);
  --accent-gradient-hover: linear-gradient(135deg, #8e72ff 0%, #72a0ff 100%);

  /* Semantic */
  --success: #34d399;
  --success-muted: rgba(52, 211, 153, 0.12);
  --success-border: rgba(52, 211, 153, 0.25);
  --info: #5e8bff;
  --info-muted: rgba(94, 139, 255, 0.12);
  --info-border: rgba(94, 139, 255, 0.25);
  --warning: #fbbf24;
  --warning-muted: rgba(251, 191, 36, 0.12);
  --danger: #f87171;
  --danger-muted: rgba(248, 113, 113, 0.12);
  --danger-border: rgba(248, 113, 113, 0.25);
  --danger-hover: #fca5a5;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-default: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(124, 92, 252, 0.5);

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 20px rgba(124, 92, 252, 0.15);
  --shadow-glow-strong: 0 0 30px rgba(124, 92, 252, 0.25);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.875rem;
  --text-md: 0.9375rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;

  --leading-tight: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.625;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;
  --transition-spring: 400ms cubic-bezier(0.16, 1, 0.3, 1);

  /* Layout */
  --sidebar-width: 260px;
  --header-height: 64px;
}


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

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

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background: var(--bg-root);
  min-height: 100vh;
  overflow: hidden;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

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

table {
  border-collapse: collapse;
  width: 100%;
}


/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.14);
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.08) transparent;
}


/* --- Layout Shell --- */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}


/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border-right: 1px solid var(--border-subtle);
  position: relative;
  z-index: 100;
}

.sidebar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(124, 92, 252, 0.03) 0%,
    transparent 40%,
    rgba(94, 139, 255, 0.02) 100%);
  pointer-events: none;
}

.sidebar-header {
  padding: var(--space-6);
  border-bottom: 1px solid var(--border-subtle);
  position: relative;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  box-shadow: var(--shadow-glow);
  flex-shrink: 0;
}

.sidebar-title {
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.sidebar-subtitle {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 1px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  overflow-y: auto;
}

.nav-section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: var(--space-4) var(--space-3) var(--space-2);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 450;
  color: var(--text-secondary);
  transition: all var(--transition-base);
  position: relative;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-link.active {
  color: var(--text-primary);
  background: var(--accent-primary-muted);
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent-primary);
  border-radius: var(--radius-full);
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-link.active .nav-icon {
  opacity: 1;
}

.sidebar-footer {
  padding: var(--space-4) var(--space-4);
  border-top: 1px solid var(--border-subtle);
  position: relative;
}

.user-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2);
  border-radius: var(--radius-md);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent-primary);
  flex-shrink: 0;
  text-transform: uppercase;
}

.user-details {
  min-width: 0;
  flex: 1;
}

.user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.user-status {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: var(--radius-full);
  flex-shrink: 0;
  box-shadow: 0 0 6px rgba(52, 211, 153, 0.4);
}


/* --- Main Content --- */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-root);
  position: relative;
}

.main-content::before {
  content: '';
  position: absolute;
  top: -200px;
  right: -200px;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124, 92, 252, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#app {
  flex: 1;
  overflow-y: auto;
  position: relative;
  z-index: 1;
}


/* --- View Container --- */
.view {
  padding: var(--space-8) var(--space-8);
  max-width: 1280px;
  animation: viewFadeIn var(--transition-slow) ease both;
}

@keyframes viewFadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* --- View Header --- */
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-7);
  gap: var(--space-4);
}

.view-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.view-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}

.view-description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}


/* --- Stats Bar --- */
.stats-bar {
  display: flex;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.stat-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 180px;
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  flex-shrink: 0;
}

.stat-icon.purple {
  background: var(--accent-primary-muted);
  color: var(--accent-primary);
}

.stat-icon.green {
  background: var(--success-muted);
  color: var(--success);
}

.stat-icon.blue {
  background: var(--info-muted);
  color: var(--info);
}

.stat-value {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 500;
}


/* --- Toolbar --- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex: 1;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}


/* --- Search Input --- */
.search-wrapper {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-4) var(--space-2) 36px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--transition-base);
  height: 36px;
}

.search-input::placeholder {
  color: var(--text-tertiary);
}

.search-input:hover {
  border-color: var(--border-strong);
}

.search-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
  background: var(--bg-tertiary);
}


/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  transition: all var(--transition-base);
  height: 36px;
  line-height: 1;
  position: relative;
  overflow: hidden;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover {
  background: var(--accent-gradient-hover);
  box-shadow: var(--shadow-md), var(--shadow-glow);
}

.btn-secondary {
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-danger {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid transparent;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.18);
  color: var(--danger-hover);
  border-color: var(--danger-border);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: var(--space-1) var(--space-2);
  height: 30px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.btn-icon {
  width: 36px;
  padding: 0;
}

.btn-sm {
  height: 30px;
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 42px;
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-md);
}

.btn + .btn {
  margin-left: var(--space-2);
}

.btn svg {
  width: 16px;
  height: 16px;
}


/* --- Form Inputs --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.form-input {
  padding: var(--space-2) var(--space-3);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-sm);
  outline: none;
  transition: all var(--transition-base);
  height: 40px;
}

.form-input::placeholder {
  color: var(--text-tertiary);
}

.form-input:hover {
  border-color: var(--border-strong);
}

.form-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-primary-muted);
  background: var(--bg-tertiary);
}

.form-input.mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--danger);
}

.form-row {
  display: flex;
  gap: var(--space-4);
}

.form-row .form-group {
  flex: 1;
}


/* --- Table --- */
.table-container {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.table {
  width: 100%;
}

.table th {
  text-align: left;
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border-subtle);
  background: rgba(255, 255, 255, 0.01);
}

.table td {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--bg-hover);
}

.table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.01);
}

.table tbody tr:nth-child(even):hover {
  background: var(--bg-hover);
}

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

.table .cell-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-primary);
}

.table .cell-path {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--accent-primary-hover);
  font-weight: 500;
}

.table .cell-url {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-secondary);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table .cell-actions {
  text-align: right;
  white-space: nowrap;
}

.table .cell-actions .btn + .btn {
  margin-left: var(--space-1);
}

.table .cell-date {
  color: var(--text-secondary);
  font-size: var(--text-xs);
}

.table .cell-user {
  color: var(--text-secondary);
}

/* Inline edit row */
.table .row-editing td {
  background: var(--accent-primary-subtle);
}

.table .inline-input {
  padding: var(--space-1) var(--space-2);
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  outline: none;
  width: 100%;
  transition: all var(--transition-base);
  height: 32px;
}

.table .inline-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px var(--accent-primary-muted);
}


/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1.6;
}

.badge-create {
  background: var(--success-muted);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-update {
  background: var(--info-muted);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.badge-delete {
  background: var(--danger-muted);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}


/* --- Filter Pills --- */
.filter-pills {
  display: flex;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.filter-pill {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all var(--transition-base);
  height: 32px;
  display: inline-flex;
  align-items: center;
}

.filter-pill:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-pill.active {
  background: var(--accent-primary-muted);
  border-color: var(--accent-primary);
  color: var(--accent-primary-hover);
}


/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-5);
  padding: var(--space-3) 0;
}

.pagination-info {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.pagination-btn {
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: all var(--transition-base);
  height: 34px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--border-strong);
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-page {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  font-weight: 500;
}


/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: overlayFadeIn 200ms ease both;
  padding: var(--space-6);
}

@keyframes overlayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 480px;
  animation: modalSlideIn var(--transition-spring) both;
  overflow: hidden;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: var(--space-6) var(--space-6) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all var(--transition-base);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-body {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.modal-footer {
  padding: 0 var(--space-6) var(--space-6);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

.modal-danger-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.modal-danger-text code {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  color: var(--danger);
}


/* --- Toast Notifications --- */
.toast-container {
  position: fixed;
  top: var(--space-5);
  right: var(--space-5);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--glass-bg-strong);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: toastSlideIn var(--transition-spring) both;
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

.toast.removing {
  animation: toastSlideOut 250ms ease both;
}

@keyframes toastSlideOut {
  to {
    opacity: 0;
    transform: translateX(40px) scale(0.95);
  }
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.toast-message {
  font-size: var(--text-sm);
  font-weight: 450;
  color: var(--text-primary);
  flex: 1;
}

.toast-dismiss {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition-fast);
  border-radius: var(--radius-sm);
}

.toast-dismiss:hover {
  color: var(--text-primary);
}

.toast.toast-success {
  border-left: 3px solid var(--success);
}

.toast.toast-success .toast-icon {
  color: var(--success);
}

.toast.toast-error {
  border-left: 3px solid var(--danger);
}

.toast.toast-error .toast-icon {
  color: var(--danger);
}

.toast.toast-info {
  border-left: 3px solid var(--info);
}

.toast.toast-info .toast-icon {
  color: var(--info);
}


/* --- Loading Spinner --- */
.spinner-container {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) 0;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-default);
  border-top-color: var(--accent-primary);
  border-radius: var(--radius-full);
  animation: spin 0.7s linear infinite;
}

.spinner-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  margin-top: var(--space-3);
  text-align: center;
}


/* --- Empty State --- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-10) var(--space-6);
  text-align: center;
}

.empty-icon {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-xl);
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  margin-bottom: var(--space-5);
  color: var(--text-tertiary);
}

.empty-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
  letter-spacing: -0.02em;
}

.empty-description {
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  max-width: 360px;
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-6);
}


/* --- Utility --- */
.text-mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--text-secondary);
}

.text-xs {
  font-size: var(--text-xs);
}

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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


/* --- Responsive --- */
@media (max-width: 1024px) {
  .view {
    padding: var(--space-6);
  }

  .stats-bar {
    flex-wrap: wrap;
  }

  .stat-card {
    min-width: 140px;
    flex: 1;
  }

  .table .cell-url {
    max-width: 260px;
  }
}

@media (max-width: 768px) {
  :root {
    --sidebar-width: 220px;
  }

  .layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: unset;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    flex-direction: row;
    align-items: center;
    padding: var(--space-3) var(--space-4);
  }

  .sidebar-header {
    border-bottom: none;
    padding: 0;
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 0;
    overflow-x: auto;
    flex: unset;
  }

  .nav-section-label {
    display: none;
  }

  .nav-link.active::before {
    display: none;
  }

  .sidebar-footer {
    border-top: none;
    padding: 0;
    margin-left: auto;
  }

  .user-details {
    display: none;
  }

  .main-content {
    height: calc(100vh - 60px);
  }

  .view {
    padding: var(--space-4);
  }

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

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-left {
    flex-direction: column;
  }

  .search-wrapper {
    max-width: none;
  }

  .table-container {
    overflow-x: auto;
  }

  .stats-bar {
    flex-direction: column;
  }

  .stat-card {
    min-width: unset;
  }

  .filter-pills {
    flex-wrap: wrap;
  }

  .form-row {
    flex-direction: column;
  }

  .modal {
    margin: var(--space-4);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
  }
}
