:root {
  --bg: #08111f;
  --panel: rgba(10, 20, 36, 0.88);
  --panel-strong: rgba(8, 16, 28, 0.96);
  --panel-soft: rgba(18, 31, 52, 0.75);
  --border: rgba(117, 155, 210, 0.2);
  --border-strong: rgba(117, 155, 210, 0.35);
  --text: #ebf2ff;
  --muted: #93a5c6;
  --accent: #56d6ff;
  --accent-strong: #1cb3e0;
  --success: #47c98a;
  --warning: #ffb347;
  --critical: #ff6d70;
  --shadow: 0 20px 60px rgba(1, 8, 18, 0.45);
  --radius: 18px;
  --mono: "JetBrains Mono", "SFMono-Regular", Menlo, Monaco, Consolas, monospace;
  --sans: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 15% 20%, rgba(35, 133, 177, 0.28), transparent 30%),
    radial-gradient(circle at 85% 12%, rgba(255, 109, 112, 0.18), transparent 22%),
    linear-gradient(180deg, #0a1425 0%, #060c15 45%, #04070d 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(86, 214, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 214, 255, 0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  opacity: 0.35;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

.login-page,
.page-wrapper {
  position: relative;
  z-index: 1;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(10, 23, 42, 0.96), rgba(7, 15, 28, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo-mark {
  position: relative;
  width: 80px;
  height: 80px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(7, 16, 30, 0.78);
  border: 1px solid rgba(86, 214, 255, 0.14);
}

.logo-pulse {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(86, 214, 255, 0.22);
  border-radius: 999px;
  animation: pulse-ring 2.6s ease-in-out infinite;
}

.login-logo,
.navbar-logo {
  margin: 0;
  letter-spacing: 0.35em;
  font-family: var(--mono);
  font-size: 1.3rem;
  font-weight: 700;
}

.label,
.muted,
.status-text,
.stat-item-label,
.feed-empty-sub,
.panel-subtitle,
.helper-text,
.key-note,
.pill-subtle {
  color: var(--muted);
}

.label {
  display: inline-block;
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}

.login-form,
.stack {
  display: grid;
  gap: 16px;
}

.form-group {
  display: grid;
  gap: 8px;
}

.form-label,
.section-title,
.panel-title,
.stat-item-value,
.event-type,
.event-meta strong {
  font-weight: 600;
}

.form-input,
.filter-input,
.filter-select,
.form-textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(117, 155, 210, 0.22);
  background: rgba(3, 10, 18, 0.8);
  color: var(--text);
  outline: none;
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.form-textarea {
  min-height: 100px;
  resize: vertical;
}

.form-input:focus,
.filter-input:focus,
.filter-select:focus,
.form-textarea:focus {
  border-color: rgba(86, 214, 255, 0.65);
  background: rgba(5, 14, 25, 0.9);
  transform: translateY(-1px);
}

.login-error {
  min-height: 20px;
  color: var(--critical);
  font-size: 0.92rem;
}

.btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: rgba(15, 33, 59, 0.9);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, opacity 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: wait;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-strong), var(--accent));
  color: #04111d;
  font-weight: 700;
}

.btn-ghost {
  border-color: var(--border);
  background: rgba(8, 16, 28, 0.66);
}

.btn-danger {
  border-color: rgba(255, 109, 112, 0.35);
  background: rgba(71, 18, 27, 0.55);
}

.btn-signout,
.btn-sm {
  min-height: 38px;
}

.btn-signout {
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(8, 16, 28, 0.7);
  color: var(--muted);
}

.login-btn {
  margin-top: 8px;
}

.navbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(117, 155, 210, 0.12);
  background: rgba(5, 12, 21, 0.78);
  backdrop-filter: blur(16px);
}

.navbar-left,
.navbar-right,
.nav-logo,
.nav-links,
.filter-bar,
.event-header,
.event-meta-row,
.timeline-header,
.project-card-header,
.project-actions,
.project-key-row,
.pill-row,
.connection-status {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links {
  gap: 6px;
}

.nav-link {
  padding: 10px 14px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  transition: background 160ms ease, color 160ms ease;
}

.nav-link.active,
.nav-link:hover {
  background: rgba(86, 214, 255, 0.12);
  color: var(--text);
}

.status-dot-ws {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  display: inline-block;
  background: var(--warning);
  box-shadow: 0 0 0 6px rgba(255, 179, 71, 0.12);
}

.status-dot-ws.connected {
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(71, 201, 138, 0.12);
}

.status-dot-ws.disconnected {
  background: var(--critical);
  box-shadow: 0 0 0 6px rgba(255, 109, 112, 0.12);
}

.navbar-divider {
  width: 1px;
  height: 22px;
  background: rgba(117, 155, 210, 0.16);
}

.page-wrapper {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 22px 0 48px;
}

.stats-bar,
.filter-bar,
.project-layout,
.timeline-layout {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.stats-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.stat-item {
  padding: 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(12, 26, 44, 0.92), rgba(7, 16, 28, 0.86));
  border: 1px solid rgba(117, 155, 210, 0.12);
}

.stat-item-value {
  display: block;
  font-family: var(--mono);
  font-size: 1.7rem;
  letter-spacing: 0.04em;
}

.stat-critical {
  color: var(--critical);
}

.filter-bar {
  margin-top: 18px;
  flex-wrap: wrap;
  padding: 16px;
}

.filter-select {
  width: 180px;
}

.filter-input {
  width: 220px;
}

.toggle-label {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.toggle-cb {
  accent-color: var(--accent);
}

.view-container {
  margin-top: 18px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.live-feed {
  display: grid;
  gap: 14px;
}

.feed-empty,
.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 280px;
  text-align: center;
  border: 1px dashed rgba(117, 155, 210, 0.18);
  border-radius: 24px;
  background: rgba(8, 16, 28, 0.6);
}

.feed-empty p,
.empty-state p {
  margin: 0;
}

.event-card,
.panel,
.project-card,
.key-card,
.summary-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(10, 21, 37, 0.94), rgba(6, 13, 22, 0.9));
  box-shadow: var(--shadow);
}

.event-card {
  overflow: hidden;
}

.event-card::before {
  content: "";
  display: block;
  height: 3px;
  background: rgba(117, 155, 210, 0.24);
}

.event-card.severity-critical::before {
  background: var(--critical);
}

.event-card.severity-warning::before {
  background: var(--warning);
}

.event-card.severity-info::before {
  background: var(--accent);
}

.event-card.severity-debug::before {
  background: rgba(117, 155, 210, 0.3);
}

.event-body {
  padding: 18px;
  display: grid;
  gap: 12px;
}

.event-header {
  justify-content: space-between;
  align-items: flex-start;
}

.event-type {
  font-family: var(--mono);
  font-size: 1rem;
}

.event-timestamp {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.84rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.pill-info {
  background: rgba(86, 214, 255, 0.12);
  color: var(--accent);
  border-color: rgba(86, 214, 255, 0.25);
}

.pill-warning {
  background: rgba(255, 179, 71, 0.12);
  color: var(--warning);
  border-color: rgba(255, 179, 71, 0.22);
}

.pill-critical {
  background: rgba(255, 109, 112, 0.12);
  color: var(--critical);
  border-color: rgba(255, 109, 112, 0.26);
}

.pill-debug {
  background: rgba(147, 165, 198, 0.12);
  color: #c9d4ec;
  border-color: rgba(147, 165, 198, 0.22);
}

.pill-project {
  background: rgba(117, 155, 210, 0.12);
  color: #ced9ef;
  border-color: rgba(117, 155, 210, 0.22);
}

.pill-tag,
.pill-subtle {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(117, 155, 210, 0.16);
}

.event-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.event-meta-item {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(117, 155, 210, 0.1);
}

.payload-block,
.code-block {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(3, 9, 16, 0.92);
  border: 1px solid rgba(117, 155, 210, 0.12);
  color: #d6e6ff;
  font-family: var(--mono);
  font-size: 0.84rem;
  white-space: pre-wrap;
  overflow-x: auto;
}

.panel,
.summary-card,
.project-card,
.key-card {
  padding: 18px;
}

.view-grid,
.summary-grid,
.project-grid,
.project-detail-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.summary-card .panel-title {
  margin-bottom: 10px;
}

.project-layout,
.timeline-layout {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.project-layout {
  grid-template-columns: minmax(320px, 1.1fr) minmax(0, 1.4fr);
}

.timeline-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

.section-title,
.panel-title {
  margin: 0 0 8px;
}

.project-grid {
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.project-card {
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease;
}

.project-card:hover,
.project-card.active {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.project-card-header {
  justify-content: space-between;
  align-items: flex-start;
}

.project-slug {
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.82rem;
}

.project-stat-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.project-stat {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.project-stat strong {
  display: block;
  font-family: var(--mono);
  font-size: 1.12rem;
}

.project-key-list,
.timeline-list {
  display: grid;
  gap: 12px;
}

.project-key-row {
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
}

.timeline-entry {
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(117, 155, 210, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.timeline-entry h4 {
  margin: 0 0 8px;
  font-family: var(--mono);
  font-size: 0.92rem;
}

.timeline-group-label {
  margin-bottom: 12px;
  font-family: var(--mono);
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.timeline-aside {
  display: grid;
  gap: 16px;
}

.notice {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 179, 71, 0.18);
  background: rgba(52, 31, 6, 0.42);
  color: #f8d9a4;
}

.inline-reveal {
  margin-top: 14px;
  padding: 14px;
  border-radius: 16px;
  border: 1px solid rgba(71, 201, 138, 0.18);
  background: rgba(6, 37, 22, 0.45);
}

.helper-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.hidden {
  display: none !important;
}

@keyframes pulse-ring {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.48;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.1;
  }
}

@media (max-width: 1120px) {
  .stats-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .project-layout,
  .timeline-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .navbar,
  .navbar-left,
  .navbar-right {
    flex-wrap: wrap;
  }

  .page-wrapper {
    width: min(100vw - 20px, 100%);
  }

  .stats-bar {
    grid-template-columns: 1fr;
  }

  .filter-select,
  .filter-input {
    width: 100%;
  }

  .toggle-label {
    margin-left: 0;
  }
}
