@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f4f7fb;
  --paper: #ffffff;
  --ink: #0f2745;
  --muted: #5d6d84;
  --line: #dbe4ef;
  --primary: #163f73;
  --primary-2: #1f5495;
  --accent: #c1121f;
  --accent-2: #e01e2d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 100% 0%, #eaf1fb 0%, transparent 45%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: "Manrope", "Segoe UI", sans-serif;
}

.container { max-width: 1380px; margin: 0 auto; padding: 24px; }

h1 { margin: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: transparent;
  border: 0;
  box-shadow: none;
  margin-bottom: 6px;
  padding: 0;
}
.title-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.topbar h1 {
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  font-size: clamp(24px, 2.05vw, 38px);
  line-height: 1.02;
  margin-bottom: 0;
}
body.locale-ru .topbar h1 {
  font-size: clamp(22px, 1.7vw, 32px);
}

.login-wrap {
  max-width: 480px;
  margin: 80px auto 0;
}

.login-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.login-error {
  color: #b4232f;
  font-weight: 600;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.version-link {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
  border: 1px solid #c8d6ea;
  border-radius: 8px;
  padding: 6px 10px;
  background: #eef4fc;
  flex: 0 0 auto;
}
.version-link:hover {
  background: var(--primary);
  color: #fff;
}
.lang-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}
.lang-select {
  width: auto;
  min-width: 74px;
  padding: 8px 10px;
  margin: 0;
}
.login-lang-box {
  justify-content: flex-end;
  margin-bottom: 10px;
}

.auth-box #authStatusText {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

h1 {
  margin: 0 0 14px;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--ink);
}
h2 { margin: 0 0 12px; font-size: 30px; letter-spacing: -0.015em; }
h3 { margin: 0 0 10px; color: var(--ink); }
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.section-header-row h2 {
  margin: 0;
  margin-right: auto;
}
.section-snapshot-badge {
  border: 1px solid #c9d9ee;
  background: #f5f9ff;
  color: #294f7a;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.section-snapshot-badge:hover {
  background: #1f4f86;
  color: #fff;
}
.section-help-btn {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border: 1px solid #2c5f98;
  background: #eef5fd;
  color: #1f4f86;
  font-weight: 800;
}
.section-help-btn:hover {
  background: #1f4f86;
  color: #fff;
}

section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 1px 2px rgba(10, 30, 60, 0.03);
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  position: relative;
  z-index: 20;
  gap: 8px;
  margin-bottom: 12px;
  width: 100%;
  background: linear-gradient(180deg, #f6f9fd 0%, #f1f6fc 100%);
  border: 1px solid #d5e0ee;
  border-radius: 14px;
  padding: 10px 14px;
  box-shadow: 0 1px 3px rgba(10, 30, 60, 0.05);
  overflow: visible;
}

.tab-btn {
  background: #e9f0f8;
  color: var(--primary);
  border: 1px solid #d8e2ef;
  flex: 0 0 auto;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.tab-btn.howto-btn {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
}
.tab-menu {
  position: relative;
  flex: 0 0 auto;
  padding-bottom: 6px;
  margin-bottom: -6px;
}
.tab-menu-btn {
  position: relative;
  padding-right: 24px;
}
.tab-menu-btn::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-48%);
  font-size: 12px;
  opacity: 0.85;
}
.tab-menu-list {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #cfdced;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(10, 30, 60, 0.12);
  padding: 6px;
  z-index: 120;
}
.tab-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
  cursor: pointer;
}
.tab-menu-group-title {
  font-size: 12px;
  font-weight: 800;
  color: #5d6d84;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px 4px;
  margin-top: 2px;
}
.tab-menu-item:hover {
  background: #eef5fd;
  color: var(--primary);
}
.tab-menu.open .tab-menu-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--primary-2);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.link-btn:hover {
  color: var(--primary);
}
.settings-key-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.settings-desc-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.settings-desc-text {
  flex: 1 1 auto;
}
.settings-help-btn {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
  background: #e9f0f8;
  color: var(--primary);
  border: 1px solid #c7d7ea;
}
.settings-help-btn:hover {
  background: var(--primary);
  color: #fff;
}
.tab-btn.howto-btn:hover {
  background: var(--accent-2);
  border-color: var(--accent-2);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; background: transparent; border: 0; padding: 0; margin: 0; }

.controls {
  display: flex;
  gap: 12px;
  row-gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin: 14px 0;
}
.bulk-controls {
  flex-wrap: wrap;
  align-items: center;
}
.bulk-controls > button,
.bulk-controls > select,
.bulk-controls > input {
  flex: 0 0 auto;
}
.bulk-controls #bulkActionSelect,
.bulk-controls #bulkOwnerValue,
.bulk-controls #bulkStatusValue {
  min-width: 180px;
  width: auto;
}
.bulk-controls #leadSelectionInfo {
  margin-left: 0;
  margin-bottom: 0;
  flex: 1 1 100%;
  text-align: right;
}
.bulk-controls #workModeInfo {
  flex: 1 1 100%;
  text-align: right;
}
.leads-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 14px;
  align-items: stretch;
  margin: 4px 0 16px;
}
.leads-table-actions,
.leads-admin-action {
  border: 1px solid #dbe6f3;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px;
}
.leads-table-actions {
  display: grid;
  gap: 8px;
}
.leads-top-row .controls {
  margin: 0;
}
.leads-admin-action {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}
.leads-admin-action #processSnapshotBtn {
  margin: 0;
}
.leads-admin-action #leadGenerationStatus {
  max-width: 100%;
  text-align: right;
  line-height: 1.35;
}
.leads-table-actions .work-controls {
  justify-content: space-between;
}
.leads-table-actions .work-controls #workModeInfo {
  flex: 1 1 auto;
  min-width: 180px;
}
.leads-table-actions .work-controls #leadSelectionInfo {
  margin-left: auto;
  text-align: right;
  white-space: nowrap;
}
.leads-filter-panel {
  padding: 10px 0 4px;
  border-top: 1px solid #e5edf6;
}
@media (max-width: 760px) {
  .leads-top-row {
    grid-template-columns: 1fr;
  }
  .leads-admin-action {
    align-items: stretch;
  }
  .leads-admin-action #leadGenerationStatus {
    max-width: none;
    text-align: left;
  }
  .leads-table-actions .work-controls {
    justify-content: flex-start;
  }
  .leads-table-actions .work-controls #leadSelectionInfo {
    margin-left: 0;
    text-align: left;
  }
}
.controls button {
  margin: 6px 0;
}
.controls select {
  width: auto;
}
.controls #snapshotSelect {
  flex: 1;
  min-width: 260px;
}
.runs-controls {
  padding: 8px 10px;
  border: 1px solid #d6e0ec;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(15, 39, 69, 0.06);
}
.runs-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  width: 100%;
}
.runs-toolbar-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.runs-toolbar-group-main {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}
.runs-toolbar-group-main #snapshotSelect {
  width: 100%;
  min-width: 260px;
}
.changelog-current-line {
  flex-wrap: nowrap;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px minmax(280px, 1fr);
  align-items: center;
  gap: 8px;
}
.changelog-current-line input {
  background: #f2f6fb;
  color: var(--ink);
  font-weight: 700;
}
.changelog-current-line #changelogCurrentVersion {
  cursor: pointer;
}
.changelog-current-line #changelogCurrentTitle {
  cursor: pointer;
}
@media (max-width: 980px) {
  .runs-toolbar-group-main {
    grid-template-columns: 1fr;
  }
  .changelog-current-line {
    grid-template-columns: 1fr;
  }
  .changelog-current-line #changelogCurrentVersion,
  .changelog-current-line #changelogCurrentTitle {
    width: 100%;
  }
}

.run-status {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  border-left: 4px solid var(--accent);
}

.run-status strong { color: var(--primary); }

.run-stages-block {
  margin-top: 10px;
}
.run-stages-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.run-stages-header h3 {
  margin: 0;
}
.run-stages-body {
  margin-top: 10px;
}
.run-stages-body td:last-child,
.run-stages-body th:last-child {
  text-align: right;
  white-space: nowrap;
}
.run-stage-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.run-stage-dot.pending { background: #9aa8b8; }
.run-stage-dot.running { background: #f1c232; }
.run-stage-dot.success { background: #2ea043; }
.run-stage-dot.error { background: #c1121f; }
.run-stage-dot.cancelled { background: #7a8795; }
#runStagesTable th:first-child,
#runStagesTable td:first-child {
  width: 80px;
  text-align: center;
}

.progress-wrap {
  width: 100%;
  height: 10px;
  background: #e3ebf4;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.35s ease;
}

.progress-bar.indeterminate {
  width: 35%;
  animation: progress-indeterminate 1.2s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}

button {
  border: 0;
  background: var(--primary);
  color: white;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.04s ease;
  white-space: nowrap;
}
button:hover {
  background: var(--primary-2);
  color: #fff;
}
button:active { transform: translateY(1px); }

#loadDataMenuBtn,
#saveRecalcBtn,
#downloadXlsxBtn {
  background: var(--accent);
}
#loadDataMenuBtn:hover,
#saveRecalcBtn:hover,
#downloadXlsxBtn:hover {
  background: var(--accent-2);
}

.run-source-menu {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.run-source-menu::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}
.run-source-menu .menu-btn {
  padding-right: 28px;
}
.run-source-menu .menu-btn::after {
  content: "▾";
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-48%);
  font-size: 12px;
  opacity: 0.9;
}
.run-source-menu-list {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 220px;
  background: #fff;
  border: 1px solid #cfdced;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(10, 30, 60, 0.12);
  padding: 6px;
  z-index: 45;
}
.run-source-menu-list.hidden {
  display: none;
}
.run-source-item {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 10px;
}
.run-source-item:hover {
  background: #eef5fd;
  color: var(--primary);
}

.settings-form {
  display: grid;
  grid-template-columns: minmax(220px, 360px);
  gap: 14px;
  max-width: 520px;
}
.settings-form label {
  display: grid;
  gap: 6px;
  font-weight: 600;
}
.settings-form input:not([type="checkbox"]) {
  width: 100%;
}
.checkbox-label {
  display: inline-flex !important;
  grid-template-columns: none !important;
  align-items: center;
  gap: 8px !important;
  width: fit-content;
}
.checkbox-label input {
  width: auto;
}
.settings-fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.settings-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
}

.small-btn {
  padding: 6px 8px;
  font-size: 12px;
  margin-right: 4px;
  border-radius: 8px;
  background: #1f5495;
}
.small-btn.danger-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.small-btn.danger-btn:hover {
  background: var(--accent-2);
  color: #fff;
}
.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 110px;
}
.actions-cell .small-btn {
  margin-right: 0;
}
.reasons-cell {
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.doc-render {
  width: 100%;
  max-width: 100%;
  border: 1px solid #d5e0ee;
  border-radius: 12px;
  padding: 14px 16px;
  background: #fbfdff;
}
.doc-render h2,
.doc-render h3,
.doc-render h4 {
  margin: 0 0 8px;
}
.doc-render p {
  margin: 0 0 8px;
}
.doc-render ul {
  margin: 0 0 10px 20px;
}
.actions-menu { position: relative; }
.actions-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  min-width: 132px;
  background: #fff;
  border: 1px solid #ccd8e7;
  border-radius: 10px;
  box-shadow: 0 8px 20px rgba(10, 30, 60, 0.12);
  z-index: 20000;
  padding: 4px;
}
.actions-dropdown.hidden { display: none; }
.hidden { display: none !important; }
.dropdown-item {
  display: block;
  width: 100%;
  text-align: left;
  border-radius: 8px;
  padding: 8px 10px;
  margin: 0;
  background: transparent;
  color: var(--ink);
}
.dropdown-item:hover {
  background: #eef5fd;
  color: var(--primary);
}

.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.chip-high { background: #dff5e8; color: #14532d; border: 1px solid #93e4b0; }
.chip-med { background: #fff4db; color: #8a5a10; border: 1px solid #ffd08a; }
.chip-low { background: #fde8e8; color: #8f2323; border: 1px solid #f6b3b3; }
.chip-open { background: #fff4db; color: #8a5a10; border: 1px solid #ffd08a; }
.chip-done { background: #dff5e8; color: #14532d; border: 1px solid #93e4b0; }

.file-label {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.file-label input { display: none; }

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: visible;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
#leadsTable {
  min-width: 0;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  overflow: visible !important;
}
#leadsTable th,
#leadsTable td {
  font-size: 11px;
  padding: 6px 5px;
}
#leadsTable th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#leadsTable td {
  overflow: hidden;
  text-overflow: ellipsis;
}
#leadsTable td:last-child {
  overflow: visible;
  position: relative;
  z-index: 200;
}
#leadsTableWrap {
  overflow: visible !important;
}
.actions-menu,
.actions-dropdown {
  overflow: visible;
}
#leadsTable tbody,
#leadsTable tbody tr,
#leadsTable tbody td {
  overflow: visible !important;
}
#leadsTable tbody tr {
  position: relative;
  z-index: 1;
}
#leadsTable tbody tr.row-menu-open {
  z-index: 999;
}
#leadsTable tbody tr.work-row-active td {
  background: #eef5fd;
}
#leadsTable th:nth-child(1),
#leadsTable td:nth-child(1) { width: 32px; }
#leadsTable th:nth-child(2),
#leadsTable td:nth-child(2) { width: 76px; }
#leadsTable th:nth-child(3),
#leadsTable td:nth-child(3) { width: 56px; }
#leadsTable th:nth-child(4),
#leadsTable td:nth-child(4) { width: 86px; }
#leadsTable th:nth-child(5),
#leadsTable td:nth-child(5) { width: 98px; }
#leadsTable th:nth-child(6),
#leadsTable td:nth-child(6) { width: 116px; }
#leadsTable th:nth-child(7),
#leadsTable td:nth-child(7) { width: 78px; }
#leadsTable th:nth-child(8),
#leadsTable td:nth-child(8) { width: 160px; }
#leadsTable th:nth-child(9),
#leadsTable td:nth-child(9) { width: 104px; }
#leadsTable th:nth-child(10),
#leadsTable td:nth-child(10) { width: 96px; }
#leadsTable th:nth-child(11),
#leadsTable td:nth-child(11) { width: 136px; }
#leadsTable th:nth-child(12),
#leadsTable td:nth-child(12) { width: 84px; }
#leadsTable th:nth-child(13),
#leadsTable td:nth-child(13) { width: 84px; }
#leadsTable th:nth-child(14),
#leadsTable td:nth-child(14) { width: 112px; }
#contactsTable {
  min-width: 1280px;
}
#contactsTable th {
  white-space: nowrap;
}

th, td {
  text-align: left;
  border-bottom: 1px solid #e8eef5;
  padding: 9px 10px;
  font-size: 14px;
  vertical-align: middle;
}

th {
  color: var(--primary);
  background: #f8fbff;
  font-weight: 700;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}
th.sortable:hover {
  background: #eef4fc;
}
th.sortable.active-sort::after {
  content: " " attr(data-sort-indicator);
  font-size: 11px;
  color: #5b6f8f;
}

tr:hover { background: #f7fbff; }

input,
select {
  width: 100%;
  margin-bottom: 0;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ccd8e7;
  background: #fff;
  color: var(--ink);
}
input:focus,
select:focus {
  outline: 2px solid #cfe1f7;
  border-color: #8fb2dd;
}
input[type="checkbox"] {
  width: auto;
  padding: 0;
  margin: 0;
}
.muted { color: var(--muted); }

.filters {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 8px;
  margin: 14px 0;
}
.trials-filters {
  grid-template-columns: repeat(9, minmax(0, 1fr));
}
.leads-filters {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  margin: 0 0 12px;
}
.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.chip-toggle {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #c9d8ea;
  background: #edf3fa;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}
.chip-toggle:hover {
  background: #dfeaf7;
}
.chip-toggle.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.pager {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  margin: 14px 0;
  color: var(--muted);
}
.pager label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pager select {
  width: auto;
  min-width: 86px;
}
.pager-bottom {
  margin-top: 14px;
  margin-bottom: 0;
}

.hint { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.howto-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.howto-card {
  border: 1px solid #d9e4f2;
  border-radius: 12px;
  background: #fbfdff;
  padding: 12px;
}
.howto-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}
.howto-card ol {
  margin: 0;
  padding-left: 20px;
}
.howto-card li {
  margin: 0 0 8px;
  color: #1f3656;
}
.cfg-input { margin: 0; width: 140px; }
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.kpi-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 12px;
}
.kpi-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}
.kpi-card strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
}

/* Consistent spacing between key block elements */
section > * + .controls,
section > * + .filters,
section > * + .pager,
section > * + .table-scroll,
section > * + table {
  margin-top: 12px;
}

.info-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border-radius: 50%;
  border: 1px solid #2c5f98;
  background: #eef5fd;
  color: #1f4f86;
  font-weight: 800;
  cursor: pointer;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.modal.hidden { display: none; }

.modal-content {
  width: min(900px, 92vw);
  max-height: 80vh;
  overflow: auto;
  background: white;
  border-radius: 14px;
  padding: 18px;
  position: relative;
}
.modal-content-narrow {
  width: min(560px, 92vw);
}
.modal-content-wide {
  width: min(1160px, 96vw);
}
.modal-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-actions-inline {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.modal-actions #leadActionSaveBtn {
  background: var(--accent);
}
.modal-actions #leadActionSaveBtn:hover {
  background: var(--accent-2);
}
.modal-field {
  margin-bottom: 10px;
}
.modal-field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
}
.modal-field textarea {
  width: 100%;
  min-height: 96px;
  border: 1px solid #ccd8e7;
  border-radius: 10px;
  padding: 10px;
  font-family: inherit;
  font-size: 14px;
}

.account-network-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid #d7e3f2;
  border-radius: 12px;
  background: #fbfdff;
  padding: 8px;
  margin: 6px 0 12px;
}
.account-network-svg {
  width: 100%;
  min-width: 1100px;
  height: auto;
  display: block;
}

#tplBodyInput {
  width: 100%;
  min-height: 220px;
  border: 1px solid #ccd8e7;
  border-radius: 10px;
  padding: 12px;
  font-family: inherit;
  font-size: 14px;
  margin: 8px 0 12px;
  resize: vertical;
}

.modal-close {
  position: absolute;
  right: 10px;
  top: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  border: 0;
  background: #e74d3c;
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 20px;
}

@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .trials-filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .leads-filters { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
}
@media (max-width: 760px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  th, td { font-size: 12px; }
  .tab-btn.howto-btn { margin-left: 0; }
  .howto-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .trials-filters { grid-template-columns: 1fr; }
  .leads-filters { grid-template-columns: 1fr; }
}
