.admin-body {
  background: var(--bg);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.admin-login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.admin-login-card {
  display: grid;
  gap: 18px;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 30px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-login-card h1 {
  margin-bottom: 10px;
  font-size: clamp(32px, 5vw, 46px);
}

.admin-login-card label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-login-card input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0b1017;
  color: var(--text);
}

.admin-header {
  position: sticky;
  top: 0;
  z-index: 70;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 24px;
  min-height: 74px;
  padding: 12px clamp(16px, 4vw, 56px);
}

.admin-header .brand {
  min-width: 172px;
}

.admin-header .brand span {
  letter-spacing: 0.12em;
}

.admin-header .brand strong {
  font-size: 18px;
}

.admin-header .main-nav {
  display: flex;
  flex: 1 1 100%;
  order: 3;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: 0;
  font-size: 13px;
  white-space: nowrap;
}

.admin-tabs-nav button {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  background: transparent;
  color: #c7ceda;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-tabs-nav button:hover,
.admin-tabs-nav button.is-active {
  border-color: rgba(255, 122, 24, 0.55);
  background: rgba(255, 122, 24, 0.1);
  color: #ff9b39;
}

.admin-header .header-chat {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid rgba(255, 122, 24, 0.7);
  border-radius: 8px;
  padding: 0 16px;
  background: rgba(255, 122, 24, 0.03);
  color: #ff9b39;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.admin-header .brand + .admin-tabs-nav + .header-chat {
  margin-left: auto;
}

.admin-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.admin-form {
  display: grid;
}

.admin-section {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(18px, 3vw, 28px);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.admin-section.is-active {
  display: block;
}

.admin-actions {
  display: none;
}

.admin-form:has(.admin-section.is-active) .admin-actions {
  display: flex;
}

.admin-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.admin-section h2 {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  text-transform: none;
}

.admin-section-heading p {
  max-width: 460px;
  margin: 0;
  font-size: 14px;
}

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

.field-grid .wide {
  grid-column: 1 / -1;
}

.admin-hint {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-section label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.admin-section input,
.admin-section select,
.admin-section textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0b1017;
  color: var(--text);
  line-height: 1.45;
}

.admin-section textarea {
  resize: vertical;
}

.admin-section .checkbox-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  align-self: end;
  min-height: 45px;
  text-transform: none;
}

.admin-section .checkbox-field input {
  width: 18px;
  height: 18px;
}

.pending-reviews {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.pending-reviews-head,
.pending-review-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 122, 24, 0.06);
}

.pending-reviews-head strong,
.pending-review-card strong {
  color: var(--text);
  font-size: 16px;
}

.pending-reviews-head span,
.pending-review-card span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.pending-review-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.pending-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-list {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.editor-card {
  display: grid;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.editor-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.editor-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.editor-card-header strong {
  font-size: 18px;
  line-height: 1.25;
}

.remove-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid rgba(255, 80, 80, 0.45);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 80, 80, 0.09);
  color: #ffb7b7;
  font-weight: 900;
  text-transform: uppercase;
}

.platform-checks {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.platform-checks strong {
  color: var(--text);
  font-size: 14px;
}

.platform-checks label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  text-transform: none;
}

.platform-checks input {
  width: 18px;
  height: 18px;
}

.platform-checks span {
  color: var(--muted);
  font-size: 12px;
}

.service-detail-admin {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.service-detail-admin summary {
  cursor: pointer;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
  text-transform: uppercase;
}

.service-detail-admin[open] summary {
  margin-bottom: 16px;
}

.builder-fields-admin {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.builder-fields-head,
.builder-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.builder-fields-head strong,
.builder-field-head strong {
  color: #fff;
}

.builder-fields-list {
  display: grid;
  gap: 12px;
}

.builder-field-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.03);
}

.gallery-image-editor {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.gallery-preview {
  display: grid;
  place-items: center;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(255, 122, 24, 0.08), transparent 42%),
    #080d13;
}

.gallery-preview img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.gallery-preview span,
.gallery-image-editor p {
  color: var(--muted);
}

.gallery-image-editor p {
  margin: 0;
  font-size: 13px;
}

.hero-overlay-editor {
  display: grid;
  grid-template-columns: minmax(260px, 420px) minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.hero-overlay-preview {
  display: grid;
  place-items: center;
  min-height: 210px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    linear-gradient(45deg, rgba(255, 255, 255, 0.04) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.04) 75%),
    #080d13;
  background-position:
    0 0,
    12px 12px;
  background-size: 24px 24px;
}

.hero-overlay-preview img {
  display: block;
  width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.hero-overlay-preview span,
.hero-overlay-editor p {
  color: var(--muted);
}

.hero-overlay-editor p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.5;
}

.service-badge-editor {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.service-badge-preview {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.service-badge-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.service-badge-preview span,
.service-badge-editor p {
  color: var(--muted);
}

.service-badge-editor p {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.45;
}

.chat-admin-layout {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr) minmax(220px, 300px);
  gap: 16px;
  align-items: stretch;
  height: min(720px, calc(100vh - 220px));
  min-height: 0;
}

.thread-list,
.thread-panel {
  min-height: 0;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.thread-list {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  overflow: auto;
  min-height: 0;
}

.thread-list button {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #0b1017;
  color: var(--text);
  text-align: left;
}

.thread-list button.is-active {
  border-color: rgba(232, 93, 27, 0.72);
  background: rgba(232, 93, 27, 0.12);
}

.thread-list span,
.thread-list small,
.empty-thread {
  color: var(--muted);
}

.thread-list small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.thread-meta {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 14px;
  color: #ffb68f;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.thread-meta span {
  color: var(--muted);
  font-weight: 800;
}

.thread-controls {
  display: grid;
  align-content: start;
  min-height: 0;
  height: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.thread-controls:empty {
  display: none;
}

.thread-tools {
  display: grid;
  gap: 12px;
}

.thread-tools summary {
  cursor: pointer;
  border: 1px solid rgba(255, 122, 24, 0.55);
  border-radius: 8px;
  padding: 10px 12px;
  color: #ffb68f;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.thread-tools-body {
  display: grid;
  gap: 12px;
  padding-top: 12px;
}

.thread-controls-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.thread-controls label,
.thread-active-services {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.thread-controls select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #0b1017;
  color: var(--text);
  font: inherit;
  text-transform: none;
}

.thread-active-services > div,
.thread-control-actions {
  display: grid;
  gap: 8px;
}

.thread-active-services > div {
  max-height: 170px;
  overflow: auto;
}

.thread-active-services label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--text);
  text-transform: none;
}

.secondary-button.compact {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12px;
}

.thread-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 14px;
  overflow: auto;
  min-height: 0;
}

.thread-reply {
  display: flex;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.thread-reply input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #0b1017;
  color: var(--text);
}

.admin-actions {
  position: static;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(13, 18, 26, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid rgba(232, 93, 27, 0.5);
  border-radius: 8px;
  padding: 0 18px;
  background: rgba(232, 93, 27, 0.08);
  color: #ffd7c7;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.admin-body .primary-button,
.admin-body .secondary-button,
.admin-body .file-button,
.admin-body .danger-button,
.admin-body .remove-button {
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.file-button input {
  display: none;
}

.telegram-settings-panel {
  display: grid;
  gap: 18px;
}

.toggle-field {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  color: #fff;
  font-weight: 900;
}

.toggle-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.telegram-help {
  border: 1px solid rgba(255, 122, 24, 0.25);
  border-radius: 10px;
  padding: 14px;
  background: rgba(255, 122, 24, 0.08);
}

.telegram-help strong {
  display: block;
  margin-bottom: 7px;
  color: #fff;
}

.telegram-help p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(24, 195, 126, 0.4);
  border-radius: 8px;
  padding: 13px 16px;
  background: #0f1d19;
  color: #d9fff0;
  box-shadow: var(--shadow);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.toast.is-visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 720px) {
  .admin-header {
    display: flex;
    gap: 12px;
  }

  .admin-header .main-nav {
    display: flex;
  }

  .admin-section-heading,
  .field-grid,
  .hero-overlay-editor,
  .chat-admin-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-actions {
    position: static;
  }

  .chat-admin-layout {
    height: auto;
  }

  .thread-list {
    height: auto;
    max-height: 260px;
  }

  .thread-panel {
    height: min(620px, calc(100vh - 150px));
  }
}
