.theme-portal {
  --portal-cream: 247 243 237;
  --portal-indigo: 79 70 229;
}

html.dark .theme-portal {
  --bg: 18 16 32;
  --surface: 30 27 48;
  --surface2: 42 38 64;
  --text: 236 232 248;
  --muted: 168 160 190;
  --border: 58 52 86;
  --navy: 196 181 253;
  --primary: 129 140 248;
  --on-primary: 20 18 36;
  --accent: 251 146 60;
  --accent-soft: 49 46 90;
  --on-accent-soft: 199 210 254;
  --nav: 30 27 48;
  --on-nav: 196 181 253;
  --nav-active: 165 180 252;
  --ring: 129 140 248;
  --s50: 26 23 42;
  --s100: 36 32 54;
  --s200: 52 46 76;
  --s500: 168 160 190;
  --s600: 186 178 206;
  --s900: 236 232 248;
}

@media (prefers-color-scheme: dark) {
  html:not(.light) .theme-portal {
    --bg: 18 16 32;
    --surface: 30 27 48;
    --surface2: 42 38 64;
    --text: 236 232 248;
    --muted: 168 160 190;
    --border: 58 52 86;
    --navy: 196 181 253;
    --primary: 129 140 248;
    --on-primary: 20 18 36;
    --accent-soft: 49 46 90;
    --on-accent-soft: 199 210 254;
    --nav: 30 27 48;
    --on-nav: 196 181 253;
    --nav-active: 165 180 252;
    --ring: 129 140 248;
  }
}

.theme-portal .vk-portal-shell {
  min-height: 100vh;
}

.theme-portal .vk-portal-side {
  display: none;
  flex-direction: column;
  width: 240px;
  flex-shrink: 0;
  background: rgb(var(--surface));
  border-inline-end: 1px solid rgb(var(--border));
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
}

.theme-portal .vk-portal-side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 18px;
}

.theme-portal .vk-portal-mono {
  width: 40px;
  height: 40px;
  border-radius: 14px;
  background: rgb(var(--primary));
  color: rgb(var(--on-primary));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}

.theme-portal .vk-portal-side a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  color: rgb(var(--muted));
  min-height: 44px;
}

.theme-portal .vk-portal-side a.is-active {
  background: rgb(var(--accent-soft));
  color: rgb(var(--primary));
  font-weight: 700;
}

.theme-portal .vk-portal-side a svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.theme-portal .vk-portal-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.theme-portal .vk-portal-summary a,
.theme-portal .vk-portal-summary .vk-card {
  min-height: 92px;
}

.theme-portal .vk-portal-kicker {
  font-size: 11px;
  color: rgb(var(--muted));
}

.theme-portal .vk-portal-timeline {
  position: relative;
  padding-right: 14px;
}

.theme-portal .vk-portal-timeline:before {
  content: "";
  position: absolute;
  right: 4px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgb(var(--border));
}

.theme-portal .vk-portal-tl-item {
  position: relative;
  margin-bottom: 12px;
}

.theme-portal .vk-portal-tl-item:before {
  content: "";
  position: absolute;
  right: -12px;
  top: 14px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgb(var(--primary));
}

.theme-portal .vk-portal-tabs {
  display: flex;
  gap: 6px;
  overflow: auto;
  margin: 8px 0 16px;
}

.theme-portal .vk-portal-tabs button {
  border: 0;
  background: rgb(var(--surface2));
  color: rgb(var(--muted));
  border-radius: 999px;
  padding: 8px 14px;
  min-height: 40px;
  white-space: nowrap;
  font-size: 13px;
}

.theme-portal .vk-portal-tabs button.is-active {
  background: rgb(var(--primary));
  color: rgb(var(--on-primary));
  font-weight: 700;
}

.theme-portal .vk-portal-bubble {
  max-width: 88%;
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.theme-portal .vk-portal-bubble.is-client {
  background: rgb(var(--accent-soft));
  margin-right: auto;
}

.theme-portal .vk-portal-bubble.is-staff {
  background: rgb(var(--surface));
  border: 1px solid rgb(var(--border));
}

.theme-portal .vk-portal-nav-badge {
  position: relative;
}

.theme-portal .vk-portal-nav-badge .vk-badge {
  position: absolute;
  top: 2px;
  left: 18%;
  min-width: 16px;
  height: 16px;
  font-size: 10px;
}

.theme-portal .vk-bottom-nav {
  padding-bottom: max(var(--vk-safe-bottom), 6px);
}

@media (min-width: 768px) and (max-width: 1023px) {
  .theme-portal .vk-bottom-nav {
    display: flex !important;
  }
}

@media (min-width: 1024px) {
  .theme-portal .vk-portal-shell {
    display: flex;
    align-items: stretch;
  }
  .theme-portal .vk-portal-side {
    display: flex !important;
  }
  .theme-portal .vk-appbar,
  .theme-portal .vk-bottom-nav {
    display: none !important;
  }
  .theme-portal .vk-portal-maincol {
    flex: 1;
    min-width: 0;
  }
  .theme-portal .vk-portal-main {
    padding-top: 28px !important;
    padding-bottom: 40px !important;
    max-width: 880px;
  }
  .theme-portal .vk-portal-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
