/* NovaResolve Design System — Global Tokens & Reset */
:root, [data-theme="light"] {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --canvas: #f4f6fa;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-subtle: #f8fafc;
  --ink: #1e293b;
  --ink-heading: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --accent-glow: rgba(37, 99, 235, 0.25);
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red: #e11d48;
  --red-soft: #fff1f2;
  --sidebar-bg: #0f172a;
  --sidebar-border: #1e293b;
  --topbar-bg: #ffffff;
  --topbar-border: #e2e8f0;
  --radius: 14px;
  --sidebar: 240px;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 12px 35px rgba(15, 23, 42, 0.1);
  --dialog-bg: #ffffff;
  --input-bg: #f8fafc;
  --input-border: #d1d5db;
}

[data-theme="dark"] {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --canvas: #090d16;
  --surface: #111726;
  --surface-elevated: #161e31;
  --surface-subtle: #172033;
  --ink: #cbd5e1;
  --ink-heading: #f8fafc;
  --muted: #94a3b8;
  --line: #1e293b;
  --line-strong: #334155;
  --accent: #3b82f6;
  --accent-dark: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.35);
  --blue: #3b82f6;
  --blue-soft: #142240;
  --green: #22c55e;
  --green-soft: #052e16;
  --amber: #f59e0b;
  --amber-soft: #2e1d08;
  --red: #f43f5e;
  --red-soft: #380d15;
  --sidebar-bg: #090d16;
  --sidebar-border: #172033;
  --topbar-bg: #111726;
  --topbar-border: #1e293b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 12px 35px rgba(0, 0, 0, 0.6);
  --dialog-bg: #111726;
  --input-bg: #161e31;
  --input-border: #2c3a52;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(700px circle at var(--mouse-x, 50vw) var(--mouse-y, 30vh), rgba(59, 130, 246, 0.07), transparent 80%);
  opacity: 1;
}

[data-theme="dark"] body {
  background-image: 
    radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.09) 0px, transparent 45%),
    radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.07) 0px, transparent 45%),
    radial-gradient(at 50% 50%, rgba(99, 102, 241, 0.05) 0px, transparent 55%);
  background-attachment: fixed;
}

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

button {
  font-family: inherit;
  font-size: inherit;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  letter-spacing: -0.025em;
  margin: 0;
  color: var(--ink-heading);
}

.skip-link {
  position: absolute;
  top: -60px;
  left: 12px;
  background: var(--accent);
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  z-index: 150;
  font-weight: 600;
  transition: top 150ms ease;
}
.skip-link:focus {
  top: 12px;
}

.app {
  margin-left: var(--sidebar);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 240ms var(--ease);
}

.main {
  max-width: 1600px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 32px 40px;
  flex: 1;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--font-display);
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  color: var(--ink);
  white-space: nowrap;
}
.badge.blue { background: var(--blue-soft); color: var(--blue); border-color: transparent; }
.badge.green { background: var(--green-soft); color: var(--green); border-color: transparent; }
.badge.amber { background: var(--amber-soft); color: var(--amber); border-color: transparent; }
.badge.red { background: var(--red-soft); color: var(--red); border-color: transparent; }
.badge svg { width: 13px; height: 13px; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-heading);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 160ms var(--ease);
}
.button:hover {
  background: var(--surface-subtle);
  border-color: var(--line-strong);
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px var(--accent-glow);
}
.button.primary:hover {
  background: var(--accent-dark);
}
.button svg {
  width: 15px;
  height: 15px;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  border-radius: 50%;
  background: #e0f2fe;
  color: #0369a1;
  width: 32px;
  height: 32px;
  font-size: 11.5px;
  flex-shrink: 0;
}
.avatar.mauve { background: #fce7f3; color: #9d174d; }
.avatar.sand { background: #ccfbf1; color: #115e59; }
.avatar.blue { background: #dbeafe; color: #1e40af; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
  position: relative;
}

[data-theme="dark"] .panel {
  background: rgba(17, 23, 38, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.panel:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

/* Sound Button & Topbar Interactive Tools */
.sound-toggle-btn.muted {
  opacity: 0.5;
}
.sound-toggle-btn.active {
  color: var(--accent);
}

.threshold-hud-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-subtle);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  color: var(--muted);
  cursor: pointer;
  transition: all 150ms ease;
}
.threshold-hud-chip:hover {
  border-color: var(--accent);
  color: var(--ink-heading);
}
.threshold-hud-chip strong {
  color: var(--accent);
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #0f172a;
  color: white;
  padding: 10px 18px;
  border-radius: 24px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-lg);
  z-index: 140;
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-display);
}
.toast svg {
  width: 16px;
  height: 16px;
  color: #4ade80;
}

dialog {
  border: 1px solid var(--line);
  background: var(--dialog-bg);
  color: var(--ink);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 580px;
  width: 90vw;
  z-index: 130;
}
dialog::backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}
.dialog-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dialog-body {
  padding: 22px;
  max-height: 70vh;
  overflow-y: auto;
}
.dialog-actions {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-subtle);
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-top: 36px;
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}
.footer svg { width: 14px; height: 14px; }
