:root {
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --surface: #0f172a;
  --panel: #1e293b;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --font-sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --color-text: #e2e8f0;
  --color-text-inverse: #0f172a;
  --color-bg: #0f172a;
  --focus-ring: #ffb700;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgba(100, 116, 139, 0.5) transparent;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background-color: rgba(100, 116, 139, 0.5);
  border-radius: 4px;
  transition: background-color 0.2s;
}

::-webkit-scrollbar-thumb:hover {
  background-color: rgba(100, 116, 139, 0.8);
}

::selection {
  background-color: rgba(59, 130, 246, 0.4);
  color: #ffffff;
}

:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6,
p,
span,
a,
label,
li {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

img,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

.hidden {
  display: none !important;
}

/* === Components, Animations & UX Defenses === */

.bg-surface { background-color: var(--surface); }
.bg-panel\/80 { background-color: rgba(30, 41, 59, 0.8); }
.shadow-card { box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); }
.shadow-glow { box-shadow: 0 0 20px rgba(59, 130, 246, 0.6); }

#bg-decoration { z-index: 1; }
#bg-decoration > div {
  background: radial-gradient(circle, rgba(59,130,246,0.5) 0%, rgba(29,78,216,0.2) 40%, transparent 70%);
}
#bg-decoration > div:first-child {
  background: radial-gradient(circle, rgba(59,130,246,0.4) 0%, transparent 60%);
}
#bg-decoration > div:last-child {
  background: radial-gradient(circle, rgba(29,78,216,0.3) 0%, transparent 65%);
}

#sidebar {
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
}
#sidebar-logo {
  box-shadow: 0 0 25px rgba(59,130,246,0.7);
}
#sidebar-nav a {
  position: relative;
}
#sidebar-nav a.active::after {
  content: '';
  position: absolute;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 60%;
  background: var(--brand-400);
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(96,165,250,0.8);
}

#top-header {
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
}

#welcome-banner {
  position: relative;
  overflow: hidden;
}
#welcome-banner::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -5%;
  width: 350px;
  height: 350px;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
  pointer-events: none;
}
#welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -40%;
  left: 10%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  pointer-events: none;
}

#stat-card-1, #stat-card-2, #stat-card-3, #stat-card-4 {
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
#stat-card-1:hover, #stat-card-2:hover, #stat-card-3:hover, #stat-card-4:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4);
}

#btn-create-report, #btn-view-docs {
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}
#btn-create-report:active, #btn-view-docs:active {
  transform: translateY(1px) scale(0.98);
}

#live-badge .animate-pulse {
  animation: pulse-soft 2s infinite;
}
#notification-dot {
  animation: pulse-soft 1.5s infinite;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes scale-bounce {
  0% { transform: scale(0.8); opacity: 0; }
  60% { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes pulse-soft {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
@keyframes skeleton-loading {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes glow-pulse {
  0%, 100% { box-shadow: 0 0 5px rgba(59,130,246,0.5); }
  50% { box-shadow: 0 0 25px rgba(59,130,246,0.8); }
}

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.15) 50%, rgba(255,255,255,0.05) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s infinite;
}
.animate-fade-in { animation: fade-in 0.5s ease forwards; }
.animate-slide-up { animation: slide-up 0.4s ease forwards; }
.animate-scale-bounce { animation: scale-bounce 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards; }

.dark .bg-surface { background-color: #0f172a; }
.dark .bg-panel\/80 { background-color: rgba(30,41,59,0.8); }
.dark .shadow-card { box-shadow: 0 4px 12px rgba(0,0,0,0.3); }
.dark .shadow-glow { box-shadow: 0 0 20px rgba(59,130,246,0.6); }
.dark .border-slate-700 { border-color: #334155; }
.dark .bg-slate-900\/80 { background-color: rgba(15,23,42,0.8); }
.dark .bg-slate-800 { background-color: #1e293b; }
.dark .text-slate-200 { color: #e2e8f0; }
.dark .text-slate-300 { color: #cbd5e1; }
.dark .text-slate-400 { color: #94a3b8; }
.dark .text-white { color: #ffffff; }
.dark .hover\:bg-slate-700:hover { background-color: #334155; }
.dark .hover\:bg-brand-700:hover { background-color: #1d4ed8; }
.dark .hover\:bg-brand-50:hover { background-color: #eff6ff; }
.dark .active\:bg-brand-100:active { background-color: #dbeafe; }

button,
a,
[role="button"],
input[type="button"],
input[type="submit"] {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

button:hover,
a:hover,
[role="button"]:hover,
input[type="button"]:hover,
input[type="submit"]:hover {
  transform: translateY(-1px);
}

button:active,
a:active,
[role="button"]:active,
input[type="button"]:active,
input[type="submit"]:active {
  transform: translateY(1px) scale(0.98);
}

.modal,
.dialog,
.overlay,
.popover,
.dropdown-menu,
.tooltip,
.modal-backdrop {
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s;
}

.modal.active,
.dialog.active,
.overlay.active,
.popover.active,
.dropdown-menu.active,
.tooltip.active,
.modal-backdrop.active {
  pointer-events: auto;
  opacity: 1;
  visibility: visible;
}

.z-background { z-index: 1; }
.z-sticky { z-index: 20; }
.z-floating { z-index: 35; }
.z-overlay { z-index: 40; }
.z-modal { z-index: 45; }
.z-toast { z-index: 9999 !important; }