:root {
  color-scheme: dark;
  --bg: #09070f;
  --panel: #14101f;
  --panel-2: #1a1328;
  --text: #f5f3ff;
  --muted: #a7a1b8;
  --line: rgba(196, 181, 253, 0.16);
  --brand: #8b5cf6;
  --brand-2: #c084fc;
  --accent: #fb7185;
  --ok: #22c55e;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 332px minmax(0, 1fr);
  background: var(--bg);
  color: var(--text);
  font-family: Inter, Segoe UI, Arial, sans-serif;
}

button,
input {
  font: inherit;
}

.login-view {
  position: relative;
  grid-column: 1 / -1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.18), transparent 34%),
    var(--bg);
}

.login-paths {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: rgba(232, 221, 255, 0.62);
  opacity: 0.72;
  transform: translateZ(0);
}

.login-paths svg {
  position: absolute;
  inset: -8%;
  width: 116%;
  height: 116%;
  filter: drop-shadow(0 0 18px rgba(139, 92, 246, 0.18));
  animation: pathsFloat 18s ease-in-out infinite alternate;
}

.login-paths path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 1.1;
  opacity: 0.16;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: pathDraw 12s ease-in-out infinite;
}

.login-paths path:nth-child(2n) {
  opacity: 0.24;
  animation-delay: -2s;
}

.login-paths path:nth-child(3n) {
  stroke-width: 1.6;
  animation-delay: -5s;
}

.login-paths path:nth-child(4n) {
  opacity: 0.1;
  animation-delay: -8s;
}

.panel-paths {
  z-index: 0;
  opacity: 0.46;
  color: rgba(216, 180, 254, 0.72);
}

.panel-paths svg {
  inset: -14%;
  width: 128%;
  height: 128%;
  filter: drop-shadow(0 0 14px rgba(139, 92, 246, 0.12));
  animation-duration: 24s;
}

.panel-paths path {
  opacity: 0.2;
  animation-duration: 18s;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(18, 13, 29, 0.86);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
}

.login-brand {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 8px;
}

.login-avatar {
  width: 86px;
  height: 86px;
  border-radius: 22px;
  object-fit: cover;
  border: 2px solid rgba(192, 132, 252, 0.72);
  box-shadow: 0 0 34px rgba(139, 92, 246, 0.45);
}

.login-card h1 {
  margin-bottom: 4px;
}

.login-card h1 span {
  display: inline-block;
  color: transparent;
  background: linear-gradient(90deg, #fff, rgba(216, 180, 254, 0.84));
  background-clip: text;
  -webkit-background-clip: text;
  animation: titleLetter 720ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.login-card .eyebrow {
  margin: 4px 0 0;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.login-card input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #100c19;
  outline: none;
}

.login-card input:focus {
  border-color: rgba(192, 132, 252, 0.75);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.login-card button {
  height: 44px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.login-card button:hover {
  background: #7c3aed;
}

#loginStatus {
  min-height: 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@keyframes pathsFloat {
  from {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }

  to {
    transform: translate3d(1.5%, 1%, 0) scale(1.015);
  }
}

@keyframes pathDraw {
  0% {
    stroke-dashoffset: 620;
  }

  50% {
    stroke-dashoffset: 0;
  }

  100% {
    stroke-dashoffset: -620;
  }
}

@keyframes titleLetter {
  from {
    opacity: 0;
    transform: translateY(42px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-paths svg,
  .login-paths path,
  .login-card h1 span {
    animation: none;
  }

  .login-paths path {
    stroke-dashoffset: 0;
  }
}

.sidebar {
  min-height: 100vh;
  padding: 22px;
  background: #0d0a15;
  border-right: 1px solid var(--line);
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.brand-avatar {
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(192, 132, 252, 0.72);
  box-shadow: 0 0 28px rgba(139, 92, 246, 0.38);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0;
}

.brand small {
  color: var(--muted);
  margin-top: 3px;
}

.search span {
  display: block;
  margin-bottom: 7px;
  color: #c4b5fd;
  font-size: 13px;
}

.search input,
.form-row input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #100c19;
  outline: none;
}

.search input:focus,
.form-row input:focus {
  border-color: rgba(192, 132, 252, 0.75);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

.group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 4px;
}

.group-item {
  width: 100%;
  min-height: 62px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px;
  text-align: left;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.group-item:hover,
.group-item.active {
  background: #171124;
  border-color: rgba(192, 132, 252, 0.28);
}

.group-item.active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.group-avatar,
.group-hero-avatar {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #fff;
  font-weight: 800;
  background: #31214d;
  border: 1px solid rgba(192, 132, 252, 0.35);
  overflow: hidden;
}

.group-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  font-size: 15px;
}

.group-avatar img,
.group-hero-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.group-avatar span,
.group-hero-avatar span {
  position: relative;
  z-index: 0;
}

.group-copy {
  min-width: 0;
  display: block;
}

.group-copy strong,
.group-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.main {
  position: relative;
  isolation: isolate;
  min-width: 0;
  padding: 26px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 0%, rgba(139, 92, 246, 0.10), transparent 32%),
    radial-gradient(circle at 20% 55%, rgba(192, 132, 252, 0.08), transparent 28%);
}

.main > :not(.panel-paths) {
  position: relative;
  z-index: 1;
}

.topbar,
.panel-heading,
.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  margin-bottom: 22px;
}

.current-group {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 14px;
}

.group-hero-avatar {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  font-size: 24px;
  box-shadow: 0 18px 40px rgba(139, 92, 246, 0.18);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-2);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 17px;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: #151020;
  cursor: pointer;
}

.icon-button:hover {
  border-color: rgba(192, 132, 252, 0.48);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.bot-status {
  margin-bottom: 18px;
}

.bot-card {
  display: grid;
  gap: 16px;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.system-grid article {
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #100c19;
}

.system-grid span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.system-grid strong {
  display: block;
  color: #fff;
  font-size: 24px;
  overflow-wrap: anywhere;
}

#statusChart {
  width: 100%;
  height: 180px;
  display: block;
  border-radius: 8px;
  background: #14101f;
}

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

.session-list article {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 12, 25, 0.78);
}

.session-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fb7185;
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.6);
}

.session-dot.online {
  background: var(--ok);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.6);
}

.session-copy {
  min-width: 0;
}

.session-copy strong,
.session-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-copy small {
  margin-top: 3px;
  color: var(--muted);
}

.session-list b {
  color: var(--muted);
  font-size: 12px;
}

.metrics article,
.panel {
  background: rgba(20, 16, 31, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metrics article {
  padding: 18px;
  background: rgba(21, 16, 32, 0.86);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.metrics strong {
  font-size: 31px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 18px;
}

.panel-heading {
  margin-bottom: 16px;
}

.panel-heading span,
#saveStatus {
  color: var(--muted);
  font-size: 13px;
}

.group-settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row {
  align-items: end;
}

.form-row label {
  flex: 1;
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.file-picker {
  position: relative;
  width: 100%;
  min-height: 42px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: #100c19;
}

.file-picker input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-button {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 12px;
  color: #fff;
  background: #2b2040;
  border: 1px solid rgba(192, 132, 252, 0.28);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.file-name {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.file-picker:hover .file-button {
  background: #3a2a59;
  border-color: rgba(192, 132, 252, 0.48);
}

.form-row button {
  height: 42px;
  min-width: 92px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
}

.form-row button:hover {
  background: #7c3aed;
}

.chart-panel canvas {
  width: 100%;
  height: 300px;
  display: block;
  border-radius: 8px;
  background: #14101f;
}

.protections-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 10px;
}

.insights-grid {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.blacklist-grid,
.logs-list {
  display: grid;
  gap: 10px;
  max-height: 320px;
  overflow: auto;
  padding-right: 4px;
}

.blacklist-grid article,
.logs-list article {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(26, 19, 40, 0.82);
}

.blacklist-grid strong,
.blacklist-grid span,
.logs-list strong,
.logs-list small,
.log-action {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.blacklist-grid strong,
.logs-list strong {
  color: #fff;
  font-size: 14px;
}

.blacklist-grid span,
.logs-list small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.log-action {
  margin-bottom: 6px;
  color: var(--brand-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.empty-state {
  display: block;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(16, 12, 25, 0.74);
}

.support-panel {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.support-panel p {
  margin: 8px 0 0;
  color: var(--muted);
}

.support-panel a {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 0 16px;
  color: #fff;
  background: #22c55e;
  text-decoration: none;
  font-weight: 800;
  white-space: nowrap;
}

.support-panel a:hover {
  background: #16a34a;
}

.access-panel {
  margin-top: 18px;
}

.access-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
}

.access-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.access-grid span,
.access-grid strong,
.access-grid small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-grid span {
  color: var(--muted);
  font-size: 13px;
}

.access-grid strong {
  margin-top: 7px;
  color: #fff;
  font-size: 19px;
}

.access-grid small {
  margin-top: 6px;
  color: #7c728d;
}

.toggle {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.toggle span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-panel {
  margin-top: 18px;
}

.schedule-enabled {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-enabled input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

#scheduleForm {
  display: grid;
  gap: 16px;
}

.schedule-time {
  width: min(220px, 100%);
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-time input {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--text);
  background: #100c19;
  outline: none;
}

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

.schedule-days label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.schedule-days textarea {
  width: 100%;
  min-height: 105px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--text);
  background: #100c19;
  outline: none;
  font: inherit;
}

.schedule-time input:focus,
.schedule-days textarea:focus {
  border-color: rgba(192, 132, 252, 0.75);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
}

#scheduleForm > button {
  justify-self: end;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  color: #fff;
  background: var(--brand);
  cursor: pointer;
  font-weight: 800;
}

.switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: 0 0 auto;
}

.switch input {
  opacity: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #4b3b63;
  cursor: pointer;
}

.slider::before {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 160ms ease;
}

.switch input:checked + .slider {
  background: var(--brand);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

@media (max-width: 1050px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
  }

  .group-list {
    max-height: 260px;
  }

  .metrics,
  .system-grid,
  .session-list,
  .workspace,
  .insights-grid,
  .access-grid,
  .protections-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    display: block;
  }

  .main,
  .sidebar {
    padding: 14px;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }

  .brand {
    width: min(520px, 100%);
    justify-content: center;
    text-align: center;
  }

  .search {
    width: min(520px, 100%);
  }

  .group-list {
    width: 100%;
    max-height: none;
    display: flex;
    justify-content: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 0 8px;
  }

  .group-item {
    flex: 0 0 min(520px, 86vw);
  }

  .group-item:only-child {
    margin-inline: auto;
  }

  .metrics,
  .system-grid,
  .session-list,
  .workspace,
  .insights-grid,
  .access-grid,
  .protections-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .form-row,
  .support-panel,
  .schedule-panel .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar {
    position: relative;
    text-align: center;
  }

  .current-group {
    flex-direction: column;
    justify-content: center;
  }

  .icon-button {
    position: absolute;
    top: 0;
    right: 0;
  }

  h1 {
    font-size: 22px;
  }

  .panel {
    padding: 14px;
  }

  .metrics article {
    text-align: center;
  }

  .form-row button {
    width: 100%;
  }

  .schedule-panel {
    text-align: center;
  }

  .schedule-enabled,
  .schedule-time {
    justify-self: center;
  }

  .schedule-days {
    grid-template-columns: 1fr;
    text-align: left;
  }

  #scheduleForm > button {
    width: 100%;
    justify-self: stretch;
  }

  .chart-panel canvas {
    height: 240px;
  }

  #statusChart {
    height: 160px;
  }

  .support-panel {
    text-align: center;
  }

  .support-panel a {
    width: 100%;
  }
}
