/* WelnHost cabinet v37: calm infrastructure design with a shared light/dark theme. */
:root {
  color-scheme: light;
  --wh-bg: #f4f6f3;
  --wh-surface: #ffffff;
  --wh-surface-soft: #edf2ed;
  --wh-text: #17201a;
  --wh-muted: #68736b;
  --wh-line: #dfe5df;
  --wh-primary: #2f6b4f;
  --wh-primary-hover: #285c44;
  --wh-primary-soft: #deebe1;
  --wh-amber: #d9a441;
  --wh-amber-soft: #f7edcf;
  --wh-info: #4f6fa8;
  --wh-danger: #bd5b58;
  --wh-danger-soft: #f8e6e4;
  --wh-success: #2f7b55;
  --wh-terminal: #111714;
  --wh-terminal-text: #cde6d5;
  --wh-shadow-sm: 0 6px 18px rgba(31, 48, 38, .07);
  --wh-shadow-md: 0 14px 38px rgba(31, 48, 38, .09);
  --wh-radius-sm: 10px;
  --wh-radius: 14px;
  --wh-radius-lg: 18px;
  --wh-transition: 180ms cubic-bezier(.2, .8, .2, 1);

  --bg: var(--wh-bg);
  --panel: var(--wh-surface);
  --text: var(--wh-text);
  --muted: var(--wh-muted);
  --blue: var(--wh-primary);
  --yellow: var(--wh-amber-soft);
  --lime: var(--wh-primary-soft);
  --black: var(--wh-text);
  --white: var(--wh-surface);
  --border: 1px solid var(--wh-line);
  --shadow: var(--wh-shadow-sm);
  --font-body: "Manrope Stitch", "Manrope Local", "Segoe UI", system-ui, sans-serif;
  --font-heading: "Manrope Stitch", "Manrope Local", "Segoe UI", system-ui, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --wh-bg: #111714;
  --wh-surface: #18201c;
  --wh-surface-soft: #1e2923;
  --wh-text: #eaf0ec;
  --wh-muted: #a5b0a8;
  --wh-line: #2c3831;
  --wh-primary: #73b792;
  --wh-primary-hover: #86c7a3;
  --wh-primary-soft: #25392d;
  --wh-amber: #dfb45b;
  --wh-amber-soft: #3a3220;
  --wh-info: #8fa8d3;
  --wh-danger: #e18a86;
  --wh-danger-soft: #3a2524;
  --wh-success: #73b792;
  --wh-terminal: #0c110e;
  --wh-terminal-text: #b9d8c4;
  --wh-shadow-sm: 0 8px 22px rgba(0, 0, 0, .2);
  --wh-shadow-md: 0 18px 46px rgba(0, 0, 0, .28);
}

html {
  background: var(--wh-bg);
}

body.cabinet-page {
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  background: var(--wh-bg);
  color: var(--wh-text);
  font-family: var(--font-body);
  letter-spacing: 0;
  transition: background-color .24s ease, color .24s ease;
}

body.cabinet-page *,
body.cabinet-page *::before,
body.cabinet-page *::after {
  box-sizing: border-box;
}

body.cabinet-page h1,
body.cabinet-page h2,
body.cabinet-page h3,
body.cabinet-page h4,
body.cabinet-page button,
body.cabinet-page input,
body.cabinet-page select {
  font-family: var(--font-body);
  letter-spacing: 0;
}

body.cabinet-page button,
body.cabinet-page a,
body.cabinet-page select,
body.cabinet-page input {
  -webkit-tap-highlight-color: transparent;
}

body.cabinet-page :focus-visible {
  outline: 3px solid color-mix(in srgb, var(--wh-primary) 28%, transparent);
  outline-offset: 2px;
}

.material-symbols-outlined {
  font-size: 21px;
}

.side-nav {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 264px;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--wh-line);
  background: var(--wh-surface);
  color: var(--wh-text);
  box-shadow: none;
}

.side-head {
  padding: 4px 6px 14px;
  border-bottom: 1px solid var(--wh-line);
}

.brand-row {
  gap: 10px;
}

.brand-row h1 {
  font-size: 19px;
  font-weight: 760;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 12px;
  background: var(--wh-primary);
  color: #fff;
  box-shadow: none;
}

html[data-theme="dark"] .brand-mark {
  color: #102118;
}

.access-status-mini {
  margin-top: 12px;
  padding: 7px 10px;
  border: 1px solid var(--wh-line);
  border-radius: 999px;
  background: var(--wh-surface-soft);
  color: var(--wh-muted);
  font-size: 12px;
  font-weight: 650;
}

.side-menu {
  display: grid;
  gap: 5px;
}

.side-section {
  margin: 14px 10px 5px;
  color: var(--wh-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.side-link {
  min-height: 44px;
  padding: 10px 12px;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  background: transparent;
  color: var(--wh-muted);
  font-size: 14px;
  font-weight: 620;
  transition: color var(--wh-transition), background-color var(--wh-transition), border-color var(--wh-transition);
}

.side-link:hover {
  border-color: var(--wh-line);
  background: var(--wh-surface-soft);
  color: var(--wh-text);
}

.side-link.is-active {
  border-color: color-mix(in srgb, var(--wh-primary) 26%, var(--wh-line));
  background: var(--wh-primary-soft);
  color: var(--wh-primary);
}

.side-link.is-locked {
  opacity: .62;
}

.side-link .lock-icon {
  margin-left: auto;
  font-size: 17px;
}

.side-footer {
  margin-top: auto;
  gap: 12px;
}

.buy-note {
  padding: 14px;
  border: 1px solid var(--wh-line);
  border-radius: var(--wh-radius);
  background: var(--wh-surface-soft);
  color: var(--wh-muted);
  box-shadow: none;
}

.buy-note a {
  color: var(--wh-primary);
}

.footer-links {
  border-top: 1px solid var(--wh-line);
  padding-top: 9px;
}

.footer-links a,
.footer-links button {
  color: var(--wh-muted);
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 68px;
  margin-left: 264px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--wh-line);
  background: color-mix(in srgb, var(--wh-bg) 88%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: none;
}

.top-kicker {
  color: var(--wh-primary);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
}

.top-title h2 {
  margin: 1px 0 0;
  color: var(--wh-text);
  font-size: 18px;
  font-weight: 730;
}

.top-actions {
  gap: 8px;
}

.icon-button,
.theme-button {
  width: 42px;
  height: 42px;
  min-width: 42px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--wh-line);
  border-radius: 12px;
  background: var(--wh-surface);
  color: var(--wh-text);
  box-shadow: none;
  transition: transform var(--wh-transition), border-color var(--wh-transition), background-color var(--wh-transition);
}

.icon-button:hover,
.theme-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--wh-primary) 52%, var(--wh-line));
  background: var(--wh-surface-soft);
}

.divider {
  background: var(--wh-line);
}

.profile-chip {
  min-height: 42px;
  padding: 4px 11px 4px 5px;
  border: 1px solid var(--wh-line);
  border-radius: 13px;
  background: var(--wh-surface);
}

.profile-avatar {
  background: var(--wh-primary-soft);
  color: var(--wh-primary);
}

.profile-chip strong {
  color: var(--wh-text);
}

.profile-chip small {
  color: var(--wh-muted);
}

.top-support {
  color: var(--wh-muted);
}

.order-button {
  min-height: 42px;
  padding: 10px 15px;
  border: 1px solid var(--wh-primary);
  border-radius: 12px;
  background: var(--wh-primary);
  color: #fff;
  box-shadow: none;
  font-weight: 680;
  transition: transform var(--wh-transition), background-color var(--wh-transition);
}

html[data-theme="dark"] .order-button {
  color: #102118;
}

.order-button:hover {
  transform: translateY(-1px);
  background: var(--wh-primary-hover);
}

.workspace {
  min-height: calc(100svh - 68px);
  margin-left: 264px;
  padding: 30px 24px 64px;
  overflow: visible;
  background: var(--wh-bg);
}

.workspace-inner {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: 0;
  overflow: visible;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(290px, .75fr);
  gap: 16px;
  align-items: stretch;
}

.status-card,
.start-card,
.login-card,
.locked-preview,
.launch-shell,
.logs-toolbar,
.logs-terminal,
.tariff-card,
.crypto-payment-panel,
.bot-card,
.confirm-dialog {
  border: 1px solid var(--wh-line);
  border-radius: var(--wh-radius-lg);
  background: var(--wh-surface);
  color: var(--wh-text);
  box-shadow: var(--wh-shadow-sm);
}

.status-card {
  min-height: 312px;
  padding: 34px;
}

.violet-glow {
  display: none;
}

.status-badge,
.payment-state,
.log-status,
.selected-bot-label,
.tariff-badge,
.popular-tag,
.tariff-chip-row span,
.bot-status {
  border: 1px solid var(--wh-line);
  border-radius: 999px;
  background: var(--wh-surface-soft);
  color: var(--wh-muted);
  box-shadow: none;
}

.status-card h3 {
  max-width: 680px;
  margin: 18px 0 10px;
  color: var(--wh-text);
  font-size: 36px;
  line-height: 1.12;
  font-weight: 760;
}

.status-card p,
.page-head p,
.tariffs-head p,
.tariff-head p,
.login-card p {
  color: var(--wh-muted);
}

.card-actions {
  gap: 10px;
}

.primary-action,
.platega-button,
.crypto-actions button:first-child,
.logs-controls button,
.ghost-button,
.bot-actions button {
  min-height: 44px;
  border: 1px solid var(--wh-primary);
  border-radius: 11px;
  background: var(--wh-primary);
  color: #fff;
  box-shadow: none;
  font-weight: 680;
  transition: transform var(--wh-transition), background-color var(--wh-transition), border-color var(--wh-transition);
}

html[data-theme="dark"] .primary-action,
html[data-theme="dark"] .platega-button,
html[data-theme="dark"] .crypto-actions button:first-child,
html[data-theme="dark"] .logs-controls button,
html[data-theme="dark"] .ghost-button,
html[data-theme="dark"] .bot-actions button {
  color: #102118;
}

.primary-action:hover,
.platega-button:hover,
.ghost-button:hover,
.bot-actions button:hover {
  transform: translateY(-1px);
  background: var(--wh-primary-hover);
}

.secondary-action,
.crypto-button,
.crypto-actions button:last-child {
  min-height: 44px;
  border: 1px solid var(--wh-line);
  border-radius: 11px;
  background: var(--wh-surface-soft);
  color: var(--wh-text);
  box-shadow: none;
}

body.cabinet-page .tariff-actions .platega-button {
  border-color: var(--wh-primary);
  border-radius: 11px;
  background: var(--wh-primary);
  color: #fff;
}

html[data-theme="dark"] body.cabinet-page .tariff-actions .platega-button {
  color: #102118;
}

body.cabinet-page .tariff-actions .crypto-button {
  border: 1px solid var(--wh-line);
  border-radius: 11px;
  background: var(--wh-surface-soft);
  color: var(--wh-text);
}

.start-card {
  padding: 26px;
  background: var(--wh-primary-soft);
}

.start-label {
  color: var(--wh-primary);
}

.start-card h4 {
  color: var(--wh-text);
}

.start-price,
.tariff-price {
  color: var(--wh-primary);
}

.start-card li .material-symbols-outlined,
.tariff-card li .material-symbols-outlined {
  color: var(--wh-primary);
}

.start-card li,
.tariff-card li {
  color: var(--wh-text);
}

.locked-preview {
  margin-top: 16px;
  overflow: hidden;
}

.locked-overlay {
  background: color-mix(in srgb, var(--wh-surface) 92%, transparent);
  backdrop-filter: blur(7px);
}

.lock-circle,
.login-icon,
.upload-icon,
.confirm-icon {
  border: 0;
  border-radius: 14px;
  background: var(--wh-primary-soft);
  color: var(--wh-primary);
  box-shadow: none;
}

.management-panel,
.management-view,
.logs-view {
  width: 100%;
  min-width: 0;
}

.page-head,
.tariffs-head {
  margin-bottom: 20px;
}

.page-head h3,
.tariffs-head h3 {
  color: var(--wh-text);
  font-size: 30px;
  font-weight: 750;
}

.launch-shell {
  padding: 20px;
}

.upload-dropzone {
  border: 1px dashed color-mix(in srgb, var(--wh-primary) 46%, var(--wh-line));
  border-radius: var(--wh-radius);
  background: var(--wh-surface-soft);
  color: var(--wh-text);
}

.upload-dropzone small,
.upload-dropzone em,
.bot-state small,
.bot-meta,
.bot-card p {
  color: var(--wh-muted);
}

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

.bot-card {
  padding: 18px;
}

.bot-card:hover {
  border-color: color-mix(in srgb, var(--wh-primary) 42%, var(--wh-line));
  box-shadow: var(--wh-shadow-md);
}

.bot-actions .danger,
.danger-button {
  border-color: color-mix(in srgb, var(--wh-danger) 45%, var(--wh-line));
  background: var(--wh-danger-soft);
  color: var(--wh-danger);
}

.logs-toolbar {
  padding: 14px;
  box-shadow: none;
}

.bot-select-label select {
  border: 1px solid var(--wh-line);
  border-radius: 10px;
  background: var(--wh-surface-soft);
  color: var(--wh-text);
}

.logs-terminal {
  overflow: hidden;
  border-color: #28322c;
  background: var(--wh-terminal);
  color: var(--wh-terminal-text);
  box-shadow: var(--wh-shadow-md);
}

.terminal-head {
  border-bottom: 1px solid #28322c;
  background: #141b17;
  color: #a8b7ad;
}

.terminal-output,
.terminal-empty,
.terminal-line {
  color: var(--wh-terminal-text);
}

.tariffs {
  width: 100%;
}

.tariffs-head > span {
  color: var(--wh-primary);
}

.tariff-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.tariff-card {
  min-width: 0;
  padding: 22px;
  display: flex;
  flex-direction: column;
}

.tariff-card.featured {
  border-color: var(--wh-primary);
  background: color-mix(in srgb, var(--wh-surface) 91%, var(--wh-primary-soft));
  box-shadow: var(--wh-shadow-md);
  transform: none;
}

.tariff-card h4 {
  color: var(--wh-text);
  font-size: 22px;
}

.tariff-price {
  font-size: 34px;
  font-weight: 780;
}

.tariff-price span {
  color: var(--wh-muted);
}

.tariff-card ul {
  flex: 1;
}

.tariff-card li {
  color: var(--wh-text);
}

.tariff-actions {
  display: grid;
  gap: 8px;
}

.crypto-payment-panel {
  margin-top: 16px;
}

.crypto-kicker,
.crypto-status {
  color: var(--wh-primary);
}

.login-card {
  max-width: 560px;
  padding: 34px;
}

.login-actions button {
  border-radius: 11px;
  box-shadow: none;
}

.toast {
  border: 1px solid var(--wh-line);
  border-radius: 12px;
  background: var(--wh-text);
  color: var(--wh-bg);
  box-shadow: var(--wh-shadow-md);
}

.confirm-backdrop {
  background: rgba(9, 14, 11, .56);
  backdrop-filter: blur(4px);
}

.confirm-dialog {
  padding: 26px;
}

.mobile-tabs {
  display: none;
}

@media (max-width: 1120px) {
  .tariff-grid {
    grid-template-columns: 1fr;
  }

  .tariff-card {
    max-width: none;
  }
}

@media (max-width: 980px) {
  .side-nav {
    display: none;
  }

  .top-nav {
    margin-left: 0;
    min-height: 62px;
    padding: 8px 16px;
  }

  .workspace {
    min-height: calc(100svh - 62px);
    margin-left: 0;
    padding: 20px 16px calc(104px + env(safe-area-inset-bottom));
  }

  .mobile-tabs {
    position: fixed;
    inset: auto 12px calc(10px + env(safe-area-inset-bottom)) 12px;
    z-index: 60;
    height: 66px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    border: 1px solid var(--wh-line);
    border-radius: 17px;
    background: color-mix(in srgb, var(--wh-surface) 92%, transparent);
    box-shadow: 0 16px 38px rgba(22, 33, 26, .16);
    backdrop-filter: blur(18px);
  }

  .mobile-tab {
    width: 100%;
    min-width: 0;
    height: 52px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--wh-muted);
    font-size: 10px;
    font-weight: 650;
    line-height: 1.1;
    overflow: hidden;
  }

  .mobile-tab .material-symbols-outlined {
    flex: 0 0 auto;
    font-size: 21px;
  }

  .mobile-tab > span:last-child {
    display: block;
    width: 100%;
    overflow: hidden;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-tab.is-active {
    background: var(--wh-primary-soft);
    color: var(--wh-primary);
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .bot-grid {
    grid-template-columns: 1fr;
  }

  .top-support,
  .divider,
  .order-button {
    display: none;
  }
}

@media (max-width: 620px) {
  .top-nav {
    gap: 10px;
  }

  .top-title h2 {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 16px;
  }

  .top-actions {
    margin-left: auto;
  }

  .top-actions > .icon-button:not(.theme-button),
  .profile-chip {
    display: none;
  }

  .workspace {
    padding-inline: 12px;
  }

  .status-card,
  .start-card,
  .login-card,
  .launch-shell,
  .tariff-card,
  .confirm-dialog {
    border-radius: 15px;
  }

  .status-card {
    min-height: 0;
    padding: 24px 20px;
  }

  .status-card h3 {
    font-size: 28px;
  }

  .card-actions,
  .login-actions,
  .confirm-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .start-card,
  .tariff-card,
  .launch-shell {
    padding: 18px;
  }

  .page-head h3,
  .tariffs-head h3 {
    font-size: 25px;
  }

  .logs-toolbar,
  .logs-controls {
    align-items: stretch;
  }

  .logs-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .bot-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Telegram Mini App uses the same width contract. Platform alone never forces desktop layout. */
body.is-telegram-miniapp,
body.is-telegram-shell {
  position: static !important;
  width: 100% !important;
  height: auto !important;
  min-height: var(--tg-viewport-stable-height, 100svh) !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}

.is-telegram-miniapp .side-nav,
.is-telegram-miniapp .top-nav,
.is-telegram-shell .side-nav,
.is-telegram-shell .top-nav {
  display: none !important;
}

.is-telegram-miniapp .workspace,
.is-telegram-shell .workspace {
  width: 100% !important;
  min-height: var(--tg-viewport-stable-height, 100svh) !important;
  height: auto !important;
  margin: 0 !important;
  padding: 12px 12px calc(96px + var(--tg-safe-area-bottom, 0px)) !important;
  overflow: visible !important;
}

.is-telegram-miniapp .workspace-inner,
.is-telegram-shell .workspace-inner {
  width: min(100%, 760px) !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 auto !important;
  padding: 0 !important;
  overflow: visible !important;
}

.is-telegram-miniapp .mobile-tabs,
.is-telegram-shell .mobile-tabs {
  position: fixed !important;
  inset: auto 10px calc(8px + var(--tg-safe-area-bottom, 0px)) 10px !important;
  width: auto !important;
  height: 64px !important;
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  transform: none !important;
}

.is-telegram-miniapp .hero-grid,
.is-telegram-shell .hero-grid,
.is-telegram-miniapp .tariff-grid,
.is-telegram-shell .tariff-grid,
.is-telegram-miniapp .bot-grid,
.is-telegram-shell .bot-grid {
  grid-template-columns: 1fr !important;
}

@media (prefers-reduced-motion: reduce) {
  body.cabinet-page *,
  body.cabinet-page *::before,
  body.cabinet-page *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
