:root {
  --bg-0: #050b1b;
  --bg-1: #061228;
  --bg-2: #0a1d3a;
  --panel: rgba(8, 18, 36, 0.72);
  --panel-2: rgba(9, 22, 44, 0.88);
  --ink: #d7e7ff;
  --muted: #8aa3c7;
  --accent: #27d4ff;
  --accent-2: #4f7bff;
  --violet: #7b6cff;
  --pink: #b779ff;
  --warn: #ffb06a;
  --danger: #ff5d7d;
  --glow: 0 0 18px rgba(39, 212, 255, 0.25);
  --shadow: 0 20px 60px rgba(2, 8, 20, 0.55);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Sora", sans-serif;
  background:
    radial-gradient(1200px 600px at 15% 10%, rgba(39, 212, 255, 0.1), transparent 60%),
    radial-gradient(900px 500px at 85% 20%, rgba(123, 108, 255, 0.12), transparent 60%),
    radial-gradient(900px 600px at 60% 80%, rgba(79, 123, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg-2), var(--bg-0));
  color: var(--ink);
  position: relative;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(400px 280px at 20% 35%, rgba(39, 212, 255, 0.16), transparent 70%),
    radial-gradient(520px 360px at 75% 35%, rgba(123, 108, 255, 0.18), transparent 70%),
    radial-gradient(420px 300px at 60% 75%, rgba(183, 121, 255, 0.12), transparent 70%),
    radial-gradient(300px 240px at 85% 85%, rgba(255, 176, 106, 0.1), transparent 70%);
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140' viewBox='0 0 140 140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 1;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
  padding: 18px 24px 32px;
  position: relative;
  z-index: 2;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
}

.logo {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: radial-gradient(circle at 30% 20%, rgba(39, 212, 255, 0.8), rgba(8, 18, 36, 0.9));
  color: #f7fbff;
  display: grid;
  place-items: center;
  font-weight: 700;
  letter-spacing: 1px;
  box-shadow: var(--glow), inset 0 0 12px rgba(39, 212, 255, 0.4);
}

.title {
  font-weight: 700;
  font-size: 20px;
}

.subtitle {
  color: var(--muted);
  font-size: 13px;
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.dot {
  width: 10px;
  height: 10px;
  background: #4b607f;
  border-radius: 50%;
}

.dot.ok {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(39, 212, 255, 0.2);
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  border: 1px solid rgba(79, 123, 255, 0.2);
  background: rgba(8, 18, 36, 0.7);
  padding: 10px 18px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
}

.tab.active {
  background: linear-gradient(135deg, rgba(39, 212, 255, 0.2), rgba(79, 123, 255, 0.18));
  color: #f7fbff;
  border-color: rgba(39, 212, 255, 0.45);
  box-shadow: var(--glow);
}

.content {
  display: block;
}

.panel {
  display: none;
  background: var(--panel);
  border-radius: 18px;
  padding: 18px;
  border: 1px solid rgba(79, 123, 255, 0.2);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  position: relative;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(39, 212, 255, 0.25), rgba(123, 108, 255, 0.2), rgba(183, 121, 255, 0.1));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.04), transparent 45%);
  pointer-events: none;
}

.panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
}

select,
.filters input,
.btn {
  border-radius: 10px;
  border: 1px solid rgba(79, 123, 255, 0.24);
  padding: 8px 12px;
  background: rgba(8, 18, 36, 0.85);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.filters input::placeholder {
  color: rgba(138, 163, 199, 0.6);
}

.btn {
  background: linear-gradient(135deg, rgba(39, 212, 255, 0.35), rgba(79, 123, 255, 0.2));
  color: #f7fbff;
  border: 1px solid rgba(39, 212, 255, 0.5);
  box-shadow: var(--glow);
}

.btn.ghost {
  background: rgba(8, 18, 36, 0.7);
  border: 1px solid rgba(79, 123, 255, 0.25);
}

.btn.warning {
  background: linear-gradient(135deg, rgba(255, 176, 106, 0.35), rgba(79, 123, 255, 0.1));
  border-color: rgba(255, 176, 106, 0.45);
}

.btn.danger {
  background: linear-gradient(135deg, rgba(255, 93, 125, 0.4), rgba(123, 108, 255, 0.1));
  border-color: rgba(255, 93, 125, 0.55);
}

.session-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 18px;
}

.session-card {
  background: var(--panel-2);
  border-radius: 16px;
  padding: 16px;
  border: 1px solid rgba(79, 123, 255, 0.2);
  box-shadow: var(--shadow), inset 0 0 18px rgba(39, 212, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.session-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.06), transparent 45%);
  pointer-events: none;
}

.kv {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 10px;
  font-size: 13px;
  margin-bottom: 16px;
}

.kv span:nth-child(odd) {
  color: var(--muted);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.note {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.session-list {
  margin-top: 0;
  display: grid;
  gap: 8px;
}

.session-row {
  display: grid;
  grid-template-columns: 1.2fr 1.4fr 1fr 0.6fr;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(79, 123, 255, 0.18);
  border-radius: 12px;
  background: rgba(9, 22, 44, 0.7);
  font-size: 13px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.session-row::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.04), transparent 40%);
  opacity: 0.6;
  pointer-events: none;
}

.session-row:hover {
  border-color: rgba(39, 212, 255, 0.5);
  box-shadow: var(--glow);
}

.session-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #0b1225;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(39, 212, 255, 0.8);
}

.session-tag.trusted {
  background: rgba(79, 123, 255, 0.85);
}

.session-tag.risk {
  background: rgba(255, 176, 106, 0.85);
}

.session-tag.official {
  background: rgba(39, 212, 255, 0.8);
}

.session-empty {
  padding: 12px;
  border: 1px dashed rgba(79, 123, 255, 0.3);
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  background: rgba(9, 22, 44, 0.6);
}

.list {
  display: grid;
  gap: 10px;
}

.list-item {
  padding: 12px;
  border: 1px solid rgba(79, 123, 255, 0.18);
  border-radius: 12px;
  background: rgba(9, 22, 44, 0.7);
  font-size: 13px;
  word-break: break-word;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  border: 1px solid rgba(79, 123, 255, 0.2);
  border-radius: 14px;
  padding: 14px;
  background: rgba(9, 22, 44, 0.7);
  box-shadow: var(--shadow), inset 0 0 18px rgba(39, 212, 255, 0.08);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  will-change: transform;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.04), transparent 45%);
  pointer-events: none;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 22px;
  font-weight: 700;
  margin-top: 6px;
}

.metric small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

.agent {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed rgba(79, 123, 255, 0.25);
  font-size: 13px;
}

.agent:last-child {
  border-bottom: none;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: rgba(9, 22, 44, 0.9);
  color: #f7fbff;
  padding: 10px 14px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.2s ease;
  border: 1px solid rgba(39, 212, 255, 0.4);
  box-shadow: var(--glow);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 8, 18, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.show {
  display: flex;
}

.modal-content {
  background: rgba(9, 22, 44, 0.92);
  border-radius: 16px;
  padding: 16px;
  width: min(520px, 100%);
  border: 1px solid rgba(79, 123, 255, 0.25);
  box-shadow: var(--shadow), inset 0 0 18px rgba(39, 212, 255, 0.08);
  position: relative;
  overflow: hidden;
}

.modal-content::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.05), transparent 45%);
  pointer-events: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

@media (max-width: 980px) {
  .session-grid {
    grid-template-columns: 1fr;
  }
  .ops-grid {
    grid-template-columns: 1fr;
  }
  .filters {
    flex-wrap: wrap;
  }
  .session-row {
    grid-template-columns: 1fr;
  }
}
