/* =========================================================
   ===== FINAL ACTIVE UI LAYER (chat/right-panel/client) =====
   This block is the current source of truth for:
   - chat bubbles
   - message meta row
   - attachments
   - reply bar
   - right panel
   - templates/admin/client side sections
   - inline client editing
   Future UI edits should prefer this final layer first.
   ========================================================= */

/* ----- FINAL LAYER: reply bar ----- */
/* ===== reply bar hidden state fix ===== */

.composer-reply-bar.hidden,
#composer-reply-bar.hidden {
  display: none !important;
}


/* ----- FINAL LAYER: chat bubbles ----- */
/* ===== message bubbles polish ===== */

.messages-list {
  padding: 12px 14px !important;
  gap: 10px !important;
}

.message.message-compact {
  padding: 11px 13px !important;
  border-radius: 16px !important;
  max-width: 72% !important;
}

.message-row.out .message.message-compact {
  max-width: 68% !important;
}

.message-text {
  font-size: 14px !important;
  line-height: 1.32 !important;
}

.message-bottom-row {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
  margin-top: 6px !important;
}

.message-meta-row {
  margin-top: 0 !important;
}

.message-time {
  font-size: 11.5px !important;
  opacity: 0.82 !important;
}

.msg-delivery-ticks {
  font-size: 12px !important;
  opacity: 0.9 !important;
}

.message-attachments {
  margin-top: 7px !important;
  gap: 7px !important;
}

.message-attachment {
  padding: 7px 9px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,0.045) !important;
  border: 1px solid rgba(130,160,220,0.12) !important;
}

.message-attachment-icon {
  width: 24px !important;
  height: 24px !important;
  min-width: 24px !important;
  min-height: 24px !important;
  font-size: 11px !important;
  border-radius: 8px !important;
}

.message-attachment-kind {
  font-size: 11px !important;
  margin-bottom: 1px !important;
  opacity: 0.82 !important;
}

.message-attachment-name {
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.message-attachment-meta {
  font-size: 10.5px !important;
  opacity: 0.72 !important;
  margin-top: 2px !important;
}

.message-attachment-link {
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
}

.message-attachments-download-all {
  padding: 7px 11px !important;
  border-radius: 11px !important;
  font-size: 12px !important;
}

@media (max-width: 980px) {
  .message.message-compact {
    max-width: 84% !important;
    padding: 10px 12px !important;
  }

  .message-row.out .message.message-compact {
    max-width: 80% !important;
  }

  .message-text {
    font-size: 13px !important;
  }
}

/* ===== SAFE bubbles/meta tighten ===== */

.message.message-compact {
  position: relative !important;
}

.message-attachments {
  margin-top: 5px !important;
  gap: 5px !important;
}

.message-attachment {
  padding: 5px 7px !important;
  border-radius: 10px !important;
}

.message-attachment-icon {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  font-size: 10px !important;
  border-radius: 7px !important;
}

.message-attachment-kind {
  font-size: 10px !important;
  margin-bottom: 0 !important;
  opacity: 0.8 !important;
}

.message-attachment-name {
  font-size: 12px !important;
  line-height: 1.15 !important;
}

.message-attachment-meta {
  font-size: 10px !important;
  margin-top: 1px !important;
  opacity: 0.72 !important;
}

.message-bottom-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 6px !important;
  margin-top: 4px !important;
}

.message-meta-row {
  display: flex !important;
  justify-content: flex-end !important;
  width: 100% !important;
  margin-top: 0 !important;
}

.message-time {
  font-size: 10px !important;
  opacity: 0.68 !important;
  text-align: right !important;
}

.msg-delivery-ticks {
  display: none !important;
}

/* ===== active message text links ===== */

.message-text a.message-inline-link {
  color: #8db7ff !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
  word-break: break-all !important;
}

body.theme-light .message-text a.message-inline-link {
  color: #2f67d8 !important;
}

/* ===== sanitize step3: active message text links ===== */

.message-text a.message-inline-link {
  color: #8db7ff !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 2px !important;
  word-break: break-all !important;
}

body.theme-light .message-text a.message-inline-link {
  color: #2f67d8 !important;
}

/* ===== attachments polish next ===== */

.message-attachments {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
  margin-top: 4px !important;
}

.message-attachment {
  display: flex !important;
  align-items: center !important;
  gap: 7px !important;
  padding: 4px 6px !important;
  border-radius: 9px !important;
  min-height: 0 !important;
}

.message-attachment-icon {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  border-radius: 6px !important;
  font-size: 9px !important;
}

.message-attachment-body {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.message-attachment-kind {
  display: none !important;
}

.message-attachment-name {
  font-size: 12px !important;
  line-height: 1.1 !important;
  margin: 0 !important;
}

.message-attachment-meta {
  font-size: 9.5px !important;
  line-height: 1.05 !important;
  margin-top: 1px !important;
}

.message-attachments-download-all {
  align-self: flex-start !important;
  padding: 5px 8px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
}

.message-grouped-inbound-files .message-attachments {
  gap: 3px !important;
}

.message-grouped-inbound-files .message-attachment {
  padding: 4px 6px !important;
}

@media (max-width: 980px) {
  .message-attachment {
    gap: 6px !important;
    padding: 4px 5px !important;
  }

  .message-attachment-name {
    font-size: 11px !important;
  }

  .message-attachment-meta {
    font-size: 9px !important;
  }
}


/* ----- FINAL LAYER: attachments ----- */
/* ===== HARD compact attachments ===== */

.messages-list .message-attachments {
  display: flex !important;
  flex-direction: column !important;
  gap: 3px !important;
  margin-top: 3px !important;
}

.messages-list .message-attachment {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  padding: 3px 5px !important;
  border-radius: 8px !important;
  min-height: 0 !important;
  background: rgba(255,255,255,0.035) !important;
}

.messages-list .message-attachment-icon {
  width: 16px !important;
  height: 16px !important;
  min-width: 16px !important;
  min-height: 16px !important;
  border-radius: 5px !important;
  font-size: 8px !important;
}

.messages-list .message-attachment-body {
  min-width: 0 !important;
  flex: 1 1 auto !important;
}

.messages-list .message-attachment-kind {
  display: none !important;
}

.messages-list .message-attachment-name {
  font-size: 11px !important;
  line-height: 1.05 !important;
  margin: 0 !important;
}

.messages-list .message-attachment-meta {
  font-size: 9px !important;
  line-height: 1 !important;
  margin-top: 1px !important;
  opacity: 0.68 !important;
}

.messages-list .message-attachments-download-all {
  align-self: flex-start !important;
  padding: 4px 7px !important;
  border-radius: 8px !important;
  font-size: 10px !important;
  line-height: 1 !important;
}

.messages-list .message-grouped-inbound-files .message-attachments {
  gap: 2px !important;
}

.messages-list .message-grouped-inbound-files .message-attachment {
  padding: 3px 5px !important;
}


/* ----- FINAL LAYER: message meta ----- */
/* ===== message meta row polish ===== */

.messages-list .message.message-compact {
  position: relative !important;
}

.messages-list .message-bottom-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
  gap: 4px !important;
  margin-top: 3px !important;
  min-height: 12px !important;
}

.messages-list .message-meta-row {
  display: inline-flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
  width: auto !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}

.messages-list .message-time {
  display: inline-block !important;
  font-size: 9px !important;
  line-height: 1 !important;
  opacity: 0.58 !important;
  letter-spacing: 0.01em !important;
  text-align: right !important;
}

.messages-list .msg-delivery-ticks {
  display: none !important;
}

@media (max-width: 980px) {
  .messages-list .message-time {
    font-size: 8.5px !important;
  }

  .messages-list .message-bottom-row {
    margin-top: 2px !important;
  }
}

/* ===== pin message time to bottom-right ===== */

.messages-list .message.message-compact {
  display: flex !important;
  flex-direction: column !important;
}

.messages-list .message-bottom-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
  width: 100% !important;
  margin-top: 3px !important;
}

.messages-list .message-meta-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: flex-end !important;
  width: 100% !important;
  text-align: right !important;
}

.messages-list .message-time {
  display: inline-block !important;
  margin-left: auto !important;
  text-align: right !important;
}

/* ===== soften right panel ===== */

.dialogs-side-panel .card,
.dialogs-side-panel .accordion {
  border-color: rgba(130,160,220,0.14) !important;
  box-shadow: none !important;
}

.dialogs-side-panel .accordion-toggle {
  padding: 12px 14px !important;
  font-size: 16px !important;
}

.dialogs-side-panel .accordion-body {
  padding: 12px 14px !important;
}

.dialogs-side-panel .input,
.dialogs-side-panel .textarea,
.dialogs-side-panel select.input {
  border-radius: 12px !important;
  padding: 9px 11px !important;
  font-size: 13px !important;
}

.dialogs-side-panel .small-btn,
.dialogs-side-panel .secondary-btn,
.dialogs-side-panel .status-btn {
  border-radius: 12px !important;
  padding: 8px 10px !important;
  font-size: 12px !important;
  box-shadow: none !important;
}

.dialogs-side-panel .grid-2 {
  gap: 10px !important;
}

.dialogs-side-panel .stack-btns {
  gap: 8px !important;
}

.dialogs-side-panel .label {
  font-size: 11px !important;
  margin-bottom: 4px !important;
  opacity: 0.82 !important;
}

.dialogs-side-panel .kv,
.dialogs-side-panel .kv-notes {
  margin-bottom: 10px !important;
}

.dialogs-side-panel .kv strong,
.dialogs-side-panel .kv-notes div {
  font-size: 14px !important;
}

.dialogs-side-panel .mini-item {
  padding: 10px !important;
  border-radius: 12px !important;
}

.dialogs-side-panel .mini-item-title {
  font-size: 13px !important;
}

.dialogs-side-panel .mini-item-meta {
  font-size: 12px !important;
  margin-bottom: 6px !important;
  opacity: 0.78 !important;
}


/* ----- FINAL LAYER: right panel ----- */
/* ===== right panel compact visible ===== */

.dialogs-side-panel {
  gap: 10px !important;
}

.dialogs-side-panel .accordion-toggle {
  padding: 9px 11px !important;
  font-size: 14px !important;
  min-height: 0 !important;
}

.dialogs-side-panel .accordion-body {
  padding: 9px 11px !important;
}

.dialogs-side-panel .input,
.dialogs-side-panel .textarea,
.dialogs-side-panel select.input {
  padding: 7px 9px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

.dialogs-side-panel .small-btn,
.dialogs-side-panel .secondary-btn,
.dialogs-side-panel .status-btn {
  padding: 6px 8px !important;
  font-size: 11px !important;
  border-radius: 10px !important;
  min-height: 0 !important;
}

.dialogs-side-panel .grid-2 {
  gap: 8px !important;
}

.dialogs-side-panel .stack-btns {
  gap: 6px !important;
  margin-top: 8px !important;
}

.dialogs-side-panel .label {
  font-size: 10px !important;
  margin-bottom: 3px !important;
}

.dialogs-side-panel .kv,
.dialogs-side-panel .kv-notes {
  gap: 2px !important;
  margin-bottom: 8px !important;
}

.dialogs-side-panel .kv strong,
.dialogs-side-panel .kv-notes div {
  font-size: 13px !important;
}

.dialogs-side-panel .mini-item {
  padding: 8px !important;
  border-radius: 10px !important;
}

.dialogs-side-panel .mini-item-title {
  font-size: 12px !important;
  margin-bottom: 2px !important;
}

.dialogs-side-panel .mini-item-meta {
  font-size: 11px !important;
  margin-bottom: 4px !important;
}

.dialogs-side-panel .full-btn {
  width: 100% !important;
}

/* ===== right panel: templates section compact ===== */

#dialog-templates-mini {
  gap: 6px !important;
}

#dialog-templates-mini .mini-item {
  padding: 7px 8px !important;
  border-radius: 9px !important;
}

#dialog-templates-mini .mini-item-title {
  font-size: 11.5px !important;
  line-height: 1.15 !important;
  margin-bottom: 2px !important;
}

#dialog-templates-mini .mini-item-meta {
  font-size: 10.5px !important;
  line-height: 1.15 !important;
  margin-bottom: 0 !important;
  opacity: 0.72 !important;

  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

#open-templates-section {
  padding: 7px 9px !important;
  font-size: 11px !important;
  border-radius: 10px !important;
  min-height: 0 !important;
}

.dialogs-side-panel [data-accordion="templates"] .accordion-body {
  padding-top: 9px !important;
  padding-bottom: 10px !important;
}

/* ----- FINAL LAYER: templates compact ----- */
/* ===== HARD templates section compact ===== */

#dialog-templates-mini {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px !important;
}

#dialog-templates-mini .mini-item {
  padding: 6px 7px !important;
  border-radius: 8px !important;
  min-height: 0 !important;
}

#dialog-templates-mini .mini-item-title {
  font-size: 11px !important;
  line-height: 1.1 !important;
  margin-bottom: 1px !important;
}

#dialog-templates-mini .mini-item-meta {
  font-size: 10px !important;
  line-height: 1.1 !important;
  margin: 0 !important;
  opacity: 0.7 !important;

  display: -webkit-box !important;
  -webkit-line-clamp: 2 !important;
  -webkit-box-orient: vertical !important;
  overflow: hidden !important;
}

#open-templates-section,
.dialogs-side-panel #open-templates-section {
  padding: 6px 8px !important;
  font-size: 10.5px !important;
  line-height: 1.1 !important;
  border-radius: 9px !important;
  min-height: 0 !important;
}

.dialogs-side-panel [data-accordion="templates"] .accordion-body {
  padding: 8px 10px !important;
}

.dialogs-side-panel [data-accordion="templates"] .mini-list {
  gap: 4px !important;
}

/* ----- FINAL LAYER: admin/templates split layout ----- */
/* ===== split admin and templates blocks ===== */

.dialog-admin-assignee {
  margin-bottom: 10px;
}

.dialog-admin-assignee-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.dialog-admin-actions,
.dialog-admin-statuses {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dialog-admin-actions {
  margin-bottom: 8px;
}

.dialog-admin-statuses .small-btn,
.dialog-admin-actions .small-btn,
.dialog-admin-assignee-row .small-btn {
  min-height: 0 !important;
}

.dialogs-side-panel [data-accordion="templates"] .accordion-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dialogs-side-panel [data-accordion="templates"] #dialog-templates-mini {
  min-height: 0;
}

@media (max-width: 980px) {
  .dialog-admin-assignee-row {
    grid-template-columns: 1fr;
  }
}


/* ----- FINAL LAYER: templates/admin ----- */
/* ===== templates accordion collapse fix ===== */

.dialogs-side-panel [data-accordion="templates"].collapsed .accordion-body,
.dialogs-side-panel [data-accordion="dialog-admin"].collapsed .accordion-body {
  display: none !important;
}

/* ===== dialog admin compact ===== */

.dialogs-side-panel [data-accordion="dialog-admin"] .accordion-body {
  padding: 8px 10px !important;
}

.dialog-admin-assignee {
  margin-bottom: 8px !important;
}

.dialog-admin-assignee-row {
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 6px !important;
}

.dialog-admin-assignee-row .input {
  padding: 7px 9px !important;
  font-size: 12px !important;
  min-height: 0 !important;
}

.dialog-admin-assignee-row .small-btn {
  padding: 6px 8px !important;
  font-size: 11px !important;
  min-height: 0 !important;
  white-space: nowrap !important;
}

.dialog-admin-actions,
.dialog-admin-statuses {
  display: grid !important;
  gap: 6px !important;
}

.dialog-admin-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  margin-bottom: 6px !important;
}

.dialog-admin-statuses {
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.dialog-admin-actions .small-btn,
.dialog-admin-statuses .small-btn {
  width: 100% !important;
  padding: 6px 8px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
  min-height: 0 !important;
}

@media (max-width: 980px) {
  .dialog-admin-assignee-row {
    grid-template-columns: 1fr !important;
  }

  .dialog-admin-actions,
  .dialog-admin-statuses {
    grid-template-columns: 1fr !important;
  }
}


/* ----- FINAL LAYER: client panel ----- */
/* ===== client panel compact ===== */

.dialogs-side-panel [data-accordion="client"] .accordion-body {
  padding: 8px 10px !important;
}

.dialogs-side-panel [data-accordion="client"] .kv,
.dialogs-side-panel [data-accordion="client"] .kv-notes {
  gap: 2px !important;
  margin-bottom: 7px !important;
}

.dialogs-side-panel [data-accordion="client"] .kv span,
.dialogs-side-panel [data-accordion="client"] .kv-notes span {
  font-size: 10px !important;
  margin-bottom: 0 !important;
  opacity: 0.72 !important;
}

.dialogs-side-panel [data-accordion="client"] .kv strong,
.dialogs-side-panel [data-accordion="client"] .kv-notes div {
  font-size: 13px !important;
  line-height: 1.2 !important;
}

.dialogs-side-panel [data-accordion="client"] #side-client-notes {
  white-space: pre-wrap !important;
  word-break: break-word !important;
  opacity: 0.92 !important;
}

.dialogs-side-panel [data-accordion="client"] .secondary-btn.full-btn {
  padding: 6px 8px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
  min-height: 0 !important;
  margin-top: 4px !important;
}


/* ----- FINAL LAYER: merged client block ----- */
/* ===== merged client block ===== */

.client-unified-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.client-unified-tech {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  opacity: 0.62;
  padding-top: 2px;
}

.client-unified-tech strong {
  font-size: 10px !important;
}

.client-unified-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 2px;
}

@media (max-width: 980px) {
  .client-unified-grid {
    grid-template-columns: 1fr;
  }
}



/* ----- FINAL LAYER: inline client editing ----- */
/* ===== client inline edit ===== */

.client-edit-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.client-edit-field .label {
  margin-bottom: 0 !important;
}

.client-edit-field .input,
.client-edit-field .textarea {
  padding: 7px 9px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

.client-notes-textarea {
  min-height: 72px !important;
  resize: vertical !important;
}

.client-unified-actions .primary-btn.full-btn {
  padding: 7px 9px !important;
  font-size: 11px !important;
  border-radius: 9px !important;
  min-height: 0 !important;
}


/* ----- FINAL LAYER: request workspace ----- */

.request-source-hidden {
  display: none !important;
}

.request-workspace-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.request-summary-card {
  border: 1px solid rgba(130,160,220,0.14);
  border-radius: 12px;
  padding: 8px 9px;
  background: rgba(255,255,255,0.02);
  min-width: 0;
}

.request-summary-label {
  font-size: 10px;
  opacity: 0.72;
  margin-bottom: 3px;
}

.request-summary-value {
  font-size: 12px;
  line-height: 1.2;
  min-width: 0;
  word-break: break-word;
}

.request-section {
  border: 1px solid rgba(130,160,220,0.12);
  border-radius: 12px;
  padding: 9px 10px;
  background: rgba(255,255,255,0.015);
}

.request-section-title {
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}

.request-section-body {
  min-width: 0;
}

.request-next-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.request-next-comment-wrap {
  margin-bottom: 6px;
}

.request-next-comment {
  min-height: 78px;
  resize: vertical;
}

.request-next-hint {
  font-size: 10px;
  line-height: 1.2;
}

.request-workspace-body .mini-result {
  margin-top: 6px !important;
}

.request-workspace-body .stack-btns {
  margin-top: 8px !important;
}

.request-workspace-body .client-unified-actions,
.request-workspace-body .dialog-admin-actions,
.request-workspace-body .dialog-admin-statuses {
  margin-top: 0 !important;
}

@media (max-width: 980px) {
  .request-summary-grid,
  .request-next-grid {
    grid-template-columns: 1fr;
  }
}


.request-subaccordion {
  border: 1px solid rgba(130,160,220,0.14);
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
  overflow: hidden;
}

.request-subaccordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.request-subaccordion-toggle:hover {
  background: rgba(255,255,255,0.02);
}

.request-subaccordion-caret {
  opacity: 0.82;
  transition: transform 0.18s ease;
}

.request-subaccordion.is-open .request-subaccordion-caret {
  transform: rotate(180deg);
}

.request-subaccordion-body {
  display: none;
  padding: 0 10px 10px;
}

.request-subaccordion.is-open .request-subaccordion-body {
  display: block;
}

.request-subaccordion .request-section {
  border: 0;
  background: transparent;
  padding: 0;
}

.request-subaccordion .request-section-title {
  display: none;
}


.request-person-card {
  border: 1px solid rgba(130,160,220,0.14);
  border-radius: 14px;
  padding: 10px 11px;
  background: rgba(255,255,255,0.02);
  margin-bottom: 8px;
}

.request-person-main {
  margin-bottom: 8px;
  min-width: 0;
}

.request-person-name {
  font-size: 18px;
  line-height: 1.15;
  font-weight: 700;
  margin-bottom: 3px;
  word-break: break-word;
}

.request-person-handle {
  font-size: 12px;
  line-height: 1.2;
  opacity: 0.78;
  word-break: break-word;
}

.request-person-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.request-person-meta-item {
  min-width: 0;
}

.request-person-meta-label {
  font-size: 10px;
  opacity: 0.68;
  margin-bottom: 2px;
}

.request-person-meta-value {
  font-size: 12px;
  line-height: 1.2;
  word-break: break-word;
}

.request-summary-value .source-badge,
.request-summary-value .status-badge {
  vertical-align: middle;
}

@media (max-width: 980px) {
  .request-person-name {
    font-size: 16px;
  }

  .request-person-meta {
    grid-template-columns: 1fr;
  }
}


.request-workspace-removed {
  display: none !important;
}

.client-tech-details {
  margin-top: 6px;
  border: 1px solid rgba(130,160,220,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.015);
  overflow: hidden;
}

.client-tech-summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 9px;
  font-size: 11px;
  font-weight: 600;
  opacity: 0.86;
}

.client-tech-summary::-webkit-details-marker {
  display: none;
}

.client-tech-body {
  padding: 0 9px 8px;
  font-size: 10px;
  line-height: 1.35;
  opacity: 0.72;
  display: grid;
  gap: 2px;
}

/* ----- FINAL LAYER: right panel accordion restore ----- */

.dialogs-side-panel {
  gap: 10px !important;
}

.dialogs-side-panel .accordion {
  margin: 0 !important;
  border: 1px solid rgba(130,160,220,0.14) !important;
  border-radius: 16px !important;
  background: rgba(255,255,255,0.015) !important;
  overflow: hidden !important;
  box-shadow: none !important;
}

.dialogs-side-panel .accordion + .accordion {
  margin-top: 0 !important;
}

.dialogs-side-panel .accordion-toggle {
  min-height: 0 !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
  line-height: 1.2 !important;
  border: 0 !important;
  background: transparent !important;
}

.dialogs-side-panel .accordion-body {
  padding: 10px 12px !important;
  border-top: 1px solid rgba(130,160,220,0.10) !important;
}

.dialogs-side-panel .accordion.collapsed .accordion-body {
  display: none !important;
}

.dialogs-side-panel > *::before,
.dialogs-side-panel > *::after,
.dialogs-side-panel .accordion::before,
.dialogs-side-panel .accordion::after {
  display: none !important;
  content: none !important;
}

.dialogs-side-panel hr {
  display: none !important;
}

.dialogs-side-panel [data-accordion="dialog-admin"] .accordion-body,
.dialogs-side-panel [data-accordion="templates"] .accordion-body,
.dialogs-side-panel [data-accordion="client"] .accordion-body,
.dialogs-side-panel [data-accordion="client-orders"] .accordion-body {
  padding: 10px 12px !important;
}

.dialogs-side-panel .accordion-toggle span:last-child {
  opacity: 0.8 !important;
}

@media (max-width: 980px) {
  .dialogs-side-panel .accordion-toggle {
    padding: 11px 12px !important;
    font-size: 13px !important;
  }

  .dialogs-side-panel .accordion-body {
    padding: 9px 10px !important;
  }
}

/* ----- FINAL LAYER: right panel tighten 2 ----- */

.dialogs-side-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 8px !important;
  padding-top: 0 !important;
}

.dialogs-side-panel > .accordion.card {
  position: relative !important;
  margin: 0 !important;
  border: 1px solid rgba(130,160,220,0.13) !important;
  border-radius: 15px !important;
  background: rgba(255,255,255,0.012) !important;
  overflow: hidden !important;
}

.dialogs-side-panel > .accordion.card + .accordion.card {
  margin-top: 0 !important;
}

.dialogs-side-panel > .accordion.card::before,
.dialogs-side-panel > .accordion.card::after {
  display: none !important;
  content: none !important;
}

.dialogs-side-panel .accordion-toggle {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 0 !important;
  padding: 10px 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  border: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

.dialogs-side-panel .accordion-toggle span:first-child {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 0 !important;
}

.dialogs-side-panel .accordion-toggle span:last-child {
  font-size: 12px !important;
  line-height: 1 !important;
  opacity: 0.82 !important;
}

.dialogs-side-panel .accordion-body {
  padding: 8px 10px 10px !important;
  border-top: 1px solid rgba(130,160,220,0.08) !important;
  background: transparent !important;
}

.dialogs-side-panel .accordion.collapsed .accordion-body {
  display: none !important;
}

.dialogs-side-panel .accordion .accordion-body > :first-child {
  margin-top: 0 !important;
}

.dialogs-side-panel .accordion .accordion-body > :last-child {
  margin-bottom: 0 !important;
}

.dialogs-side-panel [data-accordion="dialog-admin"] .accordion-body,
.dialogs-side-panel [data-accordion="templates"] .accordion-body,
.dialogs-side-panel [data-accordion="calculator"] .accordion-body,
.dialogs-side-panel [data-accordion="client"] .accordion-body,
.dialogs-side-panel [data-accordion="client-orders"] .accordion-body {
  padding: 8px 10px 10px !important;
}

.dialogs-side-panel .stack-btns {
  gap: 6px !important;
}

.dialogs-side-panel .stack-btns .secondary-btn,
.dialogs-side-panel .stack-btns .primary-btn,
.dialogs-side-panel .small-btn,
.dialogs-side-panel .status-btn {
  min-height: 0 !important;
}

.dialogs-side-panel .label {
  margin-bottom: 3px !important;
}

@media (max-width: 980px) {
  .dialogs-side-panel {
    gap: 7px !important;
  }

  .dialogs-side-panel .accordion-toggle {
    padding: 9px 12px !important;
    font-size: 12.5px !important;
  }

  .dialogs-side-panel .accordion-body {
    padding: 7px 9px 9px !important;
  }
}


/* ----- FINAL LAYER: client name/handle split ----- */

#side-client-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

#side-client-name .client-name-main {
  display: block;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 700;
  word-break: break-word;
}

#side-client-name .client-name-handle {
  display: block;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 500;
  opacity: 0.76;
  word-break: break-word;
}

@media (max-width: 980px) {
  #side-client-name .client-name-main {
    font-size: 15px;
  }

  #side-client-name .client-name-handle {
    font-size: 11px;
  }
}

/* ----- FINAL LAYER: client name label hide ----- */

#side-client-name {
  margin-top: 2px !important;
}

#side-client-name strong,
#side-client-name .client-name-main,
#side-client-name .client-name-handle {
  margin: 0 !important;
}

.dialogs-side-panel [data-accordion="client"] .kv:has(#side-client-name) > span,
.dialogs-side-panel [data-accordion="client"] .kv > span:has(+ #side-client-name) {
  display: none !important;
}

.dialogs-side-panel [data-accordion="client"] .kv:has(#side-client-name) {
  margin-bottom: 10px !important;
  gap: 0 !important;
}

/* ----- FINAL LAYER: client inputs soften ----- */

.dialogs-side-panel [data-accordion="client"] .input,
.dialogs-side-panel [data-accordion="client"] .textarea {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(130,160,220,0.16) !important;
  color: rgba(255,255,255,0.96) !important;
  box-shadow: none !important;
}

.dialogs-side-panel [data-accordion="client"] .input::placeholder,
.dialogs-side-panel [data-accordion="client"] .textarea::placeholder {
  color: rgba(255,255,255,0.36) !important;
}

.dialogs-side-panel [data-accordion="client"] .input:focus,
.dialogs-side-panel [data-accordion="client"] .textarea:focus {
  border-color: rgba(110,160,255,0.38) !important;
  box-shadow: 0 0 0 2px rgba(90,140,255,0.10) !important;
  outline: none !important;
}

.dialogs-side-panel [data-accordion="client"] #side-client-tag-input,
.dialogs-side-panel [data-accordion="client"] #side-client-phone-input,
.dialogs-side-panel [data-accordion="client"] #side-client-email-input,
.dialogs-side-panel [data-accordion="client"] #side-client-company-input {
  font-weight: 500 !important;
}

.dialogs-side-panel [data-accordion="client"] #side-client-notes-input {
  line-height: 1.35 !important;
}

.dialogs-side-panel [data-accordion="client"] .primary-btn.full-btn {
  margin-top: 2px !important;
}

.dialogs-side-panel [data-accordion="client"] .secondary-btn.full-btn,
.dialogs-side-panel [data-accordion="client"] .primary-btn.full-btn {
  border-radius: 12px !important;
}

/* ----- FINAL LAYER: dialog list soft polish ----- */

.dialog-compact-card {
  padding: 9px 10px !important;
  border-radius: 13px !important;
}

.dialog-card-row {
  align-items: center !important;
  gap: 9px !important;
}

.dialog-card-content {
  min-width: 0 !important;
}

.dialog-title-single-line {
  font-size: 13px !important;
  line-height: 1.15 !important;
  font-weight: 700 !important;
  margin-bottom: 2px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

.dialog-preview {
  font-size: 12px !important;
  line-height: 1.2 !important;
  opacity: 0.88 !important;
}

.dialog-compact-date,
.dialog-date-right,
.dialog-compact-date-bottom {
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.62 !important;
}

.dialog-side-dots {
  gap: 5px !important;
}

.dialog-dot {
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  font-size: 10px !important;
}

.entity-item.dialog-compact-card .entity-subtitle {
  margin-top: 1px !important;
}

.entity-item.dialog-compact-card.active {
  box-shadow: inset 0 0 0 1px rgba(120,170,255,0.20) !important;
}

@media (max-width: 980px) {
  .dialog-compact-card {
    padding: 8px 9px !important;
  }

  .dialog-title-single-line {
    font-size: 12.5px !important;
  }

  .dialog-preview {
    font-size: 11px !important;
  }
}


/* ----- FINAL LAYER: dialog list compact right layout ----- */

.dialog-card-row-v2 {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  gap: 10px !important;
  align-items: center !important;
}

.dialog-card-avatar-col {
  display: flex !important;
  align-items: center !important;
}

.dialog-card-main-col {
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  justify-content: center !important;
}

.dialog-card-meta-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 8px !important;
  min-width: 74px !important;
}

.dialog-card-badges-top {
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.dialog-card-unread-col {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 28px !important;
}

.dialog-compact-card {
  padding: 8px 10px !important;
  border-radius: 12px !important;
}

.dialog-title-single-line {
  font-size: 13px !important;
  line-height: 1.12 !important;
  margin-bottom: 3px !important;
}

.dialog-preview {
  font-size: 11px !important;
  line-height: 1.18 !important;
  opacity: 0.88 !important;
}

.dialog-date-right {
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.62 !important;
  white-space: nowrap !important;
}

.dialog-dot {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  font-size: 9px !important;
}

.dialog-dot.is-unread {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  font-size: 9px !important;
}

.dialog-dot.is-unread.has-unread {
  width: 28px !important;
  min-width: 28px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

@media (max-width: 980px) {
  .dialog-card-row-v2 {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
  }

  .dialog-card-meta-col {
    min-width: 64px !important;
    gap: 6px !important;
  }

  .dialog-title-single-line {
    font-size: 12px !important;
  }

  .dialog-preview {
    font-size: 10.5px !important;
  }
}

/* ----- FINAL LAYER: dialog list right align ----- */

.dialog-card-row-v2 {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
}

.dialog-card-meta-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 7px !important;
  min-width: 104px !important;
}

.dialog-card-badges-top {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  width: 100% !important;
}

.dialog-card-unread-col {
  display: contents !important;
}

.dialog-dot.is-source,
.dialog-dot.is-status {
  flex: 0 0 auto !important;
}

.dialog-dot.is-unread {
  flex: 0 0 auto !important;
  margin-left: 2px !important;
}

.dialog-date-right {
  display: block !important;
  width: 100% !important;
  text-align: right !important;
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.62 !important;
  white-space: nowrap !important;
}

@media (max-width: 980px) {
  .dialog-card-row-v2 {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .dialog-card-meta-col {
    min-width: 96px !important;
    gap: 6px !important;
  }

  .dialog-card-badges-top {
    gap: 5px !important;
  }
}

/* ----- FINAL LAYER: dialog list right row fix ----- */

.dialog-card-row-v2 {
  grid-template-columns: auto minmax(0, 1fr) auto auto !important;
  gap: 10px !important;
  align-items: center !important;
}

.dialog-card-meta-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 6px !important;
  min-width: 74px !important;
}

.dialog-card-badges-top {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  width: auto !important;
}

.dialog-card-unread-col {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-width: 28px !important;
}

.dialog-dot.is-source,
.dialog-dot.is-status,
.dialog-dot.is-unread {
  flex: 0 0 auto !important;
  margin: 0 !important;
}

.dialog-dot.is-unread {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  font-size: 9px !important;
}

.dialog-dot.is-unread.has-unread {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.dialog-date-right {
  display: block !important;
  width: 100% !important;
  text-align: right !important;
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.62 !important;
  white-space: nowrap !important;
}

@media (max-width: 980px) {
  .dialog-card-row-v2 {
    grid-template-columns: auto minmax(0, 1fr) auto auto !important;
    gap: 8px !important;
  }

  .dialog-card-meta-col {
    min-width: 68px !important;
  }

  .dialog-card-unread-col {
    min-width: 26px !important;
  }
}


/* ----- FINAL LAYER: dialog list top row unified ----- */

.dialog-card-row-v3 {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  gap: 10px !important;
  align-items: center !important;
}

.dialog-card-right-col {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  justify-content: center !important;
  gap: 7px !important;
  min-width: 118px !important;
}

.dialog-card-topline {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 6px !important;
  width: 100% !important;
}

.dialog-card-main-col {
  min-width: 0 !important;
}

.dialog-title-single-line {
  margin-bottom: 4px !important;
}

.dialog-preview {
  max-width: none !important;
}

.dialog-date-right {
  display: block !important;
  width: 100% !important;
  text-align: right !important;
  font-size: 10px !important;
  line-height: 1 !important;
  opacity: 0.62 !important;
  white-space: nowrap !important;
}

.dialog-dot.is-unread {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  font-size: 9px !important;
  margin: 0 !important;
}

.dialog-dot.is-unread.has-unread {
  width: 28px !important;
  min-width: 28px !important;
  height: 28px !important;
  min-height: 28px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
}

.dialog-card-unread-col,
.dialog-card-meta-col,
.dialog-card-badges-top {
  all: unset;
}

@media (max-width: 980px) {
  .dialog-card-row-v3 {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    gap: 8px !important;
  }

  .dialog-card-right-col {
    min-width: 108px !important;
    gap: 6px !important;
  }

  .dialog-card-topline {
    gap: 5px !important;
  }
}

/* ----- FINAL LAYER: dialog list right col narrow ----- */

.dialog-card-row-v3 {
  grid-template-columns: auto minmax(0, 1fr) auto !important;
  gap: 8px !important;
}

.dialog-card-right-col {
  min-width: 86px !important;
  gap: 5px !important;
}

.dialog-card-topline {
  gap: 4px !important;
}

.dialog-dot.is-source,
.dialog-dot.is-status,
.dialog-dot.is-unread {
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  font-size: 9px !important;
}

.dialog-dot.is-unread.has-unread {
  width: 26px !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  font-size: 10px !important;
}

.dialog-date-right {
  font-size: 9.5px !important;
  letter-spacing: 0 !important;
}

.dialog-preview {
  max-width: none !important;
  padding-right: 0 !important;
}

@media (max-width: 980px) {
  .dialog-card-row-v3 {
    gap: 7px !important;
  }

  .dialog-card-right-col {
    min-width: 80px !important;
  }

  .dialog-card-topline {
    gap: 4px !important;
  }
}

/* ----- FINAL LAYER: settings page polish ----- */

#section-settings {
  padding: 16px 18px 22px !important;
}

#section-settings .settings-layout {
  max-width: 1160px !important;
  margin: 0 auto !important;
}

#section-settings .settings-card {
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-settings .settings-panel-header {
  align-items: center !important;
  gap: 18px !important;
  padding: 18px 20px !important;
}

#section-settings .settings-panel-header h2 {
  font-size: 18px !important;
  line-height: 1.2 !important;
}

#section-settings .settings-panel-subtitle,
#section-settings .settings-field-hint {
  color: var(--text-muted-2) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

#section-settings .settings-panel-subtitle {
  margin-top: 5px !important;
}

#section-settings .settings-header-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-left: auto !important;
}

#section-settings .settings-status {
  min-width: 150px !important;
  text-align: right !important;
  font-size: 13px !important;
}

#section-settings .settings-form-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
  gap: 18px 20px !important;
  padding: 20px !important;
}

#section-settings .settings-field {
  min-width: 0 !important;
}

#section-settings .settings-field-wide {
  grid-column: 1 / -1 !important;
}

#section-settings .label {
  margin-bottom: 7px !important;
  color: var(--text-muted-2) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-settings .input,
#section-settings .textarea,
#section-settings select.input {
  min-height: 44px !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
}

#section-settings .settings-field-hint {
  margin: -2px 0 10px !important;
}

#section-settings .large-textarea {
  min-height: 156px !important;
  max-height: 280px !important;
  line-height: 1.45 !important;
}

#section-settings #settings-save {
  min-width: 132px !important;
  border-radius: 8px !important;
}

@media (max-width: 900px) {
  #section-settings .settings-panel-header,
  #section-settings .settings-header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-settings .settings-header-actions {
    width: 100% !important;
  }

  #section-settings .settings-status {
    min-width: 0 !important;
    text-align: left !important;
  }

  #section-settings .settings-form-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ----- FINAL LAYER: theme contrast normalization ----- */

body.theme-light {
  --text: #142033 !important;
  --muted: #5e6b7f !important;
  --text-main: #142033 !important;
  --text-muted-2: #5e6b7f !important;
  --page-bg: #eef3f8 !important;
  --page-bg-2: #f7fafc !important;
  --shell-top: rgba(255,255,255,0.96) !important;
  --card-bg: #ffffff !important;
  --card-bg-soft: #f4f7fb !important;
  --card-border: #d7e1ee !important;
  --message-in: #ffffff !important;
  --message-out: #dceaff !important;
  --composer-bg: #ffffff !important;
}

body.theme-dark {
  --text: #e8eefc !important;
  --muted: #aab6c9 !important;
  --text-main: #e8eefc !important;
  --text-muted-2: #aab6c9 !important;
  --page-bg: #0b1220 !important;
  --page-bg-2: #10192b !important;
  --shell-top: rgba(15,23,42,0.92) !important;
  --card-bg: #121c2f !important;
  --card-bg-soft: #162238 !important;
  --card-border: #2b3a54 !important;
  --message-in: #17243a !important;
  --message-out: #213d73 !important;
  --composer-bg: #101a33 !important;
}

body.theme-light,
body.theme-dark {
  color: var(--text-main) !important;
}

body.theme-light .topbar,
body.theme-light .card,
body.theme-light .chat-panel,
body.theme-light .dialogs-list-panel,
body.theme-light .dialogs-side-panel .accordion,
body.theme-light .login-card {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-dark .topbar,
body.theme-dark .card,
body.theme-dark .chat-panel,
body.theme-dark .dialogs-list-panel,
body.theme-dark .dialogs-side-panel .accordion,
body.theme-dark .login-card {
  background: var(--card-bg) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-light .messages-list {
  background: #f5f8fc !important;
  color: var(--text-main) !important;
}

body.theme-dark .messages-list {
  background: #0b1328 !important;
  color: var(--text-main) !important;
}

body.theme-light .message,
body.theme-light .message.message-compact {
  background: var(--message-in) !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-light .message.out,
body.theme-light .message-row.out .message.message-compact {
  background: var(--message-out) !important;
  border-color: rgba(96,165,250,0.35) !important;
  color: #10213a !important;
}

body.theme-dark .message,
body.theme-dark .message.message-compact {
  background: var(--message-in) !important;
  border-color: rgba(148,163,184,0.18) !important;
  color: var(--text-main) !important;
}

body.theme-dark .message.out,
body.theme-dark .message-row.out .message.message-compact {
  background: var(--message-out) !important;
  border-color: rgba(96,165,250,0.36) !important;
  color: #edf4ff !important;
}

body.theme-light .message-text,
body.theme-light .message-attachment-name,
body.theme-light .message-attachment-link,
body.theme-light .entity-title,
body.theme-light .dialog-title-single-line,
body.theme-light .accordion-toggle span:first-child,
body.theme-light .mini-item-title,
body.theme-light .kv strong,
body.theme-light .kv-notes div {
  color: var(--text-main) !important;
}

body.theme-dark .message-text,
body.theme-dark .message-attachment-name,
body.theme-dark .message-attachment-link,
body.theme-dark .entity-title,
body.theme-dark .dialog-title-single-line,
body.theme-dark .accordion-toggle span:first-child,
body.theme-dark .mini-item-title,
body.theme-dark .kv strong,
body.theme-dark .kv-notes div {
  color: var(--text-main) !important;
}

body.theme-light .entity-subtitle,
body.theme-light .entity-meta,
body.theme-light .muted,
body.theme-light .message-meta,
body.theme-light .message-time,
body.theme-light .dialog-preview,
body.theme-light .dialog-compact-date,
body.theme-light .dialog-date-right,
body.theme-light .mini-item-meta,
body.theme-light .label,
body.theme-light .kv span,
body.theme-light .kv-notes span,
body.theme-light .settings-field-hint,
body.theme-light .settings-panel-subtitle {
  color: var(--text-muted-2) !important;
  opacity: 1 !important;
}

body.theme-dark .entity-subtitle,
body.theme-dark .entity-meta,
body.theme-dark .muted,
body.theme-dark .message-meta,
body.theme-dark .message-time,
body.theme-dark .dialog-preview,
body.theme-dark .dialog-compact-date,
body.theme-dark .dialog-date-right,
body.theme-dark .mini-item-meta,
body.theme-dark .label,
body.theme-dark .kv span,
body.theme-dark .kv-notes span,
body.theme-dark .settings-field-hint,
body.theme-dark .settings-panel-subtitle {
  color: var(--text-muted-2) !important;
  opacity: 1 !important;
}

body.theme-light .entity-item,
body.theme-light .mini-item,
body.theme-light .dialog-compact-card,
body.theme-light .message-attachment,
body.theme-light .message-attachment-name,
body.theme-light .message-attachments-download-all {
  background: #f8fbff !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-light .entity-item.active,
body.theme-light .entity-item.dialog-compact-card.active {
  background: #eaf3ff !important;
  border-color: rgba(96,165,250,0.72) !important;
  color: var(--text-main) !important;
}

body.theme-dark .entity-item,
body.theme-dark .mini-item,
body.theme-dark .dialog-compact-card,
body.theme-dark .message-attachment,
body.theme-dark .message-attachment-name,
body.theme-dark .message-attachments-download-all {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.18) !important;
  color: var(--text-main) !important;
}

body.theme-dark .entity-item.active,
body.theme-dark .entity-item.dialog-compact-card.active {
  background: rgba(59,130,246,0.18) !important;
  border-color: rgba(96,165,250,0.58) !important;
  color: var(--text-main) !important;
}

body.theme-light .input,
body.theme-light .textarea,
body.theme-light select.input,
body.theme-light .preview-box {
  background: #ffffff !important;
  border-color: #cfd9e8 !important;
  color: var(--text-main) !important;
}

body.theme-dark .input,
body.theme-dark .textarea,
body.theme-dark select.input,
body.theme-dark .preview-box {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.22) !important;
  color: var(--text-main) !important;
}

body.theme-light .input::placeholder,
body.theme-light .textarea::placeholder {
  color: #7a8798 !important;
  opacity: 1 !important;
}

body.theme-dark .input::placeholder,
body.theme-dark .textarea::placeholder {
  color: #7f8da3 !important;
  opacity: 1 !important;
}

body.theme-light .secondary-btn,
body.theme-light .small-btn,
body.theme-light .status-btn,
body.theme-light .quick-reply-btn,
body.theme-light .composer-side-btn,
body.theme-light .composer-icon-btn {
  background: #f7faff !important;
  border-color: #d4deed !important;
  color: var(--text-main) !important;
}

body.theme-dark .secondary-btn,
body.theme-dark .small-btn,
body.theme-dark .status-btn,
body.theme-dark .quick-reply-btn,
body.theme-dark .composer-side-btn,
body.theme-dark .composer-icon-btn {
  background: rgba(255,255,255,0.055) !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: var(--text-main) !important;
}

body.theme-light .composer {
  background: var(--composer-bg) !important;
  border-top-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-light .composer-textarea,
body.theme-light .composer-textarea-v2 {
  background: #ffffff !important;
  border-color: #cfd9e8 !important;
  color: var(--text-main) !important;
}

body.theme-light .composer-textarea::placeholder,
body.theme-light .composer-textarea-v2::placeholder {
  color: #7a8798 !important;
  opacity: 1 !important;
}

body.theme-dark .composer {
  background: var(--composer-bg) !important;
  border-top-color: rgba(148,163,184,0.22) !important;
  color: var(--text-main) !important;
}

body.theme-dark .composer-textarea,
body.theme-dark .composer-textarea-v2 {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.22) !important;
  color: var(--text-main) !important;
}

body.theme-dark .composer-textarea::placeholder,
body.theme-dark .composer-textarea-v2::placeholder {
  color: #8c9ab0 !important;
  opacity: 1 !important;
}

body.theme-light .dialogs-side-panel [data-accordion="client"] .input,
body.theme-light .dialogs-side-panel [data-accordion="client"] .textarea,
body.theme-light .dialogs-side-panel [data-accordion="calculator"] .input,
body.theme-light .dialogs-side-panel [data-accordion="calculator"] select.input {
  background: #ffffff !important;
  border-color: #cfd9e8 !important;
  color: var(--text-main) !important;
}

body.theme-dark .dialogs-side-panel [data-accordion="client"] .input,
body.theme-dark .dialogs-side-panel [data-accordion="client"] .textarea,
body.theme-dark .dialogs-side-panel [data-accordion="calculator"] .input,
body.theme-dark .dialogs-side-panel [data-accordion="calculator"] select.input {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.22) !important;
  color: var(--text-main) !important;
}

body.theme-light #dialog-templates-mini .mini-item,
body.theme-light #dialog-client-orders-mini .mini-item {
  background: #f8fbff !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-dark #dialog-templates-mini .mini-item,
body.theme-dark #dialog-client-orders-mini .mini-item {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.18) !important;
  color: var(--text-main) !important;
}

body.theme-light #dialog-templates-mini .mini-item-title,
body.theme-light #dialog-client-orders-mini .mini-item-title,
body.theme-light #side-client-name,
body.theme-light #side-client-name strong,
body.theme-light #side-client-name .client-name-main,
body.theme-light #side-client-name .client-name-handle {
  color: var(--text-main) !important;
  opacity: 1 !important;
}

body.theme-dark #dialog-templates-mini .mini-item-title,
body.theme-dark #dialog-client-orders-mini .mini-item-title,
body.theme-dark #side-client-name,
body.theme-dark #side-client-name strong,
body.theme-dark #side-client-name .client-name-main,
body.theme-dark #side-client-name .client-name-handle {
  color: var(--text-main) !important;
  opacity: 1 !important;
}

body.theme-light #dialog-templates-mini .mini-item-meta,
body.theme-light #dialog-client-orders-mini .mini-item-meta,
body.theme-light #composer-status {
  color: var(--text-muted-2) !important;
  opacity: 1 !important;
}

body.theme-dark #dialog-templates-mini .mini-item-meta,
body.theme-dark #dialog-client-orders-mini .mini-item-meta,
body.theme-dark #composer-status {
  color: var(--text-muted-2) !important;
  opacity: 1 !important;
}

body.theme-light option {
  background: #ffffff !important;
  color: #142033 !important;
}

body.theme-dark option {
  background: #121c2f !important;
  color: #e8eefc !important;
}

/* ----- FINAL LAYER: calculator page polish ----- */

#section-calculator {
  padding: 16px 18px 22px !important;
}

#section-calculator .calculator-layout {
  max-width: 1160px !important;
  margin: 0 auto !important;
}

#section-calculator .calculator-card {
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-calculator .calculator-panel-header,
#section-calculator .calculator-test-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 18px !important;
}

#section-calculator .calculator-panel-header {
  padding: 18px 20px !important;
  border-bottom: 1px solid var(--card-border) !important;
}

#section-calculator .calculator-panel-header h2,
#section-calculator .calculator-test-header h2 {
  margin: 0 !important;
  font-size: 18px !important;
  line-height: 1.2 !important;
}

#section-calculator .calculator-panel-subtitle,
#section-calculator .calculator-field-hint {
  color: var(--text-muted-2) !important;
  font-size: 13px !important;
  line-height: 1.35 !important;
}

#section-calculator .calculator-panel-subtitle {
  margin-top: 5px !important;
}

#section-calculator .calculator-header-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 12px !important;
  margin-left: auto !important;
}

#section-calculator .calculator-status {
  min-width: 120px !important;
  text-align: right !important;
  font-size: 13px !important;
}

#section-calculator .calculator-form-grid,
#section-calculator .calculator-test-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(140px, 1fr)) !important;
  gap: 18px 20px !important;
  padding: 20px !important;
}

#section-calculator .calculator-field,
#section-calculator .calculator-result-wrap {
  min-width: 0 !important;
}

#section-calculator .calculator-field-small {
  max-width: 180px !important;
}

#section-calculator .calculator-field-wide,
#section-calculator .calculator-result-wrap {
  grid-column: 1 / -1 !important;
}

#section-calculator .label {
  margin-bottom: 7px !important;
  color: var(--text-muted-2) !important;
  font-size: 12px !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-calculator .input,
#section-calculator .textarea,
#section-calculator select.input {
  min-height: 44px !important;
  border-radius: 8px !important;
  padding: 10px 12px !important;
}

#section-calculator .calculator-field-hint {
  margin: -2px 0 10px !important;
}

#section-calculator .large-textarea {
  min-height: 148px !important;
  max-height: 260px !important;
  line-height: 1.45 !important;
}

#section-calculator .calculator-test-panel {
  border-top: 1px solid var(--card-border) !important;
}

#section-calculator .calculator-test-header {
  padding: 18px 20px 0 !important;
}

#section-calculator .calculator-result-box {
  min-height: 112px !important;
  border-radius: 8px !important;
  line-height: 1.5 !important;
  font-weight: 650 !important;
}

#section-calculator #calculator-save,
#section-calculator #calculator-test-btn {
  min-width: 132px !important;
  border-radius: 8px !important;
}

body.theme-light #section-calculator .calculator-result-box {
  background: #f8fbff !important;
  border-color: var(--card-border) !important;
  color: var(--text-main) !important;
}

body.theme-dark #section-calculator .calculator-result-box {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.18) !important;
  color: var(--text-main) !important;
}

@media (max-width: 1100px) {
  #section-calculator .calculator-form-grid,
  #section-calculator .calculator-test-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  #section-calculator .calculator-panel-header,
  #section-calculator .calculator-test-header,
  #section-calculator .calculator-header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-calculator .calculator-header-actions {
    width: 100% !important;
  }

  #section-calculator .calculator-status {
    min-width: 0 !important;
    text-align: left !important;
  }

  #section-calculator .calculator-form-grid,
  #section-calculator .calculator-test-grid {
    grid-template-columns: 1fr !important;
  }

  #section-calculator .calculator-field-small {
    max-width: none !important;
  }
}

.app-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10000;
  max-width: min(460px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,0.28);
  background: rgba(15,23,42,0.96);
  color: #f8fafc;
  box-shadow: 0 18px 46px rgba(2,6,23,0.34);
  font-size: 14px;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast-error {
  border-color: rgba(248,113,113,0.48);
  background: rgba(69,19,28,0.96);
}

body.theme-light .app-toast {
  background: rgba(255,255,255,0.98);
  color: #162033;
  border-color: #d8e1ee;
}

body.theme-light .app-toast-error {
  background: #fff5f5;
  border-color: #fecaca;
  color: #7f1d1d;
}

/* ----- FINAL LAYER: chat file attachments single-pill fix ----- */

.messages-list .message-attachments {
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 7px !important;
  margin-top: 8px !important;
}

.messages-list .message-attachment {
  display: flex !important;
  align-items: flex-start !important;
  max-width: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.messages-list .message-attachment-body,
.messages-list .message-attachment-body.only-file-name {
  display: flex !important;
  min-width: 0 !important;
  max-width: 100% !important;
}

.messages-list .message-attachment-name {
  display: inline-flex !important;
  align-items: center !important;
  max-width: min(100%, 460px) !important;
  min-height: 38px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 750 !important;
  line-height: 1.18 !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  box-shadow: none !important;
}

.messages-list .message-attachment-link {
  display: inline !important;
  min-height: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: inherit !important;
  font: inherit !important;
  text-decoration: underline !important;
  text-decoration-thickness: 1px !important;
  text-underline-offset: 3px !important;
  box-shadow: none !important;
}

.messages-list .message-attachment-icon,
.messages-list .message-attachment-kind,
.messages-list .message-attachment-meta {
  display: none !important;
}

.messages-list .message-attachments-download-all {
  display: inline-flex !important;
  align-items: center !important;
  min-height: 30px !important;
  padding: 0 10px !important;
  border-radius: 9px !important;
  font-size: 12px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  box-shadow: none !important;
}

.messages-list .message-grouped-inbound-files {
  padding: 10px 12px !important;
}

.messages-list .message-grouped-inbound-files .message-attachments {
  gap: 7px !important;
  margin-top: 0 !important;
}

.messages-list .message-grouped-inbound-files .message-attachment {
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
}

body.theme-light .messages-list .message-attachment-name,
body.theme-light .messages-list .message-attachments-download-all {
  background: #eef5ff !important;
  border: 1px solid #d2def0 !important;
  color: #142033 !important;
}

body.theme-dark .messages-list .message-attachment-name,
body.theme-dark .messages-list .message-attachments-download-all {
  background: rgba(255,255,255,0.070) !important;
  border: 1px solid rgba(148,163,184,0.20) !important;
  color: #eef4ff !important;
}

/* ----- FINAL LAYER: clients page polish ----- */

#section-clients .clients-layout {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 18px !important;
}

#section-clients .clients-list-card,
#section-clients .client-editor-card {
  display: flex !important;
  flex-direction: column !important;
  min-height: calc(100vh - 112px) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-clients .clients-panel-header {
  min-height: 84px !important;
  padding: 18px 20px !important;
  border-bottom-width: 1px !important;
}

#section-clients .clients-panel-header h2 {
  font-size: 20px !important;
  line-height: 1.2 !important;
}

#section-clients .clients-panel-header .header-actions {
  gap: 8px !important;
}

#section-clients #clients-new,
#section-clients #clients-refresh,
#section-clients #client-save {
  border-radius: 8px !important;
  min-height: 44px !important;
}

#section-clients .clients-toolbar {
  padding: 14px 14px 10px !important;
}

#section-clients #clients-search {
  min-height: 44px !important;
  border-radius: 8px !important;
}

#section-clients #clients-list {
  flex: 1 1 auto !important;
  padding: 0 14px 14px !important;
  gap: 8px !important;
}

#section-clients .client-list-item {
  padding: 13px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

#section-clients .client-list-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-width: 0 !important;
}

#section-clients .client-list-main {
  min-width: 0 !important;
}

#section-clients .client-list-title {
  margin: 0 0 5px !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#section-clients .client-list-phone {
  font-size: 12px !important;
  line-height: 1.25 !important;
}

#section-clients .client-list-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px 8px !important;
  margin-top: 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
}

#section-clients .client-list-meta span {
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#section-clients .client-list-tag {
  flex: 0 0 auto !important;
  max-width: 110px !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#section-clients .client-form-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  padding: 22px 22px 0 !important;
}

#section-clients .client-field {
  min-width: 0 !important;
}

#section-clients .client-field .label {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-clients .client-field .input,
#section-clients .client-field .textarea {
  min-height: 44px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
}

#section-clients #client-id {
  cursor: default !important;
}

#section-clients #client-notes {
  min-height: 150px !important;
  resize: vertical !important;
}

#section-clients #client-status {
  margin: 12px 22px 22px !important;
  min-height: 20px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

body.theme-light #section-clients .clients-list-card,
body.theme-light #section-clients .client-editor-card {
  background: #ffffff !important;
  border-color: #d8e1ee !important;
}

body.theme-dark #section-clients .clients-list-card,
body.theme-dark #section-clients .client-editor-card {
  background: rgba(15,23,42,0.74) !important;
  border-color: rgba(148,163,184,0.18) !important;
}

body.theme-light #section-clients .client-list-tag {
  background: #eef5ff !important;
  color: #1d4f91 !important;
  border: 1px solid #cdddf4 !important;
}

body.theme-dark #section-clients .client-list-tag {
  background: rgba(96,165,250,0.16) !important;
  color: #bfdbfe !important;
  border: 1px solid rgba(96,165,250,0.26) !important;
}

body.theme-light #section-clients .client-field .input,
body.theme-light #section-clients .client-field .textarea {
  background: #f8fbff !important;
  border-color: #d4deed !important;
  color: var(--text-main) !important;
}

body.theme-dark #section-clients .client-field .input,
body.theme-dark #section-clients .client-field .textarea {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: var(--text-main) !important;
}

body.theme-light #section-clients #client-id {
  background: #eef2f7 !important;
  color: #667085 !important;
}

body.theme-dark #section-clients #client-id {
  background: rgba(255,255,255,0.030) !important;
  color: #8f9db2 !important;
}

@media (max-width: 1080px) {
  #section-clients .clients-layout {
    grid-template-columns: 1fr !important;
  }

  #section-clients .clients-list-card,
  #section-clients .client-editor-card {
    min-height: auto !important;
  }
}

@media (max-width: 720px) {
  #section-clients .clients-panel-header,
  #section-clients .clients-panel-header .header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-clients .client-form-grid {
    grid-template-columns: 1fr !important;
    padding: 18px 16px 0 !important;
  }

  #section-clients #client-status {
    margin: 12px 16px 18px !important;
  }
}

/* ----- FINAL LAYER: users page polish ----- */

#section-users .users-layout {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 18px !important;
}

#section-users .users-list-card,
#section-users .user-editor-card {
  display: flex !important;
  flex-direction: column !important;
  min-height: calc(100vh - 112px) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-users .users-panel-header {
  min-height: 84px !important;
  padding: 18px 20px !important;
  border-bottom-width: 1px !important;
}

#section-users .users-panel-header h2 {
  font-size: 20px !important;
  line-height: 1.2 !important;
}

#section-users .users-panel-header .header-actions {
  gap: 8px !important;
}

#section-users #users-new,
#section-users #users-refresh,
#section-users #user-save {
  border-radius: 8px !important;
  min-height: 44px !important;
}

#section-users .users-toolbar {
  padding: 14px 14px 10px !important;
}

#section-users #users-search {
  min-height: 44px !important;
  border-radius: 8px !important;
}

#section-users #users-list {
  flex: 1 1 auto !important;
  padding: 0 14px 14px !important;
  gap: 8px !important;
}

#section-users .user-list-item {
  padding: 13px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

#section-users .user-list-item.is-inactive {
  opacity: 0.66 !important;
}

#section-users .user-list-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-width: 0 !important;
}

#section-users .user-list-main {
  min-width: 0 !important;
}

#section-users .user-list-title {
  margin: 0 0 5px !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#section-users .user-list-login {
  font-size: 12px !important;
  line-height: 1.25 !important;
}

#section-users .user-list-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px 8px !important;
  margin-top: 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
}

#section-users .user-role-pill {
  flex: 0 0 auto !important;
  max-width: 124px !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#section-users .user-form-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  padding: 22px 22px 0 !important;
}

#section-users .user-field {
  min-width: 0 !important;
}

#section-users .user-field .label {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-users .user-field .input {
  min-height: 44px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.35 !important;
}

#section-users #user-id {
  cursor: default !important;
}

#section-users #user-status {
  margin: 12px 22px 22px !important;
  min-height: 20px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

body.theme-light #section-users .users-list-card,
body.theme-light #section-users .user-editor-card {
  background: #ffffff !important;
  border-color: #d8e1ee !important;
}

body.theme-dark #section-users .users-list-card,
body.theme-dark #section-users .user-editor-card {
  background: rgba(15,23,42,0.74) !important;
  border-color: rgba(148,163,184,0.18) !important;
}

body.theme-light #section-users .user-role-pill {
  background: #eef5ff !important;
  color: #1d4f91 !important;
  border: 1px solid #cdddf4 !important;
}

body.theme-light #section-users .user-role-pill.is-admin {
  background: #ecfdf3 !important;
  color: #17663a !important;
  border-color: #badfca !important;
}

body.theme-dark #section-users .user-role-pill {
  background: rgba(96,165,250,0.16) !important;
  color: #bfdbfe !important;
  border: 1px solid rgba(96,165,250,0.26) !important;
}

body.theme-dark #section-users .user-role-pill.is-admin {
  background: rgba(74,222,128,0.13) !important;
  color: #bbf7d0 !important;
  border-color: rgba(74,222,128,0.24) !important;
}

body.theme-light #section-users .user-field .input {
  background: #f8fbff !important;
  border-color: #d4deed !important;
  color: var(--text-main) !important;
}

body.theme-dark #section-users .user-field .input {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: var(--text-main) !important;
}

body.theme-light #section-users #user-id {
  background: #eef2f7 !important;
  color: #667085 !important;
}

body.theme-dark #section-users #user-id {
  background: rgba(255,255,255,0.030) !important;
  color: #8f9db2 !important;
}

@media (max-width: 1080px) {
  #section-users .users-layout {
    grid-template-columns: 1fr !important;
  }

  #section-users .users-list-card,
  #section-users .user-editor-card {
    min-height: auto !important;
  }
}

@media (max-width: 720px) {
  #section-users .users-panel-header,
  #section-users .users-panel-header .header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-users .user-form-grid {
    grid-template-columns: 1fr !important;
    padding: 18px 16px 0 !important;
  }

  #section-users #user-status {
    margin: 12px 16px 18px !important;
  }
}

/* ----- FINAL LAYER: templates page polish ----- */

#section-templates .templates-layout {
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 18px !important;
}

#section-templates .templates-list-card,
#section-templates .template-editor-card {
  display: flex !important;
  flex-direction: column !important;
  min-height: calc(100vh - 112px) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-templates .templates-panel-header {
  min-height: 84px !important;
  padding: 18px 20px !important;
  border-bottom-width: 1px !important;
}

#section-templates .templates-panel-header h2 {
  font-size: 20px !important;
  line-height: 1.2 !important;
}

#section-templates .templates-panel-header .header-actions {
  gap: 8px !important;
}

#section-templates #templates-new,
#section-templates #templates-refresh,
#section-templates #template-save {
  border-radius: 8px !important;
  min-height: 44px !important;
}

#section-templates .templates-toolbar {
  padding: 14px 14px 10px !important;
}

#section-templates #templates-search {
  min-height: 44px !important;
  border-radius: 8px !important;
}

#section-templates #templates-list {
  flex: 1 1 auto !important;
  padding: 0 14px 14px !important;
  gap: 8px !important;
}

#section-templates .template-list-item {
  padding: 13px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

#section-templates .template-list-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-width: 0 !important;
}

#section-templates .template-list-main {
  min-width: 0 !important;
}

#section-templates .template-list-title {
  margin: 0 0 5px !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#section-templates .template-list-preview {
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
  overflow: hidden !important;
  font-size: 12px !important;
  line-height: 1.3 !important;
}

#section-templates .template-list-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px 8px !important;
  margin-top: 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
}

#section-templates .template-category-pill {
  flex: 0 0 auto !important;
  max-width: 120px !important;
  padding: 4px 8px !important;
  border-radius: 999px !important;
  font-size: 11px !important;
  font-weight: 750 !important;
  line-height: 1 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

#section-templates .template-form-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  padding: 22px 22px 0 !important;
}

#section-templates .template-field {
  min-width: 0 !important;
}

#section-templates .template-field .label {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-templates .template-field .input,
#section-templates .template-field .textarea {
  min-height: 44px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
}

#section-templates #template-id {
  cursor: default !important;
}

#section-templates #template-body {
  min-height: 280px !important;
  resize: vertical !important;
}

#section-templates #template-status {
  margin: 12px 22px 22px !important;
  min-height: 20px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

body.theme-light #section-templates .templates-list-card,
body.theme-light #section-templates .template-editor-card {
  background: #ffffff !important;
  border-color: #d8e1ee !important;
}

body.theme-dark #section-templates .templates-list-card,
body.theme-dark #section-templates .template-editor-card {
  background: rgba(15,23,42,0.74) !important;
  border-color: rgba(148,163,184,0.18) !important;
}

body.theme-light #section-templates .template-category-pill {
  background: #eef5ff !important;
  color: #1d4f91 !important;
  border: 1px solid #cdddf4 !important;
}

body.theme-dark #section-templates .template-category-pill {
  background: rgba(96,165,250,0.16) !important;
  color: #bfdbfe !important;
  border: 1px solid rgba(96,165,250,0.26) !important;
}

body.theme-light #section-templates .template-field .input,
body.theme-light #section-templates .template-field .textarea {
  background: #f8fbff !important;
  border-color: #d4deed !important;
  color: var(--text-main) !important;
}

body.theme-dark #section-templates .template-field .input,
body.theme-dark #section-templates .template-field .textarea {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: var(--text-main) !important;
}

body.theme-light #section-templates #template-id {
  background: #eef2f7 !important;
  color: #667085 !important;
}

body.theme-dark #section-templates #template-id {
  background: rgba(255,255,255,0.030) !important;
  color: #8f9db2 !important;
}

@media (max-width: 1080px) {
  #section-templates .templates-layout {
    grid-template-columns: 1fr !important;
  }

  #section-templates .templates-list-card,
  #section-templates .template-editor-card {
    min-height: auto !important;
  }
}

@media (max-width: 720px) {
  #section-templates .templates-panel-header,
  #section-templates .templates-panel-header .header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-templates .template-form-grid {
    grid-template-columns: 1fr !important;
    padding: 18px 16px 0 !important;
  }

  #section-templates #template-status {
    margin: 12px 16px 18px !important;
  }
}

/* ----- FINAL LAYER: orders page polish ----- */

#section-orders .orders-layout {
  grid-template-columns: minmax(320px, 400px) minmax(0, 1fr) !important;
  align-items: stretch !important;
  gap: 18px !important;
}

#section-orders .orders-list-card,
#section-orders .order-editor-card {
  display: flex !important;
  flex-direction: column !important;
  min-height: calc(100vh - 112px) !important;
  border-radius: 8px !important;
  overflow: hidden !important;
}

#section-orders .orders-panel-header {
  min-height: 84px !important;
  padding: 18px 20px !important;
  border-bottom-width: 1px !important;
}

#section-orders .orders-panel-header h2 {
  font-size: 20px !important;
  line-height: 1.2 !important;
}

#section-orders .orders-panel-header .header-actions {
  gap: 8px !important;
}

#section-orders #orders-new,
#section-orders #orders-refresh,
#section-orders #order-save {
  border-radius: 8px !important;
  min-height: 44px !important;
}

#section-orders .orders-toolbar {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 190px) !important;
  gap: 10px !important;
  padding: 14px 14px 10px !important;
}

#section-orders #orders-search,
#section-orders #orders-status-filter {
  min-height: 44px !important;
  border-radius: 8px !important;
}

#section-orders #orders-list {
  flex: 1 1 auto !important;
  padding: 0 14px 14px !important;
  gap: 8px !important;
}

#section-orders .order-list-item {
  padding: 13px 14px !important;
  border-radius: 8px !important;
  cursor: pointer !important;
}

#section-orders .order-list-row {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 12px !important;
  min-width: 0 !important;
}

#section-orders .order-list-main {
  min-width: 0 !important;
}

#section-orders .order-list-title {
  margin: 0 0 5px !important;
  font-size: 15px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

#section-orders .order-list-client {
  font-size: 12px !important;
  line-height: 1.25 !important;
}

#section-orders .order-list-status {
  flex: 0 0 auto !important;
  max-width: 132px !important;
}

#section-orders .order-list-meta {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 5px 8px !important;
  margin-top: 9px !important;
  font-size: 11px !important;
  line-height: 1.2 !important;
}

#section-orders .order-quick-actions,
#section-orders .order-status-actions {
  padding: 16px 22px 0 !important;
  gap: 8px !important;
}

#section-orders .order-quick-actions .small-btn,
#section-orders .order-status-actions .status-btn {
  border-radius: 8px !important;
  min-height: 38px !important;
}

#section-orders .order-status-actions {
  padding-top: 12px !important;
}

#section-orders .order-form-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
  gap: 16px !important;
  padding: 18px 22px 0 !important;
}

#section-orders .order-field {
  min-width: 0 !important;
}

#section-orders .order-field .label {
  display: block !important;
  margin: 0 0 7px !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

#section-orders .order-field .input,
#section-orders .order-field .textarea {
  min-height: 44px !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
}

#section-orders #order-id {
  cursor: default !important;
}

#section-orders #order-notes {
  min-height: 150px !important;
  resize: vertical !important;
}

#section-orders #order-status {
  margin: 12px 22px 22px !important;
  min-height: 20px !important;
  font-size: 12px !important;
  line-height: 1.35 !important;
}

body.theme-light #section-orders .orders-list-card,
body.theme-light #section-orders .order-editor-card {
  background: #ffffff !important;
  border-color: #d8e1ee !important;
}

body.theme-dark #section-orders .orders-list-card,
body.theme-dark #section-orders .order-editor-card {
  background: rgba(15,23,42,0.74) !important;
  border-color: rgba(148,163,184,0.18) !important;
}

body.theme-light #section-orders .order-field .input,
body.theme-light #section-orders .order-field .textarea {
  background: #f8fbff !important;
  border-color: #d4deed !important;
  color: var(--text-main) !important;
}

body.theme-dark #section-orders .order-field .input,
body.theme-dark #section-orders .order-field .textarea {
  background: rgba(255,255,255,0.045) !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: var(--text-main) !important;
}

body.theme-light #section-orders #order-id {
  background: #eef2f7 !important;
  color: #667085 !important;
}

body.theme-dark #section-orders #order-id {
  background: rgba(255,255,255,0.030) !important;
  color: #8f9db2 !important;
}

@media (max-width: 1080px) {
  #section-orders .orders-layout {
    grid-template-columns: 1fr !important;
  }

  #section-orders .orders-list-card,
  #section-orders .order-editor-card {
    min-height: auto !important;
  }
}

@media (max-width: 720px) {
  #section-orders .orders-panel-header,
  #section-orders .orders-panel-header .header-actions {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  #section-orders .orders-toolbar,
  #section-orders .order-form-grid {
    grid-template-columns: 1fr !important;
  }

  #section-orders .order-quick-actions,
  #section-orders .order-status-actions,
  #section-orders .order-form-grid {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }

  #section-orders #order-status {
    margin: 12px 16px 18px !important;
  }
}

/* =========================================================
   Telegram-like dialogs comfort layer
   Visual-only polish for easier migration from native chats.
   ========================================================= */

#section-dialogs .dialogs-layout {
  gap: 10px !important;
}

#section-dialogs .dialogs-list-panel,
#section-dialogs .chat-panel,
#section-dialogs .dialogs-side-panel .accordion {
  border-radius: 18px !important;
}

#section-dialogs .panel-header {
  min-height: 58px !important;
  padding: 0 18px !important;
  border-bottom-color: rgba(148,163,184,0.18) !important;
}

#section-dialogs .panel-header h2,
#section-dialogs #chat-title {
  font-size: 17px !important;
  line-height: 1.15 !important;
  letter-spacing: 0 !important;
}

#section-dialogs .toolbar-row {
  gap: 10px !important;
  padding: 14px 14px 10px !important;
}

#section-dialogs .dialog-search-full,
#section-dialogs .dialog-filter-single {
  min-height: 42px !important;
  border-radius: 15px !important;
}

#section-dialogs .entity-list {
  gap: 4px !important;
  padding: 0 8px 12px !important;
}

#section-dialogs .dialog-compact-card {
  min-height: 70px !important;
  padding: 9px 10px !important;
  border-radius: 14px !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

#section-dialogs .dialog-compact-card:hover {
  transform: none !important;
}

#section-dialogs .dialog-card-row,
#section-dialogs .dialog-card-row-v3 {
  gap: 11px !important;
}

#section-dialogs .dialog-card-avatar-col .avatar,
#section-dialogs .dialog-card-avatar-col img,
#section-dialogs .dialog-card-avatar-col .dialog-avatar,
#section-dialogs .dialog-card-avatar-col .dialog-avatar-fallback {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  min-height: 46px !important;
  border-radius: 50% !important;
}

#section-dialogs .dialog-title-single-line {
  font-size: 14px !important;
  line-height: 1.18 !important;
  font-weight: 720 !important;
}

#section-dialogs .dialog-preview {
  margin-top: 3px !important;
  font-size: 12.5px !important;
  line-height: 1.26 !important;
  opacity: 0.78 !important;
}

#section-dialogs .dialog-card-right-col {
  min-width: 76px !important;
}

#section-dialogs .dialog-card-topline {
  gap: 5px !important;
}

#section-dialogs .dialog-dot {
  width: 19px !important;
  height: 19px !important;
  min-width: 19px !important;
  min-height: 19px !important;
  border-radius: 50% !important;
  font-size: 10px !important;
}

#section-dialogs .dialog-date-right {
  margin-top: 7px !important;
  font-size: 10.5px !important;
}

#section-dialogs .messages-list {
  padding: 18px 18px 16px !important;
  gap: 8px !important;
}

#section-dialogs .message-row {
  display: flex !important;
  width: 100% !important;
}

#section-dialogs .message-row.in {
  justify-content: flex-start !important;
}

#section-dialogs .message-row.out {
  justify-content: flex-end !important;
}

#section-dialogs .message.message-compact {
  position: relative !important;
  max-width: min(68%, 720px) !important;
  padding: 10px 13px 8px !important;
  border: 0 !important;
  border-radius: 18px !important;
  box-shadow: none !important;
}

#section-dialogs .message-row.in .message.message-compact {
  border-bottom-left-radius: 6px !important;
}

#section-dialogs .message-row.out .message.message-compact {
  max-width: min(66%, 760px) !important;
  border-bottom-right-radius: 6px !important;
}

#section-dialogs .message-text {
  font-size: 14.5px !important;
  line-height: 1.38 !important;
  white-space: pre-wrap !important;
}

#section-dialogs .message-meta-row {
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 4px !important;
  margin-top: 4px !important;
}

#section-dialogs .message-time {
  font-size: 11px !important;
  line-height: 1 !important;
  opacity: 0.58 !important;
}

#section-dialogs .msg-delivery-ticks {
  font-size: 11px !important;
}

#section-dialogs .messages-list .message-attachment-name,
#section-dialogs .messages-list .message-attachments-download-all {
  min-height: 34px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  font-size: 12.5px !important;
  font-weight: 650 !important;
}

#section-dialogs .composer {
  padding: 12px 16px 14px !important;
  border-top-color: rgba(148,163,184,0.16) !important;
}

#section-dialogs .composer-layout-v2 {
  align-items: center !important;
  gap: 10px !important;
}

#section-dialogs .composer-textarea-v2 {
  min-height: 46px !important;
  max-height: 140px !important;
  padding: 13px 16px !important;
  border-radius: 18px !important;
  font-size: 14px !important;
  line-height: 1.28 !important;
}

#section-dialogs .composer-icon-btn,
#section-dialogs .composer-side-btn {
  width: 42px !important;
  height: 42px !important;
  min-width: 42px !important;
  min-height: 42px !important;
  border-radius: 14px !important;
}

#section-dialogs .composer-send-v2 {
  width: 46px !important;
  height: 46px !important;
  min-width: 46px !important;
  min-height: 46px !important;
  border-radius: 16px !important;
  font-size: 24px !important;
}

#section-dialogs .quick-replies {
  gap: 7px !important;
  margin-top: 10px !important;
}

#section-dialogs .quick-replies button,
#section-dialogs .quick-reply {
  border-radius: 999px !important;
  min-height: 28px !important;
  padding: 0 12px !important;
}

body.theme-dark #section-dialogs .dialogs-list-panel,
body.theme-dark #section-dialogs .chat-panel,
body.theme-dark #section-dialogs .dialogs-side-panel .accordion {
  background: #111b2c !important;
  border-color: rgba(109,132,168,0.22) !important;
}

body.theme-dark #section-dialogs .messages-list {
  background: #0e1728 !important;
}

body.theme-dark #section-dialogs .dialog-compact-card {
  background: transparent !important;
  color: #dce7f7 !important;
}

body.theme-dark #section-dialogs .dialog-compact-card:hover {
  background: rgba(148,163,184,0.08) !important;
}

body.theme-dark #section-dialogs .dialog-compact-card.active {
  background: rgba(69,134,230,0.22) !important;
  box-shadow: inset 3px 0 0 #5b9bff !important;
}

body.theme-dark #section-dialogs .message-row.in .message.message-compact {
  background: #1b283b !important;
  color: #e7edf7 !important;
}

body.theme-dark #section-dialogs .message-row.out .message.message-compact {
  background: #4d79b5 !important;
  color: #f5f9ff !important;
}

body.theme-dark #section-dialogs .composer {
  background: #111b2c !important;
}

body.theme-dark #section-dialogs .composer-textarea-v2 {
  background: #18243a !important;
  border-color: rgba(148,163,184,0.20) !important;
  color: #ecf4ff !important;
}

body.theme-light #section-dialogs .dialogs-list-panel,
body.theme-light #section-dialogs .chat-panel,
body.theme-light #section-dialogs .dialogs-side-panel .accordion {
  background: #ffffff !important;
  border-color: #dde6f2 !important;
}

body.theme-light #section-dialogs .messages-list {
  background: #eef4fb !important;
}

body.theme-light #section-dialogs .dialog-compact-card {
  background: transparent !important;
}

body.theme-light #section-dialogs .dialog-compact-card:hover {
  background: #f1f6fc !important;
}

body.theme-light #section-dialogs .dialog-compact-card.active {
  background: #dbeafe !important;
  box-shadow: inset 3px 0 0 #4d8ff0 !important;
}

body.theme-light #section-dialogs .message-row.in .message.message-compact {
  background: #ffffff !important;
  color: #172033 !important;
}

body.theme-light #section-dialogs .message-row.out .message.message-compact {
  background: #d9ecff !important;
  color: #10213a !important;
}

body.theme-light #section-dialogs .composer {
  background: #ffffff !important;
}

body.theme-light #section-dialogs .composer-textarea-v2 {
  background: #f6f9fd !important;
  border-color: #d8e3f0 !important;
  color: #172033 !important;
}

@media (max-width: 1180px) {
  #section-dialogs .message.message-compact,
  #section-dialogs .message-row.out .message.message-compact {
    max-width: 78% !important;
  }
}

@media (max-width: 760px) {
  #section-dialogs .messages-list {
    padding: 14px 12px !important;
  }

  #section-dialogs .message.message-compact,
  #section-dialogs .message-row.out .message.message-compact {
    max-width: 88% !important;
  }
}

/* =========================================================
   EVA-INSPIRED VISUAL LAYER · 2026-05-30
   Backup before this layer:
   backups/ui-eva-style-20260530-0147/
   ========================================================= */

:root {
  --eva-bg: #090a0d;
  --eva-bg-2: #0d1017;
  --eva-bg-3: #11131a;
  --eva-panel: rgba(22, 23, 29, 0.88);
  --eva-panel-solid: #15161c;
  --eva-panel-soft: rgba(255, 255, 255, 0.045);
  --eva-panel-softer: rgba(255, 255, 255, 0.026);
  --eva-border: rgba(255, 255, 255, 0.105);
  --eva-border-strong: rgba(170, 112, 255, 0.34);
  --eva-text: #f2f2f5;
  --eva-text-soft: #d4d4dc;
  --eva-muted: #85858f;
  --eva-muted-2: #666772;
  --eva-purple: #8b5cf6;
  --eva-purple-2: #6d5dfc;
  --eva-purple-3: #a970ff;
  --eva-green: #35d07f;
  --eva-danger: #ff6b7a;
  --eva-warning: #f7bd50;
  --eva-radius: 16px;
  --eva-radius-sm: 11px;
  --eva-shadow: 0 18px 55px rgba(0, 0, 0, 0.34);
  --eva-font: Inter, "SF Pro Display", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

html,
body,
body.theme-dark,
body.theme-light {
  color-scheme: dark !important;
  background:
    radial-gradient(circle at 52% 0%, rgba(111, 69, 220, 0.23), transparent 36%),
    radial-gradient(circle at 33% 100%, rgba(21, 109, 87, 0.12), transparent 34%),
    linear-gradient(180deg, #0b0d13 0%, #090a0d 100%) !important;
  color: var(--eva-text) !important;
  font-family: var(--eva-font) !important;
  font-size: 14px !important;
  letter-spacing: 0 !important;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 24px 24px;
  opacity: 0.45;
}

.app-shell,
.main-shell,
.sidebar,
.topbar,
.section {
  position: relative;
  z-index: 1;
}

.app-shell {
  background: transparent !important;
}

.main-shell,
.section,
.section.active {
  background: transparent !important;
}

.sidebar {
  background: rgba(7, 8, 11, 0.88) !important;
  border-right: 1px solid rgba(255, 255, 255, 0.075) !important;
  box-shadow: 18px 0 50px rgba(0, 0, 0, 0.22) !important;
}

.sidebar-top {
  gap: 12px !important;
}

.brand-title {
  color: #ffffff !important;
  font-size: 27px !important;
  line-height: 1.02 !important;
  font-weight: 820 !important;
  letter-spacing: 0 !important;
}

.brand-title::first-letter {
  color: var(--eva-purple-3);
}

.brand-subtitle,
.topbar-right,
.muted,
.entity-meta,
.label {
  color: var(--eva-muted) !important;
}

.burger-btn,
.small-btn,
.nav-btn,
.primary-btn,
.status-btn,
button {
  letter-spacing: 0 !important;
}

.burger-btn {
  background: rgba(255, 255, 255, 0.045) !important;
  border: 1px solid var(--eva-border) !important;
  color: var(--eva-text-soft) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

.nav-btn {
  min-height: 56px !important;
  border-radius: 16px !important;
  background: rgba(255, 255, 255, 0.025) !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
  color: #d9d9df !important;
  font-weight: 720 !important;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
}

.nav-btn.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.34), rgba(96, 91, 255, 0.22)) !important;
  border-color: rgba(169, 112, 255, 0.62) !important;
  color: #ffffff !important;
  box-shadow: 0 0 0 1px rgba(169, 112, 255, 0.12) inset, 0 16px 42px rgba(104, 72, 210, 0.18) !important;
}

.topbar {
  height: 76px !important;
  background: rgba(12, 14, 20, 0.72) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(18px) saturate(125%) !important;
}

.topbar-title,
.panel-header h2,
.clients-panel-header h2,
.users-panel-header h2,
.templates-panel-header h2,
.orders-panel-header h2,
#chat-title {
  color: #f5f5f7 !important;
  font-weight: 820 !important;
  letter-spacing: 0 !important;
}

.topbar-title {
  font-size: 23px !important;
}

.status-dot {
  background: #65df8a !important;
  box-shadow: 0 0 15px rgba(101, 223, 138, 0.48) !important;
}

.section {
  padding: 18px !important;
}

.card,
.login-card,
.accordion,
.channel-connect-card,
.channel-studio-card,
.channel-help-card,
#section-clients .clients-list-card,
#section-clients .client-editor-card,
#section-users .users-list-card,
#section-users .user-editor-card,
#section-templates .templates-list-card,
#section-templates .template-editor-card,
#section-orders .orders-list-card,
#section-orders .order-editor-card,
#section-settings .card,
#section-calculator .card,
body.theme-dark #section-dialogs .dialogs-list-panel,
body.theme-dark #section-dialogs .chat-panel,
body.theme-dark #section-dialogs .dialogs-side-panel .accordion,
body.theme-light #section-dialogs .dialogs-list-panel,
body.theme-light #section-dialogs .chat-panel,
body.theme-light #section-dialogs .dialogs-side-panel .accordion {
  background: var(--eva-panel) !important;
  border: 1px solid var(--eva-border) !important;
  border-radius: 18px !important;
  box-shadow: var(--eva-shadow) !important;
  backdrop-filter: blur(18px) saturate(115%) !important;
}

.panel-header,
.clients-panel-header,
.users-panel-header,
.templates-panel-header,
.orders-panel-header,
.chat-panel .panel-header,
#section-dialogs .panel-header {
  min-height: 68px !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09) !important;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), transparent) !important;
  padding: 18px 20px !important;
}

.input,
.textarea,
select.input,
textarea,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
input[type="datetime-local"] {
  background: rgba(255, 255, 255, 0.045) !important;
  border: 1px solid rgba(255, 255, 255, 0.105) !important;
  color: var(--eva-text) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
  outline: none !important;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder {
  color: rgba(212, 212, 220, 0.44) !important;
}

.input:focus,
.textarea:focus,
select.input:focus,
textarea:focus,
input:focus {
  border-color: rgba(169, 112, 255, 0.76) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16) !important;
}

.primary-btn,
#channel-save,
#settings-save,
#calculator-save,
#client-save,
#user-save,
#template-save,
#order-save,
.composer-send,
.composer-send-v2 {
  background: linear-gradient(135deg, #7c62ff, #635cf6) !important;
  border: 1px solid rgba(190, 170, 255, 0.34) !important;
  color: #ffffff !important;
  border-radius: 14px !important;
  font-weight: 780 !important;
  box-shadow: 0 16px 42px rgba(99, 92, 246, 0.24) !important;
}

.primary-btn:hover,
#channel-save:hover,
#settings-save:hover,
#calculator-save:hover,
#client-save:hover,
#user-save:hover,
#template-save:hover,
#order-save:hover,
.composer-send:hover,
.composer-send-v2:hover {
  filter: brightness(1.07) !important;
  transform: translateY(-1px);
}

.small-btn,
.status-btn,
.quick-reply,
.quick-replies button,
.channel-studio-actions button,
.channel-help-actions button,
.order-quick-actions .small-btn,
.order-status-actions .status-btn {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: #e9e9ef !important;
  border-radius: 13px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

.small-btn:hover,
.status-btn:hover,
.quick-reply:hover,
.quick-replies button:hover {
  background: rgba(139, 92, 246, 0.16) !important;
  border-color: rgba(169, 112, 255, 0.34) !important;
}

.entity-item,
.client-list-item,
.user-list-item,
.template-list-item,
.order-list-item,
.channel-card,
#section-dialogs .dialog-compact-card,
body.theme-dark #section-dialogs .dialog-compact-card,
body.theme-light #section-dialogs .dialog-compact-card {
  background: rgba(255, 255, 255, 0.035) !important;
  border: 1px solid rgba(255, 255, 255, 0.085) !important;
  color: var(--eva-text) !important;
  border-radius: 15px !important;
  box-shadow: none !important;
}

.entity-item:hover,
.client-list-item:hover,
.user-list-item:hover,
.template-list-item:hover,
.order-list-item:hover,
#section-dialogs .dialog-compact-card:hover,
body.theme-dark #section-dialogs .dialog-compact-card:hover,
body.theme-light #section-dialogs .dialog-compact-card:hover {
  background: rgba(255, 255, 255, 0.065) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
}

.entity-item.active,
.client-list-item.active,
.user-list-item.active,
.template-list-item.active,
.order-list-item.active,
#section-dialogs .dialog-compact-card.active,
body.theme-dark #section-dialogs .dialog-compact-card.active,
body.theme-light #section-dialogs .dialog-compact-card.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(255, 255, 255, 0.055)) !important;
  border-color: rgba(169, 112, 255, 0.54) !important;
  box-shadow: 0 0 0 1px rgba(169,112,255,0.12) inset, 0 14px 32px rgba(0, 0, 0, 0.18) !important;
}

.entity-title,
.client-list-title,
.user-list-title,
.template-list-title,
.order-list-title,
.dialog-title-single-line {
  color: #f2f2f6 !important;
  font-weight: 780 !important;
}

.entity-subtitle,
.dialog-preview,
.client-list-phone,
.client-list-meta,
.user-list-login,
.user-list-meta,
.template-list-preview,
.template-list-meta,
.order-list-client,
.order-list-meta,
.dialog-compact-date {
  color: rgba(212, 212, 220, 0.66) !important;
}

.status-badge,
.dialog-dot,
.dialog-mini-badge,
.user-role-pill,
.template-category-pill,
.client-list-tag,
.order-list-status {
  border-radius: 999px !important;
  letter-spacing: 0 !important;
  font-weight: 760 !important;
}

.status-badge {
  background: rgba(255, 255, 255, 0.045) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #dedee6 !important;
}

.status-badge::before {
  box-shadow: 0 0 12px var(--badge-color);
}

#section-dialogs .dialogs-layout {
  gap: 14px !important;
}

#section-dialogs .dialogs-list-panel,
#section-dialogs .chat-panel,
#section-dialogs .dialogs-side-panel .accordion {
  overflow: hidden !important;
}

#section-dialogs .toolbar-row {
  padding: 14px !important;
  gap: 10px !important;
}

#section-dialogs .dialog-search-full,
#section-dialogs .dialog-filter-single {
  min-height: 46px !important;
}

#section-dialogs .entity-list,
#clients-list,
#users-list,
#templates-list,
#orders-list,
#channels-list {
  scrollbar-color: rgba(139, 92, 246, 0.45) rgba(255, 255, 255, 0.04);
}

#section-dialogs .messages-list,
body.theme-dark #section-dialogs .messages-list,
body.theme-light #section-dialogs .messages-list {
  background:
    radial-gradient(circle at 52% 0%, rgba(111, 69, 220, 0.18), transparent 38%),
    radial-gradient(circle at 28% 100%, rgba(21, 109, 87, 0.10), transparent 35%),
    rgba(8, 10, 16, 0.70) !important;
  background-image:
    radial-gradient(circle at 52% 0%, rgba(111, 69, 220, 0.18), transparent 38%),
    radial-gradient(circle at 28% 100%, rgba(21, 109, 87, 0.10), transparent 35%),
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) !important;
  background-size: auto, auto, 24px 24px !important;
}

#section-dialogs .message-row.in .message.message-compact,
body.theme-dark #section-dialogs .message-row.in .message.message-compact,
body.theme-light #section-dialogs .message-row.in .message.message-compact {
  background: rgba(255, 255, 255, 0.075) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #eeeeF3 !important;
}

#section-dialogs .message-row.out .message.message-compact,
body.theme-dark #section-dialogs .message-row.out .message.message-compact,
body.theme-light #section-dialogs .message-row.out .message.message-compact {
  background: linear-gradient(135deg, rgba(99, 92, 246, 0.92), rgba(78, 67, 174, 0.92)) !important;
  border: 1px solid rgba(190, 170, 255, 0.22) !important;
  color: #ffffff !important;
}

#section-dialogs .message-text {
  font-weight: 520 !important;
}

#section-dialogs .message-time,
#section-dialogs .msg-delivery-ticks {
  color: rgba(245, 245, 247, 0.66) !important;
}

.messages-list .message-attachment,
.messages-list .message-attachment-body,
.messages-list .message-attachment-body.only-file-name,
#section-dialogs .messages-list .message-attachment-name,
#section-dialogs .messages-list .message-attachments-download-all,
body.theme-dark .messages-list .message-attachment-name,
body.theme-light .messages-list .message-attachment-name {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: #f0f0f5 !important;
}

#section-dialogs .composer,
body.theme-dark #section-dialogs .composer,
body.theme-light #section-dialogs .composer {
  background: rgba(13, 15, 23, 0.94) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.10) !important;
}

#section-dialogs .composer-textarea-v2,
body.theme-dark #section-dialogs .composer-textarea-v2,
body.theme-light #section-dialogs .composer-textarea-v2 {
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(169, 112, 255, 0.28) !important;
  color: #f1f1f5 !important;
}

#section-dialogs .composer-icon-btn,
#section-dialogs .composer-side-btn {
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: rgba(235, 235, 242, 0.82) !important;
}

#section-dialogs .quick-replies button,
#section-dialogs .quick-reply {
  color: rgba(242, 242, 247, 0.88) !important;
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
}

.accordion-toggle,
.request-subaccordion-toggle {
  color: #efeff4 !important;
  background: transparent !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.accordion-body,
.request-subaccordion-body {
  color: var(--eva-text-soft) !important;
}

.client-brief-card,
.request-summary-card,
.template-side-item,
.mini-order-card,
.calculator-result,
.channel-help-card {
  background: rgba(255, 255, 255, 0.04) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
  color: var(--eva-text-soft) !important;
}

.channel-connect-dot,
.channel-studio-dot {
  background: var(--channel-accent, var(--channel-studio-accent, var(--eva-purple))) !important;
  box-shadow: 0 0 18px var(--channel-accent, var(--channel-studio-accent, var(--eva-purple))) !important;
}

.tgmtproto-qr-box {
  background:
    radial-gradient(circle at 50% 0%, rgba(139, 92, 246, 0.16), transparent 42%),
    rgba(255, 255, 255, 0.035) !important;
  border-color: rgba(169, 112, 255, 0.28) !important;
}

.login-card {
  max-width: 420px !important;
}

.login-card h2 {
  color: #ffffff !important;
}

.app-toast {
  background: rgba(18, 18, 24, 0.94) !important;
  border-color: rgba(169, 112, 255, 0.34) !important;
  color: #f3f3f6 !important;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.34) !important;
}

.app-toast-error {
  border-color: rgba(255, 107, 122, 0.62) !important;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.035);
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.38);
  border-radius: 999px;
  border: 2px solid rgba(8, 9, 12, 0.85);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(169, 112, 255, 0.58);
}

@media (max-width: 900px) {
  .section {
    padding: 12px !important;
  }

  .topbar {
    height: 66px !important;
  }

  .nav-btn {
    min-height: 50px !important;
  }
}

/* =========================================================
   EVA STYLE · ALIGNMENT PASS FOR ALL CRM SECTIONS
   Keeps the new dark visual language consistent everywhere.
   ========================================================= */

body.theme-light {
  --text-main: var(--eva-text) !important;
  --text-muted: var(--eva-muted) !important;
  --text-muted-2: var(--eva-muted) !important;
  --card-bg: var(--eva-panel) !important;
  --card-bg-soft: rgba(255, 255, 255, 0.04) !important;
  --card-border: var(--eva-border) !important;
  --composer-bg: rgba(13, 15, 23, 0.94) !important;
}

.section-layout,
.settings-layout,
.calculator-layout {
  width: 100% !important;
  max-width: none !important;
}

.section-layout {
  gap: 16px !important;
}

#section-clients .clients-layout,
#section-users .users-layout,
#section-templates .templates-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr) !important;
}

#section-orders .orders-layout {
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr) !important;
}

#section-channels .section-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr) !important;
}

#section-settings .settings-layout,
#section-calculator .calculator-layout {
  max-width: 1380px !important;
  margin: 0 auto !important;
}

#section-clients .clients-list-card,
#section-clients .client-editor-card,
#section-users .users-list-card,
#section-users .user-editor-card,
#section-templates .templates-list-card,
#section-templates .template-editor-card,
#section-orders .orders-list-card,
#section-orders .order-editor-card,
#section-channels .card,
#section-settings .settings-card,
#section-calculator .calculator-card {
  min-height: calc(100vh - 112px) !important;
  border-radius: 18px !important;
  overflow: hidden !important;
}

#section-clients .clients-panel-header,
#section-users .users-panel-header,
#section-templates .templates-panel-header,
#section-orders .orders-panel-header,
#section-settings .settings-panel-header,
#section-calculator .calculator-panel-header,
#section-channels .panel-header,
#section-dialogs .panel-header {
  min-height: 72px !important;
  padding: 16px 20px !important;
  align-items: center !important;
}

#section-clients .clients-panel-header h2,
#section-users .users-panel-header h2,
#section-templates .templates-panel-header h2,
#section-orders .orders-panel-header h2,
#section-settings .settings-panel-header h2,
#section-calculator .calculator-panel-header h2,
#section-calculator .calculator-test-header h2,
#section-channels .panel-header h2,
#section-dialogs .panel-header h2 {
  font-size: 19px !important;
  line-height: 1.18 !important;
  margin: 0 !important;
}

.settings-panel-subtitle,
.calculator-panel-subtitle,
.settings-field-hint,
.calculator-field-hint,
.channel-studio-help,
.channel-connect-text,
.channel-help-text,
.channel-help-meta {
  color: rgba(212, 212, 220, 0.62) !important;
  line-height: 1.42 !important;
}

#section-clients .clients-panel-header .header-actions,
#section-users .users-panel-header .header-actions,
#section-templates .templates-panel-header .header-actions,
#section-orders .orders-panel-header .header-actions,
#section-settings .settings-header-actions,
#section-calculator .calculator-header-actions,
#section-channels .panel-header {
  gap: 10px !important;
}

#section-clients #clients-new,
#section-clients #clients-refresh,
#section-users #users-new,
#section-users #users-refresh,
#section-templates #templates-new,
#section-templates #templates-refresh,
#section-orders #orders-new,
#section-orders #orders-refresh,
#section-calculator #calculator-test-btn,
#section-channels .panel-header .small-btn {
  min-height: 42px !important;
  border-radius: 13px !important;
}

#section-clients #client-save,
#section-users #user-save,
#section-templates #template-save,
#section-orders #order-save,
#section-settings #settings-save,
#section-calculator #calculator-save,
#section-channels #channel-save {
  min-height: 48px !important;
  min-width: 142px !important;
  border-radius: 15px !important;
}

#section-clients .clients-toolbar,
#section-users .users-toolbar,
#section-templates .templates-toolbar,
#section-orders .orders-toolbar {
  padding: 14px 14px 12px !important;
}

#section-clients #clients-search,
#section-users #users-search,
#section-templates #templates-search,
#section-orders #orders-search,
#section-orders #orders-status-filter,
#section-dialogs .dialog-search-full,
#section-dialogs .dialog-filter-single {
  min-height: 46px !important;
  border-radius: 14px !important;
}

#section-clients #clients-list,
#section-users #users-list,
#section-templates #templates-list,
#section-orders #orders-list,
#section-channels #channels-list {
  padding: 0 14px 16px !important;
  gap: 9px !important;
}

#section-clients .client-list-item,
#section-users .user-list-item,
#section-templates .template-list-item,
#section-orders .order-list-item,
#section-channels .channel-card {
  min-height: 70px !important;
  padding: 13px 15px !important;
  border-radius: 15px !important;
}

#section-clients .client-list-title,
#section-users .user-list-title,
#section-templates .template-list-title,
#section-orders .order-list-title,
#section-channels .channel-card .entity-title {
  font-size: 15px !important;
  line-height: 1.2 !important;
}

#section-clients .client-list-phone,
#section-users .user-list-login,
#section-templates .template-list-preview,
#section-orders .order-list-client,
#section-channels .channel-card .entity-subtitle {
  font-size: 12.5px !important;
  line-height: 1.32 !important;
}

#section-clients .client-list-meta,
#section-users .user-list-meta,
#section-templates .template-list-meta,
#section-orders .order-list-meta,
#section-channels .channel-card .entity-meta {
  color: rgba(212, 212, 220, 0.55) !important;
}

#section-clients .client-form-grid,
#section-users .user-form-grid,
#section-templates .template-form-grid,
#section-orders .order-form-grid,
#section-settings .settings-form-grid,
#section-calculator .calculator-form-grid,
#section-calculator .calculator-test-grid {
  gap: 16px 18px !important;
  padding: 22px !important;
}

#section-settings .settings-form-grid,
#section-calculator .calculator-form-grid,
#section-calculator .calculator-test-grid {
  grid-template-columns: repeat(2, minmax(240px, 1fr)) !important;
}

#section-calculator .calculator-field-small {
  max-width: none !important;
}

#section-clients .span-2,
#section-users .span-2,
#section-templates .span-2,
#section-orders .span-2,
#section-channels .span-2,
#section-settings .settings-field-wide,
#section-calculator .calculator-field-wide,
#section-calculator .calculator-result-wrap {
  grid-column: 1 / -1 !important;
}

#section-clients .client-field .label,
#section-users .user-field .label,
#section-templates .template-field .label,
#section-orders .order-field .label,
#section-settings .label,
#section-calculator .label,
#section-channels .label,
.channel-connect-label,
.channel-studio-label {
  color: rgba(212, 212, 220, 0.68) !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
  font-weight: 820 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
}

#section-clients .client-field .input,
#section-clients .client-field .textarea,
#section-users .user-field .input,
#section-templates .template-field .input,
#section-templates .template-field .textarea,
#section-orders .order-field .input,
#section-orders .order-field .textarea,
#section-settings .input,
#section-settings .textarea,
#section-calculator .input,
#section-calculator .textarea,
#section-channels .input,
#section-channels .textarea,
.channel-qf-input,
.channel-studio-input {
  min-height: 46px !important;
  border-radius: 14px !important;
  padding: 11px 13px !important;
  font-size: 14px !important;
  line-height: 1.34 !important;
}

#section-clients #client-notes,
#section-orders #order-notes {
  min-height: 170px !important;
}

#section-templates #template-body,
#section-settings #settings-quick-replies,
#section-calculator #calculator-template,
#section-channels #channel-config {
  min-height: 260px !important;
  font-family: var(--eva-font) !important;
}

#section-channels #channel-config {
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace !important;
  font-size: 12.5px !important;
}

#section-channels #channel-logs,
#section-channels .preview-box,
#section-calculator .calculator-result-box {
  background: rgba(255, 255, 255, 0.04) !important;
  border: 1px solid rgba(255, 255, 255, 0.10) !important;
  color: rgba(242, 242, 247, 0.86) !important;
  border-radius: 15px !important;
}

#section-channels #channel-logs {
  min-height: 180px !important;
  padding: 14px !important;
  overflow: auto !important;
}

#section-channels .channel-studio-card,
#section-channels .channel-connect-card,
#section-channels .channel-help-card {
  border-radius: 17px !important;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--channel-studio-accent, var(--channel-accent, var(--eva-purple))) 14%, transparent), transparent 34%),
    rgba(255,255,255,0.04) !important;
}

#section-channels .channel-studio-head,
#section-channels .channel-connect-head {
  align-items: center !important;
  gap: 12px !important;
}

#section-channels .channel-studio-title,
#section-channels .channel-connect-title,
#section-channels .channel-help-title {
  color: #f4f4f7 !important;
  font-size: 17px !important;
  font-weight: 820 !important;
}

#section-channels .channel-studio-grid,
#section-channels .channel-connect-grid {
  gap: 14px !important;
}

#section-channels .channel-studio-actions,
#section-channels .channel-help-actions,
#section-channels .tgmtproto-qr-actions {
  gap: 10px !important;
  flex-wrap: wrap !important;
}

#section-channels .channel-studio-actions .small-btn,
#section-channels .channel-help-actions .small-btn,
#section-channels .tgmtproto-qr-actions .small-btn {
  min-height: 40px !important;
}

#section-settings .settings-card,
#section-calculator .calculator-card {
  overflow: hidden !important;
}

#section-settings .settings-status,
#section-calculator .calculator-status,
#section-clients #client-status,
#section-users #user-status,
#section-templates #template-status,
#section-orders #order-status,
#section-channels #channel-status {
  color: rgba(212, 212, 220, 0.62) !important;
  font-size: 12.5px !important;
}

.client-list-tag,
.user-role-pill,
.template-category-pill,
.order-list-status {
  background: rgba(139, 92, 246, 0.14) !important;
  border: 1px solid rgba(169, 112, 255, 0.28) !important;
  color: #d9ccff !important;
}

.user-role-pill.is-admin {
  background: rgba(53, 208, 127, 0.13) !important;
  border-color: rgba(53, 208, 127, 0.28) !important;
  color: #b7f4d0 !important;
}

#section-dialogs .dialogs-layout {
  gap: 14px !important;
}

#section-dialogs .dialogs-list-panel,
#section-dialogs .chat-panel,
#section-dialogs .dialogs-side-panel .accordion,
body.theme-dark #section-dialogs .dialogs-list-panel,
body.theme-dark #section-dialogs .chat-panel,
body.theme-dark #section-dialogs .dialogs-side-panel .accordion,
body.theme-light #section-dialogs .dialogs-list-panel,
body.theme-light #section-dialogs .chat-panel,
body.theme-light #section-dialogs .dialogs-side-panel .accordion {
  background: var(--eva-panel) !important;
  border-color: var(--eva-border) !important;
}

#section-dialogs .messages-list,
body.theme-dark #section-dialogs .messages-list,
body.theme-light #section-dialogs .messages-list {
  background:
    radial-gradient(circle at 52% 0%, rgba(111, 69, 220, 0.18), transparent 38%),
    radial-gradient(circle at 28% 100%, rgba(21, 109, 87, 0.10), transparent 35%),
    radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    rgba(8, 10, 16, 0.70) !important;
  background-size: auto, auto, 24px 24px, auto !important;
}

#section-dialogs .dialog-compact-card.active,
body.theme-dark #section-dialogs .dialog-compact-card.active,
body.theme-light #section-dialogs .dialog-compact-card.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(255, 255, 255, 0.055)) !important;
  border-color: rgba(169, 112, 255, 0.54) !important;
  box-shadow: 0 0 0 1px rgba(169,112,255,0.12) inset !important;
}

#section-dialogs .message-row.out .message.message-compact,
body.theme-dark #section-dialogs .message-row.out .message.message-compact,
body.theme-light #section-dialogs .message-row.out .message.message-compact {
  background: linear-gradient(135deg, rgba(99, 92, 246, 0.92), rgba(78, 67, 174, 0.92)) !important;
  color: #ffffff !important;
}

#section-dialogs .message-row.in .message.message-compact,
body.theme-dark #section-dialogs .message-row.in .message.message-compact,
body.theme-light #section-dialogs .message-row.in .message.message-compact {
  background: rgba(255, 255, 255, 0.075) !important;
  color: #eeeef3 !important;
}

option {
  background: #15161c !important;
  color: #f2f2f5 !important;
}

@media (max-width: 1180px) {
  #section-clients .clients-layout,
  #section-users .users-layout,
  #section-templates .templates-layout,
  #section-orders .orders-layout,
  #section-channels .section-layout {
    grid-template-columns: 1fr !important;
  }

  #section-clients .clients-list-card,
  #section-clients .client-editor-card,
  #section-users .users-list-card,
  #section-users .user-editor-card,
  #section-templates .templates-list-card,
  #section-templates .template-editor-card,
  #section-orders .orders-list-card,
  #section-orders .order-editor-card,
  #section-channels .card {
    min-height: auto !important;
  }
}

@media (max-width: 760px) {
  #section-clients .client-form-grid,
  #section-users .user-form-grid,
  #section-templates .template-form-grid,
  #section-orders .order-form-grid,
  #section-settings .settings-form-grid,
  #section-calculator .calculator-form-grid,
  #section-calculator .calculator-test-grid {
    grid-template-columns: 1fr !important;
    padding: 16px !important;
  }

  #section-clients .clients-panel-header,
  #section-users .users-panel-header,
  #section-templates .templates-panel-header,
  #section-orders .orders-panel-header,
  #section-settings .settings-panel-header,
  #section-calculator .calculator-panel-header,
  #section-channels .panel-header {
    align-items: stretch !important;
    flex-direction: column !important;
  }
}

/* =========================================================
   EVA STYLE · FORM CELL NORMALIZATION
   A stricter pass for fields/graphs across every page.
   ========================================================= */

.section .label,
.section label,
.channel-connect-label,
.channel-studio-label {
  letter-spacing: 0.045em !important;
}

#section-clients .client-field,
#section-users .user-field,
#section-templates .template-field,
#section-orders .order-field,
#section-settings .settings-field,
#section-calculator .calculator-field,
#section-calculator .calculator-result-wrap,
#section-channels .form-group,
#section-channels .span-2 > .label,
#section-channels .channel-connect-field,
#section-channels .channel-studio-field {
  min-width: 0 !important;
}

#section-clients .client-field,
#section-users .user-field,
#section-templates .template-field,
#section-orders .order-field,
#section-settings .settings-field,
#section-calculator .calculator-field,
#section-channels .form-group {
  display: flex !important;
  flex-direction: column !important;
  gap: 7px !important;
}

#section-channels .span-2 > .label {
  display: block !important;
  margin: 0 0 8px !important;
}

#section-clients .client-form-grid,
#section-users .user-form-grid,
#section-templates .template-form-grid,
#section-orders .order-form-grid,
#section-settings .settings-form-grid,
#section-calculator .calculator-form-grid,
#section-calculator .calculator-test-grid {
  align-items: start !important;
}

.input,
.textarea,
select.input,
.preview-box,
.large-textarea,
#section-channels #channel-logs,
#section-calculator .calculator-result-box {
  width: 100% !important;
}

.input,
select.input {
  height: 46px !important;
}

textarea.textarea,
.large-textarea {
  display: block !important;
}

.input,
.textarea,
select.input,
.preview-box,
.large-textarea,
#section-calculator .calculator-result-box,
#section-channels #channel-logs {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0.034)) !important;
  border: 1px solid rgba(255,255,255,0.115) !important;
  color: #f1f1f5 !important;
  border-radius: 14px !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.025) !important;
}

.input:hover,
.textarea:hover,
select.input:hover,
.preview-box:hover,
.large-textarea:hover {
  border-color: rgba(255,255,255,0.18) !important;
}

.input:focus,
.textarea:focus,
select.input:focus,
.large-textarea:focus {
  background: rgba(255,255,255,0.062) !important;
  border-color: rgba(169,112,255,0.72) !important;
  box-shadow:
    0 0 0 3px rgba(139,92,246,0.15),
    inset 0 1px 0 rgba(255,255,255,0.03) !important;
}

input[readonly],
#client-id,
#user-id,
#template-id,
#order-id,
#channel-id,
#channel-code,
#channel-status-input {
  background: rgba(255,255,255,0.026) !important;
  color: rgba(212,212,220,0.58) !important;
  border-color: rgba(255,255,255,0.075) !important;
}

select.input {
  appearance: auto !important;
}

#section-clients #client-status,
#section-users #user-status,
#section-templates #template-status,
#section-orders #order-status,
#section-settings .settings-status,
#section-calculator .calculator-status,
#section-channels #channel-status {
  min-height: 22px !important;
  margin-top: 10px !important;
  color: rgba(212,212,220,0.62) !important;
}

#section-clients #client-status,
#section-users #user-status,
#section-templates #template-status,
#section-orders #order-status {
  margin-left: 22px !important;
  margin-right: 22px !important;
}

#section-settings .settings-field-hint,
#section-calculator .calculator-field-hint {
  margin: 0 0 2px !important;
  font-size: 12.5px !important;
}

#section-calculator .calculator-test-panel {
  border-top: 1px solid rgba(255,255,255,0.085) !important;
  background: rgba(0,0,0,0.08) !important;
}

#section-calculator .calculator-test-header {
  padding: 20px 22px 0 !important;
}

#section-calculator .calculator-result-box {
  min-height: 116px !important;
  padding: 16px !important;
  white-space: pre-wrap !important;
}

#section-settings #settings-quick-replies,
#section-calculator #calculator-template,
#section-templates #template-body,
#section-channels #channel-config {
  line-height: 1.48 !important;
}

#section-channels .channel-studio-card,
#section-channels .channel-connect-card {
  padding: 20px !important;
}

#section-channels .channel-studio-grid,
#section-channels .channel-connect-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(220px, 1fr)) !important;
}

#section-channels .channel-studio-field-span,
#section-channels .channel-connect-field-span {
  grid-column: 1 / -1 !important;
}

#section-channels .channel-studio-advanced,
#section-channels .channel-connect-advanced {
  margin-top: 16px !important;
  padding-top: 14px !important;
  border-top: 1px solid rgba(255,255,255,0.085) !important;
}

#section-channels .channel-studio-advanced summary,
#section-channels .channel-connect-advanced summary {
  color: rgba(242,242,247,0.86) !important;
  font-weight: 780 !important;
  cursor: pointer !important;
}

#section-channels .channel-studio-actions,
#section-channels .channel-help-actions {
  margin-top: 18px !important;
}

#section-channels .channel-help-card {
  padding: 16px !important;
  margin-bottom: 12px !important;
}

#section-channels #channel-logs pre {
  margin: 0 !important;
  color: rgba(242,242,247,0.82) !important;
  white-space: pre-wrap !important;
  font-family: "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace !important;
  font-size: 12px !important;
}

.entity-item,
.client-list-item,
.user-list-item,
.template-list-item,
.order-list-item,
.channel-card {
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease !important;
}

.entity-item:hover,
.client-list-item:hover,
.user-list-item:hover,
.template-list-item:hover,
.order-list-item:hover,
.channel-card:hover {
  transform: translateY(-1px) !important;
}

#section-dialogs .dialog-compact-card:hover {
  transform: none !important;
}

.status-badge,
.client-list-tag,
.user-role-pill,
.template-category-pill,
.order-list-status,
.dialog-dot {
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04) !important;
}

.app-shell.sidebar-collapsed .nav-btn {
  text-align: center !important;
}

@media (max-width: 760px) {
  #section-clients #client-status,
  #section-users #user-status,
  #section-templates #template-status,
  #section-orders #order-status {
    margin-left: 16px !important;
    margin-right: 16px !important;
  }

  #section-channels .channel-studio-grid,
  #section-channels .channel-connect-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ---------------------------------------------------------
   EVA STYLE · SINGLE SYSTEM PASS
   One final source of visual truth for all sections.
   --------------------------------------------------------- */
:root,
body.theme-dark,
body.theme-light {
  --eva-bg-0: #08090d !important;
  --eva-bg-1: #0c0d13 !important;
  --eva-bg-2: #11131b !important;
  --eva-panel: rgba(21, 22, 31, 0.84) !important;
  --eva-panel-2: rgba(255, 255, 255, 0.045) !important;
  --eva-panel-3: rgba(255, 255, 255, 0.072) !important;
  --eva-border: rgba(255, 255, 255, 0.105) !important;
  --eva-border-2: rgba(169, 112, 255, 0.34) !important;
  --eva-text: #f3f3f7 !important;
  --eva-text-soft: rgba(243, 243, 247, 0.82) !important;
  --eva-muted: rgba(212, 212, 220, 0.58) !important;
  --eva-muted-2: rgba(212, 212, 220, 0.42) !important;
  --eva-purple: #8b5cf6 !important;
  --eva-purple-2: #665cff !important;
  --eva-purple-3: #a970ff !important;
  --eva-blue: #6f7dff !important;
  --eva-green: #65df8a !important;
  --eva-warn: #f2b84b !important;
  --eva-red: #ff6d7a !important;
  --eva-shadow: 0 24px 70px rgba(0, 0, 0, 0.34) !important;
  --text: var(--eva-text) !important;
  --muted: var(--eva-muted) !important;
  --text-main: var(--eva-text) !important;
  --text-muted-2: var(--eva-muted) !important;
  --page-bg: var(--eva-bg-0) !important;
  --page-bg-2: var(--eva-bg-1) !important;
  --shell-top: rgba(12, 14, 20, 0.78) !important;
  --card-bg: var(--eva-panel) !important;
  --card-bg-soft: var(--eva-panel-2) !important;
  --card-border: var(--eva-border) !important;
  --composer-bg: rgba(13, 15, 23, 0.94) !important;
  --message-in: rgba(255, 255, 255, 0.075) !important;
  --message-out: rgba(99, 92, 246, 0.92) !important;
  --primary: var(--eva-purple-2) !important;
  --border: var(--eva-border) !important;
}

html,
body,
body.theme-dark,
body.theme-light {
  color-scheme: dark !important;
  color: var(--eva-text) !important;
  background:
    radial-gradient(circle at 56% -12%, rgba(105, 76, 255, 0.22), transparent 38%),
    radial-gradient(circle at 8% 100%, rgba(23, 108, 87, 0.13), transparent 34%),
    linear-gradient(180deg, var(--eva-bg-1), var(--eva-bg-0)) !important;
}

body::before {
  background-image: radial-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px) !important;
  background-size: 24px 24px !important;
  opacity: 1 !important;
}

.app-shell,
.main-shell,
.section,
.section.active,
.section-body,
.dialogs-layout {
  background: transparent !important;
  color: var(--eva-text) !important;
}

.topbar,
.sidebar {
  background: rgba(9, 10, 15, 0.86) !important;
  border-color: var(--eva-border) !important;
}

.card,
.accordion,
.dialog-compact-card,
.chat-panel,
.dialogs-list-panel,
.dialogs-side-panel .accordion,
.settings-card,
.calculator-card,
.calculator-test-panel,
.clients-list-card,
.client-editor-card,
.users-list-card,
.user-editor-card,
.templates-list-card,
.template-editor-card,
.orders-list-card,
.order-editor-card,
.channel-card,
.channel-connect-card,
.channel-studio-card,
.channel-help-card,
.login-card,
.modal,
.mini-item,
.request-summary-card,
.client-brief-card,
.template-side-item,
.mini-order-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.046), rgba(255,255,255,0.026)),
    var(--eva-panel) !important;
  border: 1px solid var(--eva-border) !important;
  color: var(--eva-text) !important;
  border-radius: 18px !important;
  box-shadow: var(--eva-shadow) !important;
}

.panel-header,
.clients-panel-header,
.users-panel-header,
.templates-panel-header,
.orders-panel-header,
.settings-panel-header,
.calculator-panel-header,
.calculator-test-header,
.channel-studio-head,
.channel-connect-head,
.accordion-toggle,
.request-subaccordion-toggle {
  background: linear-gradient(180deg, rgba(255,255,255,0.036), rgba(255,255,255,0)) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
}

.topbar-title,
.brand-title,
.panel-header h2,
.clients-panel-header h2,
.users-panel-header h2,
.templates-panel-header h2,
.orders-panel-header h2,
.settings-panel-header h2,
.calculator-panel-header h2,
.calculator-test-header h2,
.channel-connect-title,
.channel-studio-title,
.channel-help-title,
.accordion-title,
.entity-title,
.dialog-title-single-line,
.client-list-title,
.user-list-title,
.template-list-title,
.order-list-title,
label,
.label {
  color: var(--eva-text) !important;
  letter-spacing: 0 !important;
}

.brand-subtitle,
.topbar-right,
.muted,
.entity-subtitle,
.entity-meta,
.dialog-preview,
.dialog-compact-date,
.client-list-phone,
.client-list-meta,
.user-list-login,
.user-list-meta,
.template-list-preview,
.template-list-meta,
.order-list-client,
.order-list-meta,
.settings-panel-subtitle,
.settings-field-hint,
.calculator-panel-subtitle,
.calculator-field-hint,
.channel-connect-text,
.channel-studio-help,
.channel-help-text,
.channel-help-meta,
.accordion-body,
.request-subaccordion-body,
.empty-state {
  color: var(--eva-muted) !important;
}

.input,
.textarea,
select.input,
textarea,
input,
select,
.preview-box,
.large-textarea,
.calculator-result-box,
#channel-logs,
#channel-logs pre {
  background: rgba(255, 255, 255, 0.048) !important;
  border: 1px solid var(--eva-border) !important;
  color: var(--eva-text) !important;
  border-radius: 14px !important;
  box-shadow: none !important;
}

.input::placeholder,
.textarea::placeholder,
textarea::placeholder,
input::placeholder {
  color: var(--eva-muted-2) !important;
}

.input:focus,
.textarea:focus,
select.input:focus,
textarea:focus,
input:focus,
select:focus {
  border-color: rgba(169, 112, 255, 0.76) !important;
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.16) !important;
}

input[readonly],
#client-id,
#user-id,
#template-id,
#order-id,
#channel-id,
#channel-code,
#channel-status-input {
  background: rgba(255, 255, 255, 0.026) !important;
  color: var(--eva-muted) !important;
  border-color: rgba(255, 255, 255, 0.075) !important;
}

.primary-btn,
#client-save,
#user-save,
#template-save,
#order-save,
#settings-save,
#calculator-save,
#channel-save,
.composer-send,
.composer-send-v2 {
  background: linear-gradient(135deg, var(--eva-purple-3), var(--eva-purple-2)) !important;
  border: 1px solid rgba(205, 190, 255, 0.34) !important;
  color: #ffffff !important;
  box-shadow: 0 16px 42px rgba(99, 92, 246, 0.24) !important;
}

.small-btn,
.status-btn,
.quick-reply,
.quick-replies button,
.composer-icon-btn,
.composer-side-btn,
.order-quick-actions .small-btn,
.order-status-actions .status-btn,
.channel-studio-actions button,
.channel-help-actions button,
.tgmtproto-qr-actions .small-btn {
  background: rgba(255, 255, 255, 0.052) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  color: var(--eva-text-soft) !important;
  box-shadow: none !important;
}

.small-btn:hover,
.status-btn:hover,
.quick-reply:hover,
.quick-replies button:hover,
.composer-icon-btn:hover,
.composer-side-btn:hover {
  background: rgba(139, 92, 246, 0.16) !important;
  border-color: rgba(169, 112, 255, 0.36) !important;
  color: #ffffff !important;
}

.nav-btn.active,
.entity-item.active,
.dialog-compact-card.active,
.client-list-item.active,
.user-list-item.active,
.template-list-item.active,
.order-list-item.active,
.channel-card.active,
.channel-card.selected,
.channel-connect-card.is-active,
.channel-studio-card.is-active {
  background:
    linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(255, 255, 255, 0.055)),
    var(--eva-panel) !important;
  border-color: rgba(169, 112, 255, 0.56) !important;
  color: #ffffff !important;
}

#section-channels .channel-card,
#section-channels .channel-connect-card,
#section-channels .channel-studio-card {
  --channel-accent: var(--eva-purple-3) !important;
  --channel-studio-accent: var(--eva-purple-3) !important;
  border-color: var(--eva-border) !important;
}

#section-channels .channel-card.active,
#section-channels .channel-card.selected,
#section-channels .channel-connect-card.is-active,
#section-channels .channel-studio-card.is-active {
  border-color: rgba(169, 112, 255, 0.58) !important;
}

.channel-connect-dot,
.channel-studio-dot,
.dialog-source-dot,
.status-dot {
  background: var(--eva-purple-3) !important;
  box-shadow: 0 0 16px rgba(169, 112, 255, 0.46) !important;
}

.status-dot {
  background: var(--eva-green) !important;
  box-shadow: 0 0 14px rgba(101, 223, 138, 0.44) !important;
}

.status-badge,
.source-badge,
.dialog-dot,
.dialog-mini-badge,
.client-list-tag,
.user-role-pill,
.template-category-pill,
.order-list-status {
  background: color-mix(in srgb, var(--badge-color, var(--eva-purple-3)) 18%, transparent) !important;
  border: 1px solid color-mix(in srgb, var(--badge-color, var(--eva-purple-3)) 48%, transparent) !important;
  color: color-mix(in srgb, var(--badge-color, var(--eva-purple-3)) 72%, #ffffff) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
}

#section-settings .settings-card,
#section-calculator .calculator-card,
#section-channels .card,
#section-channels .channel-help-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.046), rgba(255,255,255,0.026)),
    var(--eva-panel) !important;
  border-color: var(--eva-border) !important;
}

#section-settings .settings-form-grid,
#section-calculator .calculator-form-grid,
#section-calculator .calculator-test-grid,
#section-channels .channel-connect-grid,
#section-channels .channel-studio-grid,
#section-clients .client-form-grid,
#section-users .user-form-grid,
#section-templates .template-form-grid,
#section-orders .order-form-grid {
  gap: 16px !important;
}

#section-settings .settings-field,
#section-calculator .calculator-field,
#section-channels .form-group,
#section-channels .channel-connect-field,
#section-channels .channel-studio-field,
#section-clients .client-field,
#section-users .user-field,
#section-templates .template-field,
#section-orders .order-field {
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
}

#section-dialogs .messages-list,
#section-dialogs .composer {
  border-color: var(--eva-border) !important;
}

#section-dialogs .message-row.in .message.message-compact {
  background: rgba(255, 255, 255, 0.078) !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
}

#section-dialogs .message-row.out .message.message-compact {
  background: linear-gradient(135deg, rgba(105, 96, 246, 0.95), rgba(84, 68, 184, 0.95)) !important;
  border-color: rgba(205, 190, 255, 0.22) !important;
}

.messages-list .message-attachment,
.messages-list .message-attachment-body,
.messages-list .message-attachment-body.only-file-name,
#section-dialogs .messages-list .message-attachment-name,
#section-dialogs .messages-list .messages-attachments-download-all {
  background: rgba(255, 255, 255, 0.082) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: var(--eva-text) !important;
}

.toast,
.app-toast {
  background: rgba(21, 22, 31, 0.96) !important;
  border: 1px solid var(--eva-border) !important;
  color: var(--eva-text) !important;
}

.toast.error,
.app-toast.error {
  background: rgba(76, 24, 35, 0.96) !important;
  border-color: rgba(255, 109, 122, 0.48) !important;
}

/* Strong overrides for older theme-specific admin sections. */
body.theme-dark #section-clients .clients-list-card,
body.theme-dark #section-clients .client-editor-card,
body.theme-dark #section-users .users-list-card,
body.theme-dark #section-users .user-editor-card,
body.theme-dark #section-templates .templates-list-card,
body.theme-dark #section-templates .template-editor-card,
body.theme-dark #section-orders .orders-list-card,
body.theme-dark #section-orders .order-editor-card,
body.theme-light #section-clients .clients-list-card,
body.theme-light #section-clients .client-editor-card,
body.theme-light #section-users .users-list-card,
body.theme-light #section-users .user-editor-card,
body.theme-light #section-templates .templates-list-card,
body.theme-light #section-templates .template-editor-card,
body.theme-light #section-orders .orders-list-card,
body.theme-light #section-orders .order-editor-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.046), rgba(255,255,255,0.026)),
    var(--eva-panel) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
}

body.theme-dark #section-clients .client-field .input,
body.theme-dark #section-clients .client-field .textarea,
body.theme-dark #section-users .user-field .input,
body.theme-dark #section-templates .template-field .input,
body.theme-dark #section-templates .template-field .textarea,
body.theme-dark #section-orders .order-field .input,
body.theme-dark #section-orders .order-field .textarea,
body.theme-dark #section-settings .input,
body.theme-dark #section-settings .textarea,
body.theme-dark #section-calculator .input,
body.theme-dark #section-calculator .textarea,
body.theme-dark #section-channels .input,
body.theme-dark #section-channels .textarea,
body.theme-light #section-clients .client-field .input,
body.theme-light #section-clients .client-field .textarea,
body.theme-light #section-users .user-field .input,
body.theme-light #section-templates .template-field .input,
body.theme-light #section-templates .template-field .textarea,
body.theme-light #section-orders .order-field .input,
body.theme-light #section-orders .order-field .textarea,
body.theme-light #section-settings .input,
body.theme-light #section-settings .textarea,
body.theme-light #section-calculator .input,
body.theme-light #section-calculator .textarea,
body.theme-light #section-channels .input,
body.theme-light #section-channels .textarea {
  background: rgba(255, 255, 255, 0.048) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
}

body.theme-dark #section-clients #client-id,
body.theme-dark #section-users #user-id,
body.theme-dark #section-templates #template-id,
body.theme-dark #section-orders #order-id,
body.theme-dark #section-channels #channel-id,
body.theme-dark #section-channels #channel-code,
body.theme-dark #section-channels #channel-status-input,
body.theme-light #section-clients #client-id,
body.theme-light #section-users #user-id,
body.theme-light #section-templates #template-id,
body.theme-light #section-orders #order-id,
body.theme-light #section-channels #channel-id,
body.theme-light #section-channels #channel-code,
body.theme-light #section-channels #channel-status-input {
  background: rgba(255, 255, 255, 0.026) !important;
  border-color: rgba(255, 255, 255, 0.075) !important;
  color: var(--eva-muted) !important;
}

body.theme-dark #section-clients .input,
body.theme-dark #section-clients .textarea,
body.theme-dark #section-users .input,
body.theme-dark #section-users .textarea,
body.theme-dark #section-templates .input,
body.theme-dark #section-templates .textarea,
body.theme-dark #section-orders .input,
body.theme-dark #section-orders .textarea,
body.theme-light #section-clients .input,
body.theme-light #section-clients .textarea,
body.theme-light #section-users .input,
body.theme-light #section-users .textarea,
body.theme-light #section-templates .input,
body.theme-light #section-templates .textarea,
body.theme-light #section-orders .input,
body.theme-light #section-orders .textarea {
  background: rgba(255, 255, 255, 0.048) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
}

/* ===== dialogs workspace geometry: more room for reading ===== */
.topbar {
  min-height: 54px !important;
  height: 54px !important;
  padding: 0 20px !important;
}

.topbar-title {
  font-size: 20px !important;
  line-height: 1.05 !important;
}

.topbar-right {
  font-size: 12px !important;
}

#section-dialogs.section {
  padding: 10px 14px 8px !important;
  min-height: calc(100vh - 54px) !important;
}

#section-dialogs .dialogs-layout {
  grid-template-columns: minmax(300px, 340px) minmax(520px, 1fr) minmax(190px, var(--dialogs-side-width, 260px)) !important;
  gap: 10px !important;
  min-height: calc(100vh - 74px) !important;
}

#section-dialogs .chat-panel,
#section-dialogs .dialogs-list-panel {
  min-width: 0 !important;
}

#section-dialogs .dialogs-side-panel {
  min-width: 0 !important;
  width: 100% !important;
  max-width: 360px !important;
  position: relative !important;
}

#section-dialogs .dialogs-side-panel::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 0;
  width: 10px;
  height: 100%;
  cursor: col-resize;
  z-index: 4;
}

#section-dialogs .dialogs-side-panel.is-resize-ready,
#section-dialogs .dialogs-side-panel.is-resizing {
  cursor: col-resize !important;
}

#section-dialogs .dialogs-side-panel .accordion {
  border-radius: 14px !important;
}

#section-dialogs .dialogs-side-panel .accordion-toggle {
  min-height: 36px !important;
  padding: 8px 12px !important;
  font-size: 12.5px !important;
}

#section-dialogs .dialogs-side-panel .accordion-body {
  padding: 8px 10px 10px !important;
}

#section-dialogs .dialogs-side-panel .accordion + .accordion {
  margin-top: 8px !important;
}

#section-dialogs .dialogs-side-panel .input,
#section-dialogs .dialogs-side-panel .textarea,
#section-dialogs .dialogs-side-panel select.input {
  min-height: 34px !important;
  padding: 7px 9px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

#section-dialogs .dialogs-side-panel .small-btn,
#section-dialogs .dialogs-side-panel .secondary-btn,
#section-dialogs .dialogs-side-panel .status-btn {
  min-height: 32px !important;
  padding: 7px 9px !important;
  font-size: 12px !important;
  border-radius: 10px !important;
}

#section-dialogs .messages-list {
  padding: 12px 18px !important;
}

#section-dialogs .message.message-compact {
  max-width: min(680px, 76%) !important;
}

#section-dialogs .message-row.out .message.message-compact {
  max-width: min(720px, 72%) !important;
}

#section-dialogs .composer {
  padding: 8px 14px 8px !important;
}

#section-dialogs .composer-file-row,
#section-dialogs #composer-upload-list,
#section-dialogs #composer-upload-progress,
#section-dialogs #composer-status {
  margin: 0 !important;
  min-height: 0 !important;
}

#section-dialogs .composer-file-row:empty,
#section-dialogs #composer-upload-list:empty,
#section-dialogs #composer-upload-progress:empty,
#section-dialogs #composer-status:empty {
  display: none !important;
}

#section-dialogs .composer-layout-v2 {
  grid-template-columns: 82px minmax(0, 1fr) 88px !important;
  gap: 8px !important;
  align-items: center !important;
}

#section-dialogs .composer-side {
  flex-direction: row !important;
  gap: 6px !important;
  align-items: center !important;
  justify-content: center !important;
}

#section-dialogs .composer-side-btn,
#section-dialogs .composer-icon-btn.composer-side-btn {
  width: 38px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 11px !important;
}

#section-dialogs .composer-textarea-v2 {
  min-height: 42px !important;
  max-height: 84px !important;
  padding: 10px 13px !important;
  border-radius: 14px !important;
  font-size: 14px !important;
}

#section-dialogs .composer-send-v2,
#section-dialogs #composer-send.composer-send-v2 {
  width: 40px !important;
  height: 38px !important;
  min-height: 38px !important;
  border-radius: 14px !important;
  font-size: 19px !important;
}

#section-dialogs .quick-replies {
  margin-top: 6px !important;
  gap: 5px !important;
  max-height: 32px !important;
  overflow: hidden !important;
}

#section-dialogs .quick-reply,
#section-dialogs .quick-replies button {
  min-height: 24px !important;
  padding: 4px 9px !important;
  font-size: 11px !important;
  border-radius: 999px !important;
}

@media (min-width: 1500px) {
  #section-dialogs .dialogs-layout {
    grid-template-columns: minmax(320px, 360px) minmax(620px, 1fr) minmax(190px, var(--dialogs-side-width, 260px)) !important;
  }
}

@media (max-width: 1280px) {
  #section-dialogs .dialogs-layout {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr) minmax(180px, var(--dialogs-side-width, 220px)) !important;
  }
}

@media (max-width: 1120px) {
  #section-dialogs .dialogs-layout {
    grid-template-columns: minmax(280px, 330px) minmax(0, 1fr) !important;
  }

  #section-dialogs .dialogs-side-panel {
    display: none !important;
  }
}

/* ===== dialog list badges: readable unread + source colors ===== */
#section-dialogs .dialog-card-topline {
  gap: 6px !important;
}

#section-dialogs .dialog-dot {
  width: 22px !important;
  height: 22px !important;
  min-width: 22px !important;
  min-height: 22px !important;
  border-radius: 999px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: none !important;
}

#section-dialogs .dialog-dot.is-source {
  color: #ffffff !important;
  border-color: transparent !important;
}

#section-dialogs .dialog-dot.is-source.is-vk {
  background: #2f7df6 !important;
  border-color: rgba(122, 174, 255, 0.76) !important;
}

#section-dialogs .dialog-dot.is-source.is-tg_mtproto,
#section-dialogs .dialog-dot.is-source.is-tg_mtproto_2 {
  background: #22a8f2 !important;
  border-color: rgba(127, 218, 255, 0.78) !important;
}

#section-dialogs .dialog-dot.is-source.is-mail_ru {
  background: #f5b83d !important;
  border-color: rgba(255, 219, 126, 0.86) !important;
  color: #1b1624 !important;
}

#section-dialogs .dialog-dot.is-source.is-avito {
  background: #20c56b !important;
  border-color: rgba(116, 242, 166, 0.78) !important;
}

#section-dialogs .dialog-dot.is-source.is-max {
  background: #9257ff !important;
  border-color: rgba(198, 164, 255, 0.84) !important;
}

#section-dialogs .dialog-dot.is-status {
  background: rgba(255, 255, 255, 0.055) !important;
  border-color: rgba(255, 255, 255, 0.14) !important;
  color: rgba(244, 241, 255, 0.78) !important;
}

#section-dialogs .dialog-dot.is-unread {
  width: 22px !important;
  min-width: 22px !important;
  height: 22px !important;
  min-height: 22px !important;
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(169, 112, 255, 0.34) !important;
  color: transparent !important;
}

#section-dialogs .dialog-dot.is-unread.has-unread {
  width: auto !important;
  min-width: 26px !important;
  height: 26px !important;
  min-height: 26px !important;
  padding: 0 8px !important;
  background: linear-gradient(135deg, #b45cff, #7c3cff) !important;
  border-color: rgba(226, 199, 255, 0.88) !important;
  color: #ffffff !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  box-shadow:
    0 0 0 1px rgba(180, 92, 255, 0.18) inset,
    0 0 18px rgba(170, 82, 255, 0.48) !important;
}

#section-dialogs .dialog-compact-card.dialog-unread {
  border-color: rgba(180, 92, 255, 0.56) !important;
}

/* ===== light theme final readability pass ===== */
body.theme-light {
  color-scheme: light !important;
  --eva-bg-0: #f3f5fb !important;
  --eva-bg-1: #eef2fa !important;
  --eva-bg-2: #e7edf7 !important;
  --eva-panel: rgba(255, 255, 255, 0.92) !important;
  --eva-panel-2: rgba(248, 250, 255, 0.92) !important;
  --eva-panel-3: rgba(238, 243, 252, 0.96) !important;
  --eva-border: rgba(116, 130, 158, 0.24) !important;
  --eva-border-2: rgba(139, 92, 246, 0.32) !important;
  --eva-text: #121826 !important;
  --eva-text-soft: #273244 !important;
  --eva-muted: #647085 !important;
  --eva-muted-2: #8a95a8 !important;
  --eva-shadow: 0 18px 48px rgba(32, 42, 68, 0.10) !important;
  --text: var(--eva-text) !important;
  --muted: var(--eva-muted) !important;
  --text-main: var(--eva-text) !important;
  --text-muted-2: var(--eva-muted) !important;
  --page-bg: var(--eva-bg-0) !important;
  --page-bg-2: var(--eva-bg-1) !important;
  --card-bg: var(--eva-panel) !important;
  --card-bg-soft: var(--eva-panel-2) !important;
  --card-border: var(--eva-border) !important;
  --composer-bg: rgba(255, 255, 255, 0.96) !important;
  --message-in: #ffffff !important;
  --message-out: #ede7ff !important;
  background:
    radial-gradient(circle at 56% -12%, rgba(139, 92, 246, 0.14), transparent 38%),
    radial-gradient(circle at 8% 100%, rgba(32, 197, 107, 0.10), transparent 34%),
    linear-gradient(180deg, var(--eva-bg-1), var(--eva-bg-0)) !important;
  color: var(--eva-text) !important;
}

body.theme-light::before {
  background-image: radial-gradient(rgba(82, 95, 127, 0.16) 1px, transparent 1px) !important;
  opacity: 1 !important;
}

body.theme-light .main-shell,
body.theme-light .section,
body.theme-light .section.active,
body.theme-light .section-body,
body.theme-light .dialogs-layout {
  color: var(--eva-text) !important;
}

body.theme-light .topbar {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(116, 130, 158, 0.22) !important;
  color: var(--eva-text) !important;
}

body.theme-light .sidebar {
  background: linear-gradient(180deg, #10131c 0%, #090b10 100%) !important;
  border-color: rgba(255, 255, 255, 0.10) !important;
}

body.theme-light .card,
body.theme-light .accordion,
body.theme-light .dialog-compact-card,
body.theme-light .chat-panel,
body.theme-light .dialogs-list-panel,
body.theme-light .dialogs-side-panel .accordion,
body.theme-light .settings-card,
body.theme-light .calculator-card,
body.theme-light .calculator-test-panel,
body.theme-light .clients-list-card,
body.theme-light .client-editor-card,
body.theme-light .users-list-card,
body.theme-light .user-editor-card,
body.theme-light .templates-list-card,
body.theme-light .template-editor-card,
body.theme-light .orders-list-card,
body.theme-light .order-editor-card,
body.theme-light .channel-card,
body.theme-light .channel-connect-card,
body.theme-light .channel-studio-card,
body.theme-light .channel-help-card,
body.theme-light .mini-item,
body.theme-light .request-summary-card,
body.theme-light .client-brief-card,
body.theme-light .template-side-item,
body.theme-light .mini-order-card {
  background:
    linear-gradient(180deg, rgba(255,255,255,0.88), rgba(248,250,255,0.88)),
    var(--eva-panel) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
  box-shadow: var(--eva-shadow) !important;
}

body.theme-light .panel-header,
body.theme-light .accordion-toggle,
body.theme-light .request-subaccordion-toggle,
body.theme-light .clients-panel-header,
body.theme-light .users-panel-header,
body.theme-light .templates-panel-header,
body.theme-light .orders-panel-header,
body.theme-light .settings-panel-header,
body.theme-light .calculator-panel-header,
body.theme-light .calculator-test-header,
body.theme-light .channel-studio-head,
body.theme-light .channel-connect-head {
  background: linear-gradient(180deg, rgba(248, 250, 255, 0.86), rgba(255, 255, 255, 0)) !important;
  border-color: var(--eva-border) !important;
  color: var(--eva-text) !important;
}

body.theme-light .topbar-title,
body.theme-light .panel-header h2,
body.theme-light .entity-title,
body.theme-light .dialog-title-single-line,
body.theme-light .accordion-toggle span:first-child,
body.theme-light .mini-item-title,
body.theme-light .kv strong,
body.theme-light .kv-notes div,
body.theme-light .message-text,
body.theme-light .message-attachment-name,
body.theme-light .message-attachment-link {
  color: var(--eva-text) !important;
}

body.theme-light .entity-subtitle,
body.theme-light .entity-meta,
body.theme-light .muted,
body.theme-light .message-meta,
body.theme-light .message-time,
body.theme-light .dialog-preview,
body.theme-light .dialog-compact-date,
body.theme-light .dialog-date-right,
body.theme-light .mini-item-meta,
body.theme-light .label,
body.theme-light label,
body.theme-light .kv span,
body.theme-light .kv-notes span,
body.theme-light .settings-field-hint,
body.theme-light .settings-panel-subtitle {
  color: var(--eva-muted) !important;
}

body.theme-light .input,
body.theme-light .textarea,
body.theme-light select.input,
body.theme-light textarea,
body.theme-light input,
body.theme-light select,
body.theme-light .preview-box,
body.theme-light .large-textarea,
body.theme-light .calculator-result-box,
body.theme-light #channel-logs,
body.theme-light #channel-logs pre {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(116, 130, 158, 0.28) !important;
  color: var(--eva-text) !important;
}

body.theme-light .input::placeholder,
body.theme-light .textarea::placeholder,
body.theme-light textarea::placeholder,
body.theme-light input::placeholder {
  color: #8b96aa !important;
  opacity: 1 !important;
}

body.theme-light option {
  background: #ffffff !important;
  color: var(--eva-text) !important;
}

body.theme-light .small-btn,
body.theme-light .status-btn,
body.theme-light .secondary-btn,
body.theme-light .quick-reply,
body.theme-light .quick-replies button,
body.theme-light .composer-icon-btn,
body.theme-light .composer-side-btn {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(116, 130, 158, 0.28) !important;
  color: var(--eva-text-soft) !important;
}

body.theme-light .small-btn:hover,
body.theme-light .status-btn:hover,
body.theme-light .secondary-btn:hover,
body.theme-light .quick-reply:hover,
body.theme-light .quick-replies button:hover,
body.theme-light .composer-icon-btn:hover,
body.theme-light .composer-side-btn:hover {
  background: rgba(139, 92, 246, 0.10) !important;
  border-color: rgba(139, 92, 246, 0.34) !important;
  color: #3b245f !important;
}

body.theme-light #section-dialogs .dialogs-list-panel,
body.theme-light #section-dialogs .chat-panel,
body.theme-light #section-dialogs .dialogs-side-panel .accordion {
  background: rgba(255, 255, 255, 0.90) !important;
  border-color: rgba(116, 130, 158, 0.24) !important;
}

body.theme-light #section-dialogs .messages-list {
  background:
    radial-gradient(circle at 52% 0%, rgba(139, 92, 246, 0.12), transparent 38%),
    radial-gradient(circle at 28% 100%, rgba(32, 197, 107, 0.08), transparent 35%),
    radial-gradient(rgba(82, 95, 127, 0.13) 1px, transparent 1px),
    rgba(247, 249, 254, 0.96) !important;
  background-size: auto, auto, 24px 24px, auto !important;
  color: var(--eva-text) !important;
}

body.theme-light #section-dialogs .dialog-compact-card {
  background: rgba(255, 255, 255, 0.82) !important;
  border-color: rgba(116, 130, 158, 0.22) !important;
  color: var(--eva-text) !important;
}

body.theme-light #section-dialogs .dialog-compact-card:hover {
  background: rgba(248, 250, 255, 0.96) !important;
  border-color: rgba(139, 92, 246, 0.32) !important;
}

body.theme-light #section-dialogs .dialog-compact-card.active {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.18), rgba(255, 255, 255, 0.94)) !important;
  border-color: rgba(139, 92, 246, 0.58) !important;
}

body.theme-light #section-dialogs .message-row.in .message.message-compact {
  background: #ffffff !important;
  border-color: rgba(116, 130, 158, 0.22) !important;
  color: var(--eva-text) !important;
}

body.theme-light #section-dialogs .message-row.out .message.message-compact {
  background: linear-gradient(135deg, #8f6cff, #6e56e8) !important;
  border-color: rgba(111, 86, 232, 0.28) !important;
  color: #ffffff !important;
}

body.theme-light .messages-list .message-attachment,
body.theme-light .messages-list .message-attachment-body,
body.theme-light .messages-list .message-attachment-body.only-file-name,
body.theme-light #section-dialogs .messages-list .message-attachment-name,
body.theme-light #section-dialogs .messages-list .message-attachments-download-all {
  background: #ffffff !important;
  border-color: rgba(116, 130, 158, 0.26) !important;
  color: var(--eva-text) !important;
}

body.theme-light #section-dialogs .composer {
  background: rgba(255, 255, 255, 0.96) !important;
  border-color: rgba(116, 130, 158, 0.24) !important;
  color: var(--eva-text) !important;
}

body.theme-light #section-dialogs .composer-textarea-v2,
body.theme-light .composer-textarea,
body.theme-light .composer-textarea-v2 {
  background: rgba(248, 250, 255, 0.96) !important;
  border-color: rgba(139, 92, 246, 0.28) !important;
  color: var(--eva-text) !important;
}

body.theme-light .composer-textarea::placeholder,
body.theme-light .composer-textarea-v2::placeholder {
  color: #7c879b !important;
}

body.theme-light #section-dialogs .dialog-dot.is-status {
  background: rgba(255, 255, 255, 0.80) !important;
  border-color: rgba(116, 130, 158, 0.32) !important;
  color: #4b5568 !important;
}

body.theme-light #section-dialogs .dialog-dot.is-unread {
  background: rgba(255, 255, 255, 0.76) !important;
  border-color: rgba(139, 92, 246, 0.30) !important;
}

body.theme-light #section-dialogs .dialog-dot.is-unread.has-unread {
  background: linear-gradient(135deg, #b45cff, #7c3cff) !important;
  color: #ffffff !important;
  border-color: rgba(124, 60, 255, 0.34) !important;
}

/* ===== light theme contrast hardening for admin/forms/channels ===== */
body.theme-light .section .label,
body.theme-light .section label,
body.theme-light .channel-connect-label,
body.theme-light .channel-studio-label,
body.theme-light #section-channels .span-2 > .label,
body.theme-light #section-clients .client-field .label,
body.theme-light #section-users .user-field .label,
body.theme-light #section-templates .template-field .label,
body.theme-light #section-orders .order-field .label,
body.theme-light #section-settings .label,
body.theme-light #section-calculator .label,
body.theme-light #section-channels .label {
  color: #4b5568 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients .clients-panel-header h2,
body.theme-light #section-users .users-panel-header h2,
body.theme-light #section-templates .templates-panel-header h2,
body.theme-light #section-orders .orders-panel-header h2,
body.theme-light #section-settings .settings-panel-header h2,
body.theme-light #section-calculator .calculator-panel-header h2,
body.theme-light #section-calculator .calculator-test-header h2,
body.theme-light #section-channels .panel-header h2,
body.theme-light #section-channels .channel-studio-title,
body.theme-light #section-channels .channel-connect-title,
body.theme-light #section-channels .channel-help-title {
  color: #111827 !important;
  opacity: 1 !important;
}

body.theme-light #section-channels .channel-connect-text,
body.theme-light #section-channels .channel-studio-help,
body.theme-light #section-channels .channel-help-text,
body.theme-light #section-channels .channel-help-meta,
body.theme-light #section-settings .settings-field-hint,
body.theme-light #section-calculator .calculator-field-hint,
body.theme-light #section-clients .client-list-phone,
body.theme-light #section-clients .client-list-meta,
body.theme-light #section-users .user-list-login,
body.theme-light #section-users .user-list-meta,
body.theme-light #section-templates .template-list-preview,
body.theme-light #section-templates .template-list-meta,
body.theme-light #section-orders .order-list-client,
body.theme-light #section-orders .order-list-meta,
body.theme-light #section-channels .channel-card .entity-subtitle,
body.theme-light #section-channels .channel-card .entity-meta {
  color: #647085 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients #client-status,
body.theme-light #section-users #user-status,
body.theme-light #section-templates #template-status,
body.theme-light #section-orders #order-status,
body.theme-light #section-settings .settings-status,
body.theme-light #section-calculator .calculator-status,
body.theme-light #section-channels #channel-status {
  color: #647085 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients .client-list-title,
body.theme-light #section-users .user-list-title,
body.theme-light #section-templates .template-list-title,
body.theme-light #section-orders .order-list-title,
body.theme-light #section-channels .channel-card .entity-title {
  color: #111827 !important;
  opacity: 1 !important;
}

body.theme-light #section-channels .channel-studio-card,
body.theme-light #section-channels .channel-connect-card,
body.theme-light #section-channels .channel-help-card {
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--channel-studio-accent, var(--channel-accent, var(--eva-purple))) 10%, transparent), transparent 34%),
    rgba(255, 255, 255, 0.94) !important;
  border-color: rgba(116, 130, 158, 0.24) !important;
  color: #111827 !important;
}

body.theme-light #section-channels .channel-studio-head,
body.theme-light #section-channels .channel-connect-head {
  color: #111827 !important;
}

body.theme-light #section-channels #channel-logs,
body.theme-light #section-channels .preview-box,
body.theme-light #section-calculator .calculator-result-box {
  background: rgba(255, 255, 255, 0.92) !important;
  border-color: rgba(116, 130, 158, 0.26) !important;
  color: #273244 !important;
}

body.theme-light #channel-id,
body.theme-light #channel-code,
body.theme-light #channel-status-input,
body.theme-light #client-id,
body.theme-light #user-id,
body.theme-light #template-id,
body.theme-light #order-id {
  background: rgba(245, 248, 253, 0.96) !important;
  border-color: rgba(116, 130, 158, 0.20) !important;
  color: #647085 !important;
}

body.theme-light input[readonly],
body.theme-light textarea[readonly],
body.theme-light .input[readonly] {
  background: rgba(245, 248, 253, 0.96) !important;
  color: #647085 !important;
  -webkit-text-fill-color: #647085 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients .client-field .input,
body.theme-light #section-clients .client-field .textarea,
body.theme-light #section-users .user-field .input,
body.theme-light #section-templates .template-field .input,
body.theme-light #section-templates .template-field .textarea,
body.theme-light #section-orders .order-field .input,
body.theme-light #section-orders .order-field .textarea,
body.theme-light #section-settings .input,
body.theme-light #section-settings .textarea,
body.theme-light #section-calculator .input,
body.theme-light #section-calculator .textarea,
body.theme-light #section-channels .input,
body.theme-light #section-channels .textarea,
body.theme-light .channel-qf-input,
body.theme-light .channel-studio-input {
  background: rgba(255, 255, 255, 0.98) !important;
  border-color: rgba(116, 130, 158, 0.28) !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients .client-field .input::placeholder,
body.theme-light #section-clients .client-field .textarea::placeholder,
body.theme-light #section-users .user-field .input::placeholder,
body.theme-light #section-templates .template-field .input::placeholder,
body.theme-light #section-templates .template-field .textarea::placeholder,
body.theme-light #section-orders .order-field .input::placeholder,
body.theme-light #section-orders .order-field .textarea::placeholder,
body.theme-light #section-settings .input::placeholder,
body.theme-light #section-settings .textarea::placeholder,
body.theme-light #section-calculator .input::placeholder,
body.theme-light #section-calculator .textarea::placeholder,
body.theme-light #section-channels .input::placeholder,
body.theme-light #section-channels .textarea::placeholder {
  color: #8792a6 !important;
  -webkit-text-fill-color: #8792a6 !important;
  opacity: 1 !important;
}

body.theme-light #section-clients .client-list-item,
body.theme-light #section-users .user-list-item,
body.theme-light #section-templates .template-list-item,
body.theme-light #section-orders .order-list-item,
body.theme-light #section-channels .channel-card {
  background: rgba(255, 255, 255, 0.86) !important;
  border-color: rgba(116, 130, 158, 0.23) !important;
  color: #111827 !important;
}

body.theme-light #section-clients .client-list-item.active,
body.theme-light #section-users .user-list-item.active,
body.theme-light #section-templates .template-list-item.active,
body.theme-light #section-orders .order-list-item.active,
body.theme-light #section-channels .channel-card.active,
body.theme-light #section-channels .channel-card.selected {
  background: #eaf3ff !important;
  border-color: rgba(96, 165, 250, 0.72) !important;
  color: #111827 !important;
}

body.theme-light #section-channels .channel-studio-actions .small-btn,
body.theme-light #section-channels .channel-help-actions .small-btn,
body.theme-light #section-channels .tgmtproto-qr-actions .small-btn,
body.theme-light #section-channels .panel-header .small-btn {
  background: rgba(255, 255, 255, 0.88) !important;
  border-color: rgba(116, 130, 158, 0.28) !important;
  color: #273244 !important;
}
.mini-pricebook,
.calculator-pricebook-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.mini-pricebook .label,
.calculator-pricebook-grid .label {
  margin-bottom: -4px;
}

.mini-pricebook {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.mini-pricebook .label {
  font-size: 10px;
}

.mini-pricebook .input,
.calculator-pricebook-grid .input {
  min-height: 38px;
}

@media (max-width: 760px) {
  .mini-pricebook,
  .calculator-pricebook-grid {
    grid-template-columns: 1fr;
  }
}

/* Drag files directly into the active dialog composer */
#section-dialogs .chat-panel {
  position: relative;
}

#section-dialogs .chat-panel.composer-drop-active {
  outline: 2px solid rgba(139, 92, 246, 0.72);
  outline-offset: -4px;
}

#section-dialogs .chat-panel.composer-drop-active::after {
  content: "Отпустите файлы, чтобы прикрепить их к сообщению";
  position: absolute;
  inset: 82px 18px 118px;
  z-index: 30;
  display: grid;
  place-items: center;
  border: 1px dashed rgba(168, 116, 255, 0.9);
  border-radius: 18px;
  background: rgba(16, 15, 24, 0.72);
  color: #f8f7ff;
  font-size: 18px;
  font-weight: 800;
  text-align: center;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 18px 60px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(8px);
}

#section-dialogs .composer.composer-drop-active {
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.56), 0 16px 48px rgba(139, 92, 246, 0.18) !important;
}

body.theme-light #section-dialogs .chat-panel.composer-drop-active::after {
  background: rgba(255, 255, 255, 0.86);
  color: #111827;
  border-color: rgba(124, 77, 255, 0.72);
  box-shadow: inset 0 0 0 1px rgba(124, 77, 255, 0.1), 0 18px 60px rgba(78, 70, 229, 0.18);
}
