:root {
  color-scheme: dark;
  --bg: #06080f;
  --bg-elevated: rgba(16, 20, 32, 0.72);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8edf7;
  --muted: #8b95a8;
  --accent: #5b8cff;
  --accent-2: #3ee0c5;
  --danger: #ff5c7a;
  --warn: #ffb020;
  --radius: 12px;
  --font: 'Plus Jakarta Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: -0.01em;
}

.bg-ink { background: var(--bg); }

.bg-aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42rem 32rem at 8% -8%, rgba(91, 140, 255, 0.18), transparent 58%),
    radial-gradient(36rem 28rem at 92% 4%, rgba(62, 224, 197, 0.1), transparent 52%),
    radial-gradient(24rem 20rem at 50% 100%, rgba(120, 90, 255, 0.06), transparent 60%);
}

.bg-aurora::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
}

.glass {
  background: var(--bg-elevated);
  border-color: var(--border);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.mono { font-family: var(--mono); font-feature-settings: 'ss01' 1; }

.input {
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.7rem 0.85rem;
  color: #fff;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.input::placeholder { color: #6b7588; }
.input:focus {
  border-color: rgba(91, 140, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
  background: rgba(0, 0, 0, 0.38);
}

.btn-primary {
  background: linear-gradient(135deg, #5b8cff 0%, #3ee0c5 100%);
  color: #061018;
  font-weight: 700;
  padding: 0.55rem 1.05rem;
  border-radius: 10px;
  border: none;
  box-shadow: 0 8px 24px rgba(91, 140, 255, 0.22);
  transition: transform 0.15s ease, filter 0.15s ease, opacity 0.15s ease;
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.45; transform: none; box-shadow: none; }

.btn-ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem 0.8rem;
  border-radius: 10px;
  color: var(--text);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-ghost:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
  color: #fff;
}

header.glass {
  border-bottom: 1px solid var(--border) !important;
  background: rgba(8, 11, 20, 0.78) !important;
}

#sidebar.glass {
  background: rgba(8, 11, 20, 0.55) !important;
  border-right-color: var(--border) !important;
}

#sidebar .uppercase {
  letter-spacing: 0.14em;
  font-weight: 600;
  color: #6f7a8d !important;
}

.domain-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.domain-item:hover { background: var(--surface-hover); }
.domain-item.active {
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.16), rgba(62, 224, 197, 0.06));
  border-color: rgba(91, 140, 255, 0.28);
}
.domain-branch { font-size: 0.9em; }

.tree-group {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.2rem;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.tree-group.has-sel {
  border-color: rgba(91, 140, 255, 0.28);
  background: rgba(91, 140, 255, 0.04);
}

.tree-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.55rem;
  border-radius: 10px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s ease;
}
.tree-toggle:hover { background: var(--surface-hover); }

.tree-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

.tree-chevron-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  padding: 0.45rem 0.55rem;
  margin: 0.15rem 0 0.15rem 0.15rem;
  border-radius: 8px;
  color: #a8b2c4;
  min-width: 2rem;
  min-height: 2rem;
  display: grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tree-chevron-btn:hover {
  background: rgba(91, 140, 255, 0.2);
  border-color: rgba(91, 140, 255, 0.35);
  color: #fff;
}
.tree-chevron-icon {
  font-size: 0.62rem;
  line-height: 1;
  display: block;
}

.domain-group-hit.active,
.tree-group.has-sel > .tree-toggle-row .domain-group-hit {
  background: rgba(91, 140, 255, 0.1);
  border-radius: 10px;
}

.group-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  padding: 0.2rem 0.5rem;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(91, 140, 255, 0.28), rgba(62, 224, 197, 0.12));
  border: 1px solid rgba(91, 140, 255, 0.35);
  color: #d7e4ff;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tree-members {
  margin-left: 0.55rem;
  padding-left: 0.45rem;
  border-left: 1px solid rgba(91, 140, 255, 0.28);
  overflow: hidden;
  max-height: 480px;
  transition: max-height 0.22s ease, opacity 0.18s ease;
  opacity: 1;
}
.tree-members.is-minimized {
  max-height: 0;
  opacity: 0;
  border-left-color: transparent;
  pointer-events: none;
}

.tree-elbow {
  display: inline-block;
  width: 12px;
  height: 10px;
  margin-top: 5px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.4);
  flex-shrink: 0;
}

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 92, 122, 0.18);
}
.badge-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px rgba(255, 176, 32, 0.16);
}

.sev-major { border-left: 3px solid var(--danger); }
.sev-minor { border-left: 3px solid var(--warn); }
.sev-info { border-left: 3px solid #64748b; }

#detail .glass {
  border: 1px solid var(--border);
  background: rgba(12, 16, 28, 0.55);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 12px 40px rgba(0, 0, 0, 0.22);
  transition: border-color 0.2s ease, transform 0.2s ease;
}
#detail .glass:hover { border-color: rgba(255, 255, 255, 0.12); }

#detail h1 {
  letter-spacing: -0.03em;
}

#empty-state p:first-child {
  letter-spacing: -0.02em;
}

#modal .glass {
  border: 1px solid var(--border-strong);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

#notif-dropdown {
  border: 1px solid var(--border);
  background: rgba(10, 14, 24, 0.92) !important;
}

#login-form.glass {
  border: 1px solid var(--border-strong);
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.18); }
