* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(180deg, #fbfcff 0%, #f3f6fb 100%);
  color: #1f2937;
}

.topbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e8edf5;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: -0.04em;
}

.topbar p {
  margin: 4px 0 0;
  color: #7a8699;
  font-size: 14px;
}

.page-shell {
  position: relative;
}

.board-wrap {
  overflow-x: auto;
  padding: 24px;
}

.inline-form-wrap {
  margin-bottom: 18px;
}

.inline-form-wrap.hidden {
  display: none;
}

.inline-form-card,
.panel {
  background: rgba(255,255,255,0.95);
  border: 1px solid #e7edf7;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.06);
}

.inline-form {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.inline-form input,
.inline-form button {
  min-width: 160px;
  flex: 1;
}

input,
select,
textarea,
button {
  width: 100%;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid #d8e1ef;
  font-size: 14px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #6ba2ff;
  box-shadow: 0 0 0 3px rgba(107, 162, 255, 0.15);
}

textarea {
  resize: vertical;
}

button {
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%);
  color: white;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.98);
}

.icon-add-btn,
.mini-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: #2f6dff;
  border: 1px dashed #bfd2ff;
  border-radius: 999px;
  padding: 11px 15px;
  cursor: pointer;
  font-weight: 700;
  width: auto;
  box-shadow: 0 6px 18px rgba(47, 109, 255, 0.08);
}

.mini-add-btn {
  width: 100%;
  justify-content: center;
  border-radius: 14px;
  background: #f9fbff;
  box-shadow: none;
}

.board {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  min-width: max-content;
}

.column {
  width: 320px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
  border: 1px solid #dce8ff;
  border-radius: 24px;
  padding: 14px;
  box-shadow: 0 12px 24px rgba(52, 84, 138, 0.06);
}

.column-head {
  margin-bottom: 12px;
}

.stage-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.stage-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.stage-title-row h3 {
  margin: 0;
  font-size: 17px;
}

.stage-title-row span {
  background: #fff;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #d9e7ff;
  min-width: 32px;
  text-align: center;
}

.stage-edit-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tiny-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  padding: 7px 10px;
  border-radius: 10px;
  text-decoration: none;
  border: 1px solid #d9e4f5;
  background: #fff;
  color: #556273;
  width: auto;
}

.tiny-btn.save {
  background: #eff6ff;
  color: #2563eb;
}

.tiny-btn.cancel {
  background: #fff;
  color: #6b7280;
}

.stage-edit-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.add-card-wrap {
  margin-bottom: 12px;
}

.dropzone {
  min-height: 140px;
  border-radius: 18px;
  padding: 4px;
}

.dropzone.over {
  background: rgba(64, 126, 255, 0.10);
}

.empty-column-note {
  border: 1px dashed #c8d8f5;
  border-radius: 16px;
  padding: 18px 12px;
  text-align: center;
  color: #7a8699;
  font-size: 13px;
  background: rgba(255,255,255,0.55);
}

.card {
  background: rgba(255,255,255,0.98);
  border: 1px solid #e6edf8;
  border-radius: 18px;
  padding: 12px;
  margin-bottom: 12px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.05);
  cursor: grab;
}

.card.dragging {
  opacity: 0.55;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.card-badge {
  font-size: 11px;
  font-weight: 700;
  color: #2f6dff;
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  border-radius: 999px;
  padding: 5px 9px;
}

.card-title {
  font-weight: 700;
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.3;
}

.card-client {
  font-size: 14px;
  margin-bottom: 8px;
  color: #364152;
}

.card-meta {
  font-size: 13px;
  color: #6f7d90;
  margin-bottom: 4px;
}

.card-amount {
  margin-top: 10px;
  font-weight: 700;
  color: #0f766e;
}

.card-actions {
  margin-top: 12px;
}

.card-actions a {
  text-decoration: none;
  color: #2563eb;
  font-size: 13px;
  font-weight: 700;
}

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

.form-head h2,
.drawer-head h2,
.panel h3 {
  margin: 0;
}

.drawer-head p {
  margin: 4px 0 0;
  color: #7a8699;
  font-size: 13px;
}

.ghost-close,
.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  min-width: 38px;
  border-radius: 12px;
  border: 1px solid #d6e0f0;
  background: #fff;
  color: #475569;
  text-decoration: none;
}

.card-grid-form label {
  display: block;
  margin: 11px 0 6px;
  font-size: 13px;
  color: #6b7280;
}

.comments {
  margin-top: 12px;
}

.comment-item {
  background: #f9fbff;
  border: 1px solid #e7edf7;
  border-radius: 14px;
  padding: 10px;
  margin-bottom: 8px;
}

.comment-date {
  font-size: 12px;
  color: #7a8699;
  margin-bottom: 6px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.18);
  z-index: 20;
}

.drawer {
  position: fixed;
  top: 0;
  right: -470px;
  width: 450px;
  max-width: calc(100vw - 20px);
  height: 100vh;
  background: linear-gradient(180deg, #fdfefe 0%, #f5f8fd 100%);
  border-left: 1px solid #dde7f5;
  padding: 18px;
  overflow-y: auto;
  z-index: 30;
  transition: right 0.25s ease;
  box-shadow: -10px 0 40px rgba(15, 23, 42, 0.10);
}

.drawer.open {
  right: 0;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.danger-link {
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #c0394b;
}

.menu-wrap {
  position: relative;
}

.menu-trigger {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 12px;
  border: 1px solid #d9e4f5;
  background: #f8fafc;
  color: #7b8798;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  box-shadow: none;
}

.card-menu-btn {
  background: #f8fafc;
}

.menu-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 140px;
  background: #fff;
  border: 1px solid #dce6f5;
  border-radius: 14px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  padding: 6px;
  display: none;
  z-index: 50;
}

.menu-dropdown.open {
  display: block;
}

.menu-dropdown a {
  display: block;
  text-decoration: none;
  color: #445166;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 10px;
}

.menu-dropdown a:hover {
  background: #f5f8ff;
}

.menu-dropdown a.danger {
  color: #c0394b;
}

.column.dragging-stage {
  opacity: 0.45;
}

.column.stage-over {
  outline: 2px dashed #8cb5ff;
  outline-offset: 4px;
}

@media (max-width: 900px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .drawer {
    width: 100%;
    max-width: 100%;
  }

  .inline-form {
    flex-direction: column;
  }

  .inline-form input,
  .inline-form button {
    width: 100%;
    min-width: 0;
  }
}


.menu-icon-only {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 10px;
  padding: 0;
}

.dots-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.dots-icon i {
  display: block;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: currentColor;
}

.menu-trigger:hover {
  background: #f5f8ff;
}

.menu-trigger:active {
  transform: translateY(1px);
}


.add-card-bottom {
  width: 320px;
  max-width: calc(100vw - 48px);
  margin-top: 12px;
  margin-bottom: 0;
}


.card-client a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
}

.card-client a:hover {
  color: #2563eb;
  text-decoration: underline;
}


/* Bitrix-like stage colors */
.column:nth-child(6n+1) {
  background: linear-gradient(180deg, #f3f6fb 0%, #e9eef7 100%);
  border-color: #d7e0ee;
}

.column:nth-child(6n+1) .stage-title-row h3 {
  color: #475569;
}

.column:nth-child(6n+2) {
  background: linear-gradient(180deg, #eef6ff 0%, #e2eeff 100%);
  border-color: #cfe0ff;
}

.column:nth-child(6n+2) .stage-title-row h3 {
  color: #2563eb;
}

.column:nth-child(6n+3) {
  background: linear-gradient(180deg, #f5f0ff 0%, #ede4ff 100%);
  border-color: #dccbff;
}

.column:nth-child(6n+3) .stage-title-row h3 {
  color: #7c3aed;
}

.column:nth-child(6n+4) {
  background: linear-gradient(180deg, #eefcf6 0%, #dff5ea 100%);
  border-color: #c9ebda;
}

.column:nth-child(6n+4) .stage-title-row h3 {
  color: #059669;
}

.column:nth-child(6n+5) {
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  border-color: #fed7aa;
}

.column:nth-child(6n+5) .stage-title-row h3 {
  color: #ea580c;
}

.column:nth-child(6n+6) {
  background: linear-gradient(180deg, #fff1f2 0%, #ffe4e6 100%);
  border-color: #fecdd3;
}

.column:nth-child(6n+6) .stage-title-row h3 {
  color: #e11d48;
}

.column .stage-title-row span {
  background: rgba(255,255,255,0.92);
}


.stage-drag-handle {
  cursor: grab;
}

.stage-drag-handle:active {
  cursor: grabbing;
}


.search-bar-wrap {
  margin-bottom: 18px;
}

.search-bar-card {
  background: rgba(255,255,255,0.95);
  border: 1px solid #e7edf7;
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.04);
}

.lead-search-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d8e1ef;
  font-size: 14px;
}

.stage-total {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  border: 1px solid #d9e7ff;
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
}

.column-head {
  margin-bottom: 12px;
}

.card.hidden-by-search {
  display: none;
}


.card-date {
  font-size: 12px;
  color: #7a8699;
  margin-bottom: 8px;
}

.deal-created-line {
  margin-top: 8px;
  font-size: 12px;
  color: #7a8699;
}


.card-compact {
  padding: 10px 12px;
}

.compact-topline {
  margin-bottom: 6px;
}

.menu-spacer {
  width: 1px;
  height: 1px;
}

.card-client-main {
  font-size: 15px;
  margin-bottom: 0;
}

.card-client-main a {
  font-weight: 700;
}

.card-compact .card-amount {
  margin-top: 8px;
  font-size: 13px;
}

.card-compact .card-meta,
.card-compact .card-title,
.card-compact .card-date,
.card-compact .card-badge,
.card-compact .card-actions {
  display: none;
}


.compact-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.compact-header-row .card-client-main {
  margin: 0;
  min-width: 0;
  flex: 1;
}

.compact-header-row .card-client-main a {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-phone {
  font-size: 13px;
  color: #6f7d90;
  margin-top: 2px;
  margin-bottom: 4px;
}

.card-compact .menu-trigger {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.card-compact .card-client-main a {
  text-decoration: none;
}


.card-phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.copy-phone-btn,
.copy-email-btn,
.copy-icon-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #d9e4f5;
  background: #f8fafc;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
  font-size: 13px;
}

.copy-phone-btn:hover,
.copy-email-btn:hover,
.copy-icon-btn:hover {
  background: #eef4ff;
  color: #2563eb;
}

.copy-phone-btn.copied,
.copy-email-btn.copied,
.copy-icon-btn.copied {
  background: #e8fff2;
  border-color: #b7ebc9;
  color: #059669;
}


/* appended modal styles */
.modal-open {
  overflow: hidden;
}

.deal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 40;
}

.deal-modal-window {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dfe8f5;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.deal-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid #ebf0f7;
  background: rgba(255,255,255,0.92);
}

.deal-modal-head h2 {
  margin: 8px 0 4px;
  font-size: 28px;
  line-height: 1.2;
}

.deal-modal-head p {
  margin: 0;
  color: #6f7d90;
  font-size: 15px;
}

.deal-stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2f6dff;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #d8e6ff;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid #d6e0f0;
  background: #fff;
  color: #475569;
  text-decoration: none;
  font-size: 18px;
}

.deal-modal-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.deal-modal-left,
.deal-modal-right {
  padding: 22px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
}

.deal-modal-right {
  border-left: 1px solid #ebf0f7;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
}

.deal-box,
.timeline-composer,
.timeline-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid #e7edf7;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.06);
}

.deal-box-head {
  color: #7e8b9b;
  font-size: 12px;
  letter-spacing: 0.03em;
  margin-bottom: 16px;
}

.deal-info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.deal-info-item label {
  display: block;
  font-size: 12px;
  color: #8b97a7;
  margin-bottom: 6px;
}

.deal-info-item > div {
  font-size: 15px;
  color: #253041;
}

.deal-big-amount {
  font-size: 42px !important;
  line-height: 1.05;
  color: #253041;
  font-weight: 700;
}

.field-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e7edf7;
}

.field-edit-btn {
  width: auto;
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d9e4f5;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.inline-edit-form {
  margin-top: 10px;
}

.inline-edit-form.hidden {
  display: none;
}

.inline-edit-form input,
.inline-edit-form textarea {
  margin-bottom: 8px;
}


.deal-agent-panel-wrap {
  grid-column: 1 / -1;
}
.deal-agent-panel {
  border-radius: 18px;
  border: 1px solid #dbe7fb;
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
  padding: 16px;
  display: grid;
  gap: 12px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.65);
}
.deal-agent-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deal-agent-status-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.deal-agent-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #2563eb;
}
.deal-agent-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(148,163,184,.22);
  font-size: 12px;
  font-weight: 800;
  color: #1e3a8a;
}
.deal-agent-lock-badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(22,163,74,.12);
  border: 1px solid rgba(22,163,74,.18);
  color: #166534;
  font-size: 12px;
  font-weight: 800;
}
.deal-agent-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.deal-agent-cell {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(148,163,184,.16);
}
.deal-agent-cell-label {
  display: block;
  margin-bottom: 6px;
  color: #7b8796;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.deal-agent-cell strong {
  display: block;
  color: #243042;
  font-size: 14px;
  line-height: 1.35;
  word-break: break-word;
}
.deal-agent-debug-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
  border-top: 1px dashed rgba(148,163,184,.24);
}
.deal-agent-debug-line span {
  color: #7b8796;
  font-size: 12px;
  font-weight: 700;
}
.deal-agent-debug-line code {
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(15,23,42,.06);
  color: #334155;
  font-size: 12px;
}
.deal-agent-panel.is-calling {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
}
.deal-agent-panel.is-calling .deal-agent-title,
.deal-agent-panel.is-calling .deal-agent-status-pill {
  color: #166534;
}
.deal-agent-panel.is-callback {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
}
.deal-agent-panel.is-callback .deal-agent-title,
.deal-agent-panel.is-callback .deal-agent-status-pill {
  color: #6d28d9;
}
.deal-agent-panel.is-paused,
.deal-agent-panel.is-disabled {
  border-color: #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.deal-agent-panel.is-live {
  position: relative;
  overflow: hidden;
}
.deal-agent-panel.is-live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0) 35%, rgba(255,255,255,.42) 50%, rgba(255,255,255,0) 65%, transparent 100%);
  transform: translateX(-120%);
  animation: agentSweep 2.8s linear infinite;
  pointer-events: none;
}

.deal-agent-history {
  display: grid;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148,163,184,.24);
}
.deal-agent-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.deal-agent-history-head span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.deal-agent-history-head em {
  color: #7b8796;
  font-size: 12px;
  font-style: normal;
}
.deal-agent-history-list {
  display: grid;
  gap: 8px;
}
.deal-agent-history-item {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  border: 1px solid rgba(148,163,184,.16);
}
.deal-agent-history-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}
.deal-agent-history-top strong {
  font-size: 13px;
  color: #243042;
}
.deal-agent-history-top span {
  color: #7b8796;
  font-size: 12px;
}
.deal-agent-history-body {
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 13px;
  line-height: 1.4;
}
.deal-agent-history-body p { margin: 0; }
.deal-agent-history-body a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 700;
}
.deal-agent-history-empty {
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.62);
  border: 1px dashed rgba(148,163,184,.22);
  color: #7b8796;
  font-size: 13px;
}
@media (max-width: 720px) {
  .deal-agent-grid {
    grid-template-columns: 1fr;
  }
  .deal-agent-panel-top,
  .deal-agent-debug-line {
    align-items: flex-start;
    flex-direction: column;
  }
}

.timeline-top-tabs {
  display: flex;
  gap: 18px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.96);
  border: 1px solid #e7edf7;
  border-radius: 16px;
}

.timeline-top-tabs span {
  font-size: 14px;
  color: #6f7d90;
}

.timeline-top-tabs span.active {
  color: #2f6dff;
  font-weight: 700;
}

.timeline-composer {
  margin-bottom: 14px;
}

.composer-actions {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.close-link-btn {
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
}

.timeline-feed {
  display: grid;
  gap: 12px;
}

.timeline-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.timeline-card-head strong {
  font-size: 14px;
}

.timeline-card-head span {
  color: #8b97a7;
  font-size: 12px;
}

.timeline-card-body {
  color: #253041;
  line-height: 1.5;
  font-size: 14px;
}

@media (max-width: 980px) {
  .deal-modal-window {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 18px;
  }

  .deal-modal-grid {
    grid-template-columns: 1fr;
  }

  .deal-modal-right {
    border-left: none;
    border-top: 1px solid #ebf0f7;
  }

  .deal-modal-left,
  .deal-modal-right {
    max-height: none;
  }
}



/* v22 fix: completely disable old right drawer */
.drawer,
.drawer-backdrop,
#cardDrawer,
#drawerBackdrop {
  display: none !important;
}

.modal-open {
  overflow: hidden;
}

.deal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.28);
  z-index: 40;
}

.deal-modal-window {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(1120px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  transform: translate(-50%, -50%);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #dfe8f5;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.22);
  z-index: 50;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.deal-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid #ebf0f7;
  background: rgba(255,255,255,0.92);
}

.deal-modal-head h2 {
  margin: 8px 0 4px;
  font-size: 28px;
  line-height: 1.2;
}

.deal-modal-head p {
  margin: 0;
  color: #6f7d90;
  font-size: 15px;
}

.deal-stage-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef4ff;
  color: #2f6dff;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #d8e6ff;
}

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 12px;
  border: 1px solid #d6e0f0;
  background: #fff;
  color: #475569;
  text-decoration: none;
  font-size: 18px;
}

.deal-modal-grid {
  display: grid;
  grid-template-columns: minmax(340px, 0.92fr) minmax(420px, 1.08fr);
  gap: 0;
  min-height: 0;
  overflow: hidden;
}

.deal-modal-left,
.deal-modal-right {
  padding: 22px 24px;
  overflow-y: auto;
  max-height: calc(100vh - 130px);
}

.deal-modal-right {
  border-left: 1px solid #ebf0f7;
  background: linear-gradient(180deg, #fbfdff 0%, #f6f9fd 100%);
}

.field-inline-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #f8fbff;
  border: 1px solid #e7edf7;
}

.field-edit-btn {
  width: auto;
  min-width: 64px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #d9e4f5;
  color: #2563eb;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.inline-edit-form.hidden {
  display: none;
}

.close-link-btn {
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  color: #64748b;
}

@media (max-width: 980px) {
  .deal-modal-window {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    border-radius: 18px;
  }

  .deal-modal-grid {
    grid-template-columns: 1fr;
  }

  .deal-modal-right {
    border-left: none;
    border-top: 1px solid #ebf0f7;
  }

  .deal-modal-left,
  .deal-modal-right {
    max-height: none;
  }
}


/* v25 source badges on lead cards */
.card-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  border: 1px solid transparent;
}

.source-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  min-width: 16px;
  font-size: 11px;
}

.source-telegram {
  background: #eef6ff;
  color: #2563eb;
  border-color: #cfe0ff;
}

.source-whatsapp {
  background: #ecfdf5;
  color: #059669;
  border-color: #b7ebc9;
}

.source-website {
  background: #eff6ff;
  color: #1d4ed8;
  border-color: #bfdbfe;
}

.source-referral {
  background: #f5f3ff;
  color: #7c3aed;
  border-color: #ddd6fe;
}

.source-instagram {
  background: #fff1f2;
  color: #db2777;
  border-color: #fecdd3;
}

.source-facebook {
  background: #eef2ff;
  color: #4338ca;
  border-color: #c7d2fe;
}

.source-custom {
  background: #f8fafc;
  color: #475569;
  border-color: #e2e8f0;
}

/* v25 add-card form should open with stage width instead of full page width */
.stage-width-form {
  max-width: 320px;
  width: 320px;
}

.stage-width-form .inline-form-card {
  border-radius: 20px;
}

@media (max-width: 900px) {
  .stage-width-form {
    max-width: 100%;
    width: 100%;
  }
}


.card-email-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.card-email {
  font-size: 13px;
  color: #6f7d90;
  min-width: 0;
}

.card-email .email-text {
  display: inline-block;
  max-width: 220px;
  vertical-align: bottom;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.card-head-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.card-days-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.copy-icon-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid #d9e4f5;
  background: #f8fafc;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: none;
}

.copy-icon-btn:hover {
  background: #eef4ff;
  color: #2563eb;
}

.copy-icon-btn.copied {
  background: #e8fff2;
  border-color: #b7ebc9;
  color: #059669;
}

.copy-squares {
  position: relative;
  width: 12px;
  height: 12px;
  display: inline-block;
}

.copy-squares::before,
.copy-squares::after {
  content: "";
  position: absolute;
  border: 1.6px solid currentColor;
  border-radius: 2px;
  background: transparent;
}

.copy-squares::before {
  width: 7px;
  height: 7px;
  left: 1px;
  top: 3px;
}

.copy-squares::after {
  width: 7px;
  height: 7px;
  left: 4px;
  top: 0;
}

.card-email-row,
.card-phone-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 2px;
  margin-bottom: 4px;
}

.card-email,
.card-phone {
  font-size: 13px;
  color: #6f7d90;
  min-width: 0;
}

.card-email .email-text,
.card-phone .phone-text {
  display: inline-block;
  max-width: 210px;
  vertical-align: bottom;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.copy-squares.copy-success-mark {
  width: auto;
  height: auto;
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

.copy-squares.copy-success-mark::before,
.copy-squares.copy-success-mark::after {
  display: none;
}


.field-menu-wrap .menu-trigger,
.comment-menu-trigger {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.inline-edit-form {
  margin-top: 10px;
}

.inline-edit-form.hidden {
  display: none;
}

.inline-edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.inline-cancel-btn {
  width: auto;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d9e4f5;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.timeline-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}


/* v35 auth / admin */
.topbar-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}
.role-admin { background: #eef4ff; color: #2563eb; border: 1px solid #cfe0ff; }
.role-user { background: #f1f5f9; color: #475569; border: 1px solid #e2e8f0; }

.login-page,
.admin-page {
  min-height: 100vh;
  background: linear-gradient(180deg, #fbfcff 0%, #f3f6fb 100%);
}
.login-shell,
.admin-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 18px;
}
.login-card,
.admin-card {
  background: rgba(255,255,255,0.96);
  border: 1px solid #e7edf7;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.06);
}
.login-card {
  max-width: 460px;
  margin: 40px auto;
}
.login-form label,
.admin-card label,
.add-field-form label {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  color: #6b7280;
}
.alert-box {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.login-hint {
  margin-top: 14px;
  font-size: 13px;
  color: #64748b;
}
.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.simple-table {
  display: grid;
  gap: 8px;
}
.simple-row {
  display: grid;
  grid-template-columns: 1fr 120px 140px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #e7edf7;
}
.simple-head {
  font-size: 12px;
  color: #64748b;
  font-weight: 700;
}
@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
  .simple-row {
    grid-template-columns: 1fr;
  }
}

/* field/comment editing menus */
.field-menu-wrap .menu-trigger,
.comment-menu-trigger {
  width: 30px;
  height: 30px;
  min-width: 30px;
}

.inline-edit-form {
  margin-top: 10px;
}
.inline-edit-form.hidden {
  display: none;
}
.inline-edit-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.inline-cancel-btn {
  width: auto;
  min-width: 74px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid #d9e4f5;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.timeline-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.add-field-form {
  margin-bottom: 14px;
}

/* v42 comments timeline refresh */
.timeline-top-tabs {
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  box-shadow: 0 8px 24px rgba(31, 41, 55, 0.05);
}

.timeline-top-tabs span {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 600;
}

.timeline-top-tabs span.active {
  background: #eef4ff;
}

.timeline-composer {
  padding: 18px;
  border-radius: 22px;
}

.comment-compose-form textarea {
  min-height: 78px;
  border-radius: 16px;
  background: #fcfdff;
}

.composer-actions {
  justify-content: space-between;
}

.composer-actions button {
  max-width: 180px;
}

.timeline-feed {
  gap: 14px;
}

.bitrix-comment-card {
  position: relative;
  display: grid;
  grid-template-columns: 20px 42px minmax(0,1fr);
  gap: 12px;
  align-items: start;
  padding: 18px;
  border-radius: 22px;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 18px;
  border-radius: 50%;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%);
  box-shadow: 0 0 0 4px #edf4ff;
}

.timeline-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #eff4ff 0%, #dde8ff 100%);
  color: #2f6dff;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.timeline-content {
  min-width: 0;
}

.timeline-card-head {
  align-items: flex-start;
  margin-bottom: 8px;
}

.timeline-card-head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.timeline-card-head strong {
  font-size: 15px;
}

.timeline-card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.timeline-date {
  color: #8b97a7;
  font-size: 12px;
  white-space: nowrap;
}

.timeline-source-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.timeline-source-tag.is-imported {
  color: #6b7280;
  background: #f5f7fb;
  border-color: #e5eaf2;
}

.timeline-source-tag.is-manual {
  color: #2457d6;
  background: #edf4ff;
  border-color: #d7e5ff;
}

.timeline-source-tag.is-system {
  color: #0f766e;
  background: #ecfdf5;
  border-color: #c9f1df;
}

.rich-comment-body {
  white-space: normal;
  line-height: 1.65;
  word-break: break-word;
}

.rich-comment-body a {
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.rich-comment-body a:hover {
  text-decoration: underline;
}

.empty-bitrix-box {
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
  background: rgba(255,255,255,0.96);
  border: 1px dashed #d7e4f8;
  border-radius: 20px;
  color: #7b8798;
}

.empty-comments-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef4ff;
  font-size: 22px;
}

.comment-edit-form {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #edf1f7;
}

.comment-edit-form textarea {
  min-height: 92px;
}


/* ===== Multi-pipeline UI (clean) ===== */
.pipeline-switcher-card {
  margin: 0 0 18px;
  padding: 16px 18px;
  border: 1px solid #dfe7f6;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(43, 74, 143, 0.06);
}
.pipeline-switcher-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.pipeline-switcher-head h2 {
  margin: 0;
  font-size: 20px;
}
.pipeline-switcher-head p,
.deal-pipeline-line {
  margin: 4px 0 0;
  color: #6d7b95;
  font-size: 14px;
}
.pipeline-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.pipeline-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pipeline-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid #d8e3fb;
  background: #f8fbff;
  color: #2e5bff;
  text-decoration: none;
  font-weight: 600;
}
.pipeline-tab em {
  font-style: normal;
  font-size: 12px;
  color: #6c7da3;
  background: #eef3ff;
  border-radius: 999px;
  padding: 2px 8px;
}
.pipeline-tab.active {
  background: linear-gradient(180deg, #edf3ff 0%, #dfeaff 100%);
  border-color: #bcd0ff;
  color: #214fdf;
}
.empty-pipeline-column {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}
@media (max-width: 900px) {
  .pipeline-switcher-head {
    flex-direction: column;
  }
}


.board-nav {
  position: fixed;
  top: 56%;
  transform: translateY(-50%);
  width: 44px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  border: 1px solid #dbe6fb;
  background: rgba(255,255,255,0.96);
  color: #2f6dff;
  box-shadow: 0 12px 24px rgba(47,109,255,0.14);
  z-index: 40;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  width: 44px;
  padding: 0;
}

.board-nav:hover {
  transform: translateY(-50%) scale(1.03);
  box-shadow: 0 16px 32px rgba(47,109,255,0.18);
}

.board-nav-left { left: 10px; }
.board-nav-right { right: 10px; }

.board-nav.hidden {
  display: none;
}

@media (max-width: 900px) {
  .board-nav {
    width: 38px;
    height: 60px;
    font-size: 24px;
  }
}


.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid #dbe6fb;
  background: rgba(255,255,255,0.96);
  color: #2f6dff;
  box-shadow: 0 12px 24px rgba(47,109,255,0.14);
  z-index: 45;
  font-size: 24px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}

.back-to-top:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgba(47,109,255,0.18);
}

.back-to-top.hidden {
  display: none;
}

@media (max-width: 900px) {
  .back-to-top {
    width: 44px;
    height: 44px;
    right: 12px;
    bottom: 12px;
    font-size: 22px;
  }
}


/* v51 unified compact top nav */
.topbar-compact {
  padding: 14px 24px;
  align-items: flex-start;
}
.topbar-brand {
  min-width: 220px;
}
.topbar-right {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}
.compact-menu {
  justify-content: flex-end;
}
.compact-menu-unified {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.topbar-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: auto;
  width: auto;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid #d8e3fb;
  background: #fff;
  color: #3159d6;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(47, 109, 255, 0.06);
  cursor: pointer;
}
.topbar-link-btn:hover {
  background: #f8fbff;
}
.topbar-link-btn.danger-link {
  color: #c2410c;
  border-color: #fed7aa;
  background: #fffaf5;
}
.topbar-menu-separator {
  width: 1px;
  height: 28px;
  background: linear-gradient(180deg, rgba(49,89,214,0.06), rgba(49,89,214,0.28), rgba(49,89,214,0.06));
  border-radius: 999px;
  margin: 0 2px 0 4px;
}
.pipeline-tabs-topbar {
  justify-content: flex-end;
}
.pipeline-tabs-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.pipeline-tabs-topbar .pipeline-tab {
  padding: 8px 12px;
  box-shadow: none;
  background: #ffffff;
  margin: 0;
}
.pipeline-tabs-topbar .pipeline-tab.active {
  box-shadow: 0 8px 22px rgba(47, 109, 255, 0.14);
}
.compact-top-form {
  margin-bottom: 14px;
}
.board-wrap.full {
  padding-top: 16px;
}

@media (max-width: 980px) {
  .topbar-compact {
    flex-direction: column;
    align-items: stretch;
  }
  .topbar-right {
    align-items: stretch;
    justify-content: flex-start;
  }
  .compact-menu,
  .compact-menu-unified,
  .pipeline-tabs-topbar {
    justify-content: flex-start;
  }
  .topbar-menu-separator {
    display: none;
  }
}


/* v52 theme toggle */
.theme-toggle-btn {
  min-width: 94px;
}

body[data-theme="dark"] {
  background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
  color: #e5eefc;
}
body[data-theme="dark"] .topbar {
  background: rgba(15, 23, 42, 0.92);
  border-bottom-color: #25324a;
}
body[data-theme="dark"] .topbar p {
  color: #97a6c5;
}
body[data-theme="dark"] .inline-form-card,
body[data-theme="dark"] .panel,
body[data-theme="dark"] .search-bar-card,
body[data-theme="dark"] .card,
body[data-theme="dark"] .modal-card,
body[data-theme="dark"] .timeline-shell,
body[data-theme="dark"] .empty-comments,
body[data-theme="dark"] .menu-dropdown,
body[data-theme="dark"] .board-nav,
body[data-theme="dark"] .back-to-top {
  background: rgba(15, 23, 42, 0.94);
  border-color: #2a3955;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  color: #e5eefc;
}
body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea {
  background: #0f1a2e;
  border-color: #31415d;
  color: #e5eefc;
}
body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder {
  color: #7f91b3;
}
body[data-theme="dark"] .topbar-link-btn,
body[data-theme="dark"] .pipeline-tabs-topbar .pipeline-tab {
  background: #122033;
  border-color: #33435f;
  color: #dbe8ff;
}
body[data-theme="dark"] .topbar-link-btn:hover,
body[data-theme="dark"] .pipeline-tabs-topbar .pipeline-tab:hover {
  background: #17263c;
}
body[data-theme="dark"] .pipeline-tab em {
  background: #1e2f49;
  color: #a8b9d8;
}
body[data-theme="dark"] .pipeline-tabs-topbar .pipeline-tab.active {
  background: linear-gradient(180deg, #1d3e82 0%, #17356f 100%);
  border-color: #3a62b5;
  color: #ffffff;
}
body[data-theme="dark"] .topbar-link-btn.danger-link {
  background: #2a1a16;
  border-color: #7c3f2a;
  color: #ffbd9b;
}
body[data-theme="dark"] .theme-toggle-btn.is-dark-active {
  background: linear-gradient(180deg, #1d3e82 0%, #17356f 100%);
  border-color: #3a62b5;
  color: #fff;
}
body[data-theme="dark"] .topbar-menu-separator {
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.05), rgba(148, 163, 184, 0.4), rgba(148, 163, 184, 0.05));
}
body[data-theme="dark"] .column {
  background: rgba(17, 24, 39, 0.72);
  border-color: #2b3a54;
}
body[data-theme="dark"] .column-head,
body[data-theme="dark"] .stage-edit-form {
  border-color: #2b3a54;
}
body[data-theme="dark"] .stage-title-group h3,
body[data-theme="dark"] .card-client a,
body[data-theme="dark"] .timeline-card-head strong {
  color: #f3f7ff;
}
body[data-theme="dark"] .card-meta,
body[data-theme="dark"] .card-line,
body[data-theme="dark"] .timeline-date,
body[data-theme="dark"] .empty-comments span,
body[data-theme="dark"] .deal-pipeline-line,
body[data-theme="dark"] .topbar h1,
body[data-theme="dark"] .menu-dropdown a {
  color: #b9c8e3;
}
body[data-theme="dark"] .menu-dropdown a:hover {
  background: #17263c;
}
body[data-theme="dark"] .menu-dropdown a.danger {
  color: #ffb4a2;
}
body[data-theme="dark"] .stage-total,
body[data-theme="dark"] .card-amount {
  background: #0c3b38;
  color: #6ee7d0;
  border-color: #155e59;
}
body[data-theme="dark"] .card-days-badge,
body[data-theme="dark"] .stage-title-group span,
body[data-theme="dark"] .menu-trigger,
body[data-theme="dark"] .copy-btn,
body[data-theme="dark"] .tiny-btn,
body[data-theme="dark"] .source-pill {
  background: #122033;
  border-color: #33435f;
  color: #dbe8ff;
}
body[data-theme="dark"] .dropzone.drag-over {
  background: rgba(29, 78, 216, 0.12);
}
body[data-theme="dark"] .card:hover {
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.24);
}


.always-visible-aux-input {
  display:block;
  width:100%;
  margin-top:10px;
}

.field-help-inline {
  margin-top:6px;
  font-size:12px;
  color: var(--muted);
}


/* v60 agent queue status block on kanban cards */
.agent-queue-card {
  margin: 6px 0 8px;
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #dbeafe;
  background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}
.agent-queue-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.agent-queue-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #2563eb;
}
.agent-queue-label::before {
  content: "◌";
  font-size: 12px;
}
.agent-queue-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #1e3a8a;
}
.agent-status-dot {
  width: 8px;
  height: 8px;
  min-width: 8px;
  border-radius: 999px;
  background: currentColor;
  opacity: .9;
  box-shadow: 0 0 0 0 rgba(37,99,235,.45);
}
.agent-queue-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.agent-queue-meta span {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(148,163,184,.22);
  color: #516176;
  font-size: 11px;
  font-weight: 700;
}
.agent-queue-card.is-live {
  position: relative;
  overflow: hidden;
}
.agent-queue-card.is-live::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.0) 35%, rgba(255,255,255,.42) 50%, rgba(255,255,255,.0) 65%, transparent 100%);
  transform: translateX(-120%);
  animation: agentSweep 2.8s linear infinite;
  pointer-events: none;
}
.agent-queue-card.is-live .agent-status-dot {
  animation: agentPulse 1.4s ease-out infinite;
}
.agent-queue-card.is-queued {
  border-color: #bfdbfe;
  background: linear-gradient(180deg, #f8fbff 0%, #eff6ff 100%);
}
.agent-queue-card.is-calling {
  border-color: #86efac;
  background: linear-gradient(180deg, #f0fdf4 0%, #dcfce7 100%);
}
.agent-queue-card.is-calling .agent-queue-label,
.agent-queue-card.is-calling .agent-queue-status { color: #166534; }
.agent-queue-card.is-callback {
  border-color: #c4b5fd;
  background: linear-gradient(180deg, #faf5ff 0%, #f3e8ff 100%);
}
.agent-queue-card.is-callback .agent-queue-label,
.agent-queue-card.is-callback .agent-queue-status { color: #6d28d9; }
.agent-queue-card.is-busy,
.agent-queue-card.is-no-answer,
.agent-queue-card.is-failed,
.agent-queue-card.is-new {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}
.agent-queue-card.is-wrong-number,
.agent-queue-card.is-completed,
.agent-queue-card.is-answered {
  border-color: #bbf7d0;
  background: linear-gradient(180deg, #f0fdf4 0%, #ecfdf5 100%);
}
.agent-queue-card.is-paused,
.agent-queue-card.is-disabled {
  border-color: #e2e8f0;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  opacity: .92;
}
.agent-queue-card.is-paused .agent-queue-label,
.agent-queue-card.is-paused .agent-queue-status,
.agent-queue-card.is-disabled .agent-queue-label,
.agent-queue-card.is-disabled .agent-queue-status { color: #64748b; }
@keyframes agentPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.35); transform: scale(1); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); transform: scale(1.06); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); transform: scale(1); }
}
@keyframes agentSweep {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(120%); }
}
body[data-theme="dark"] .agent-queue-card {
  border-color: #2f4f7a;
  background: linear-gradient(180deg, #102033 0%, #13263b 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}
body[data-theme="dark"] .agent-queue-label,
body[data-theme="dark"] .agent-queue-status { color: #dbeafe; }
body[data-theme="dark"] .agent-queue-meta span {
  background: rgba(15,23,42,.45);
  border-color: rgba(100,116,139,.28);
  color: #b7c6dc;
}
body[data-theme="dark"] .agent-queue-card.is-calling {
  border-color: #166534;
  background: linear-gradient(180deg, #10271d 0%, #123524 100%);
}
body[data-theme="dark"] .agent-queue-card.is-callback {
  border-color: #5b21b6;
  background: linear-gradient(180deg, #211335 0%, #2d1749 100%);
}
body[data-theme="dark"] .agent-queue-card.is-paused,
body[data-theme="dark"] .agent-queue-card.is-disabled {
  border-color: #334155;
  background: linear-gradient(180deg, #0f172a 0%, #162133 100%);
}

/* v69 manual Mia launch from CRM card */
.mia-call-open-btn {
  border: 0;
  border-radius: 999px;
  padding: 9px 14px;
  background: #111827;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(17, 24, 39, 0.18);
}

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

.mia-call-modal.hidden {
  display: none;
}

.mia-call-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.mia-call-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(3px);
}

.mia-call-modal-box {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.30);
  overflow: hidden;
}

.mia-call-modal-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  background: linear-gradient(135deg, rgba(17, 24, 39, 0.04), rgba(59, 130, 246, 0.06));
}

.mia-call-modal-head strong {
  display: block;
  font-size: 18px;
  color: #111827;
  margin-bottom: 4px;
}

.mia-call-modal-head span {
  display: block;
  color: #64748b;
  font-size: 13px;
}

.mia-call-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: rgba(15, 23, 42, 0.08);
  color: #111827;
  cursor: pointer;
}

.mia-call-form {
  padding: 22px 24px 24px;
}

.mia-call-form label {
  display: block;
  font-weight: 700;
  color: #111827;
  margin-bottom: 8px;
}

.mia-call-form textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  border: 1px solid rgba(148, 163, 184, 0.45);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  color: #111827;
  outline: none;
}

.mia-call-form textarea:focus {
  border-color: rgba(59, 130, 246, 0.75);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}

.mia-call-form-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.mia-call-status {
  margin-top: 14px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
}

.mia-call-status.is-loading {
  background: rgba(59, 130, 246, 0.10);
  color: #1d4ed8;
}

.mia-call-status.is-ok {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.mia-call-status.is-error {
  background: rgba(239, 68, 68, 0.12);
  color: #b91c1c;
}

.mia-call-actions {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
}

.mia-call-submit-btn,
.mia-call-cancel-btn {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 800;
  cursor: pointer;
}

.mia-call-submit-btn {
  background: #111827;
  color: #ffffff;
}

.mia-call-submit-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}

.mia-call-cancel-btn {
  background: rgba(15, 23, 42, 0.08);
  color: #334155;
}

body[data-theme="dark"] .mia-call-modal-box {
  background: #111827;
  color: #e5e7eb;
}

body[data-theme="dark"] .mia-call-modal-head {
  background: rgba(255, 255, 255, 0.04);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .mia-call-modal-head strong,
body[data-theme="dark"] .mia-call-form label {
  color: #f8fafc;
}

body[data-theme="dark"] .mia-call-form textarea {
  background: #0f172a;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.35);
}

/* v70 simple manual agent call UI: compact button + clean task dialog */
.deal-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mia-call-open-btn,
button.mia-call-open-btn {
  width: auto !important;
  min-width: 0 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  padding: 10px 14px !important;
  border-radius: 12px !important;
  border: 1px solid #d6e0f0 !important;
  background: #ffffff !important;
  color: #2f6dff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer;
  transform: none !important;
  filter: none !important;
}

.mia-call-open-btn:hover,
button.mia-call-open-btn:hover {
  background: #f7fbff !important;
  border-color: #bcd1ff !important;
  color: #1f5eff !important;
}

.mia-call-modal.hidden {
  display: none !important;
}

.mia-call-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
}

.mia-call-modal-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: none !important;
}

.mia-call-modal-box {
  position: relative !important;
  width: min(520px, calc(100vw - 32px)) !important;
  background: #ffffff !important;
  border: 1px solid #e4ecf7 !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24) !important;
  overflow: hidden !important;
}

.mia-call-modal-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 18px 20px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #edf2f7 !important;
}

.mia-call-modal-head strong {
  display: block !important;
  margin: 0 0 5px !important;
  color: #162033 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

.mia-call-modal-head span {
  display: block !important;
  color: #6f7d90 !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

.mia-call-close-btn,
button.mia-call-close-btn {
  width: 36px !important;
  height: 36px !important;
  min-width: 36px !important;
  padding: 0 !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px !important;
  border: 1px solid #d6e0f0 !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 16px !important;
  font-weight: 800 !important;
  box-shadow: none !important;
}

.mia-call-close-btn:hover,
button.mia-call-close-btn:hover {
  background: #f8fafc !important;
}

.mia-call-form {
  padding: 18px 20px 20px !important;
}

.mia-call-form label {
  display: block !important;
  margin: 0 0 8px !important;
  color: #334155 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

.mia-call-form textarea,
textarea#miaTaskText {
  width: 100% !important;
  min-height: 130px !important;
  max-height: 260px !important;
  resize: vertical !important;
  box-sizing: border-box !important;
  padding: 12px 13px !important;
  border: 1px solid #d8e1ef !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #162033 !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-family: inherit !important;
  outline: none !important;
}

.mia-call-form textarea:focus,
textarea#miaTaskText:focus {
  border-color: #6ba2ff !important;
  box-shadow: 0 0 0 3px rgba(107, 162, 255, 0.15) !important;
}

.mia-call-form-hint {
  display: none !important;
}

.mia-call-status {
  margin-top: 12px !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

.mia-call-status.hidden {
  display: none !important;
}

.mia-call-status.is-loading {
  background: rgba(59, 130, 246, 0.10) !important;
  color: #1d4ed8 !important;
}

.mia-call-status.is-ok {
  background: rgba(34, 197, 94, 0.12) !important;
  color: #15803d !important;
}

.mia-call-status.is-error {
  background: rgba(239, 68, 68, 0.12) !important;
  color: #b91c1c !important;
}

.mia-call-actions {
  margin-top: 14px !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
}

.mia-call-submit-btn,
button.mia-call-submit-btn {
  width: auto !important;
  min-width: 120px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 11px 18px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

.mia-call-submit-btn:hover,
button.mia-call-submit-btn:hover {
  filter: brightness(0.98) !important;
}

.mia-call-submit-btn:disabled,
button.mia-call-submit-btn:disabled {
  opacity: 0.65 !important;
  cursor: wait !important;
}

body[data-theme="dark"] .mia-call-open-btn,
body[data-theme="dark"] button.mia-call-open-btn {
  background: #111827 !important;
  border-color: #263247 !important;
  color: #93c5fd !important;
}

body[data-theme="dark"] .mia-call-modal-box,
body[data-theme="dark"] .mia-call-modal-head {
  background: #111827 !important;
  border-color: #263247 !important;
}

body[data-theme="dark"] .mia-call-modal-head strong,
body[data-theme="dark"] .mia-call-form label {
  color: #f8fafc !important;
}

body[data-theme="dark"] .mia-call-modal-head span {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .mia-call-close-btn,
body[data-theme="dark"] button.mia-call-close-btn {
  background: #0f172a !important;
  border-color: #263247 !important;
  color: #cbd5e1 !important;
}

body[data-theme="dark"] .mia-call-form textarea,
body[data-theme="dark"] textarea#miaTaskText {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}

/* v71 compact agent call UI fix: keep original CRM card design, only compact controls */
.deal-head-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.deal-head-actions .mia-call-open-btn,
.deal-head-actions button.mia-call-open-btn {
  width: auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 38px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 16px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transform: none !important;
  filter: none !important;
}

.deal-head-actions .mia-call-open-btn:hover,
.deal-head-actions button.mia-call-open-btn:hover {
  filter: brightness(0.98) !important;
}

#miaCallModal.hidden {
  display: none !important;
}

#miaCallModal.mia-call-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
}

#miaCallModal .mia-call-modal-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: none !important;
}

#miaCallModal .mia-call-modal-box {
  position: relative !important;
  width: min(460px, calc(100vw - 32px)) !important;
  max-width: 460px !important;
  background: #ffffff !important;
  border: 1px solid #e7edf7 !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24) !important;
  overflow: hidden !important;
}

#miaCallModal .mia-call-modal-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 14px !important;
  padding: 18px 20px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #edf2f7 !important;
}

#miaCallModal .mia-call-modal-head strong {
  display: block !important;
  margin: 0 0 4px !important;
  color: #1f2937 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

#miaCallModal .mia-call-modal-head span {
  display: block !important;
  color: #7a8699 !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

#miaCallModal .mia-call-close-btn,
#miaCallModal button.mia-call-close-btn {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border-radius: 12px !important;
  border: 1px solid #d8e1ef !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 15px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

#miaCallModal .mia-call-close-btn:hover,
#miaCallModal button.mia-call-close-btn:hover {
  background: #f8fafc !important;
}

#miaCallModal .mia-call-form {
  padding: 18px 20px 20px !important;
}

#miaCallModal .mia-call-form label {
  display: block !important;
  margin: 0 0 8px !important;
  color: #1f2937 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

#miaCallModal .mia-call-form textarea,
#miaCallModal textarea#miaTaskText {
  width: 100% !important;
  min-height: 118px !important;
  max-height: 240px !important;
  resize: vertical !important;
  box-sizing: border-box !important;
  padding: 12px 13px !important;
  border: 1px solid #d8e1ef !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #1f2937 !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-family: inherit !important;
  outline: none !important;
}

#miaCallModal .mia-call-form textarea:focus,
#miaCallModal textarea#miaTaskText:focus {
  border-color: #6ba2ff !important;
  box-shadow: 0 0 0 3px rgba(107, 162, 255, 0.15) !important;
}

#miaCallModal .mia-call-status.hidden {
  display: none !important;
}

#miaCallModal .mia-call-status {
  margin-top: 12px !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
}

#miaCallModal .mia-call-actions {
  margin-top: 14px !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
}

#miaCallModal .mia-call-submit-btn,
#miaCallModal button.mia-call-submit-btn {
  width: auto !important;
  min-width: 112px !important;
  max-width: none !important;
  height: 38px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 18px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%) !important;
  color: #ffffff !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

#miaCallModal .mia-call-submit-btn:disabled,
#miaCallModal button.mia-call-submit-btn:disabled {
  opacity: 0.65 !important;
  cursor: wait !important;
}

body[data-theme="dark"] #miaCallModal .mia-call-modal-box,
body[data-theme="dark"] #miaCallModal .mia-call-modal-head {
  background: #111827 !important;
  border-color: #263247 !important;
}

body[data-theme="dark"] #miaCallModal .mia-call-modal-head strong,
body[data-theme="dark"] #miaCallModal .mia-call-form label {
  color: #f8fafc !important;
}

body[data-theme="dark"] #miaCallModal .mia-call-modal-head span {
  color: #94a3b8 !important;
}

body[data-theme="dark"] #miaCallModal .mia-call-close-btn,
body[data-theme="dark"] #miaCallModal button.mia-call-close-btn {
  background: #0f172a !important;
  border-color: #263247 !important;
  color: #cbd5e1 !important;
}

body[data-theme="dark"] #miaCallModal .mia-call-form textarea,
body[data-theme="dark"] #miaCallModal textarea#miaTaskText {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}


/* v72 agent call dialog: compact button + separate task form */
.deal-head-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 10px !important;
}

.deal-head-actions .mia-call-open-btn,
.deal-head-actions button.mia-call-open-btn {
  width: auto !important;
  min-width: 0 !important;
  max-width: 180px !important;
  height: 38px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 16px !important;
  border-radius: 12px !important;
  border: 0 !important;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%) !important;
  color: #ffffff !important;
  font-size: 13px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  box-shadow: none !important;
  cursor: pointer !important;
  transform: none !important;
}

.mia-call-modal.hidden {
  display: none !important;
}

.mia-call-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 10000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 24px !important;
}

.mia-call-modal-backdrop {
  position: absolute !important;
  inset: 0 !important;
  background: rgba(15, 23, 42, 0.42) !important;
  backdrop-filter: none !important;
}

.mia-call-modal-box {
  position: relative !important;
  width: min(520px, calc(100vw - 32px)) !important;
  background: #ffffff !important;
  border: 1px solid #e4ecf7 !important;
  border-radius: 18px !important;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24) !important;
  overflow: hidden !important;
}

.mia-call-modal-head {
  display: flex !important;
  align-items: flex-start !important;
  justify-content: space-between !important;
  gap: 16px !important;
  padding: 18px 20px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #edf2f7 !important;
}

.mia-call-modal-head strong {
  display: block !important;
  margin: 0 0 5px !important;
  color: #162033 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  line-height: 1.2 !important;
}

.mia-call-modal-head span {
  display: block !important;
  color: #6f7d90 !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

.mia-call-close-btn,
button.mia-call-close-btn {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  padding: 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 12px !important;
  border: 1px solid #d6e0f0 !important;
  background: #ffffff !important;
  color: #475569 !important;
  font-size: 17px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

.mia-call-form {
  padding: 18px 20px 20px !important;
}

.mia-call-form label {
  display: block !important;
  margin: 0 0 8px !important;
  color: #334155 !important;
  font-size: 14px !important;
  font-weight: 800 !important;
}

.mia-call-form textarea,
textarea#miaTaskText {
  width: 100% !important;
  min-height: 132px !important;
  max-height: 260px !important;
  resize: vertical !important;
  box-sizing: border-box !important;
  padding: 12px 13px !important;
  border: 1px solid #d8e1ef !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  color: #162033 !important;
  font-size: 14px !important;
  line-height: 1.5 !important;
  font-family: inherit !important;
  outline: none !important;
}

.mia-call-form textarea:focus,
textarea#miaTaskText:focus {
  border-color: #6ba2ff !important;
  box-shadow: 0 0 0 3px rgba(107, 162, 255, 0.15) !important;
}

.mia-call-actions {
  margin-top: 14px !important;
  display: flex !important;
  justify-content: flex-end !important;
  align-items: center !important;
  gap: 10px !important;
}

.mia-call-actions .mia-call-cancel-btn,
.mia-call-actions .mia-call-submit-btn,
.mia-call-actions button.mia-call-cancel-btn,
.mia-call-actions button.mia-call-submit-btn {
  width: auto !important;
  min-width: 104px !important;
  max-width: 160px !important;
  height: 40px !important;
  flex: 0 0 auto !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 16px !important;
  border-radius: 12px !important;
  font-size: 14px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  box-shadow: none !important;
}

.mia-call-actions .mia-call-cancel-btn,
.mia-call-actions button.mia-call-cancel-btn {
  border: 1px solid #d6e0f0 !important;
  background: #ffffff !important;
  color: #475569 !important;
}

.mia-call-actions .mia-call-submit-btn,
.mia-call-actions button.mia-call-submit-btn {
  border: 0 !important;
  background: linear-gradient(180deg, #5c95ff 0%, #407eff 100%) !important;
  color: #ffffff !important;
}

.mia-call-status.hidden { display: none !important; }

body[data-theme="dark"] .mia-call-modal-box,
body[data-theme="dark"] .mia-call-modal-head {
  background: #111827 !important;
  border-color: #263247 !important;
}

body[data-theme="dark"] .mia-call-modal-head strong,
body[data-theme="dark"] .mia-call-form label {
  color: #f8fafc !important;
}

body[data-theme="dark"] .mia-call-modal-head span {
  color: #94a3b8 !important;
}

body[data-theme="dark"] .mia-call-close-btn,
body[data-theme="dark"] button.mia-call-close-btn,
body[data-theme="dark"] .mia-call-actions .mia-call-cancel-btn,
body[data-theme="dark"] .mia-call-actions button.mia-call-cancel-btn {
  background: #0f172a !important;
  border-color: #263247 !important;
  color: #cbd5e1 !important;
}

body[data-theme="dark"] .mia-call-form textarea,
body[data-theme="dark"] textarea#miaTaskText {
  background: #0f172a !important;
  color: #e5e7eb !important;
  border-color: #334155 !important;
}


/* v73 agent dialog visibility fix: keep dialog hidden until button click */
#miaCallModal.mia-call-modal.hidden,
#miaCallModal.hidden,
.mia-call-modal.hidden,
#miaCallModal[aria-hidden="true"].mia-call-modal {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

#miaCallModal.mia-call-modal:not(.hidden) {
  display: flex !important;
  visibility: visible !important;
  pointer-events: auto !important;
}

/* v74 voice input for comments and agent task fields */
.voice-input-wrap {
  position: relative !important;
  width: 100% !important;
}

.voice-input-wrap textarea {
  padding-right: 52px !important;
}

.speech-mic-btn,
button.speech-mic-btn {
  position: absolute !important;
  right: 10px !important;
  bottom: 10px !important;
  width: 34px !important;
  min-width: 34px !important;
  max-width: 34px !important;
  height: 34px !important;
  flex: 0 0 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0 !important;
  border: 1px solid #d6e0f0 !important;
  border-radius: 12px !important;
  background: #ffffff !important;
  color: #407eff !important;
  font-size: 16px !important;
  line-height: 1 !important;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08) !important;
  cursor: pointer !important;
  z-index: 2 !important;
  transform: none !important;
}

.speech-mic-btn:hover,
button.speech-mic-btn:hover {
  background: #f8fbff !important;
  border-color: #8fb8ff !important;
  filter: none !important;
}

.speech-mic-btn.is-listening,
button.speech-mic-btn.is-listening {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
  animation: speechMicPulse 1.15s ease-in-out infinite !important;
}

.speech-mic-btn.is-disabled,
button.speech-mic-btn.is-disabled,
.speech-mic-btn:disabled,
button.speech-mic-btn:disabled {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  animation: none !important;
}

@keyframes speechMicPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.34); }
  70% { box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.comment-compose-form .voice-input-wrap {
  margin-bottom: 10px !important;
}

#miaCallModal .voice-input-wrap {
  margin: 0 !important;
}

body[data-theme="dark"] .speech-mic-btn,
body[data-theme="dark"] button.speech-mic-btn {
  background: #0f172a !important;
  border-color: #263247 !important;
  color: #93c5fd !important;
  box-shadow: none !important;
}

body[data-theme="dark"] .speech-mic-btn:hover,
body[data-theme="dark"] button.speech-mic-btn:hover {
  background: #111827 !important;
  border-color: #3b82f6 !important;
}

body[data-theme="dark"] .speech-mic-btn.is-listening,
body[data-theme="dark"] button.speech-mic-btn.is-listening {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: #ffffff !important;
}
