*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

:root {
  --bg-app: #0f1117;
  --bg-panel: #151922;
  --bg-elevated: #1b2030;
  --bg-hover: #232a3d;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text-primary: #f3f5f9;
  --text-secondary: #9aa4b2;
  --text-muted: #6b7280;
  --accent: #5865f2;
  --accent-hover: #4752c4;
  --accent-soft: rgba(88, 101, 242, 0.12);
  --success: #23a559;
  --success-soft: rgba(35, 165, 89, 0.12);
  --error: #f23f43;
  --error-soft: rgba(242, 63, 67, 0.12);
  --warning: #f0b232;
  --warning-soft: rgba(240, 178, 50, 0.12);
  --sidebar-width: 280px;
  --header-height: 72px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-app);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: clip;
}

.hidden {
  display: none !important;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(88, 101, 242, 0.18), transparent 35%),
    var(--bg-main);
}

body.app-booting #auth-screen,
body.app-booting #dashboard,
body.app-booting #bot-select-screen,
body.app-booting #subscription-expired-screen {
  display: none !important;
}

.app-boot-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top, rgba(88, 101, 242, 0.18), transparent 35%),
    var(--bg-main);
}

.app-boot-loader.hidden {
  display: none;
}

.app-boot-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 32px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  color: var(--text-secondary);
  font-size: 14px;
}

.app-boot-loader-icon {
  border-radius: 8px;
}

.auth-card {
  width: min(100%, 420px);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow);
}

.subscription-expired-card {
  width: min(100%, 480px);
  text-align: center;
}

.subscription-expired-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: rgba(237, 66, 69, 0.12);
  border: 1px solid rgba(237, 66, 69, 0.28);
}

.subscription-expired-card h2 {
  margin: 0 0 12px;
}

.subscription-expired-message {
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0 0 16px;
}

.renew-subscription-modal {
  width: min(100%, 520px);
}

.renew-contact-links {
  display: grid;
  gap: 12px;
}

.renew-contact-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.renew-contact-card:hover {
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.08);
}

.renew-contact-card.is-static {
  cursor: default;
}

.renew-contact-card.is-static:hover {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.renew-contact-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(88, 101, 242, 0.16);
  font-size: 18px;
  flex-shrink: 0;
}

.renew-contact-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.renew-contact-copy strong {
  font-size: 14px;
}

.renew-contact-copy span {
  color: var(--text-secondary);
  font-size: 13px;
  word-break: break-word;
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-brand-login {
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
}

.auth-brand-compact {
  margin-bottom: 16px;
}

.auth-brand-compact .brand-copy h2 {
  font-size: 15px;
}

.brand-mark-logo {
  background: transparent;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
  padding: 0;
}

.auth-brand-login .brand-mark-logo {
  width: 96px;
  height: 96px;
  border-radius: 22px;
}

.auth-brand-compact .brand-mark-logo,
.sidebar-header .brand-mark-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.auth-inline-error {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(242, 63, 67, 0.45);
  background: rgba(242, 63, 67, 0.12);
  color: #ffb4b6;
  font-size: 14px;
}

.auth-step-note {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
}

.bot-select-card {
  width: min(100%, 560px);
}

.bot-list {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.bot-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.bot-gallery-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bot-gallery-card:hover {
  border-color: rgba(88, 101, 242, 0.45);
  transform: translateY(-2px);
}

.bot-gallery-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.35), 0 12px 32px rgba(88, 101, 242, 0.12);
}

.bot-gallery-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.bot-gallery-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.bot-managing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #3dd178;
  letter-spacing: 0.02em;
}

.bot-managing-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #23a559;
  box-shadow: 0 0 0 0 rgba(35, 165, 89, 0.65);
  animation: managing-pulse 2s ease-out infinite;
}

@keyframes managing-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(35, 165, 89, 0.65);
  }

  70% {
    box-shadow: 0 0 0 10px rgba(35, 165, 89, 0);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(35, 165, 89, 0);
  }
}

.bot-gallery-card.is-managing {
  border-color: rgba(35, 165, 89, 0.55);
  box-shadow: 0 0 0 1px rgba(35, 165, 89, 0.25), 0 12px 32px rgba(35, 165, 89, 0.08);
}

.bot-gallery-footer .btn[disabled] {
  opacity: 0.72;
  cursor: not-allowed;
}

.bot-gallery-avatar {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--accent), #7c87ff);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 700;
  font-size: 16px;
}

.bot-gallery-avatar img,
.user-access-bot-avatar img,
.brand-mark .brand-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.bot-gallery-avatar.is-fallback span {
  font-size: 16px;
}

.user-access-bot-avatar.is-fallback span {
  font-size: 12px;
}

.bot-gallery-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.bot-gallery-brand,
.bot-gallery-username {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.bot-gallery-meta {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.bot-gallery-meta div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}

.bot-gallery-meta dt {
  color: var(--text-muted);
}

.bot-gallery-meta dd {
  color: var(--text-primary);
  text-align: right;
  word-break: break-all;
}

.bot-gallery-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}

.bot-gallery-footer .btn {
  width: 100%;
}

.bot-select-card .bot-gallery-card {
  cursor: pointer;
}

.bot-card {
  width: 100%;
  text-align: left;
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
}

.bot-card:hover {
  border-color: var(--accent);
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.permission-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.dashboard {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  max-width: min(var(--sidebar-width), 88vw);
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 100;
  transition: transform 0.25s ease;
}

.sidebar-header {
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--border);
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7c87ff);
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 14px;
  color: white;
  box-shadow: 0 8px 20px rgba(88, 101, 242, 0.35);
}

.brand-copy h2 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-copy p {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px 20px;
}

.nav-section {
  padding: 18px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(88, 101, 242, 0.25);
}

.nav-icon {
  width: 18px;
  text-align: center;
  opacity: 0.9;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.sidebar-footer .meta {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-user-block {
  margin-bottom: 4px;
}

.sidebar-rent-timer {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(250, 168, 26, 0.28);
  background: rgba(250, 168, 26, 0.08);
}

.sidebar-rent-timer-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.sidebar-rent-timer strong {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: #ffd27a;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.sidebar-rent-timer.is-urgent {
  border-color: rgba(237, 66, 69, 0.35);
  background: rgba(237, 66, 69, 0.1);
}

.sidebar-rent-timer.is-urgent strong {
  color: #ff8e8e;
}

.sidebar-rent-timer.is-expired strong {
  color: #ff8e8e;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  height: var(--header-height);
  padding: 0 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(21, 25, 34, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

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

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  border: 0;
  background: rgba(4, 6, 12, 0.62);
  backdrop-filter: blur(2px);
}

body.sidebar-open .sidebar-backdrop {
  display: block;
}

.header h1 {
  font-size: clamp(1.1rem, 2.4vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  min-width: 0;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
}

.status-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.status-indicator.online {
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.status-indicator.offline {
  background: var(--error);
  box-shadow: 0 0 0 4px var(--error-soft);
}

.page-content {
  flex: 1;
  padding: 28px;
  min-width: 0;
  width: 100%;
}

.footer {
  padding: 16px 28px 24px;
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.stat-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--text-secondary);
}

.card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.01);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
}

.card-description {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 4px;
}

.card-body {
  padding: 24px;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.label-required {
  color: #ed4245;
  margin-left: 4px;
  font-weight: 700;
}

.form-group.is-invalid label,
.field-item.is-invalid .field-item-header span,
.button-item.is-invalid .button-item-header span,
.select-option-item.is-invalid .select-option-item-header span {
  color: #ff8e8e;
}

.form-group.is-invalid input,
.form-group.is-invalid textarea,
.form-group.is-invalid select,
.field-item.is-invalid input,
.field-item.is-invalid textarea,
.button-item.is-invalid input,
.button-item.is-invalid select,
.select-option-item.is-invalid input {
  border-color: rgba(237, 66, 69, 0.85);
  box-shadow: 0 0 0 1px rgba(237, 66, 69, 0.25);
}

.command-requirements-panel {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(88, 101, 242, 0.22);
  background: linear-gradient(180deg, rgba(88, 101, 242, 0.1) 0%, rgba(88, 101, 242, 0.04) 100%);
}

.command-requirements-panel h4 {
  font-size: 13px;
  margin: 0;
}

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

.builder-optional-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px dashed rgba(88, 101, 242, 0.28);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.builder-optional-toolbar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-right: 4px;
}

.builder-optional-chip {
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.builder-optional-chip:hover {
  border-color: rgba(88, 101, 242, 0.35);
  color: #dbe0ff;
}

.builder-optional-chip.is-active {
  border-color: rgba(88, 101, 242, 0.55);
  background: rgba(88, 101, 242, 0.18);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.18);
}

.builder-optional-chip.hidden {
  display: none;
}

.builder-optional-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.builder-optional-panel.hidden {
  display: none;
}

.embed-builder-toolbar {
  margin-top: 4px;
  margin-bottom: 0;
}

.embed-toggle-panel {
  margin-top: 0;
}

.builder-optional-panel .form-group:first-child {
  margin-top: 0;
}

.command-requirements-panel ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.6;
}

.command-requirements-panel li.is-missing {
  color: #ff8e8e;
  font-weight: 600;
}

.command-requirements-panel li.is-ok {
  color: #3dd178;
}

.command-requirements-panel .requirements-missing-list {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: #ff8e8e;
  font-size: 12px;
}

.form-group input,
.form-group textarea,
.form-group select,
.code-editor {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.code-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-group textarea,
.code-editor {
  min-height: 120px;
  resize: vertical;
  font-family: Consolas, 'Courier New', monospace;
  line-height: 1.45;
}

.form-hint {
  display: block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.form-group-toggle .toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.config-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 18px;
  margin-bottom: 18px;
  background: rgba(255, 255, 255, 0.01);
}

.config-section > legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-hover);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--error);
  color: white;
}

.btn-warning {
  background: var(--warning);
  color: #1a1a1a;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #3a4256;
  border-radius: 999px;
  transition: 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

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

.toggle-switch.is-on .toggle-slider {
  background: var(--accent);
}

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

.toggle-switch.is-on .toggle-slider::before {
  transform: translateX(20px);
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.system-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
}

.system-card strong {
  display: block;
  font-size: 14px;
}

.system-card span {
  font-size: 12px;
  color: var(--text-secondary);
}

.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

th {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

td {
  color: var(--text-primary);
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: var(--success-soft);
  color: #7dffb2;
}

.badge-error {
  background: var(--error-soft);
  color: #ffb4b6;
}

.badge-accent {
  background: rgba(88, 101, 242, 0.18);
  color: #c7ceff;
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
}

.badge-warning {
  background: rgba(240, 178, 50, 0.16);
  color: #ffd98a;
}

.user-control-header {
  align-items: flex-start;
  gap: 16px;
}

.user-control-header .btn {
  flex-shrink: 0;
}

.users-table-wrap {
  overflow-x: auto;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.users-table th,
.users-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.users-table tbody tr:last-child td {
  border-bottom: none;
}

.users-table th:last-child,
.users-table td.users-table-actions {
  width: 1%;
  white-space: nowrap;
}

.users-table-actions {
  text-align: right;
}

.users-table-actions-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
}

.users-table th {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  text-align: left;
}

.users-table-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.users-table-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #7c87ff);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-editor-current-rent {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-secondary);
  font-size: 13px;
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.45;
}

.checkbox-row input {
  margin-top: 3px;
}

.user-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.user-tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-primary);
}

.user-tag-accent {
  background: rgba(88, 101, 242, 0.16);
  border-color: rgba(88, 101, 242, 0.28);
  color: #dbe0ff;
}

.create-user-panel {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.create-user-panel-header,
.create-user-section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.create-user-panel-header h3,
.create-user-section-header h4 {
  margin: 0 0 4px;
  font-size: 18px;
}

.create-user-section {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
}

.create-user-section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.create-user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.create-user-form-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

.rent-mode-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.rent-mode-option {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.rent-mode-option:has(input:checked) {
  border-color: rgba(88, 101, 242, 0.45);
  background: rgba(88, 101, 242, 0.1);
}

.rent-mode-option input {
  accent-color: var(--accent);
}

.rent-duration-fields.hidden {
  display: none;
}

.rent-duration-grid {
  grid-template-columns: repeat(4, minmax(100px, 1fr));
}

.user-rent-summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

@media (max-width: 900px) {
  .rent-duration-grid {
    grid-template-columns: repeat(2, minmax(100px, 1fr));
  }
}

.user-access-bot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.user-access-bot-card {
  display: block;
  cursor: pointer;
}

.user-access-bot-input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.user-access-bot-card-inner {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.user-access-bot-card:hover .user-access-bot-card-inner {
  border-color: rgba(88, 101, 242, 0.35);
}

.user-access-bot-card.is-selected .user-access-bot-card-inner {
  border-color: rgba(88, 101, 242, 0.55);
  box-shadow: 0 0 0 1px rgba(88, 101, 242, 0.18);
}

.user-access-bot-card-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.user-access-bot-card-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.user-access-bot-card-copy strong {
  font-size: 14px;
}

.user-access-bot-toggle {
  flex-shrink: 0;
  pointer-events: none;
}

.user-access-bot-avatar {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex-shrink: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #7c87ff);
  color: white;
  font-weight: 700;
  font-size: 12px;
}

.user-access-bot-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.user-access-bot-meta div {
  min-width: 0;
}

.user-access-bot-meta dt {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.user-access-bot-meta dd {
  margin: 0;
  font-size: 12px;
  color: var(--text-primary);
  word-break: break-word;
}

.permission-toggle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.permission-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.permission-toggle-card.is-enabled {
  border-color: rgba(88, 101, 242, 0.35);
  background: rgba(88, 101, 242, 0.08);
}

.permission-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.permission-toggle-copy strong {
  font-size: 13px;
}

.permission-toggle-copy .form-hint {
  font-size: 11px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state h3 {
  font-size: 16px;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.page-loader {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 220px;
  color: var(--text-secondary);
}

.loading {
  width: 22px;
  height: 22px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notification {
  min-width: 320px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  animation: slideIn 0.25s ease;
}

.notification.success {
  border-color: rgba(35, 165, 89, 0.35);
}

.notification.error {
  border-color: rgba(242, 63, 67, 0.35);
}

.notification.warning {
  border-color: rgba(240, 178, 50, 0.35);
}

.notification.info {
  border-color: rgba(88, 101, 242, 0.45);
}

.notification-message {
  flex: 1;
  font-size: 13px;
}

.notification-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 18px;
}

@keyframes slideIn {
  from {
    transform: translateX(16px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 15, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1500;
  padding: 20px;
}

.modal-content {
  width: min(560px, 100%);
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.command-builder-modal {
  width: min(1680px, calc(100vw - 32px));
  height: min(92vh, 980px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(88, 101, 242, 0.08) 0%, rgba(88, 101, 242, 0) 120px),
    var(--bg-panel);
  border: 1px solid rgba(88, 101, 242, 0.22);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.command-builder-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(88, 101, 242, 0.18);
  background: rgba(255, 255, 255, 0.02);
}

.command-builder-header-main {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.command-builder-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #5865f2 0%, #7289da 100%);
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.35);
  flex-shrink: 0;
}

.command-builder-header h2 {
  font-size: 18px;
  line-height: 1.2;
  margin: 0;
}

.command-builder-subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.command-builder-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.command-builder-zoom {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
}

.command-builder-zoom span {
  min-width: 48px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.command-builder-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.command-builder-scroll {
  height: 100%;
  overflow: auto;
  padding: 18px 22px 22px;
}

.command-builder-workspace {
  zoom: var(--builder-zoom, 1);
}

.command-builder-alert {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(240, 178, 50, 0.35);
  background: rgba(240, 178, 50, 0.08);
  color: var(--text-secondary);
}

.command-builder-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-top: 1px solid rgba(88, 101, 242, 0.18);
  background: rgba(10, 12, 18, 0.92);
  backdrop-filter: blur(10px);
}

.command-builder-footer-note {
  margin: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.command-builder-footer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.command-builder-footer-actions .btn-primary {
  min-width: 140px;
  box-shadow: 0 8px 24px rgba(88, 101, 242, 0.28);
}

.command-builder-container {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 20px;
  align-items: start;
}

.builder-controls {
  min-width: 0;
}

.builder-section {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, rgba(255, 255, 255, 0.01) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.builder-section h3 {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #aeb6ff;
  margin-bottom: 14px;
}

.builder-preview {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.builder-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.builder-preview-header h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #aeb6ff;
}

.builder-preview-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #dbe0ff;
  background: rgba(88, 101, 242, 0.18);
  border: 1px solid rgba(88, 101, 242, 0.28);
}

.builder-code-panel {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.22);
}

.builder-code-panel .code-editor {
  min-height: 220px;
  max-height: 340px;
  resize: vertical;
}

.discord-preview {
  background: linear-gradient(180deg, #313338 0%, #2b2d31 100%);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 14px;
  padding: 16px;
  min-height: 280px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.modal-header,
.modal-footer {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-footer {
  border-bottom: none;
  border-top: 1px solid var(--border);
  justify-content: flex-end;
}

.modal-body {
  padding: 22px;
  overflow: auto;
}

.file-browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin-bottom: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}

.breadcrumb button {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
}

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

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-item:hover {
  border-color: rgba(88, 101, 242, 0.35);
  background: var(--bg-hover);
}

.file-name {
  font-weight: 600;
  font-size: 14px;
}

.file-meta {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.file-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.discord-message {
  display: flex;
  gap: 14px;
}

.discord-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  display: grid;
  place-items: center;
}

.discord-username {
  font-weight: 600;
  margin-bottom: 6px;
}

.discord-timestamp {
  margin-left: 8px;
  color: #949ba4;
  font-size: 12px;
  font-weight: 400;
}

.discord-text,
.discord-embed-description {
  color: #dbdee1;
  white-space: pre-wrap;
}

.discord-embed {
  margin-top: 8px;
  background: #2b2d31;
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  padding: 12px;
}

.discord-embed-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.discord-embed-author {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
}

.discord-embed-author img,
.discord-embed-footer img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.discord-embed-thumbnail {
  float: right;
  max-width: 80px;
  max-height: 80px;
  border-radius: 4px;
  margin-left: 12px;
  object-fit: cover;
}

.discord-embed-image {
  display: block;
  max-width: 100%;
  border-radius: 4px;
  margin-top: 10px;
}

.discord-embed-field {
  margin-top: 8px;
}

.discord-embed-field.inline {
  display: inline-block;
  vertical-align: top;
  width: calc(33% - 8px);
  margin-right: 8px;
}

.discord-embed-field-name {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
}

.discord-embed-field-value {
  font-size: 13px;
  color: #dbdee1;
  white-space: pre-wrap;
}

.discord-embed-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: #949ba4;
}

.discord-select {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #3f4147;
  border-radius: 4px;
  background: #1e1f22;
  color: #949ba4;
  font-size: 13px;
}

.discord-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.discord-button {
  border: none;
  border-radius: 4px;
  padding: 8px 14px;
  color: white;
  background: #4e5058;
  font-size: 13px;
}

.discord-button.primary { background: #5865f2; }
.discord-button.secondary { background: #4e5058; }
.discord-button.success { background: #248046; }
.discord-button.danger { background: #da373c; }
.discord-button.link { background: #4e5058; }

.color-picker {
  display: flex;
  gap: 10px;
}

.color-picker input[type='color'] {
  width: 48px;
  height: 42px;
  padding: 0;
  border: none;
  background: none;
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.field-item,
.button-item,
.select-option-item,
.command-option-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg-panel);
}

@media (max-width: 1100px) {
  .command-builder-container {
    grid-template-columns: 1fr;
  }

  .builder-preview {
    position: static;
  }

  .command-builder-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .command-builder-footer-actions {
    width: 100%;
    justify-content: stretch;
  }

  .command-builder-footer-actions .btn {
    flex: 1;
  }
}

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-grid;
    place-items: center;
  }

  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--shadow);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .page-content,
  .header,
  .footer {
    padding-left: clamp(14px, 4vw, 18px);
    padding-right: clamp(14px, 4vw, 18px);
  }

  .page-content {
    padding-top: 20px;
    padding-bottom: 20px;
  }

  .header {
    height: auto;
    min-height: var(--header-height);
    padding-top: 12px;
    padding-bottom: 12px;
    flex-wrap: wrap;
  }

  .header-left {
    min-width: 0;
    flex: 1 1 auto;
  }

  .header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  }

  .bot-gallery-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
  }

  .users-table-wrap {
    margin: 0 -4px;
  }

  .card-header,
  .user-control-header,
  .create-user-panel-header,
  .create-user-section-header {
    flex-direction: column;
    align-items: stretch;
  }

  .card-actions,
  .create-user-section-actions {
    width: 100%;
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .auth-card {
    padding: 22px 18px;
  }

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

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

  .header h1 {
    font-size: 1.05rem;
  }

  .footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

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

.homepage-settings .form-group-full {
  grid-column: 1 / -1;
}

.homepage-settings .homepage-category-block {
  margin-bottom: 14px;
}

.homepage-settings .homepage-category-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.homepage-settings .homepage-category-order-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 72px;
  font-size: 12px;
  color: var(--text-muted, #9aa0a6);
}

.homepage-settings .homepage-category-order {
  width: 72px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
}

.homepage-settings .homepage-category-name,
.homepage-settings .homepage-bot-row input[type="text"],
.homepage-settings .homepage-bot-row input[type="number"] {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font: inherit;
  font-size: 14px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.homepage-settings .homepage-category-name:focus,
.homepage-settings .homepage-category-order:focus,
.homepage-settings .homepage-bot-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.homepage-settings .homepage-bot-order {
  width: 100%;
  min-width: 0;
}

.homepage-settings .homepage-bot-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.homepage-settings .homepage-bot-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
}

.homepage-settings .homepage-status-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.homepage-settings .homepage-status-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.homepage-settings .homepage-status-btn.is-active {
  background: rgba(88, 101, 242, 0.14);
  border-color: rgba(88, 101, 242, 0.35);
  color: var(--text-primary);
}

.homepage-settings .homepage-status-btn .status-indicator {
  width: 10px;
  height: 10px;
}

.homepage-settings .homepage-category-name {
  flex: 1;
  min-width: 180px;
}

.homepage-settings .homepage-category-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.homepage-settings .homepage-bot-row {
  display: grid;
  grid-template-columns: 56px 1fr 1fr 1.2fr 118px auto;
  gap: 10px;
  margin-bottom: 10px;
  align-items: center;
}

.homepage-settings .homepage-bot-row-head {
  font-size: 12px;
  color: var(--text-muted, #9aa0a6);
  margin-bottom: 6px;
}

.homepage-settings .homepage-bot-row-head span:last-child {
  visibility: hidden;
}

@media (max-width: 900px) {
  .homepage-settings .form-grid,
  .homepage-settings .homepage-bot-row {
    grid-template-columns: 1fr;
  }
}
