html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Dual-thumb range slider (one track, two toggles) */
.dual-range { position: relative; height: 24px; }
.dual-range-track { position: absolute; left: 0; right: 0; top: 50%; margin-top: -4px; height: 8px; background: var(--bs-secondary-bg, #e9ecef); border-radius: 4px; }
.dual-range-fill { position: absolute; top: 50%; margin-top: -4px; height: 8px; background: rgba(13, 110, 253, 0.35); border-radius: 4px; pointer-events: none; }
.dual-range input[type="range"] { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 24px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; pointer-events: none; }
.dual-range input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #0d6efd; pointer-events: auto; cursor: pointer; border: 0; }
.dual-range input[type="range"]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #0d6efd; pointer-events: auto; cursor: pointer; border: 0; }
.dual-range input[type="range"]::-webkit-slider-runnable-track { background: transparent; height: 8px; }
.dual-range input[type="range"]::-moz-range-track { background: transparent; height: 8px; }

/* Employee count distribution histogram */
.employee-distribution { width: 100%; }
.employee-distribution-bars { display: flex; align-items: flex-end; gap: 2px; height: 48px; background: var(--bs-secondary-bg, #e9ecef); border-radius: 4px; padding: 4px; }
.employee-distribution-bar { flex: 1; min-width: 4px; background: rgba(13, 110, 253, 0.5); border-radius: 2px; min-height: 2px; transition: height 0.15s ease; }
.employee-distribution-bar:hover { background: rgba(13, 110, 253, 0.8); }
.employee-distribution-labels { display: flex; justify-content: space-between; margin-top: 2px; }

.revenue-distribution { width: 100%; }
.revenue-distribution-bars { display: flex; align-items: flex-end; gap: 2px; height: 48px; background: var(--bs-secondary-bg, #e9ecef); border-radius: 4px; padding: 4px; }
.revenue-distribution-bar { flex: 1; min-width: 4px; background: rgba(13, 110, 253, 0.5); border-radius: 2px; min-height: 2px; transition: height 0.15s ease; }
.revenue-distribution-bar:hover { background: rgba(13, 110, 253, 0.8); }
.revenue-distribution-labels { display: flex; justify-content: space-between; margin-top: 2px; }

/* Search filter boxes: curved border with header over the border (hr-style) */
.filter-box {
  border: 1px solid var(--bs-border-color, #dee2e6);
  border-radius: 0.5rem;
  padding: 0.75rem 0.75rem 0.5rem;
  padding-top: 1rem;
  position: relative;
  background: var(--bs-body-bg, #fff);
  height: 100%;
}
.filter-box-header {
  position: absolute;
  top: -0.5em;
  left: 0.5rem;
  padding: 0 0.35rem;
  background: var(--bs-body-bg, #fff);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--bs-body-color, #212529);
  white-space: nowrap;
}
.filter-box .form-control,
.filter-box .form-select {
  margin-top: 0.25rem;
}

.filter-form-wrapper {
  position: relative;
}

/* Insights box: in normal flow between filter form and company list; map and charts side by side on md+ */
.insights-box {
  width: 100%;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}
.insights-box-row {
  margin-top: 0.25rem;
  align-items: center;
}
.filter-box-subheader {
  position: static;
  display: block;
  margin: 0 0 0.25rem 0;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--bs-body-color, #212529);
  background: transparent;
}
.insights-section {
  position: relative;
}
/* Horizontal distribution bars in Insights: one row, grey track, blue segments, axis below */
.insights-distribution {
  width: 100%;
}
.insights-distribution-bars {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  height: 24px;
  gap: 2px;
  background: var(--bs-secondary-bg, #e9ecef);
  border-radius: 4px;
  padding: 2px 4px;
}
.insights-distribution-bar {
  min-width: 2px;
  background: rgba(13, 110, 253, 0.6);
  border-radius: 2px;
  transition: background 0.15s ease;
}
.insights-distribution-bar:hover {
  background: rgba(13, 110, 253, 0.85);
}
.insights-distribution-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 0.75rem;
}

/* Map scale toggle: Country | Region | City */
.companies-map-scale-toggle {
  margin-bottom: 0.35rem;
}
.companies-map-scale-toggle .btn {
  font-size: 0.8rem;
}

/* Company density map in Insights */
.companies-density-map {
  width: 100%;
  height: 280px;
  border-radius: 4px;
  background: var(--bs-secondary-bg, #e9ecef);
  z-index: 0;
}
.companies-density-map .leaflet-container {
  font: inherit;
}
.companies-map-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}
.companies-map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.companies-map-legend .legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.15);
}
.companies-map-zoom-hint {
  min-height: 1.2em;
}

/* Settings page: help icon next to labels */
.settings-help-icon,
.settings-help-icon-inline {
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
  margin-left: 0.2rem;
  color: var(--bs-secondary);
  cursor: help;
}
.settings-help-icon:hover,
.settings-help-icon-inline:hover {
  color: var(--bs-primary);
}
.form-check .settings-help-icon-inline {
  margin-left: 0.35rem;
}

/* Data tables: equal column widths (explicit th/td widths and col/colgroup still override) */
.table {
  table-layout: fixed;
  width: 100%;
}

.table th,
.table td {
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* Marketing stage attachments list: under global table-layout:fixed, reserve space for Test + Actions
   so row buttons do not overflow into adjacent columns */
.stage-attachments-table col.stage-attachments-col-test {
  width: 5.25rem;
}

.stage-attachments-table col.stage-attachments-col-actions {
  width: 14rem;
}

.stage-attachments-table .stage-attachments-actions-col {
  vertical-align: middle;
}

.stage-attachments-table .stage-attachments-test-col {
  vertical-align: middle;
}

/* Marketing run details: main items table — correspondence gets most horizontal space */
.marketing-run-items-table {
  table-layout: fixed;
  width: 100%;
}

.marketing-run-items-table th.marketing-run-correspondence-col,
.marketing-run-items-table td.marketing-run-correspondence-col {
  width: 70%;
}

/* Marketing run details: nested correspondence grid — readable recipient column */
.marketing-run-correspondence-nested th.correspondence-email-col,
.marketing-run-correspondence-nested td.correspondence-email-col {
  min-width: 14rem;
  max-width: 40rem;
  vertical-align: middle;
}

.marketing-run-correspondence-nested .correspondence-email-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Full-page success flash (TempData + client-side); visible from any scroll position */
.ahlh-flash-overlay {
  position: fixed;
  inset: 0;
  z-index: 10800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.38);
  opacity: 0;
  transition: opacity 0.35s ease;
  cursor: pointer;
}

.ahlh-flash-overlay--visible {
  opacity: 1;
}

.ahlh-flash-overlay--hiding {
  opacity: 0;
}

.ahlh-flash-panel {
  max-width: 28rem;
  width: 100%;
  cursor: default;
  font-size: 1.05rem;
  line-height: 1.45;
}

.ahlh-flash-error-body {
  max-height: min(70vh, 24rem);
  overflow-y: auto;
}

/* Settings nav: section headers (AI / IAM) stand out from the dark dropdown */
.dropdown-menu-dark > li.settings-dropdown-section {
  background-color: rgba(255, 255, 255, 0.12);
}
