@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-latin-400-normal.woff2");
}
@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-cyrillic-400-normal.woff2");
  unicode-range: U+0400-052F;
}
@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-latin-600-normal.woff2");
  font-weight: 600;
}
@font-face {
  font-family: Inter;
  src: url("/assets/fonts/inter-cyrillic-600-normal.woff2");
  font-weight: 600;
  unicode-range: U+0400-052F;
}
@font-face {
  font-family: Montserrat;
  src: url("/assets/fonts/montserrat-latin-800-normal.woff2");
  font-weight: 800;
}
@font-face {
  font-family: Montserrat;
  src: url("/assets/fonts/montserrat-cyrillic-800-normal.woff2");
  font-weight: 800;
  unicode-range: U+0400-052F;
}
:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --surface: #121217;
  --raised: #1a1a22;
  --hover: #22222c;
  --line: #292931;
  --ink: #f4f3f8;
  --secondary: #a3a2b1;
  --muted: #767583;
  --accent: #8b5cf6;
  --primary: #7435db;
  --selected: #251d38;
  --error: #ef8d98;
  --radius: 12px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f3f6;
  --surface: #fff;
  --raised: #eaeaf0;
  --hover: #e2e1eb;
  --line: #d9d7e1;
  --ink: #211a2d;
  --secondary: #64616e;
  --muted: #716b7d;
  --accent: #7035cd;
  --selected: #eee7fa;
  --error: #b92943;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font:
    14px/1.55 Inter,
    sans-serif;
  transition:
    background-color 0.25s,
    color 0.25s;
}
button,
input,
textarea {
  font: inherit;
}
button,
a,
input,
textarea {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  color: inherit;
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.6;
}
a {
  color: inherit;
  text-decoration: none;
}
svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.6;
  flex-shrink: 0;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  line-height: 1.25;
}
h1 {
  font:
    800 clamp(24px, 2.6vw, 34px) / 1.2 Montserrat,
    sans-serif;
  letter-spacing: -1px;
}
h2 {
  font-size: 18px;
  font-weight: 600;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
.muted {
  color: var(--secondary);
}
.meta {
  font-size: 12px;
  color: var(--secondary);
}
.mono {
  font-variant-numeric: tabular-nums;
}
.skip {
  position: fixed;
  top: -60px;
  left: 16px;
  z-index: 100;
  background: var(--ink);
  color: var(--bg);
  padding: 12px;
}
.skip:focus {
  top: 12px;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
button,
a {
  transition:
    background 0.18s,
    color 0.18s,
    border-color 0.18s,
    transform 0.18s var(--ease);
}
button:active,
.button:active {
  transform: translateY(1px);
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  font-weight: 600;
  white-space: nowrap;
}
.button:hover {
  background: var(--hover);
  border-color: var(--muted);
}
.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.primary:hover {
  background: #8248e5;
  border-color: #9d76e2;
}
.quiet {
  background: transparent;
}
.danger {
  color: var(--error);
}
.icon-button {
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
}
.icon-button:hover {
  background: var(--hover);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -1px;
}
.brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.brand span span {
  color: var(--accent);
}
.topbar {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  box-shadow: inset 0 -1px var(--line);
  background: var(--bg);
  gap: 16px;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.preview-note {
  font-size: 12px;
  color: var(--secondary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.preview-note:before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
}
.layout {
  min-height: calc(100dvh - 84px);
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  padding: 24px;
}
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.sidebar-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  flex: 1;
}
.bot-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
  cursor: pointer;
}
.bot-switch img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 12px;
}
.bot-switch .copy {
  min-width: 0;
  flex: 1;
}
.copy strong,
.copy small {
  display: block;
}
.copy small {
  color: var(--secondary);
  font-size: 12px;
}
.section-label {
  font-size: 12px;
  color: var(--muted);
  margin: 24px 12px 8px;
}
.nav-item {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: center;
  text-align: left;
  padding: 10px 12px;
  min-height: 44px;
  margin: 3px 0;
  border: 0;
  border-radius: 9px;
  color: var(--secondary);
  background: transparent;
  position: relative;
}
.nav-item:hover {
  background: var(--raised);
  color: var(--ink);
}
.nav-item.active {
  background: var(--selected);
  color: var(--ink);
}
.nav-item.active:after {
  content: "";
  width: 3px;
  height: 18px;
  border-radius: 3px;
  background: var(--accent);
  position: absolute;
  right: 8px;
}
.nav-item svg {
  color: var(--secondary);
}
.profile {
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 16px;
  padding: 12px;
  position: relative;
}
.profile-main {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--selected);
  color: var(--accent);
  object-fit: cover;
  flex-shrink: 0;
}
.profile .copy {
  flex: 1;
  min-width: 0;
}
.profile .copy strong {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile .copy small {
  font-size: 10px;
  white-space: nowrap;
}
.role {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border: 1px solid #7152a363;
  border-radius: 5px;
  font-size: 10px;
  color: #c6acf8;
  background: #7c3aed15;
}
.profile-toggle {
  background: none;
  border: 0;
  padding: 8px;
  min-width: 36px;
  min-height: 44px;
  display: grid;
  place-items: center;
}
.profile-toggle svg {
  transition: transform 0.24s var(--ease);
  transform: rotate(180deg);
}
.profile.open .profile-toggle svg {
  transform: rotate(0deg);
}
.profile-menu {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.24s var(--ease);
}
.profile.open .profile-menu {
  grid-template-rows: 1fr;
}
.profile-menu > div {
  overflow: hidden;
}
.profile-menu-inner {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}
.profile-menu .nav-item {
  font-size: 12px;
}
.language-options {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  padding: 4px;
}
.language-options button {
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 6px;
}
.flag {
  width: 18px;
  height: 12px;
  display: inline-block;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid #ffffff20;
}
.flag.ru {
  background: linear-gradient(#fff 33%, #2751ae 33%, #2751ae 66%, #d94848 66%);
}
.flag.uk {
  background: linear-gradient(#2864c1 50%, #f0cc45 50%);
}
.flag.en {
  background: repeating-linear-gradient(#c54350 0 1px, #fff 1px 2px);
  position: relative;
}
.flag.en:before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 8px;
  height: 7px;
  background: #33518a;
}
.content {
  min-width: 0;
  max-width: 1440px;
  width: 100%;
  margin-inline: auto;
  padding: 12px 24px 32px;
}
.loading-panel {
  min-height: 320px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}
.loading-panel h1 { font-size: clamp(20px, 2vw, 28px); }
.loading-panel p { color: var(--secondary); }
.page-heading > :last-child {
  margin-left: auto;
  flex: 0 0 auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin: 8px 0 32px;
}
.eyebrow {
  font-size: 12px;
  color: var(--secondary);
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.page-heading p {
  color: var(--secondary);
  margin-top: 10px;
  max-width: 600px;
}
.server-picker {
  position: relative;
  min-width: 216px;
}
.select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  padding: 10px 14px;
}
.select-trigger:hover {
  background: var(--hover);
}
.select-trigger[aria-expanded="true"] {
  border-color: var(--accent);
}
.options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  min-width: 200px;
  max-height: 300px;
  overflow: auto;
  padding: 6px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 32px #0004;
  animation: menu-in 0.16s var(--ease);
}
.option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: none;
}
.option:hover,
.option:focus-visible {
  background: var(--hover);
}
.option[aria-selected="true"] {
  color: var(--accent);
  background: var(--selected);
}
.server-symbol {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  color: var(--secondary);
  font-weight: 600;
}
.server-symbol svg {
  width: 16px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
}
.stat-label {
  color: var(--secondary);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}
.stat-value {
  font-size: 30px;
  line-height: 1.4;
  margin: 12px 0 4px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.stat-meta {
  font-size: 12px;
  color: var(--muted);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 20px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.segmented {
  display: flex;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  gap: 4px;
}
.segmented button {
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--secondary);
  padding: 7px 12px;
  min-height: 34px;
  font-size: 12px;
}
.segmented button.active {
  background: var(--hover);
  color: var(--ink);
}
.chart {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 3.4;
  overflow: visible;
}
.chart .grid {
  stroke: var(--line);
  stroke-width: 1;
}
.chart text {
  fill: var(--muted);
  font:
    11px Inter,
    sans-serif;
}
.chart .joins {
  stroke: var(--accent);
  stroke-width: 2.6;
  fill: none;
}
.chart .leaves {
  stroke: #8a8996;
  stroke-width: 2;
  fill: none;
}
.chart .area {
  fill: var(--accent);
  opacity: 0.055;
}
.legend {
  display: flex;
  gap: 24px;
  color: var(--secondary);
  font-size: 12px;
}
.legend span:before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 8px;
}
.legend span + span:before {
  background: #8a8996;
}
.chart-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}
.overview-bottom {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.status-row:last-child {
  padding-bottom: 0;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.status:before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--muted);
  border-radius: 50%;
}
.status.online:before {
  background: #8bba9f;
}
.text-link {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--secondary);
}
.text-link:hover {
  color: var(--ink);
}
.empty {
  padding: 48px 24px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--secondary);
}
.empty svg {
  width: 32px;
  height: 32px;
  margin-bottom: 16px;
}
.empty h2 {
  margin-bottom: 12px;
  color: var(--ink);
}
.empty p {
  max-width: 480px;
  margin: 0 auto;
}
.picker-shell {
  min-height: calc(100dvh - 84px);
  display: grid;
  place-content: center;
  padding: 48px 24px;
  gap: 32px;
  max-width: 960px;
  margin: auto;
}
.picker-shell .page-heading {
  margin: 0;
  display: block;
  text-align: center;
}
.bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, 220px);
  justify-content: center;
  gap: 16px;
}
.bot-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition:
    transform 0.22s,
    border-color 0.22s,
    background 0.22s;
}
.bot-card:hover {
  border-color: var(--accent);
  background: var(--raised);
  transform: translateY(-4px);
}
.bot-card img {
  width: 88px;
  height: 88px;
  border-radius: 24px;
  object-fit: cover;
  margin-bottom: 20px;
}
.bot-card h2 {
  font-size: 16px;
  margin-bottom: 8px;
}
.bot-card .meta {
  font-size: 10px;
  overflow-wrap: anywhere;
}
.bot-card .status {
  margin-top: 18px;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 24px;
}
.editor {
  max-width: 760px;
}
.field {
  display: block;
  margin-bottom: 24px;
}
.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
}
.required {
  position: relative;
  color: #c6acf8;
  border: 0;
  background: none;
  padding: 0 4px;
  font-size: 20px;
  line-height: 20px;
  cursor: help;
}
.required:after {
  content: attr(aria-label);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translate(-50%, 4px);
  opacity: 0;
  pointer-events: none;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 8px;
  color: var(--ink);
  font-size: 11px;
  white-space: nowrap;
  transition: 0.18s;
}
.required:hover:after,
.required:focus-visible:after {
  opacity: 1;
  transform: translate(-50%, 0);
}
input,
textarea {
  width: 100%;
  min-height: 48px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  transition:
    border-color 0.18s,
    background 0.18s;
}
input:hover,
textarea:hover {
  border-color: var(--muted);
}
input:focus,
textarea:focus {
  border-color: var(--accent);
  outline: 2px solid #8b5cf61a;
  outline-offset: 1px;
}
textarea {
  min-height: 124px;
  resize: vertical;
  line-height: 1.7;
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
.field-hint {
  display: block;
  color: var(--secondary);
  font-size: 12px;
  margin-top: 8px;
}
.field-error {
  color: var(--error);
  font-size: 12px;
  margin-top: 8px;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 0;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.toggle-row .field-hint {
  max-width: 400px;
}
.toggle {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.toggle input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  cursor: pointer;
  z-index: 1;
}
.toggle span {
  position: absolute;
  inset: 0;
  background: var(--hover);
  border: 1px solid var(--muted);
  border-radius: 12px;
  transition: background 0.2s;
}
.toggle span:after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--secondary);
  transition:
    transform 0.2s var(--ease),
    background 0.2s;
}
.toggle input:checked + span {
  background: var(--primary);
  border-color: var(--primary);
}
.toggle input:checked + span:after {
  transform: translateX(18px);
  background: #fff;
}
.toggle input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
.editor-aside .panel {
  padding: 20px;
}
.editor-aside h3 {
  margin-bottom: 12px;
}
.editor-aside p {
  font-size: 12px;
  color: var(--secondary);
  line-height: 1.8;
}
.editor-aside .preview-message {
  border-left: 2px solid var(--accent);
  padding-left: 14px;
  margin-top: 20px;
}
.image-preview {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-top: 12px;
}
.save-bar {
  position: sticky;
  bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--raised);
  z-index: 5;
  margin-top: 24px;
}
.save-bar > div {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.login {
  max-width: 440px;
  margin: 12vh auto;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  text-align: center;
}
.login img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 24px;
}
.login h1 {
  font-size: 25px;
}
.login p {
  color: var(--secondary);
  margin: 16px 0 24px;
}
.login .button {
  width: 100%;
  margin-top: 12px;
}
.notice {
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--selected);
  color: var(--secondary);
  font-size: 12px;
  margin: 16px 0;
}
.login .notice {
  color: var(--error);
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.audit {
  width: 100%;
  border-collapse: collapse;
}
.audit td,
.audit th {
  text-align: left;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.audit th {
  color: var(--secondary);
  font-weight: 400;
}
.table-wrap {
  overflow: auto;
}
dialog {
  width: min(680px, calc(100% - 32px));
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 32px 120px #0007;
}
dialog[open] {
  animation: menu-in 0.22s var(--ease);
}
dialog::backdrop {
  background: #0009;
  backdrop-filter: blur(8px);
}
.dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px;
  border-bottom: 1px solid var(--line);
}
.dialog-content {
  padding: 24px;
}
.account-summary {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}
.account-summary .avatar {
  width: 64px;
  height: 64px;
  font-size: 24px;
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
  border-top: 1px solid var(--line);
}
.settings-row .meta {
  margin-top: 4px;
}
#notifications {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 100;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  width: max-content;
  max-width: 460px;
  padding: 16px 20px;
  border: 1px solid var(--line);
  background: var(--raised);
  border-radius: 12px;
  box-shadow: 0 12px 32px #0003;
  animation: toast-in 0.22s var(--ease);
  font-size: 13px;
  pointer-events: auto;
}
.toast.error svg {
  color: var(--error);
}
.toast.success svg {
  color: #91ba9d;
}
.toast.leaving {
  opacity: 0;
  transform: translateY(8px);
  transition: 0.2s;
}
.boot {
  height: 100dvh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 24px;
}
.boot img {
  width: 88px;
  height: 88px;
}
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin 0.7s linear infinite;
}
.page-enter {
  animation: page-in 0.24s var(--ease);
}
.preview-banner {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  font-size: 12px;
  color: var(--secondary);
  padding: 12px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 24px;
}
.preview-banner svg {
  color: var(--accent);
}
.preview-banner span {
  display: flex;
  align-items: center;
  gap: 8px;
}
.mobile-menu-button {
  display: none;
}
.access-lost {
  padding: 24px;
  border: 1px solid var(--error);
  border-radius: 12px;
  color: var(--error);
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes page-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes menu-in {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (min-width: 1600px) {
  .content {
    padding-left: 48px;
    padding-right: 48px;
  }
  .layout {
    gap: 32px;
  }
}
@media (max-width: 1100px) {
  .layout {
    grid-template-columns: 228px minmax(0, 1fr);
    padding: 16px;
    gap: 16px;
  }
  .content {
    padding: 12px 8px 24px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .editor-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .editor-aside {
    display: none;
  }
  .overview-bottom {
    grid-template-columns: 1fr;
  }
  .page-heading {
    flex-wrap: wrap;
  }
  .server-picker {
    min-width: 190px;
  }
}
@media (max-width: 760px) {
  .topbar {
    height: 72px;
    padding: 0 16px;
  }
  .topbar .brand {
    font-size: 22px;
  }
  .topbar .brand img {
    width: 40px;
    height: 40px;
  }
  .top-actions {
    gap: 8px;
  }
  .top-actions .button {
    font-size: 12px;
    padding: 8px 10px;
  }
  .preview-note {
    display: none;
  }
  .layout {
    display: block;
    padding: 12px;
  }
  .sidebar {
    display: none;
    position: fixed;
    top: 72px;
    bottom: 0;
    left: 0;
    width: min(300px, 88vw);
    padding: 12px;
    background: var(--bg);
    z-index: 40;
    box-shadow: 40px 0 100px #0009;
    overflow: auto;
  }
  .sidebar.mobile-open {
    display: flex;
    animation: menu-in 0.18s;
  }
  .sidebar-panel {
    flex: 1;
  }
  .mobile-menu-button {
    display: inline-grid;
  }
  .content {
    padding: 16px 4px 32px;
  }
  .page-heading {
    margin-bottom: 24px;
    gap: 20px;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .page-heading p {
    font-size: 12px;
  }
  .server-picker {
    width: 100%;
  }
  .panel {
    padding: 20px 16px;
  }
  .stats {
    gap: 8px;
    margin-bottom: 16px;
  }
  .stat {
    padding: 16px 12px;
  }
  .stat-value {
    font-size: 27px;
  }
  .stat-label {
    font-size: 11px;
  }
  .stat-label svg {
    width: 16px;
  }
  .panel-head {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }
  .panel-head h2 {
    font-size: 16px;
  }
  .chart {
    aspect-ratio: 1.9;
  }
  .chart text {
    font-size: 13px;
  }
  .chart-footer {
    flex-wrap: wrap;
  }
  .bot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 12px;
  }
  .bot-card {
    padding: 24px 12px;
  }
  .bot-card img {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }
  .picker-shell {
    display: flex;
    flex-direction: column;
    padding: 40px 20px;
    min-height: calc(100dvh - 72px);
  }
  .save-bar {
    padding: 12px;
    bottom: 8px;
    flex-wrap: wrap;
  }
  .save-bar > div {
    width: 100%;
  }
  .save-bar .button {
    flex: 1;
    font-size: 12px;
  }
  .preview-banner {
    padding: 12px;
    font-size: 11px;
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .preview-banner span {
    align-items: flex-start;
  }
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .login {
    margin: 8vh 16px;
    padding: 28px 24px;
  }
  .settings-row {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }
  .toast {
    width: auto;
    max-width: 100%;
    font-size: 12px;
  }
  #notifications {
    right: 16px;
    left: 16px;
    bottom: 16px;
  }
  .dialog-head,
  .dialog-content {
    padding: 20px;
  }
  .dialog-head h2 {
    font-size: 17px;
  }
  .segmented button {
    min-height: 36px;
  }
  .preview-banner .button {
    min-height: 36px;
  }
  .account-summary .copy {
    min-width: 0;
  }
  .account-summary .meta {
    overflow-wrap: anywhere;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
  .spinner {
    border-right-color: currentColor;
    opacity: 0.6;
  }
}
.bot-switch {
  width: 100%;
  background: transparent;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  text-align: left;
  color: var(--ink);
}
.nav-scroll {
  max-height: calc(100dvh - 490px);
  min-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  padding-right: 4px;
}
.field-control {
  position: relative;
}
.field-control .options {
  top: calc(100% + 4px);
}
.search-fields {
  display: block;
  margin-bottom: 28px;
}
.search-fields input {
  background: var(--raised);
}
.field-list .searchable-field:last-child .field {
  margin-bottom: 0;
}
.admin-grid form {
  margin-top: 24px;
}
.admin-grid form > .button {
  margin-top: 20px;
}
.language-options[hidden] {
  display: none;
}
.profile-menu[hidden] {
  display: none;
}
.options[hidden] {
  display: none;
}
.searchable-field[hidden] {
  display: none;
}
.image-preview {
  background: var(--raised);
}
@media (max-width: 760px) {
  .nav-scroll {
    max-height: calc(100dvh - 490px);
    min-height: 160px;
  }
  .chart {
    min-height: 180px;
  }
  .bot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .bot-card {
    min-width: 0;
  }
  .bot-switch .copy strong {
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
@media (min-width: 761px) {
  .sidebar {
    position: sticky;
    top: 24px;
    align-self: start;
    height: calc(100dvh - 132px);
  }
  .sidebar-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  .nav-scroll {
    flex: 1;
    min-height: 80px;
    max-height: none;
  }
  .sidebar-panel > .nav-item,
  .sidebar-panel > .section-label,
  .sidebar-panel > .bot-switch {
    flex-shrink: 0;
  }
}
.brand img {
  width: 56px;
  height: 56px;
}
.brand {
  font-size: 26px;
}
.server-symbol img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}
.server-selected {
  display: flex;
  align-items: center;
  gap: 10px;
}
.server-selected img {
  width: 28px;
  height: 28px;
  object-fit: contain;
}
.console-panel {
  padding: 0;
  overflow: hidden;
}
.console-panel > .panel-head {
  padding: 20px 24px;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
#console-output {
  min-height: 320px;
  max-height: 480px;
  overflow: auto;
  padding: 24px;
  margin: 0;
  background: #0c0c10;
  color: #c5c2d4;
  font:
    13px/1.9 ui-monospace,
    monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.console-command {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.console-command label {
  display: flex;
  color: var(--accent);
}
.console-command input {
  min-width: 0;
  flex: 1;
}
.console-command .button {
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .console-command {
    flex-wrap: wrap;
  }
  .console-command input {
    width: calc(100% - 40px);
  }
  .console-command .button {
    width: 100%;
  }
}
.row-editor > h3 {
  margin-bottom: 16px;
}
.config-row {
  padding: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}
.row-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}
.row-actions .icon-button {
  flex: 0 0 auto;
  order: -1;
}
.row-title .server-picker {
  min-width: 180px;
}
.config-row input {
  background: var(--surface);
}
.config-row .field {
  margin-bottom: 16px;
}
.config-row .toggle-row {
  padding: 8px 0;
  margin: 0;
  border: 0;
}
.config-row .field-label {
  font-size: 12px;
}
.config-row .toggle-row > span {
  font-size: 12px;
}
@media (max-width: 600px) {
  .row-title {
    flex-wrap: wrap;
  }
  .row-title .server-picker {
    width: 100%;
  }
  .config-row {
    padding: 16px;
  }
}
.panel,
.stat,
.sidebar-panel,
.profile,
.topbar {
  transition:
    background-color 0.25s,
    border-color 0.25s,
    color 0.25s;
}
#agent-token-value {
  margin: 20px 0;
  min-height: 90px;
  font-family: ui-monospace, monospace;
}
.role.admin {
  color: #f2a7b1;
  border-color: #b0576466;
  background: #b94c6510;
}
@media (max-width: 360px) {
  .top-actions > .button > span {
    display: none;
  }
  .top-actions > .button {
    width: 44px;
    padding: 10px;
  }
  .topbar {
    gap: 8px;
  }
}
.entity-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.entity-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 6px 4px 10px;
  background: var(--selected);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 12px;
}
.entity-chip > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.entity-chip svg {
  width: 14px;
  height: 14px;
}
.entity-chip button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 5px;
  background: none;
  flex-shrink: 0;
}
.entity-chip button:hover {
  background: var(--hover);
}
@media (max-width: 760px) {
  .entity-chip button {
    width: 36px;
    height: 36px;
  }
}
.entity-avatar {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
}
.chart text {
  font-variant-numeric: tabular-nums;
}
@media (max-width: 480px) {
  .chart text {
    font-size: 30px;
  }
}
@media (max-width: 360px) {
  .chart text {
    font-size: 36px;
  }
}
.ro-mark {
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
  overflow: hidden;
  vertical-align: middle;
  flex-shrink: 0;
}
.ro-mark img {
  position: absolute;
  width: 600%;
  height: 200%;
  max-width: none;
  top: -50%;
  object-fit: fill;
}
.ro-mark.ro-2 img {
  left: -50%;
}
.ro-mark.ro-3 img {
  left: -250%;
}
.ro-mark.ro-1 img {
  left: -450%;
}
@media (max-width: 760px) {
  .preview-banner .segmented {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    min-width: 0;
  }
  .preview-banner .segmented button {
    min-width: 0;
    font-size: 11px;
    padding: 7px 4px;
    white-space: normal;
  }
}
@media (max-width: 760px) {
  .sidebar-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .sidebar .nav-scroll {
    flex: 1;
    max-height: none;
    min-height: 80px;
  }
  .sidebar > .profile {
    flex-shrink: 0;
  }
  .sidebar-panel > .nav-item,
  .sidebar-panel > .section-label,
  .sidebar-panel > .bot-switch {
    flex-shrink: 0;
  }
}
/* Shared dimensions and the persistent application shell. */
:root {
  --header-height: 76px;
  --sidebar-width: 260px;
}
.topbar {
  height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 60;
  padding: 0 24px;
}
.brand {
  font-size: 23px;
  font-weight: 800;
  cursor: pointer;
}
.brand img {
  width: 39px;
  height: 39px;
}
.brand,
.button,
.nav-item,
.bot-card,
.profile-toggle,
.select-trigger,
.option {
  user-select: none;
}
.header-bot {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  margin: 0 auto 0 28px;
  padding: 6px 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
}
.header-bot:hover {
  background: var(--raised);
}
.header-bot > img {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}
.header-bot .copy strong {
  font-size: 13px;
}
.header-bot .copy small {
  font-size: 10px;
}
.layout {
  display: block;
  padding: 24px 24px 24px 308px;
  min-height: calc(100dvh - var(--header-height));
}
.sidebar {
  position: fixed;
  left: 24px;
  top: calc(var(--header-height) + 24px);
  bottom: 24px;
  width: var(--sidebar-width);
  height: auto;
  display: flex;
  overflow: visible;
}
.sidebar-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.nav-scroll {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  scrollbar-width: auto;
  scrollbar-color: #62606f var(--surface);
}
.nav-scroll::-webkit-scrollbar {
  width: 8px;
}
.nav-scroll::-webkit-scrollbar-track {
  background: var(--surface);
  border-radius: 8px;
}
.nav-scroll::-webkit-scrollbar-thumb {
  background: #62606f;
  border-radius: 8px;
  border: 2px solid var(--surface);
}
.nav-scroll::-webkit-scrollbar-thumb:hover {
  background: #8b8798;
}
.nav-item {
  cursor: pointer;
}
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar > .profile {
  flex-shrink: 0;
}
.content {
  width: 100%;
  padding: 12px 24px 32px;
}
.profile-main {
  min-height: 56px;
}
.profile-avatar-button {
  padding: 0;
  background: none;
  border: 0;
  border-radius: 12px;
  flex-shrink: 0;
}
.profile .copy small {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-menu {
  position: absolute;
  left: 0;
  bottom: calc(100% + 8px);
  width: 100%;
  padding: 8px;
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 12px;
  display: block;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 0.2s,
    transform 0.2s,
    visibility 0.2s;
  z-index: 70;
}
.profile.open .profile-menu {
  opacity: 1;
  visibility: visible;
  transform: none;
  display: block;
}
.profile-menu-inner {
  border: 0;
  padding: 0;
  margin: 0;
}
.profile-menu > div {
  overflow: visible;
}
.role-developer {
  color: #f3a4af;
  border-color: #9b415666;
  background: #9b41561a;
}
.role-owner {
  color: #c6acf8;
  border-color: #7152a366;
  background: #7c3aed15;
}
.role-deputy {
  color: #d7c9ef;
  border-color: #9584af66;
  background: #9b81c41a;
}
.role-guest {
  color: #aaa8b2;
  border-color: #68657166;
  background: #77737e15;
}
.chooser-profile {
  position: fixed;
  left: 24px;
  bottom: 24px;
  width: 260px;
  z-index: 30;
}
.picker-shell {
  padding-bottom: 160px;
  min-height: calc(100dvh - var(--header-height));
}
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--secondary);
  font-size: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.breadcrumbs button {
  border: 0;
  background: none;
  color: inherit;
  padding: 0;
  cursor: pointer;
}
.breadcrumbs button:hover {
  color: var(--ink);
}
.breadcrumbs svg {
  width: 13px;
  height: 13px;
}
.breadcrumbs [aria-current] {
  color: var(--ink);
}
.editor {
  max-width: 1100px;
}
.editor-search {
  position: relative;
  margin-bottom: 24px;
}
.editor-search > svg {
  position: absolute;
  left: 16px;
  top: 15px;
  color: var(--secondary);
}
.editor-search input {
  padding-left: 46px;
  background: var(--surface);
}
.settings-group > h2 {
  margin-bottom: 24px;
  font-size: 16px;
}
.settings-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 24px;
}
.searchable-field:has(textarea),
.searchable-field:has(.row-editor),
.searchable-field:has(.image-preview),
.searchable-field:has([data-image-preview]),
.searchable-field:has(.record-editor) {
  grid-column: 1/-1;
}
.field-control {
  min-width: 0;
}
.save-bar {
  position: fixed;
  bottom: 24px;
  right: 32px;
  left: auto;
  max-width: calc(100vw - 340px);
  width: auto;
  min-width: 360px;
  margin: 0;
  box-shadow: 0 12px 40px #0005;
  animation: toast-in 0.2s var(--ease);
  z-index: 50;
}
.save-bar[hidden] {
  display: none;
}
.save-bar > div {
  width: auto;
}
.language-dialog {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.language-dialog > button {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--raised);
  text-align: left;
}
.language-dialog > button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--selected);
}
.language-dialog .flag {
  width: 24px;
  height: 16px;
}
.destructive {
  background: #b83650;
  border-color: #b83650;
  color: white;
}
.destructive:hover {
  background: #ca4560;
}
.confirm-dialog {
  max-width: 480px;
}
.confirm-details {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 300px;
  overflow: auto;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  font:
    12px/1.7 ui-monospace,
    monospace;
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}
.positive {
  color: #80c29b;
}
.negative {
  color: #e5919c;
}
.chart .joins {
  stroke: #80c29b;
}
.chart .leaves {
  stroke: #e5919c;
}
.chart .area {
  fill: #80c29b;
}
.legend span:first-child:before {
  background: #80c29b;
}
.legend span + span:before {
  background: #e5919c;
}
.toggle input:checked + span {
  background: #2d8f54;
  border-color: #3aa266;
}
.toggle-state {
  font-size: 11px;
  color: var(--secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.toggle-state.on {
  color: #80c29b;
}
.toggle-state.off {
  color: #e5919c;
}
@media (max-width: 1100px) and (min-width: 761px) {
  :root {
    --sidebar-width: 228px;
  }
  .layout {
    padding: 16px 16px 16px 268px;
  }
  .sidebar {
    left: 16px;
    top: calc(var(--header-height) + 16px);
    bottom: 16px;
  }
  .content {
    padding: 12px 8px 24px;
  }
  .save-bar {
    max-width: calc(100vw - 292px);
  }
}
@media (max-width: 760px) {
  .layout {
    padding: 16px 12px 16px 80px;
  }
  .content {
    padding: 8px 0 96px;
  }
  .sidebar {
    display: flex;
    top: calc(var(--header-height) + 8px);
    left: 8px;
    bottom: 8px;
    width: 56px;
    padding: 0;
    background: none;
    box-shadow: none;
    z-index: 55;
    overflow: visible;
  }
  .sidebar-panel {
    padding: 4px;
    border-radius: 12px;
  }
  .sidebar .section-label {
    display: none;
  }
  .sidebar .nav-item {
    padding: 12px 0;
    justify-content: center;
    gap: 0;
  }
  .sidebar .nav-label {
    display: none;
  }
  .sidebar .nav-item.active:after {
    right: 1px;
    height: 14px;
  }
  .sidebar .nav-item svg {
    width: 19px;
    height: 19px;
  }
  .sidebar .nav-scroll {
    min-height: 0;
    padding-right: 0;
    scrollbar-width: thin;
  }
  .sidebar > .profile {
    padding: 6px;
    border-radius: 12px;
  }
  .sidebar .profile-main {
    justify-content: center;
    min-height: 40px;
  }
  .sidebar .profile-main > .copy,
  .sidebar .profile-toggle {
    display: none;
  }
  .sidebar .profile-main .avatar {
    width: 40px;
    height: 40px;
  }
  .sidebar .profile-menu {
    left: calc(100% + 8px);
    bottom: 0;
    width: min(248px, calc(100vw - 80px));
  }
  .sidebar .profile-menu .nav-item {
    justify-content: flex-start;
    padding: 10px 12px;
    gap: 12px;
  }
  .sidebar .profile-menu .nav-label {
    display: block;
  }
  .sidebar.mobile-open {
    width: min(300px, calc(100vw - 16px));
    background: var(--bg);
    padding: 8px;
    box-shadow: 0 0 0 100vmax #0008;
  }
  .sidebar.mobile-open .section-label {
    display: block;
  }
  .sidebar.mobile-open .nav-label {
    display: block;
  }
  .sidebar.mobile-open .nav-item {
    justify-content: flex-start;
    padding: 10px 12px;
    gap: 12px;
  }
  .sidebar.mobile-open .profile-main {
    justify-content: flex-start;
  }
  .sidebar.mobile-open .profile-main > .copy,
  .sidebar.mobile-open .profile-toggle {
    display: block;
  }
  .sidebar.mobile-open .profile-menu {
    left: 0;
    bottom: calc(100% + 8px);
    width: 100%;
  }
  .mobile-menu-button {
    display: inline-grid;
  }
  .back-to-bots {
    display: none;
  }
  .header-bot {
    gap: 8px;
    margin-left: 8px;
    padding: 4px;
    max-width: 160px;
  }
  .header-bot > img {
    width: 28px;
    height: 28px;
    border-radius: 8px;
  }
  .header-bot .copy strong {
    font-size: 11px;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-bot .copy small {
    font-size: 9px;
    max-width: 108px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .header-bot > svg {
    display: none;
  }
  .has-selected-bot .brand > span {
    display: none;
  }
  .topbar {
    padding: 0 12px;
    gap: 8px;
  }
  .top-actions {
    gap: 6px;
  }
  .top-actions .button {
    width: 42px;
    height: 42px;
    padding: 10px;
  }
  .top-actions .button > span {
    display: none;
  }
  .top-actions .icon-button {
    width: 42px;
    height: 42px;
  }
  .settings-fields {
    grid-template-columns: minmax(0, 1fr);
  }
  .save-bar {
    left: 80px;
    right: 12px;
    bottom: 12px;
    min-width: 0;
    max-width: none;
    padding: 10px;
    justify-content: flex-end;
  }
  .save-bar > div {
    width: 100%;
  }
  .chooser-profile {
    left: 12px;
    bottom: 12px;
    width: min(260px, calc(100vw - 24px));
  }
  .picker-shell {
    padding: 32px 20px 160px;
  }
  .preview-banner {
    padding: 8px;
    gap: 8px;
  }
  .preview-banner .segmented {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .preview-banner > span {
    font-size: 11px;
  }
  .breadcrumbs {
    font-size: 10px;
    gap: 5px;
  }
  .page-heading h1 {
    font-size: 22px;
  }
  .panel {
    padding: 18px 14px;
  }
  .settings-group > h2 {
    font-size: 15px;
  }
  .field-label {
    font-size: 12px;
  }
  .dialog-actions .button {
    flex: 1;
  }
}
@media (max-width: 720px) {
  :root {
    --header-height: 66px;
  }
  .brand {
    font-size: 21px;
  }
  .brand img {
    width: 34px;
    height: 34px;
  }
}
.inline-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.field.wide {
  grid-column: 1/-1;
}
.fingerprint {
  overflow-wrap: anywhere;
  padding: 12px;
  background: var(--field-bg, #101016);
  border-radius: 8px;
}
.connection-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  width: 100%;
  padding: 15px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  margin-top: 10px;
}
.connection-card:hover {
  background: var(--hover);
}
.connection-card > span {
  display: grid;
  gap: 5px;
  flex: 1;
}
.access-form {
  display: grid;
  grid-template-columns: minmax(200px, 2fr) minmax(160px, 1fr);
  gap: 14px;
  align-items: end;
}
.access-form > .button {
  width: max-content;
}
.access-member {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}
.access-member .copy {
  flex: 1;
  display: grid;
  gap: 6px;
}
.access-member .role {
  width: max-content;
}
.upload-image {
  width: max-content;
  margin-top: 10px;
}
.entity-results .option > span {
  display: grid;
  gap: 4px;
}
.console-command textarea {
  min-height: 64px;
  flex: 1;
  resize: vertical;
  font-family: monospace;
}
.console-command {
  align-items: center;
}
#ai-plan pre {
  white-space: pre-wrap;
  background: var(--field-bg, #101016);
  padding: 18px;
  border-radius: 10px;
  max-height: 400px;
  overflow: auto;
}
.panel h2 > [data-lucide] {
  vertical-align: middle;
  margin-right: 8px;
}
.secret-control {
  display: flex;
  align-items: center;
  position: relative;
}
.secret-control input {
  padding-right: 45px;
}
.secret-control .icon-button {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
}
.confirm-dialog pre {
  white-space: pre-wrap;
  overflow: auto;
  max-height: 38vh;
  padding: 16px;
  border-radius: 10px;
  background: var(--field-bg, #101016);
}
.chart-tooltip {
  position: absolute;
  pointer-events: none;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 12px 35px #0005;
  display: grid;
  gap: 6px;
  z-index: 3;
}
.chart-wrap {
  position: relative;
}
.chart-hit {
  fill: transparent;
  cursor: crosshair;
}
.chart .joins {
  stroke: #43c890;
}
.chart .leaves {
  stroke: #ed6d7b;
}
.chart .area {
  fill: #43c8900b;
}
.chart-dot-join {
  fill: #43c890;
}
.chart-dot-leave {
  fill: #ed6d7b;
}
@media (max-width: 720px) {
  .access-form {
    grid-template-columns: 1fr;
  }
  .console-command {
    flex-wrap: wrap;
  }
  .console-command textarea {
    width: calc(100% - 35px);
  }
  .console-command > .button {
    margin-left: auto;
  }
  .inline-actions > .button {
    width: 100%;
  }
}
.structured-field {
  grid-column: 1/-1;
}
.structured-rows {
  display: grid;
  gap: 16px;
  margin: 14px 0;
}
.record-card {
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: 14px;
  background: var(--field-bg, #101016);
}
.record-card .image-preview {
  max-height: 240px;
  object-fit: contain;
  width: 100%;
}
.record-card .field {
  margin: 10px 0;
}
.record-card .panel-head {
  margin-bottom: 12px;
}
.record-card .settings-fields {
  align-items: start;
}
:root {
  --border: var(--line);
  --text: var(--ink);
  --panel: var(--surface);
  --field-bg: var(--bg);
}
.sidebar {
  align-self: stretch;
  height: calc(100dvh - var(--header-height) - 48px);
}
.sidebar-panel {
  min-height: 0;
  overflow: hidden;
}
.sidebar-panel > .nav-item,
.sidebar-panel > .section-label {
  flex-shrink: 0;
}
.profile-main {
  user-select: none;
}
.profile-menu {
  height: auto;
  max-height: none;
}
.profile-toggle svg {
  transform: rotate(180deg);
}
.profile.open .profile-toggle svg {
  transform: rotate(0deg);
}
.searchable-field:has(.structured-field) {
  grid-column: 1/-1;
}
.button,
.icon-button,
.header-bot,
.profile-avatar-button,
.record-card button,
.required {
  cursor: pointer;
}
button {
  user-select: none;
}
input,
textarea {
  user-select: text;
}
.chart-tooltip[hidden] {
  display: none;
}
.image-preview {
  min-height: 80px;
}
.toggle-row {
  gap: 18px;
}
.profile-menu .nav-item {
  white-space: nowrap;
}
@media (max-width: 1100px) and (min-width: 761px) {
  .sidebar {
    height: calc(100dvh - var(--header-height) - 32px);
  }
}
@media (max-width: 760px) {
  .sidebar {
    height: calc(100dvh - var(--header-height) - 16px);
  }
  .sidebar-panel {
    padding: 4px;
  }
  .sidebar .profile-main .avatar {
    width: 38px;
    height: 38px;
  }
  .record-card {
    padding: 14px;
  }
  .upload-image {
    max-width: 100%;
    white-space: normal;
  }
}
.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.stat {
  min-width: 0;
}
.stat-label {
  min-width: 0;
  gap: 8px;
}
.stat-label svg {
  flex-shrink: 0;
}
.stat-meta {
  overflow-wrap: anywhere;
}
@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .stat-label {
    font-size: 10px;
    align-items: flex-start;
  }
  .stat-value {
    font-size: 24px;
  }
  .stat-meta {
    font-size: 10px;
  }
  .stat {
    padding: 12px;
  }
  .stats {
    gap: 8px;
  }
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr);
  min-height: calc(100dvh - var(--header-height));
}

.login-grid {
  --grid-size: 40px;
  --grid-line: color-mix(in srgb, var(--accent) 20%, var(--line));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 39% 50%, var(--selected), transparent 72%),
    var(--bg);
  border-inline-end: 1px solid var(--line);
}

.login-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: center;
  mask-image: radial-gradient(ellipse at 44% 50%, #000 22%, transparent 90%);
  animation: login-grid-pulse 8s ease-in-out infinite alternate;
}

.login-grid-spot {
  position: absolute;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(circle,
    color-mix(in srgb, var(--accent) 27%, transparent),
    transparent 70%);
}

@keyframes login-grid-pulse {
  from { opacity: 0.65; }
  to { opacity: 1; }
}

.login-pane {
  display: grid;
  place-items: center;
  padding: clamp(24px, 4vw, 64px);
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 410px;
  margin: 0;
  padding: clamp(24px, 4vw, 44px);
  border-radius: var(--radius);
  text-align: start;
}

.login-card h1 {
  font-size: clamp(23px, 2.5vw, 32px);
  text-wrap: balance;
}

.login-card p {
  margin: 14px 0 0;
  line-height: 1.65;
}

.login-card .button {
  min-height: 46px;
  margin-top: 24px;
}

@media (max-width: 700px) {
  .login-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(120px, 1fr);
  }

  .login-grid {
    grid-row: 2;
    border-inline-end: 0;
    border-block-start: 1px solid var(--line);
  }

  .login-pane {
    grid-row: 1;
    padding-block: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-grid-spot {
    display: none;
  }
}

.bot-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.bot-state.is-running::before,
.bot-state.is-stopped::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3ac482;
}

.bot-state.is-stopped::before {
  background: #ed626e;
}

.bot-avatar-empty {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  color: var(--muted);
  background: var(--raised);
  border-radius: 10px;
}

.bot-card .bot-avatar-empty {
  width: 64px;
  height: 64px;
}

.bot-card .bot-avatar-empty svg {
  width: 28px;
  height: 28px;
}

.panel-head > .bot-avatar,
.connection-card > .bot-avatar {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 10px;
}

.host-key-instructions {
  margin-top: 16px;
}

.host-key-instructions summary {
  cursor: pointer;
  font-weight: 600;
}

.host-key-instructions pre {
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--raised);
}

.text-item-row { display:grid; grid-template-columns:24px minmax(0,1fr) 44px; align-items:center; gap:10px; margin:10px 0; }
.text-item-row input { min-width:0; width:100%; }

/* Center every bot row independently; a desktop row holds at most five cards. */
.picker-shell {
  width: 100%;
  max-width: 1232px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.bot-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 1164px;
  gap: 16px;
}
.bot-grid > .bot-card {
  flex: 0 0 220px;
  width: 220px;
  min-width: 0;
}
@media (max-width: 760px) {
  .bot-grid { gap: 12px; }
  .bot-grid > .bot-card {
    flex-basis: calc((100% - 12px) / 2);
    width: auto;
    max-width: 220px;
  }
}
.page-heading > :first-child { margin-left: 0; text-align: left; }
.page-heading > :last-child:not(:first-child) { margin-left: auto; }
.tracked-channel{border:1px solid var(--line);border-radius:14px;padding:14px;margin:10px 0;background:rgba(255,255,255,.025)}
.tracked-channel-profile{display:flex;align-items:center;gap:12px;margin-bottom:12px;min-width:0}
.tracked-channel-profile>img,.tracked-channel-profile>svg{width:42px;height:42px;border-radius:50%;object-fit:cover;flex:0 0 auto}
.tracked-channel-profile>span{display:grid;gap:3px;min-width:0;flex:1}
.tracked-channel-profile strong,.tracked-channel-profile small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tracked-channel-profile small{color:var(--muted);font-size:.82rem}
.activity-history{margin-top:22px}
.activity-history .table-wrap{max-height:520px;overflow:auto}
.alliance-service-panel{margin-top:20px}
.alliance-service-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px}
.alliance-service-actions .danger{color:var(--error)}

.save-green {
  background: #15803d;
  border-color: #15803d;
  color: #fff;
}
.save-green:hover {
  background: #166534;
  border-color: #166534;
}
