:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #172026;
  --muted: #6f7d87;
  --line: #dfe6ea;
  --blue: #2563eb;
  --teal: #0f9488;
  --coral: #d45d4c;
  --compare: #a84622;
  --compare-border: #ed8d61;
  --compare-bg: #fff3ed;
  --gold: #b8872b;
  --shadow: 0 14px 34px rgba(30, 42, 52, 0.08);
  --accent-soft: rgba(15, 148, 136, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  overflow-x: hidden;
}

button,
select,
input {
  font: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 32px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}



.hidden {
  display: none !important;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

h3 {
  margin-bottom: 12px;
  font-size: 14px;
}

.source-meta,
.panel-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-button {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-width: 206px;
  height: 56px;
  border-radius: 12px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-weight: 850;
  white-space: nowrap;
}

.source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 10px 12px;
  max-width: 980px;
}

.database-sync-button {
  flex: 0 0 auto;
  min-width: 210px;
  height: 56px;
  border: 1px solid var(--teal);
  border-radius: 12px;
  padding: 0 18px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
}

.database-sync-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.pdf-export-button {
  flex: 0 0 auto;
  min-width: 210px;
  height: 56px;
  border: 1px solid #d7e1e6;
  border-radius: 12px;
  padding: 0 18px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
  white-space: nowrap;
}

.map-open-button {
  flex: 0 0 auto;
  min-width: 200px;
  height: 56px;
  border: 1px solid #bee7df;
  border-radius: 12px;
  padding: 0 18px;
  color: #0d6d64;
  background: #e9faf6;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
  white-space: nowrap;
}

.automation-status-button {
  align-self: start;
  width: 176px;
  height: 56px;
  border: 1px solid #d7e1e6;
  border-radius: 10px;
  padding: 0 18px;
  color: #172026;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-weight: 850;
  white-space: nowrap;
}

.automation-status-button:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: #f7fffd;
}

.map-open-button:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: #f7fffd;
}

.pdf-export-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.database-sync-status {
  flex: 1 0 100%;
  min-height: 14px;
  color: var(--muted);
  font-size: 11px;
  text-align: right;
}

.database-sync-status.error {
  color: var(--coral);
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.pdf-export-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
}

.pdf-export-modal.hidden {
  display: none;
}

.automation-status-modal {
  position: fixed;
  inset: 0;
  z-index: 88;
  display: grid;
  place-items: center;
  padding: 20px;
}

.automation-status-modal.hidden {
  display: none;
}

.automation-status-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 22, 30, 0.42);
  backdrop-filter: blur(5px);
}

.automation-status-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1280px, calc(100vw - 36px));
  height: min(820px, calc(100vh - 36px));
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(8, 20, 30, 0.28);
}

.automation-status-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.automation-status-head p {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.automation-status-head h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.automation-status-head span {
  color: var(--muted);
  font-size: 13px;
}

.automation-status-head button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #60717c;
  background: #fff;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.automation-status-body {
  display: grid;
  align-content: start;
  gap: 16px;
  overflow: auto;
  padding: 18px 20px 22px;
  background: #f8fbfc;
}

.automation-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.automation-kpi-grid article {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid #e2ebef;
  border-radius: 14px;
  background: #fff;
}

.automation-kpi-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.automation-kpi-grid strong {
  font-size: 28px;
  line-height: 1;
}

.automation-status-section {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid #e2ebef;
  border-radius: 14px;
  background: #fff;
}

.automation-status-section h3 {
  margin: 0;
  font-size: 15px;
}

.automation-progress-section {
  border-color: #cfe3df;
  background: #fbfefd;
}

.automation-progress-section.running {
  border-color: #84cdc3;
  box-shadow: 0 12px 28px rgba(15, 148, 136, 0.08);
}

.automation-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.automation-progress-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.automation-progress-head strong {
  color: var(--teal);
  font-size: 24px;
  line-height: 1;
}

.automation-progress-bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9f0f2;
}

.automation-progress-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0f9488, #45c6b6);
  transition: width 0.3s ease;
}

.automation-progress-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.automation-progress-grid span {
  border: 1px solid #e3ebef;
  border-radius: 10px;
  padding: 8px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.automation-progress-grid b {
  color: var(--ink);
}

.automation-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.automation-reasons span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  border: 1px solid #e3ebef;
  border-radius: 999px;
  padding: 7px 10px;
  color: #52616a;
  background: #f8fbfc;
  font-size: 12px;
  font-weight: 850;
}

.automation-reasons b {
  color: var(--ink);
}

.automation-table-wrap {
  overflow: auto;
  max-height: 390px;
  border: 1px solid #e2ebef;
  border-radius: 12px;
}

.automation-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: #fff;
}

.automation-table th,
.automation-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e9eff2;
  text-align: left;
  font-size: 12px;
  vertical-align: top;
}

.automation-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #f8fbfc;
  font-weight: 900;
  text-transform: uppercase;
}

.automation-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 8px;
  font-weight: 900;
  white-space: nowrap;
}

.automation-pill.ok {
  color: #0f5d55;
  background: #e5f7f4;
}

.automation-pill.warn {
  color: #9f3a20;
  background: #fff3ed;
}

.automation-note {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.map-modal {
  position: fixed;
  inset: 0;
  z-index: 85;
  display: grid;
  place-items: center;
  padding: 8px;
}

.map-modal.hidden {
  display: none;
}

.map-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 22, 30, 0.42);
  backdrop-filter: blur(5px);
}

.map-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1840px, calc(100vw - 16px));
  height: min(980px, calc(100vh - 16px));
  overflow: hidden;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(8, 20, 30, 0.28);
}

.map-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
}

.map-dialog-head > div:first-child {
  flex: 1 1 320px;
  min-width: 260px;
}

.map-dialog-head p {
  margin-bottom: 5px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-dialog-head h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.map-dialog-head span {
  color: var(--muted);
  font-size: 13px;
}

.map-layer-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-self: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #dbe7eb;
  border-radius: 14px;
  background: #f6fafb;
}

.map-analytics-toggle {
  flex-wrap: wrap;
  max-width: min(620px, 100%);
  background: #fff;
}

.map-layer-toggle button {
  width: auto;
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  color: #60717c;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 900;
}

.map-layer-toggle button.active {
  color: #fff;
  background: var(--teal);
  box-shadow: 0 8px 18px rgba(15, 148, 136, 0.18);
}

.map-analytics-toggle button.active {
  background: #17212b;
}

.map-period-strip {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  gap: 8px;
  width: min(560px, calc(100% - 450px));
  min-width: 300px;
  border: 1px solid #dbe7eb;
  border-radius: 14px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 38px rgba(14, 30, 40, 0.13);
  backdrop-filter: blur(10px);
}

.map-period-strip.collapsed {
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.map-period-strip:not(.collapsed) {
  transform: none;
}

.map-layer-cluster {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.94);
  border-radius: 999px;
  color: #fff;
  background: var(--cluster-color, #0f9488);
  box-shadow:
    0 8px 18px rgba(14, 30, 40, 0.22),
    0 0 0 4px rgba(255, 255, 255, 0.42);
  font-size: 14px;
  font-weight: 950;
  line-height: 1;
}

.map-layer-cluster span {
  transform: translateY(-0.5px);
}

.map-period-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  border: 1px solid #dbe7eb;
  border-radius: 14px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 38px rgba(14, 30, 40, 0.13);
  cursor: pointer;
  font: inherit;
}

.map-period-toggle span {
  color: #60717c;
  font-size: 12px;
  font-weight: 950;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.map-period-toggle strong {
  color: var(--teal);
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
}

.map-period-panel {
  display: grid;
  gap: 8px;
}

.map-period-strip.collapsed .map-period-panel {
  display: none;
}

.map-period-strip-head {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.map-period-strip-head > span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.map-dialog-head button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #60717c;
  background: #fff;
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.map-dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 0;
}

.map-canvas-embed {
  position: relative;
  min-height: 0;
  background: #eef4f5;
}

.map-analysis-overlay {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
  width: min(410px, calc(100% - 28px));
  max-height: min(78%, 560px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(217, 231, 235, 0.96);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(14, 30, 40, 0.16);
  backdrop-filter: blur(10px);
  scrollbar-width: thin;
}

.map-analysis-overlay.hidden {
  display: none;
}

.map-analysis-overlay-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.map-analysis-overlay-head p {
  margin: 0 0 2px;
  color: var(--teal);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-analysis-overlay-head h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.16;
}

.yandex-map {
  width: 100%;
  height: 100%;
  min-height: 620px;
  overflow: hidden;
  border-radius: 0 0 0 18px;
}

.map-loading-state {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 620px;
  padding: 24px;
  color: #0f5d55;
  background: #eef7f6;
  font-size: 16px;
  font-weight: 900;
  text-align: center;
}

.map-project-balloon {
  display: grid;
  gap: 8px;
  min-width: 220px;
  color: #17212b;
  font-family: inherit;
}

.map-project-balloon strong {
  font-size: 16px;
  line-height: 1.2;
}

.map-project-balloon span,
.map-project-balloon em {
  color: #60717c;
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
}

.map-project-balloon button {
  justify-self: start;
  margin-top: 4px;
  padding: 9px 12px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #0f9488;
  cursor: pointer;
  font-weight: 950;
}

.map-project-balloon button:hover {
  background: #087b73;
}

.map-project-passport {
  position: absolute;
  top: 18px;
  left: 18px;
  z-index: 3;
  display: none;
  flex-direction: column;
  width: min(390px, calc(100% - 36px));
  max-height: min(calc(100% - 36px), calc(100vh - 72px));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  touch-action: pan-y;
  border: 1px solid #d9e7eb;
  border-radius: 18px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 22px 60px rgba(14, 30, 40, 0.22);
  backdrop-filter: blur(10px);
}

.map-layer-hint {
  display: grid;
  gap: 6px;
  min-width: 210px;
  max-width: 300px;
  color: #17212b;
  font-family: inherit;
}

.map-layer-hint b {
  font-size: 15px;
  line-height: 1.15;
}

.map-layer-hint small {
  color: #60717c;
  font-size: 12px;
  font-weight: 750;
}

.map-layer-hint span {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #edf3f5;
  padding-top: 5px;
}

.map-layer-hint em {
  color: #60717c;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.map-layer-hint strong {
  font-size: 13px;
  text-align: right;
  white-space: nowrap;
}

.map-project-passport.visible {
  display: flex;
}

.map-passport-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid #dce7eb;
  border-radius: 10px;
  color: #60717c;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.map-dialog-head .map-layer-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 38px;
  border: 0;
  border-radius: 10px;
  padding: 0 14px;
  color: #60717c;
  background: transparent;
  font-size: 13px;
  line-height: 1;
}

.map-dialog-head .map-layer-toggle button.active {
  color: #fff;
  background: var(--teal);
}

.map-project-passport p {
  flex: 0 0 auto;
  margin: 0 42px 6px 0;
  color: var(--teal);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-project-passport h3 {
  flex: 0 0 auto;
  margin: 0 42px 8px 0;
  font-size: 20px;
  line-height: 1.18;
}

.map-passport-meta {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.map-passport-meta span,
.map-passport-selected {
  border-radius: 999px;
  padding: 6px 9px;
  color: #52646f;
  background: #eef6f7;
  font-size: 12px;
  font-weight: 800;
}

.map-passport-selected {
  flex: 0 0 auto;
  display: inline-block;
  margin-bottom: 12px;
  color: #9f3a20;
  background: #fff3ed;
}

.map-passport-kpis {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.map-passport-kpis div {
  min-width: 0;
  border: 1px solid #e0eaee;
  border-radius: 12px;
  padding: 10px;
  background: #fbfefd;
}

.map-passport-kpis span {
  display: block;
  margin-bottom: 4px;
  color: #70818b;
  font-size: 11px;
  font-weight: 850;
}

.map-passport-kpis b {
  color: var(--ink);
  font-size: 16px;
}

.map-passport-dashboard {
  flex: 0 0 auto;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  font-weight: 950;
}

.map-passport-corpuses {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 130px;
  overflow: hidden;
  margin-top: 14px;
}

.map-passport-corpuses h4 {
  margin: 0 0 8px;
  color: #52646f;
  font-size: 12px;
  text-transform: uppercase;
}

.map-passport-corpuses ul {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 0;
  max-height: min(300px, 36vh);
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  touch-action: pan-y;
}

.map-passport-corpuses li {
  display: grid;
  gap: 2px;
  border-top: 1px solid #edf3f5;
  padding-top: 7px;
}

.map-passport-corpuses li.selected-corpus {
  border: 1px solid rgba(15, 148, 136, 0.42);
  border-left: 5px solid var(--teal);
  border-radius: 12px;
  padding: 9px 10px;
  background: #e9f8f5;
  box-shadow: 0 10px 22px rgba(15, 148, 136, 0.14);
}

.map-passport-corpuses li.selected-corpus strong {
  color: #075f57;
}

.map-passport-corpuses li span,
.map-passport-corpuses > span {
  color: var(--muted);
  font-size: 12px;
}

.map-passport-corpuses li.has-readiness span {
  color: #0f766e;
  font-weight: 800;
}

.map-passport-corpuses li.missing-readiness {
  opacity: 0.72;
}

.map-cluster-hint {
  display: grid;
  gap: 3px;
  min-width: 190px;
  color: #17212b;
}

.map-cluster-hint strong {
  font-size: 15px;
}

.map-cluster-hint span {
  color: #60717c;
  font-size: 12px;
  font-weight: 750;
}


#mapStats {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

#mapStats b {
  color: var(--ink);
}

#mapStats small {
  display: block;
  margin-top: 4px;
  color: #71838e;
  line-height: 1.35;
}

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

.map-card-title-row h3 {
  margin: 0;
}

.map-card-title-row button {
  min-height: 32px;
  border: 1px solid #d7e3ea;
  border-radius: 10px;
  padding: 0 10px;
  color: #60717c;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
}

.map-card-title-row button:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.map-filter-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.map-card-title-row button.active {
  border-color: rgba(19, 151, 137, 0.28);
  color: var(--teal);
  background: rgba(19, 151, 137, 0.08);
}

.map-filter-body {
  display: block;
}

.map-filter-body.hidden {
  display: none;
}

.map-filter-search {
  display: grid;
  gap: 6px;
  margin: 0 0 9px;
}

.map-filter-search span {
  color: #60717c;
  font-size: 12px;
  font-weight: 800;
}

.map-filter-search input {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d7e3ea;
  border-radius: 11px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  outline: none;
}

.map-filter-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 151, 137, 0.12);
}

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

.map-filter-grid select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #d7e3ea;
  border-radius: 11px;
  padding: 0 30px 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  outline: none;
}

.map-filter-grid select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 151, 137, 0.12);
}

.map-compare-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 8px;
  border: 1px solid #f0c8b9;
  border-radius: 12px;
  padding: 9px 10px;
  color: #9f3a20;
  background: #fff8f4;
  cursor: pointer;
  font-size: 12px;
  font-weight: 950;
}

.map-compare-switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--teal);
}

.map-compare-grid {
  padding-top: 2px;
}

.map-period-card,
.map-layer-card,
.map-analysis-card,
.map-radius-card {
  display: grid;
  gap: 10px;
}

.map-sync-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #60717c;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.map-sync-switch input {
  width: 15px;
  height: 15px;
  accent-color: var(--teal);
}

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

.map-period-grid label {
  display: grid;
  gap: 4px;
  color: #60717c;
  font-size: 11px;
  font-weight: 900;
}

.map-period-grid input,
.map-layer-card select {
  width: 100%;
  min-height: 36px;
  border: 1px solid #d7e3ea;
  border-radius: 11px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 850;
  outline: none;
}

.map-period-strip .map-period-presets button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 28px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 10.5px;
  line-height: 1;
}

.map-period-strip .map-period-grid {
  grid-template-columns: repeat(2, 112px);
  gap: 6px;
}

.map-period-strip .map-period-grid input {
  min-height: 32px;
  padding: 0 8px;
}

.map-period-strip .map-period-presets {
  justify-content: flex-start;
  flex-wrap: nowrap;
  overflow: visible;
  scrollbar-width: none;
}

.map-period-strip .map-period-presets::-webkit-scrollbar {
  display: none;
}

.map-period-grid input:disabled {
  color: #8b9aa3;
  background: #f4f8f8;
}

.map-period-slider {
  display: grid;
  gap: 6px;
  padding: 8px 10px 10px;
  border: 1px solid #e2ecef;
  border-radius: 13px;
  background: #f7fbfb;
}

.map-period-slider-labels {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #465965;
  font-size: 12px;
  font-weight: 950;
}

.map-period-range-wrap {
  position: relative;
  height: 24px;
}

.map-period-range-wrap::before {
  content: "";
  position: absolute;
  left: 4px;
  right: 4px;
  top: 10px;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #eef2f4, #c8d0d4);
}

.map-period-range-wrap input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: transparent;
  pointer-events: none;
  appearance: none;
  -webkit-appearance: none;
}

.map-period-range-wrap input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: transparent;
}

.map-period-range-wrap input[type="range"]::-webkit-slider-thumb {
  width: 20px;
  height: 20px;
  margin-top: -6px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9aa7ad;
  box-shadow: 0 2px 8px rgba(14, 30, 40, 0.25);
  pointer-events: auto;
  cursor: grab;
  appearance: none;
  -webkit-appearance: none;
}

.map-period-range-wrap input[type="range"]::-moz-range-track {
  height: 8px;
  background: transparent;
}

.map-period-range-wrap input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #9aa7ad;
  box-shadow: 0 2px 8px rgba(14, 30, 40, 0.25);
  pointer-events: auto;
  cursor: grab;
}

.map-period-range-wrap input[type="range"]:disabled::-webkit-slider-thumb,
.map-period-range-wrap input[type="range"]:disabled::-moz-range-thumb {
  opacity: 0.55;
  cursor: default;
}

.map-period-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-period-presets button,
.map-radius-tools button {
  min-height: 30px;
  border: 1px solid #d7e3ea;
  border-radius: 999px;
  padding: 0 10px;
  color: #60717c;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 950;
}

.map-period-presets button:hover,
.map-radius-tools button:hover,
.map-radius-tools button.active {
  border-color: var(--teal);
  color: var(--teal);
  background: rgba(19, 151, 137, 0.08);
}

.map-layer-legend {
  display: grid;
  gap: 8px;
  padding: 9px 10px;
  border: 1px solid #dbe7eb;
  border-radius: 12px;
  color: #60717c;
  background: rgba(251, 254, 253, 0.96);
  font-size: 12px;
  line-height: 1.35;
  margin-bottom: 10px;
}

.map-layer-legend p {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
}

.map-layer-legend small {
  color: #60717c;
  font-size: 11px;
  font-weight: 800;
}

.map-layer-scale {
  display: grid;
  gap: 5px;
}

.map-layer-scale > span {
  display: block;
  height: 10px;
  border-radius: 999px;
  background: var(--map-layer-gradient, linear-gradient(90deg, #d9f99d, #fde047, #fb923c, #b91c1c));
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.map-layer-scale > div,
.map-risk-legend {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.map-layer-scale b {
  color: #60717c;
  font-size: 11px;
  font-weight: 900;
}

.map-risk-legend {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.map-risk-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #60717c;
  font-size: 11px;
  font-weight: 900;
}

.map-risk-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

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

.map-analysis-grid span {
  display: grid;
  gap: 2px;
  min-height: 54px;
  border: 1px solid #e0ecef;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fbfefd;
}

.map-analysis-grid b {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.2;
}

.map-analysis-grid small,
.map-analysis-status-line span {
  color: #60717c;
  font-size: 11px;
  font-weight: 800;
}

.map-analysis-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-analysis-status-line span {
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef7f6;
}

.map-analysis-insight {
  margin: 0;
  border-left: 3px solid var(--teal);
  border-radius: 10px;
  padding: 8px 10px;
  color: #21404a;
  background: #f0fbf9;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.map-analysis-tops {
  border: 1px solid #e0ecef;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
}

.map-analysis-tops summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 12px;
  font-weight: 950;
}

.map-analysis-tops h4 {
  margin: 10px 0 4px;
  color: #60717c;
  font-size: 11px;
  text-transform: uppercase;
}

.map-analysis-tops ol {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.map-analysis-tops li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: #60717c;
  font-size: 12px;
}

.map-analysis-tops li b {
  color: var(--ink);
  white-space: nowrap;
}

.map-radius-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.map-radius-head span {
  color: #60717c;
  font-size: 12px;
  white-space: nowrap;
}

.map-radius-tools {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  border: 1px solid #e0ecef;
  border-radius: 14px;
  padding: 10px;
  background: #fbfefd;
}

.map-radius-tools h4 {
  margin: 0;
  color: #60717c;
  font-size: 12px;
  text-transform: uppercase;
}

.map-radius-tools div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.map-passport-radius-analysis {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.map-passport-radius-analysis:empty {
  display: none;
}

.map-passport-radius-analysis .map-radius-head {
  padding: 10px 10px 0;
}

.map-passport-radius-analysis .map-analysis-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.map-passport-radius-analysis .map-analysis-grid span {
  padding: 8px;
}

.map-passport-radius-analysis .map-analysis-status-line {
  padding: 9px 10px;
}

.map-passport-radius-analysis .map-analysis-insight {
  margin: 0;
  padding: 10px;
}

.map-passport-radius-analysis .map-analysis-tops {
  margin: 0;
  padding: 9px 10px;
}

#mapProjects {
  display: grid;
  gap: 8px;
  max-height: 560px;
  overflow: auto;
  padding-right: 3px;
}

.map-search {
  display: grid;
  gap: 6px;
  margin: 0 0 10px;
}

.map-search span {
  color: #60717c;
  font-size: 12px;
  font-weight: 800;
}

.map-search input {
  width: 100%;
  min-height: 40px;
  border: 1px solid #d7e3ea;
  border-radius: 12px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  outline: none;
}

.map-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(19, 151, 137, 0.12);
}

.map-project-item {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #e2ebef;
  border-radius: 10px;
  background: #fbfefd;
}

.map-project-item strong {
  font-size: 13px;
}

.map-project-item span,
.map-project-item em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

body.map-modal-open {
  overflow: hidden;
}

.pdf-export-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 22, 30, 0.38);
  backdrop-filter: blur(5px);
}

.pdf-export-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(980px, calc(100vw - 40px));
  max-height: min(720px, calc(100vh - 40px));
  border: 1px solid #d7e1e6;
  border-radius: 18px;
  padding: 20px 20px 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(21, 33, 43, 0.22);
  overflow: hidden;
}

.pdf-export-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.pdf-export-head p {
  margin: 0 0 4px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.pdf-export-head h2 {
  margin: 0;
}

.pdf-export-head button {
  width: 38px;
  height: 38px;
  border: 1px solid #dce5ea;
  border-radius: 12px;
  color: #5c6a73;
  background: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.pdf-export-body {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(300px, 0.95fr);
  gap: 14px;
  min-height: 0;
}

.pdf-export-format {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pdf-export-format label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 58px;
  border: 1px solid #dde6eb;
  border-radius: 14px;
  padding: 10px 12px;
  background: #fbfdfe;
  cursor: pointer;
}

.pdf-export-format label:has(input:checked) {
  border-color: var(--teal);
  background: #eefbf8;
  box-shadow: inset 4px 0 0 var(--teal);
}

.pdf-export-format input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.pdf-export-format span {
  display: grid;
  gap: 2px;
}

.pdf-export-format small {
  color: #63727c;
  line-height: 1.3;
}

.pdf-export-options {
  display: grid;
  gap: 10px;
  min-height: 0;
  max-height: 100%;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-color: #b9c4cb transparent;
}

.pdf-export-options label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 68px;
  border: 1px solid #dde6eb;
  border-radius: 14px;
  padding: 12px 14px;
  background: #fbfdfe;
  cursor: pointer;
}

.pdf-export-options label:has(input:checked) {
  border-color: var(--teal);
  background: #eefbf8;
  box-shadow: inset 4px 0 0 var(--teal);
}

.pdf-export-options input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.pdf-export-options span {
  display: grid;
  gap: 3px;
}

.pdf-export-options strong {
  color: var(--ink);
}

.pdf-export-options small {
  color: #63727c;
  line-height: 1.3;
}

.pdf-export-preview {
  align-self: stretch;
  position: sticky;
  top: 0;
  min-height: 0;
  max-height: 100%;
  margin-top: 0;
  border: 1px solid #dce6eb;
  border-radius: 14px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(18, 153, 137, 0.08), transparent 46%),
    #fbfdfe;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-gutter: stable;
  scrollbar-color: #b9c4cb transparent;
}

.pdf-preview-sheet {
  display: grid;
  gap: 10px;
  min-height: 100%;
}

.pdf-preview-page-wrap {
  position: relative;
  min-width: 0;
  overflow: visible;
}

.pdf-preview-title {
  position: sticky;
  top: -16px;
  z-index: 2;
  border-bottom: 1px solid #e6eef2;
  padding: 0 0 10px;
  background: #fbfdfe;
}

.pdf-preview-title p {
  margin: 0 0 3px;
  color: var(--teal);
  font-size: 10px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pdf-preview-title h3 {
  margin: 0;
  font-size: 15px;
}

.pdf-preview-capture {
  --pdf-preview-scale: 0.38;
  box-sizing: border-box;
  width: 1120px;
  min-height: 680px;
  transform: scale(var(--pdf-preview-scale));
  transform-origin: top left;
  border: 1px solid #cfdbe2;
  border-radius: 18px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 12px 34px rgba(24, 39, 50, 0.16);
  pointer-events: none;
}

.pdf-preview-capture::after {
  content: "Конец предпросмотра";
  display: block;
  margin-top: 14px;
  border-top: 1px dashed #d4e0e6;
  padding-top: 10px;
  color: #7a8a94;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pdf-preview-page-head {
  margin-bottom: 16px;
  border-bottom: 1px solid #d9e2e7;
  padding-bottom: 12px;
}

.pdf-preview-page-head p {
  margin: 0 0 4px;
  display: inline-flex;
  max-width: 100%;
  border-radius: 999px;
  padding: 4px 9px;
  color: #0f766e;
  background: #e8f8f5;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: 0.07em;
  text-transform: none;
}

.pdf-preview-page-head h3 {
  margin: 0 0 6px;
  color: var(--ink);
  font-size: 25px;
}

.pdf-preview-page-head span {
  display: block;
  color: #5c6b75;
  font-size: 13px;
  line-height: 1.35;
}

.pdf-preview-capture .kpis,
.pdf-preview-capture .panel {
  margin-bottom: 14px;
  box-shadow: none;
}

.pdf-preview-capture .chart-scroll,
.pdf-preview-capture .table-wrap,
.pdf-preview-capture .structure-list {
  width: 100%;
  max-height: none;
  overflow: visible;
}

.pdf-preview-capture .chart,
.pdf-preview-capture .dynamics-chart-card,
.pdf-preview-capture .chart.compact {
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.pdf-preview-capture .chart-scroll svg,
.pdf-preview-capture .combo-chart,
.pdf-preview-capture .price-brush-chart {
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  overflow: visible;
}

.pdf-preview-capture .absorption-ranking {
  max-height: none;
  overflow: visible;
  padding-right: 0;
}

.pdf-preview-capture .absorption-rank-row {
  grid-template-columns: 42px minmax(180px, 1fr) minmax(260px, 1.4fr) minmax(170px, 0.8fr);
}

.pdf-preview-capture .absorption-rank-details {
  display: none;
}

.pdf-preview-capture .comparison-controls,
.pdf-preview-capture .ranking-controls,
.pdf-preview-capture .structure-controls,
.pdf-preview-capture .comparison-range-actions {
  display: none !important;
}

.pdf-preview-capture .combo-overview-layer {
  display: none !important;
}

.pdf-export-preview h3 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 15px;
}

.pdf-export-preview dl {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  font-size: 12px;
}

.pdf-export-preview dt {
  color: #657681;
  font-weight: 850;
}

.pdf-export-preview dd {
  min-width: 0;
  margin: 0;
  color: #1d2930;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.pdf-export-preview ul {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.pdf-export-preview li {
  border: 1px solid rgba(18, 153, 137, 0.28);
  border-radius: 999px;
  padding: 5px 9px;
  color: #0f766e;
  background: #eefbf8;
  font-size: 12px;
  font-weight: 850;
}

.pdf-export-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  border-top: 1px solid #edf2f5;
  padding-top: 14px;
  background: #fff;
}

.pdf-export-confirm {
  min-height: 40px;
  border: 1px solid var(--teal);
  border-radius: 10px;
  padding: 0 16px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  font-weight: 900;
}

.pdf-export-report-header {
  display: none;
}

@media print {
  @page {
    size: A4 landscape;
    margin: 10mm;
  }

  body.pdf-exporting {
    background: #fff;
    color: #172026;
  }

  body.pdf-exporting .topbar,
  body.pdf-exporting .filters,
  body.pdf-exporting .comparison-filter-panel,
  body.pdf-exporting .assistant-widget,
  body.pdf-exporting .toast,
  body.pdf-exporting .pdf-export-modal {
    display: none !important;
  }

  body.pdf-exporting .pdf-export-report-header {
    display: block;
    margin: 0 0 12px;
    border-bottom: 1px solid #d9e2e7;
    padding-bottom: 10px;
  }

  body.pdf-exporting .pdf-export-report-header p {
    display: inline-flex;
    max-width: 100%;
    margin: 0 0 6px;
    border-radius: 999px;
    padding: 3px 8px;
    color: #0f766e;
    background: #e8f8f5;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.07em;
    text-transform: none;
  }

  body.pdf-exporting .pdf-export-report-header h1 {
    margin: 0 0 6px;
    font-size: 20px;
  }

  body.pdf-exporting #pdfExportReportMeta {
    color: #586974;
    font-size: 10px;
    line-height: 1.35;
  }

  body.pdf-exporting .layout,
  body.pdf-exporting .content {
    display: block;
    padding: 0;
  }

  body.pdf-exporting .kpis,
  body.pdf-exporting .market-stage-panel,
  body.pdf-exporting .absorption-ranking-panel,
  body.pdf-exporting .dynamics-panel,
  body.pdf-exporting .sales-structure-panel {
    display: none !important;
  }

  body.pdf-exporting.pdf-scope-all .kpis,
  body.pdf-exporting.pdf-scope-indicators .kpis {
    display: grid !important;
  }

  body.pdf-exporting.pdf-scope-all .market-stage-panel,
  body.pdf-exporting.pdf-scope-indicators .market-stage-panel,
  body.pdf-exporting.pdf-scope-all .absorption-ranking-panel,
  body.pdf-exporting.pdf-scope-absorption .absorption-ranking-panel,
  body.pdf-exporting.pdf-scope-all .dynamics-panel,
  body.pdf-exporting.pdf-scope-dynamics .dynamics-panel,
  body.pdf-exporting.pdf-scope-all .sales-structure-panel,
  body.pdf-exporting.pdf-scope-sales .sales-structure-panel {
    display: block !important;
  }

  body.pdf-exporting .panel,
  body.pdf-exporting .kpis article {
    break-inside: avoid;
    border-color: #d9e2e7;
    box-shadow: none;
  }

  body.pdf-exporting .panel {
    margin-bottom: 10px;
    padding: 12px;
  }

  body.pdf-exporting .chart-scroll,
  body.pdf-exporting .table-wrap,
  body.pdf-exporting .structure-list {
    width: 100% !important;
    overflow: visible !important;
    max-height: none !important;
  }

  body.pdf-exporting .chart,
  body.pdf-exporting .dynamics-chart-card,
  body.pdf-exporting #salesChart,
  body.pdf-exporting #priceChart {
    width: 100% !important;
    min-width: 0 !important;
    overflow: visible !important;
  }

  body.pdf-exporting svg {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible;
  }

  body.pdf-exporting .combo-chart,
  body.pdf-exporting .price-brush-chart {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  body.pdf-exporting .absorption-ranking {
    max-height: none !important;
    overflow: visible !important;
    padding-right: 0 !important;
  }

  body.pdf-exporting .absorption-rank-row {
    grid-template-columns: 38px minmax(160px, 1fr) minmax(240px, 1.35fr) minmax(150px, 0.78fr);
    gap: 10px;
    break-inside: avoid;
  }

  body.pdf-exporting .absorption-rank-details {
    display: none !important;
  }

  body.pdf-exporting .comparison-controls,
  body.pdf-exporting .ranking-controls,
  body.pdf-exporting .structure-controls,
  body.pdf-exporting .comparison-range-actions {
    display: none !important;
  }

  body.pdf-exporting .combo-overview-layer {
    display: none !important;
  }
}

.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 22px;
  padding: 22px 32px 32px;
}




.filters,
.panel,
.kpis article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.market-stage-panel,
.absorption-ranking-panel {
  margin-bottom: 18px;
}

.quiet-button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: #43515b;
  background: #fff;
  cursor: pointer;
  font-weight: 700;
}

.stage-date-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.stage-date-filter {
  min-width: 170px;
  margin: 0;
}

.stage-date-filter span {
  color: #60707a;
  font-size: 11px;
  font-weight: 800;
}

.stage-date-filter input {
  min-height: 36px;
}

.stage-comparison-date {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--compare-border);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--compare);
  background: var(--compare-bg);
  font-size: 11px;
  font-weight: 800;
}

.stage-funnel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stage-step {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 118px;
  border: 0;
  border-right: 1px solid var(--line);
  padding: 16px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.stage-step:last-child {
  border-right: 0;
}

.stage-step:hover,
.stage-step.active {
  background: #eef8f6;
}

.stage-step.active {
  box-shadow: inset 0 -3px 0 var(--teal);
}

.stage-index {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  color: #60707a;
  background: #edf1f3;
  font-size: 11px;
  font-weight: 900;
}

.stage-label {
  padding-right: 28px;
  color: #53636e;
  font-size: 12px;
  font-weight: 800;
}

.stage-step strong {
  align-self: end;
  margin-top: 18px;
  font-size: 20px;
  line-height: 1.1;
}

.stage-step small {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 700;
}

.stage-comparison {
  align-self: end;
  margin-top: 9px;
  width: fit-content;
  max-width: 100%;
  border-left: 2px solid var(--compare-border);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--compare);
  background: var(--compare-bg);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.absorption-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
  border-top: 1px solid var(--line);
}

.absorption-summary article {
  display: grid;
  padding: 16px 18px 2px 0;
  border-right: 1px solid var(--line);
}

.absorption-summary article + article {
  padding-left: 18px;
}

.absorption-summary article:last-child {
  border-right: 0;
}

.absorption-summary span {
  color: #60707a;
  font-size: 12px;
  font-weight: 800;
}

.absorption-summary strong {
  margin-top: 8px;
  font-size: 24px;
}

.absorption-summary small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stage-coverage {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.ranking-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 10px;
  min-width: 0;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.absorption-tabs button {
  min-width: 52px;
  min-height: 38px;
  padding: 0 12px;
  font-weight: 800;
}

.absorption-tabs button.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.ranking-controls select {
  flex: 0 1 190px;
  width: 190px;
}

.ranking-controls #absorptionSort {
  flex-basis: 210px;
  width: 210px;
}

.ranking-controls #absorptionEntityCompare {
  width: 220px;
}

.comparison-toggle {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.comparison-toggle.active {
  border-color: var(--compare-border);
  color: var(--compare);
  background: var(--compare-bg);
}

.corpus-detail-toggle {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid rgba(20, 159, 144, 0.32);
  border-radius: 9px;
  padding: 0 14px;
  color: var(--teal);
  background: rgba(20, 159, 144, 0.08);
  cursor: pointer;
  font-weight: 800;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.corpus-detail-toggle:hover {
  border-color: rgba(20, 159, 144, 0.58);
  background: rgba(20, 159, 144, 0.14);
  transform: translateY(-1px);
}

.corpus-detail-toggle.active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.corpus-detail-toggle.hidden {
  display: none;
}

.comparison-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.comparison-filter-panel {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid #d9e4ea;
  border-radius: 14px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(21, 38, 49, 0.08);
}

.comparison-filter-panel.active {
  border-color: rgba(22, 163, 148, 0.45);
  box-shadow: 0 12px 28px rgba(22, 163, 148, 0.12);
}

.comparison-filter-panel.collapsed .comparison-panel-body {
  display: none;
}

.comparison-filter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.comparison-panel-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  min-width: 96px;
}

.comparison-filter-head strong {
  display: block;
  font-size: 14px;
  font-weight: 950;
}

.comparison-filter-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.comparison-filter-head button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 8px;
  color: #60707a;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
}

.comparison-filter-head button.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
}

.comparison-mode-switch {
  display: none;
  grid-template-columns: 1fr;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  background: #f4f7f8;
  gap: 3px;
}

.comparison-mode-switch button {
  min-height: 32px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #52616a;
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

.comparison-mode-switch button.active {
  color: #fff;
  background: var(--teal);
}

.comparison-panel-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: end;
}

.comparison-panel-grid.compact {
  grid-template-columns: 1fr;
}

.comparison-panel-grid label {
  display: grid;
  gap: 5px;
  color: #60707a;
  font-size: 11px;
  font-weight: 850;
}

.comparison-panel-grid label.comparison-field-disabled {
  opacity: 0.42;
}

.comparison-panel-grid label.comparison-field-disabled select {
  cursor: not-allowed;
  background: #eef3f5;
}

.comparison-panel-grid label.comparison-field-active {
  color: #12323a;
}

.comparison-panel-grid select,
.comparison-panel-grid input {
  width: 100%;
  min-height: 38px;
  box-sizing: border-box;
}

.comparison-entity-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: stretch;
}

.comparison-entity-type-switch {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  border-radius: 12px;
  padding: 6px;
  background: #f1f5f7;
}

.comparison-period-note {
  display: none;
  border: 1px dashed #b8c7ce;
  border-radius: 10px;
  padding: 10px;
  color: #52616a;
  background: #f7fafb;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
}

.comparison-entity-type-switch button {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #52616a;
  background: transparent;
  cursor: pointer;
  font-weight: 950;
}

.comparison-entity-type-switch button.active {
  border-color: var(--teal);
  color: #fff;
  background: var(--teal);
  box-shadow: 0 8px 18px rgba(22, 163, 148, 0.22);
}

.comparison-side-card {
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdfd;
}

.comparison-side-card.primary {
  border-color: rgba(22, 163, 148, 0.28);
  background: linear-gradient(180deg, #f6fffd 0%, #ffffff 100%);
}

.comparison-side-card.compare {
  --compare-card-color: #d45d4c;
  border-color: color-mix(in srgb, var(--compare-card-color) 34%, transparent);
  background: linear-gradient(180deg, #fff8f4 0%, #ffffff 100%);
  box-shadow: inset 3px 0 0 var(--compare-card-color);
}

.compare-items-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.compare-item-card {
  --compare-card-color: var(--compare);
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid color-mix(in srgb, var(--compare-card-color) 34%, transparent);
  border-radius: 12px;
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--compare-card-color) 8%, #ffffff) 0%, #ffffff 100%);
  box-shadow:
    inset 3px 0 0 var(--compare-card-color),
    0 8px 18px rgba(33, 44, 54, 0.06);
}

.compare-item-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.compare-item-card-title {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.compare-item-card-title span {
  color: var(--compare-card-color);
  font-size: 11px;
  font-weight: 900;
  line-height: 1.15;
}

.compare-item-card-title strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
  line-height: 1.2;
}

.compare-item-card-title em {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.compare-item-card .search-select {
  min-width: 0;
}

.compare-item-remove {
  width: 34px;
  min-height: 34px;
  border: 1px solid color-mix(in srgb, var(--compare-card-color, var(--compare)) 38%, transparent);
  border-radius: 9px;
  color: var(--compare-card-color, var(--compare));
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
}

.compare-item-remove:hover {
  border-color: var(--compare-card-color, var(--compare));
  background: color-mix(in srgb, var(--compare-card-color, var(--compare)) 9%, #ffffff);
}

.compare-items-empty {
  border: 1px dashed rgba(232, 121, 62, 0.34);
  border-radius: 10px;
  padding: 9px 10px;
  color: #8a6a5b;
  background: rgba(255, 248, 244, 0.72);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
}

.compare-add-button {
  grid-column: 1 / -1;
  min-height: 36px;
  border: 1px solid rgba(232, 121, 62, 0.5);
  border-radius: 10px;
  color: var(--compare);
  background: #fff;
  cursor: pointer;
  font-weight: 950;
}

.compare-add-button:hover {
  border-color: var(--compare);
  background: #fff3ed;
}

.compare-add-button:disabled {
  color: #98a5ad;
  border-color: #dbe3e7;
  background: #f4f7f8;
  cursor: not-allowed;
}

.comparison-side-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-height: 24px;
}

.comparison-side-title strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 950;
}

.comparison-side-title span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.range-navigator {
  position: relative;
  margin-top: 18px;
  padding: 14px 18px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcfc;
}

.range-track {
  position: relative;
  height: 54px;
  touch-action: none;
  user-select: none;
  transition: height 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.range-track.comparison-active {
  height: 80px;
}

.range-overview {
  position: relative;
  display: block;
  height: 42px;
  padding: 0 5px;
  pointer-events: none;
}

.range-bars {
  position: absolute;
  inset: 0 5px;
  z-index: 1;
  display: flex;
  align-items: end;
  gap: 2px;
}

.range-bars > span {
  flex: 1 1 0;
  min-width: 2px;
  border-radius: 3px 3px 0 0;
  background: #d9dee1;
}

.range-bars > span.selected {
  background: #aeb6ba;
}

.range-year-scale {
  position: absolute;
  inset: 0 5px;
  z-index: 0;
}

.range-year-scale > span {
  position: absolute;
  inset-block: 0;
  border-left: 1px dashed #b9c4cb;
  background: rgba(255, 255, 255, 0.48);
}

.range-year-scale > span:first-child {
  border-left: 0;
}

.range-year-scale > span.alternate {
  background: rgba(226, 232, 235, 0.42);
}

.range-year-scale b {
  position: absolute;
  top: 2px;
  left: 50%;
  z-index: 2;
  transform: translateX(-50%);
  color: #60707a;
  font-size: 9px;
  font-weight: 800;
  line-height: 1;
}

.overview-year-label {
  fill: #60707a;
  stroke: #fff;
  stroke-width: 3px;
  paint-order: stroke;
  font-size: 10px;
  font-weight: 800;
}

.range-selection {
  position: absolute;
  top: 0;
  height: 46px;
  min-width: 2px;
  border: 1px solid rgba(82, 97, 105, 0.26);
  border-radius: 5px;
  background: rgba(126, 139, 146, 0.13);
  cursor: grab;
  z-index: 2;
  transition:
    left 190ms cubic-bezier(0.22, 1, 0.36, 1),
    width 190ms cubic-bezier(0.22, 1, 0.36, 1),
    background-color 220ms ease,
    border-color 220ms ease;
  will-change: left, width;
}

.range-selection:active {
  cursor: grabbing;
  transition-duration: 110ms;
}

.range-selection.compare {
  top: 46px;
  height: 26px;
  border: 2px solid rgba(232, 121, 62, 0.85);
  background: rgba(232, 121, 62, 0.12);
  z-index: 3;
}

.range-handle {
  position: absolute;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #aeb6ba;
  box-shadow: 0 1px 5px rgba(23, 32, 38, 0.28);
  cursor: ew-resize;
  transform: translateY(-50%);
}

.range-selection.compare .range-handle {
  background: #e8793e;
}

.range-handle.left {
  left: 0;
  transform: translate(-50%, -50%);
}

.range-handle.right {
  right: 0;
  transform: translate(50%, -50%);
}

.range-labels {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.range-labels strong {
  color: #43515b;
  font-size: 12px;
}

.range-labels span:last-child {
  text-align: right;
}

.comparison-range-caption {
  color: var(--compare);
  font-size: 12px;
  font-weight: 800;
}

.comparison-range-actions {
  display: flex;
  min-height: 32px;
  margin-top: 5px;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.previous-year-button {
  flex: 0 1 124px;
  min-height: 38px;
  max-width: 140px;
  border: 1px solid var(--compare-border);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--compare);
  background: var(--compare-bg);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  cursor: pointer;
}

.previous-year-button:hover,
.previous-year-button.active {
  border-color: var(--compare);
  color: #7c2f10;
  background: #ffe8dc;
}

.comparison-kpi {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 6px;
  border-left: 2px solid var(--compare-border);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--compare);
  background: var(--compare-bg);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.comparison-delta {
  font-weight: 900;
  white-space: nowrap;
}

.comparison-delta.positive {
  color: #07845f;
}

.comparison-delta.negative {
  color: #c43d32;
}

.comparison-delta.neutral {
  color: #d65b87;
}

.comparison-kpi:has(.comparison-delta.positive),
.stage-comparison:has(.comparison-delta.positive) {
  border-left-color: #18a77b;
  color: #176c55;
  background: #e8f8f2;
}

.comparison-kpi:has(.comparison-delta.negative),
.stage-comparison:has(.comparison-delta.negative) {
  border-left-color: #dc6259;
  color: #9f302a;
  background: #fff0ee;
}

.comparison-kpi:has(.comparison-delta.neutral),
.stage-comparison:has(.comparison-delta.neutral) {
  border-left-color: #dc7198;
  color: #a34068;
  background: #fff0f6;
}

.absorption-entity-comparison {
  border-left-color: #4c8ed9;
  color: #225d9d;
  background: #edf6ff;
}

.absorption-entity-base {
  border-left-color: #16a394;
  color: #0f766e;
  background: #e9f8f5;
}

.kpis .comparison-kpi,
.absorption-summary .comparison-kpi {
  margin-right: auto;
}

.absorption-rank-value .comparison-kpi {
  margin-left: auto;
  text-align: right;
}

.structure-metric .comparison-kpi {
  grid-column: 1 / -1;
}

.comparison-legend {
  color: var(--compare);
  font-weight: 800;
}

.comparison-value {
  color: var(--compare);
}

.comparison-series-label {
  font-size: 9px;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 3px;
  stroke-linejoin: round;
}

.absorption-ranking {
  display: grid;
  margin-top: 14px;
  max-height: 636px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border-top: 1px solid var(--line);
  padding-right: 6px;
}

.absorption-ranking::-webkit-scrollbar {
  width: 8px;
}

.absorption-ranking::-webkit-scrollbar-track {
  background: #edf1f3;
  border-radius: 999px;
}

.absorption-ranking::-webkit-scrollbar-thumb {
  background: #b9c6cc;
  border-radius: 999px;
}

.absorption-rank-row {
  display: grid;
  grid-template-columns: 34px minmax(120px, 1.15fr) minmax(130px, 1.7fr) minmax(126px, 0.8fr);
  align-items: center;
  gap: 14px;
  min-height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
}

.absorption-rank-row.comparison-row {
  border-left: 4px solid var(--compare-row-color, var(--compare));
  border-radius: 8px;
  padding-left: 10px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--compare-row-color, var(--compare)) 10%, #fff) 0%, #fff 45%);
}

.absorption-rank-row.comparison-row .absorption-rank-bar span {
  background: var(--compare-row-color, var(--compare));
}

.absorption-rank-number {
  color: #71808a;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.absorption-rank-name {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.absorption-rank-name strong,
.absorption-rank-name small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.absorption-rank-name strong {
  font-size: 13px;
}

.absorption-rank-name small {
  color: var(--muted);
  font-size: 11px;
}

.absorption-rank-bar {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f3;
}

.absorption-rank-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #16a394;
}

.absorption-rank-row.metric-remaining .absorption-rank-bar span {
  background: #4c8ed9;
}

.absorption-rank-row.metric-years .absorption-rank-bar span {
  background: #e8793e;
}

.absorption-rank-value {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 0;
  text-align: right;
}

.absorption-rank-value > span {
  color: #71808a;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.absorption-rank-value > strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 1.1;
}

.absorption-rank-details {
  display: grid;
  grid-column: 2 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.absorption-rank-details span {
  min-width: 0;
  border-radius: 8px;
  padding: 6px 8px;
  color: #64737d;
  background: #f4f7f8;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.25;
}

.absorption-rank-details b {
  display: block;
  margin-top: 2px;
  color: #172026;
  font-size: 11px;
  font-weight: 950;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filters {
  position: sticky;
  top: 18px;
  align-self: start;
  max-height: calc(100vh - 36px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px;
  scrollbar-gutter: stable;
  scrollbar-color: #b9c4cb transparent;
}

.filters::-webkit-scrollbar {
  width: 8px;
}

.filters::-webkit-scrollbar-track {
  background: transparent;
}

.filters::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #b9c4cb;
}

.filter-head,
.panel-title,
.toolbar,
.period-grid,
.segmented {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.filter-head h2 {
  margin: 0;
}

.filter-head button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.filter-head button {
  height: 34px;
  padding: 0 12px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #4a5964;
  font-size: 13px;
  font-weight: 700;
}

select,
input[type="month"] {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.native-select-hidden {
  display: none;
}

.search-select {
  position: relative;
  width: 100%;
}

.search-select-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 700;
  outline: none;
}

.search-select::after {
  content: "";
  position: absolute;
  top: 15px;
  right: 13px;
  width: 8px;
  height: 8px;
  border-right: 2px solid #172026;
  border-bottom: 2px solid #172026;
  pointer-events: none;
  transform: rotate(45deg);
}

.search-select.open::after {
  top: 18px;
  transform: rotate(225deg);
}

.search-select-input:focus {
  border-color: #9ccac4;
  box-shadow: 0 0 0 3px rgba(22, 163, 148, 0.12);
}

.search-select.disabled .search-select-input {
  cursor: not-allowed;
  color: #8b9aa3;
  background: #eef3f5;
}

.search-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 30;
  display: none;
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #d9e4e8;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 30px rgba(23, 32, 38, 0.14);
  padding: 6px;
}

.search-select.open .search-select-menu {
  display: grid;
  gap: 2px;
}

.search-select-option {
  width: 100%;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.search-select-option:hover,
.search-select-option.active {
  background: #edf7f5;
}

.search-select-option.selected {
  color: #0f766e;
  background: #e6f5f2;
}

.search-select-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.period-grid {
  align-items: start;
}

.period-grid label {
  width: 50%;
}

.drill {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.segmented {
  margin-bottom: 12px;
}

.segmented button {
  flex: 1;
  height: 36px;
}

.segmented button.active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.trail {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.trail span {
  max-width: 100%;
  border-radius: 999px;
  padding: 7px 10px;
  background: #eef4f3;
  color: #24534e;
  font-size: 12px;
  font-weight: 700;
}

.content {
  min-width: 0;
}

.filters,
.content,
.panel,
.chart,
.table-wrap {
  max-width: 100%;
}

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpis article {
  min-height: 112px;
  padding: 18px;
}

.kpis span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.kpis strong {
  display: block;
  margin-top: 14px;
  font-size: 27px;
  line-height: 1;
}

.panel {
  padding: 18px;
  margin-bottom: 18px;
}

.panel-title {
  justify-content: space-between;
  margin-bottom: 14px;
  min-width: 0;
}

.absorption-ranking-panel .panel-title {
  align-items: flex-start;
  gap: 14px;
}

.absorption-ranking-panel .panel-title > div:first-child {
  flex: 0 0 150px;
  min-width: 150px;
}

.absorption-ranking-panel .panel-title h2 {
  margin: 0;
}

.panel-title select,
.toolbar select {
  width: auto;
  min-width: 176px;
}

.grid-two {
  align-items: start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
}

.chart {
  width: 100%;
  min-height: 330px;
  overflow: hidden;
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-color: #b9c4cb transparent;
}

.chart.compact {
  min-height: 330px;
}

.chart svg {
  display: block;
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.dynamics-panel {
  overflow: hidden;
}

.dynamics-stack {
  display: grid;
  gap: 16px;
}

.dynamics-chart-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.dynamics-chart-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.dynamics-chart-title strong {
  color: var(--ink);
  font-size: 15px;
}

.dynamics-chart-title span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.corpus-detail-legend {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 2px 0 8px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #edf3f5;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfd 100%);
}

.combo-series-card-legend {
  margin-bottom: 10px;
}

.corpus-detail-legend-title {
  flex: 0 0 auto;
  max-width: 150px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
}

.corpus-detail-legend-scroll {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
  padding: 1px 1px 3px;
  scrollbar-width: thin;
}

.corpus-detail-chip {
  display: grid;
  grid-template-columns: 10px minmax(42px, auto);
  grid-template-areas:
    "dot name"
    "dot price"
    "dot area"
    "dot dates";
  align-items: center;
  gap: 2px 7px;
  flex: 0 0 auto;
  min-width: 142px;
  max-width: 182px;
  padding: 7px 10px;
  border: 1px solid #e3edf1;
  border-radius: 12px;
  color: #24333d;
  background: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  transition:
    opacity 0.16s ease,
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background-color 0.16s ease,
    transform 0.16s ease;
}

.combo-series-card-legend.has-hover .corpus-detail-chip {
  opacity: 0.46;
}

.combo-series-card-legend.has-hover .corpus-detail-chip.legend-highlight {
  opacity: 1;
  border-color: color-mix(in srgb, var(--chip-color) 58%, #dbe7ec);
  background: color-mix(in srgb, var(--chip-color) 10%, #fff);
  box-shadow:
    0 10px 22px color-mix(in srgb, var(--chip-color) 18%, transparent),
    inset 0 0 0 1px color-mix(in srgb, var(--chip-color) 18%, transparent);
  transform: translateY(-1px);
}

.corpus-detail-chip i {
  grid-area: dot;
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--chip-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--chip-color) 16%, transparent);
}

.corpus-detail-chip-main {
  grid-area: name;
  min-width: 0;
  overflow: hidden;
  color: #1c2a32;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corpus-detail-chip b {
  grid-area: price;
  min-width: 0;
  overflow: hidden;
  color: #0f766e;
  font-size: 11px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corpus-detail-chip em {
  grid-area: area;
  min-width: 0;
  overflow: hidden;
  color: #687882;
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corpus-detail-chip small {
  grid-area: dates;
  min-width: 0;
  overflow: hidden;
  color: #7a8992;
  font-size: 9px;
  font-weight: 850;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corpus-detail-chart-scroll svg {
  margin-top: -6px;
}

.axis-label {
  fill: var(--muted);
  font-size: 11px;
}

.chart-label {
  fill: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.combo-chart,
.price-brush-chart {
  display: block;
  background: #fff;
  user-select: none;
  touch-action: none;
}

.combo-chart text,
.price-brush-chart text {
  pointer-events: none;
  user-select: none;
}








#priceChart {
  min-height: 470px;
}

#priceChart .chart-scroll {
  height: 470px;
}

#priceChart .chart-scroll svg {
  height: 470px;
}

#structureChart {
  height: 360px;
  min-height: 360px;
}

.structure-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 620px);
}

.structure-controls select {
  width: 100%;
  min-width: 0;
}

.combo-legend text {
  fill: #000;
  font-size: 13px;
  font-weight: 700;
}

.combo-value {
  fill: #000;
  font-size: 10px;
  font-weight: 700;
}

.combo-bar-value {
  fill: #172026;
  font-size: 11px;
  font-weight: 900;
}

.price-value {
  fill: #9f481f;
}

.price-summary line {
  stroke: #e4ecef;
  stroke-width: 1.2;
}

.price-summary-label {
  fill: #6f7d87;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.price-summary-value {
  fill: #172026;
  font-size: 18px;
  font-weight: 900;
}

.price-summary-value.muted {
  fill: #9f481f;
  font-size: 15px;
}

.price-chart-legend text {
  fill: #172026;
}

.price-average-label {
  fill: #9d7c6c;
  font-size: 10px;
  font-weight: 800;
}

#priceChart .price-chart-legend text {
  font-size: 15px;
}

#priceChart .price-chart-legend {
  display: none;
}

#priceChart .axis-label {
  font-size: 13px;
  font-weight: 700;
}

#priceChart .combo-axis {
  font-size: 13px;
  font-weight: 700;
}

#priceChart .combo-side-label {
  font-size: 15px;
  font-weight: 800;
}

#priceChart .price-value {
  font-size: 13px;
  font-weight: 900;
}

#priceChart .price-summary-label {
  font-size: 12px;
}

#priceChart .price-summary-value {
  font-size: 20px;
}

#priceChart .price-summary-value.muted {
  font-size: 17px;
}

#priceChart .price-average-label {
  font-size: 12px;
}

.price-last-badge rect {
  fill: #172026;
}

.price-last-badge text {
  fill: #fff;
  font-size: 11px;
  font-weight: 900;
}

.combo-axis {
  fill: #000;
  font-size: 10px;
}

.combo-side-label {
  fill: #000;
  font-size: 13px;
}

.combo-brush {
  cursor: grab;
  pointer-events: all;
  transition:
    x 160ms cubic-bezier(0.22, 1, 0.36, 1),
    width 160ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: x, width;
}

.combo-brush:active {
  cursor: grabbing;
}

.combo-handle {
  cursor: ew-resize;
  stroke: #ffffff;
  stroke-width: 1.5;
  transition: cx 160ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: cx;
}

#salesChart {
  view-transition-name: sales-chart;
}

#priceChart {
  view-transition-name: price-chart;
}

#absorptionRanking {
  view-transition-name: absorption-ranking;
}

::view-transition {
  pointer-events: none;
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
}

::view-transition-old(sales-chart),
::view-transition-old(price-chart),
::view-transition-old(absorption-ranking) {
  animation: range-view-old 300ms cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(sales-chart),
::view-transition-new(price-chart),
::view-transition-new(absorption-ranking) {
  animation: range-view-new 300ms cubic-bezier(0, 0, 0.2, 1) both;
}

@keyframes range-view-old {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

@keyframes range-view-new {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .range-selection,
  .combo-brush,
  .combo-handle {
    transition: none;
  }

  ::view-transition-old(sales-chart),
  ::view-transition-old(price-chart),
  ::view-transition-old(absorption-ranking),
  ::view-transition-new(sales-chart),
  ::view-transition-new(price-chart),
  ::view-transition-new(absorption-ranking) {
    animation: none;
  }
}

.combo-handle-bars {
  fill: #fff;
  font-size: 12px;
  font-weight: 800;
  pointer-events: none;
}

.combo-overview-hit {
  cursor: pointer;
}

.combo-compare-brush {
  cursor: grab;
}

.combo-compare-brush:active {
  cursor: grabbing;
}

.combo-compare-handle {
  cursor: ew-resize;
  stroke: #fff;
  stroke-width: 1.5;
}

.chart-point,
.chart-bar,
.chart-hit,
.combo-period-hover {
  cursor: crosshair;
}

.combo-period-hover-line {
  opacity: 0;
  stroke: #7b8790;
  stroke-width: 1.4;
  stroke-dasharray: 4 4;
  pointer-events: none;
  transition: opacity 0.12s ease;
}

.combo-period-hover-group:hover .combo-period-hover-line {
  opacity: 0.55;
}

.chart-point:hover {
  r: 7;
}

.chart-bar:hover {
  opacity: 1;
}

.chart-tooltip {
  position: fixed;
  z-index: 50;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #fff;
  background: rgba(23, 32, 38, 0.94);
  box-shadow: 0 12px 28px rgba(23, 32, 38, 0.22);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: opacity 0.12s ease, transform 0.12s ease;
  white-space: pre-line;
}

.chart-tooltip-series {
  color: var(--series-color, #fff);
  display: inline-block;
  font-weight: 900;
}

.chart-tooltip-series::before {
  background: var(--series-color, #fff);
  border-radius: 999px;
  content: "";
  display: inline-block;
  height: 8px;
  margin-right: 7px;
  vertical-align: 1px;
  width: 8px;
}

.chart-tooltip.show {
  opacity: 1;
  transform: translateY(0);
}

.structure-list {
  align-content: start;
  display: grid;
  gap: 8px;
  max-height: 360px;
  min-height: 360px;
  overflow-x: hidden;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
  scrollbar-color: #b9c4cb transparent;
}

.structure-list::-webkit-scrollbar {
  width: 8px;
}

.structure-list::-webkit-scrollbar-thumb {
  background: #b9c4cb;
  border-radius: 999px;
}

.structure-list::-webkit-scrollbar-track {
  background: transparent;
}

.structure-head,
.structure-row {
  display: grid;
  grid-template-columns:
    44px
    minmax(180px, 1.35fr)
    minmax(180px, 1fr)
    minmax(82px, 0.42fr)
    minmax(108px, 0.52fr)
    minmax(108px, 0.5fr)
    minmax(96px, 0.48fr)
    minmax(58px, 0.24fr);
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.structure-head {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 0 10px 4px;
  color: var(--muted);
  background: var(--panel);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.structure-row {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid #e3ebef;
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.structure-row.comparison-row {
  border-color: color-mix(in srgb, var(--compare-row-color, var(--compare)) 38%, #dce7ec);
  box-shadow: inset 5px 0 0 var(--compare-row-color, var(--compare));
  background: linear-gradient(90deg, color-mix(in srgb, var(--compare-row-color, var(--compare)) 9%, #fff) 0%, #fff 44%);
}

.structure-row.comparison-row .structure-track span {
  background: var(--compare-row-color, var(--compare));
}

.structure-row:hover {
  border-color: #b9d8d4;
  background: #f8fcfb;
  transform: translateY(-1px);
}

.structure-row.expanded {
  border-color: #acd9d4;
  background: #fbfefd;
}

.structure-corpus-link {
  cursor: alias;
}

.structure-corpus-link .structure-chevron {
  color: #0f9488;
  background: #e5f7f4;
}

.structure-corpus-link .structure-name > span:first-child::after {
  content: "↗";
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  color: #0f9488;
  background: #e5f7f4;
  font-size: 11px;
  font-weight: 950;
}

.structure-level-1 {
  margin-left: 22px;
  width: calc(100% - 22px);
}

.structure-level-2 {
  margin-left: 44px;
  width: calc(100% - 44px);
  background: #fbfcfd;
}

.structure-rank {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  color: #2b615b;
  background: #eaf5f3;
  font-size: 11px;
  font-weight: 800;
}

.structure-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.structure-name > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.structure-corpus-dates {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-width: 0;
  color: #6d7f89;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.2;
}

.structure-corpus-dates span {
  white-space: nowrap;
}

.structure-level-2 .structure-name {
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
}

.structure-level-2 .structure-name::before {
  display: none;
}

.structure-name::before {
  content: "";
  flex: 0 0 8px;
  width: 8px;
  height: 28px;
  border-radius: 999px;
  background: var(--teal);
}

.structure-level-1 .structure-name::before {
  background: #4c8ed9;
}

.structure-level-2 .structure-name::before {
  background: #b9c4cb;
}

.structure-chevron {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 8px;
  padding: 0 7px;
  color: #17645d;
  background: #eaf5f3;
  font-size: 11px;
  font-weight: 950;
  line-height: 1;
  white-space: nowrap;
}

.structure-metric {
  display: grid;
  grid-template-columns: minmax(34px, 1fr) auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.structure-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3f5;
}

.structure-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #16a394, #58ca92);
}

.structure-metric strong {
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.structure-metric em {
  display: none;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}

.structure-price {
  justify-self: end;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 9px;
  color: #8f3f20;
  background: #fff2eb;
  font-size: 12px;
  font-weight: 900;
  overflow-wrap: anywhere;
  white-space: normal;
  text-align: right;
}

.structure-sellout {
  justify-self: end;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  max-width: 100%;
  border-radius: 999px;
  padding: 6px 9px;
  color: #17645d;
  background: #eaf7f4;
  font-size: 12px;
  font-weight: 950;
  line-height: 1.1;
  text-align: right;
  white-space: nowrap;
}

.structure-sellout > .comparison-kpi {
  max-width: 150px;
  font-size: 11px;
}

.structure-price > .comparison-kpi {
  max-width: 150px;
  font-size: 11px;
}

.structure-units > .comparison-kpi,
.structure-revenue > .comparison-kpi {
  margin-left: auto;
  max-width: 132px;
  font-size: 11px;
}

.structure-readiness {
  justify-self: end;
  border-radius: 999px;
  padding: 6px 9px;
  color: #5f6f78;
  background: #f1f5f7;
  font-size: 12px;
  font-weight: 950;
  white-space: nowrap;
}

.structure-readiness.has-readiness {
  color: #0f5d55;
  background: #e5f7f4;
}

.structure-units,
.structure-revenue {
  justify-self: end;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.structure-revenue {
  color: #52616a;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ranking-table-wrap {
  max-height: 620px;
  overflow: auto;
  scrollbar-gutter: stable;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

th,
td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #52616c;
  background: #f7fafb;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

td .comparison-kpi {
  max-width: 190px;
  margin-left: auto;
  font-size: 11px;
  text-align: right;
}

td:nth-child(2),
th:nth-child(2) {
  text-align: left;
  white-space: normal;
  min-width: 230px;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover {
  background: #f4f8fb;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.range-is-dragging .range-selection,
.range-is-dragging .combo-brush,
.range-is-dragging .combo-handle {
  transition: none;
}

.assistant-widget {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: grid;
  width: min(390px, calc(100vw - 32px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 20px 55px rgba(23, 32, 38, 0.22);
  transform-origin: right bottom;
  transition:
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-radius 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.assistant-head {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #fff 0%, #fff3ed 100%);
  cursor: pointer;
  transition:
    padding 0.36s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.36s ease,
    border-color 0.36s ease;
}

.assistant-avatar {
  width: 46px;
  height: 46px;
  border: 2px solid #fff;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(212, 93, 76, 0.25);
  transition:
    width 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    border-width 0.42s ease,
    transform 0.42s cubic-bezier(0.22, 1, 0.36, 1);
}

.assistant-head div,
.assistant-toggle {
  opacity: 1;
  transform: translateX(0);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
}

.assistant-head h2 {
  margin: 0;
  font-size: 16px;
}

.assistant-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.assistant-toggle {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.assistant-widget.collapsed {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: visible;
  transform: scale(0.98);
  box-shadow: 0 14px 34px rgba(23, 32, 38, 0.24);
}

.assistant-widget.collapsed .assistant-body {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
}

.assistant-widget.collapsed .assistant-head {
  display: block;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
}

.assistant-widget.collapsed .assistant-avatar {
  width: 64px;
  height: 64px;
  border: 3px solid #fff;
  transform: rotate(-2deg);
}

.assistant-widget.collapsed .assistant-head div {
  opacity: 0;
  transform: translateX(8px);
  pointer-events: none;
}

.assistant-widget.collapsed .assistant-toggle {
  opacity: 0;
  transform: scale(0.8);
  pointer-events: none;
}

.assistant-body {
  display: grid;
  gap: 10px;
  max-height: 455px;
  overflow: hidden;
  padding: 12px;
  opacity: 1;
  transition:
    max-height 0.42s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.34s ease,
    opacity 0.22s ease 0.08s;
}

.assistant-messages {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 310px;
  overflow-y: auto;
  padding-right: 4px;
}

.assistant-message {
  display: grid;
  gap: 4px;
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.assistant-message.bot {
  justify-self: start;
  border: 1px solid #f1d7cc;
  border-top-left-radius: 4px;
  color: #4f2f22;
  background: #fff3ed;
}

.assistant-message.user {
  justify-self: end;
  border-top-right-radius: 4px;
  color: #fff;
  background: var(--teal);
}

.assistant-message.typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  min-width: 76px;
}

.assistant-message.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.45;
  animation: assistantTyping 1s infinite ease-in-out;
}

.assistant-message.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.assistant-message.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes assistantTyping {
  0%,
  80%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  40% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

.assistant-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.assistant-suggestions button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: #43515b;
  background: #f7fafb;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.assistant-history-actions {
  display: flex;
  justify-content: flex-end;
}

.assistant-history-actions button {
  min-height: 30px;
  border: 1px solid #f1c9bb;
  border-radius: 999px;
  padding: 0 10px;
  color: #9a4b2c;
  background: #fff5ef;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.assistant-history-actions button:hover {
  background: #ffece2;
}

.assistant-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.assistant-form input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
}

.assistant-form button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

@media (max-width: 900px) {
  .layout,
  .grid-two,
  .kpis {
    grid-template-columns: 1fr;
  }

  .comparison-entity-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    position: static;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    background: #f3f6f7;
  }

  .assistant-widget {
    right: 10px;
    bottom: 10px;
    width: calc(100vw - 20px);
    max-height: min(520px, calc(100vh - 20px));
  }

  .assistant-widget.collapsed {
    width: 64px;
    height: 64px;
  }

  .assistant-messages {
    max-height: 260px;
  }

  .assistant-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 14px;
    width: auto;
    max-width: 100%;
    padding: 16px;
    overflow: hidden;
  }

  .topbar > div,
  .topbar h1,
  .source-meta {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .eyebrow {
    font-size: 11px;
  }

  h1 {
    font-size: 22px;
  }

  h2 {
    font-size: 17px;
  }

  .source-meta,
  .panel-title p {
    font-size: 12px;
    line-height: 1.35;
  }

  .upload-button {
    width: auto;
    max-width: 100%;
    min-width: 0;
    height: 56px;
  }

  .source-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: none;
  }

  .database-sync-button,
  .pdf-export-button,
  .map-open-button,
  .automation-status-button,
  .source-actions .comparison-toggle,
  .source-actions .upload-button {
    width: 100%;
    min-width: 0;
  }

  .database-sync-status {
    text-align: left;
  }

  .automation-status-modal {
    padding: 10px;
  }

  .automation-status-dialog {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .automation-kpi-grid {
    grid-template-columns: 1fr;
  }

  .automation-progress-grid {
    grid-template-columns: 1fr 1fr;
  }

  .map-modal {
    padding: 10px;
  }

  .map-dialog {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }

  .map-dialog-head {
    padding: 14px;
  }

  .map-period-strip {
    top: 10px;
    right: 10px;
    left: 10px;
    width: auto;
    min-width: 0;
    max-width: none;
  }

  .map-period-strip.collapsed {
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .map-period-strip .map-period-presets {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
  }

  .map-analysis-overlay {
    top: 70px;
  }

  .map-dialog-body {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .yandex-map,
  .map-loading-state {
    min-height: 420px;
  }

  .map-data-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .database-sync-status {
    grid-column: 1;
  }

  .pdf-export-dialog {
    padding: 16px;
    border-radius: 14px;
  }

  .pdf-export-body {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }

  .pdf-export-options,
  .pdf-export-format,
  .pdf-export-preview {
    overflow: visible;
  }

  .pdf-export-format {
    grid-template-columns: 1fr;
  }

  .pdf-export-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .comparison-filter-panel {
    position: static;
    padding: 12px;
    max-width: 100%;
    overflow: hidden;
  }

  .comparison-filter-head {
    min-height: auto;
  }

  .comparison-filter-head > div:first-child {
    min-width: 0;
  }

  .comparison-panel-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    gap: 8px;
  }

  .comparison-panel-actions button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
  }

  .comparison-side-card {
    min-width: 0;
    padding: 12px;
  }

  .compare-items-list {
    min-width: 0;
  }

  .compare-item-card {
    min-width: 0;
  }

  .comparison-panel-grid,
  .comparison-panel-grid.compact {
    grid-template-columns: 1fr;
  }

  .comparison-entity-type-switch {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .comparison-side-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

.layout {
    width: auto;
    max-width: 100%;
    gap: 14px;
    padding: 12px;
    overflow: hidden;
  }

.layout > *,
  .content,
  .grid-two,
  .kpis {
    min-width: 0;
    max-width: 100%;
  }

.filters,
  .panel,
  .kpis article {
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(30, 42, 52, 0.06);
  }

  .filters {
    width: 100%;
    padding: 14px;
    min-width: 0;
    max-height: none;
    overflow: visible;
  }

  .filter-head button {
    width: 100%;
    max-width: none;
    padding: 0 10px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .filter-head {
    align-items: stretch;
    flex-direction: column;
    margin-bottom: 12px;
  }

  .filter-head h2 {
    min-width: 0;
  }

  .period-grid {
    flex-direction: column;
    gap: 8px;
  }

  .period-grid label {
    width: 100%;
    min-width: 0;
  }

  select,
  .search-select-input,
  input[type="month"] {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 42px;
    font-size: 14px;
  }

  .kpis {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
  }

  .kpis article {
    min-height: 92px;
    padding: 13px;
  }

  .kpis span {
    font-size: 11px;
    line-height: 1.25;
  }

  .kpis strong {
    margin-top: 10px;
    font-size: 22px;
    line-height: 1.1;
    overflow-wrap: anywhere;
    white-space: normal;
  }

.panel {
    padding: 14px;
    margin-bottom: 14px;
    min-width: 0;
    overflow: hidden;
  }

  .panel-title,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .panel-title select,
  .toolbar select {
    width: 100%;
  }

  .panel-actions {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .panel-actions > * {
    width: 100%;
  }

  .stage-date-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .stage-date-controls > *,
  .stage-date-filter {
    width: 100%;
  }

  .chart {
    min-height: 300px;
    margin: 0 -2px;
    padding-bottom: 4px;
    width: 100%;
    max-width: 100%;
  }

  .chart-scroll {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .chart.compact {
    min-height: 300px;
  }

.structure-list {
    min-height: auto;
  }

  .structure-head {
    display: none;
  }

  .structure-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .structure-name {
    font-size: 14px;
  }

  .structure-metric {
    grid-template-columns: 1fr auto;
  }

  .structure-metric em {
    grid-column: 2;
  }

  .structure-price {
    justify-self: start;
  }

  .structure-readiness {
    justify-self: start;
  }

  .structure-sellout {
    justify-self: start;
    align-items: flex-start;
    text-align: left;
  }

  .chart-scroll svg {
    width: 820px;
    min-width: 820px;
  }

  #salesChart {
    min-height: 360px;
  }

  #salesChart .chart-scroll svg {
    width: 940px;
    min-width: 940px;
  }

  #priceChart .chart-scroll svg {
    width: 1120px;
    min-width: 1120px;
  }

  .combo-legend text,
  .combo-side-label {
    font-size: 12px;
  }

  .combo-value,
  .combo-axis {
    font-size: 10px;
  }

  .table-wrap {
    margin: 0 -2px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 10px;
    font-size: 13px;
  }

  td:nth-child(2),
  th:nth-child(2) {
    min-width: 190px;
  }

  .trail span {
    font-size: 11px;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    left: 12px;
    max-width: none;
  }

  .stage-funnel {
    grid-template-columns: 1fr;
  }

  .stage-step {
    grid-template-columns: 1fr;
    min-height: 82px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stage-step:last-child {
    border-bottom: 0;
  }

  .stage-label {
    grid-column: 1;
  }

  .stage-step strong {
    grid-column: 1;
    margin-top: 10px;
    font-size: 18px;
  }

  .stage-step small {
    grid-column: 1;
    grid-row: auto;
    justify-self: start;
  }

  .stage-comparison {
    grid-column: 1;
    font-size: 11px;
  }

  .absorption-summary {
    grid-template-columns: 1fr;
  }

  .absorption-summary article,
  .absorption-summary article + article {
    padding: 14px 0;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .absorption-summary article:last-child {
    border-bottom: 0;
  }

  .comparison-range-actions {
    align-items: stretch;
    flex-direction: column;
    text-align: center;
  }

  .comparison-controls {
    align-items: stretch;
    flex-direction: column;
  }

  .comparison-controls .comparison-toggle,
  .comparison-controls .previous-year-button,
  .comparison-controls .corpus-detail-toggle {
    width: 100%;
  }

  .corpus-detail-toggle {
    min-height: 42px;
  }

  .corpus-detail-legend {
    align-items: stretch;
    flex-direction: column;
    gap: 7px;
    padding: 8px;
  }

  .corpus-detail-legend-scroll {
    width: 100%;
    padding-bottom: 4px;
  }

  .corpus-detail-chip {
    max-width: 132px;
    padding: 6px 8px;
    font-size: 10px;
  }

  .previous-year-button {
    width: 100%;
  }

  .ranking-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  .absorption-ranking-panel .panel-title > div:first-child {
    flex: 0 1 auto;
    min-width: 0;
    width: 100%;
  }

  .absorption-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    max-width: 100%;
    gap: 6px;
  }

  .absorption-tabs button {
    width: auto;
    min-width: 0;
    padding: 0 6px;
  }

  .ranking-controls select,
  .ranking-controls #absorptionSort {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
    min-height: 42px;
  }

  .range-navigator {
    padding: 12px 10px 6px;
    overflow: hidden;
  }

  .range-track {
    height: 48px;
  }

  .range-handle {
    width: 22px;
    height: 22px;
  }

  .range-labels strong {
    display: none;
  }

  .range-labels {
    grid-template-columns: 1fr 1fr;
  }

  .dynamics-chart-card {
    padding: 10px;
    overflow: hidden;
  }

  .dynamics-chart-title {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .dynamics-chart-title span {
    text-align: left;
  }

  .absorption-rank-row {
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    min-width: 0;
    padding: 10px 0;
  }

  .absorption-rank-name {
    grid-column: 2;
  }

  .absorption-rank-bar {
    grid-column: 2;
  }

  .absorption-rank-value {
    grid-column: 2;
    justify-items: start;
    text-align: left;
  }

  .absorption-rank-details {
    grid-column: 2;
    grid-template-columns: 1fr;
  }

  .absorption-ranking {
    max-height: 62vh;
    padding-right: 4px;
  }

  .absorption-rank-meta,
  .absorption-rank-value,
  .absorption-detail-card {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .structure-list {
    max-height: 68vh;
    padding-right: 2px;
    overflow-x: hidden;
  }

  .structure-row {
    align-items: stretch;
  }

  .structure-metric {
    gap: 6px;
    min-width: 0;
  }

  .structure-track {
    min-width: 0;
  }

  .structure-metric strong,
  .structure-units,
  .structure-revenue,
  .structure-sellout,
  .structure-price,
  .structure-readiness {
    overflow-wrap: anywhere;
  }

  .assistant-widget {
    z-index: 30;
  }

  .assistant-head {
    gap: 8px;
    padding: 10px;
  }

  .assistant-avatar {
    width: 42px;
    height: 42px;
  }

  .assistant-suggestions {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .assistant-suggestions button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

@media (max-width: 420px) {
  .topbar {
    padding: 14px 12px;
  }

  .layout {
    padding: 10px;
  }

  .segmented {
    gap: 8px;
  }

  .panel,
  .filters,
  .dynamics-chart-card {
    border-radius: 10px;
  }

  .kpis article {
    min-height: 84px;
  }

  .kpis strong {
    font-size: 20px;
  }

  .comparison-panel-actions {
    grid-template-columns: 1fr;
  }

  .comparison-entity-type-switch,
  .absorption-tabs {
    grid-template-columns: 1fr;
  }

  .stage-step {
    padding: 13px;
  }

  .chart-scroll svg,
  #salesChart .chart-scroll svg,
  #priceChart .chart-scroll svg {
    width: 760px;
    min-width: 760px;
  }

  .corpus-detail-chip {
    max-width: 118px;
  }

  .assistant-widget {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .assistant-widget.collapsed {
    width: 58px;
    height: 58px;
  }

  .assistant-widget.collapsed .assistant-avatar {
    width: 58px;
    height: 58px;
  }
}

/* Mobile / fold refinement layer. Keep after legacy responsive rules. */
@media (max-width: 1180px) {
  .topbar {
    align-items: flex-start;
    gap: 16px;
    padding-inline: 20px;
  }

  .source-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 1fr));
    width: min(520px, 100%);
  }

  .database-sync-button,
  .pdf-export-button,
  .map-open-button,
  .automation-status-button,
  .upload-button {
    width: 100%;
    min-width: 0;
    height: 50px;
    font-size: 14px;
  }

  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    padding-inline: 20px;
  }

  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .absorption-ranking-panel .panel-title {
    align-items: stretch;
  }

  .absorption-ranking-panel .panel-title > div:first-child {
    flex: 1 1 180px;
    min-width: 0;
  }

  .ranking-controls,
  .structure-controls,
  .comparison-controls {
    max-width: 100%;
  }

  .map-dialog {
    width: min(100vw - 10px, 1840px);
    height: min(100dvh - 10px, 980px);
  }

  .map-dialog-head {
    align-items: center;
    gap: 10px;
  }

  .map-dialog-head > div:first-child {
    flex-basis: 260px;
  }

  .map-dialog-head h2 {
    font-size: 20px;
  }

  .map-layer-toggle {
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .map-layer-toggle button {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

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

  .filters {
    position: static;
    max-height: 56dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

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

  .period-grid label {
    width: 100%;
  }

  .map-dialog-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .map-canvas-embed {
    min-height: 0;
  }

  .yandex-map,
  .map-loading-state {
    min-height: min(62dvh, 620px);
    border-radius: 0;
  }

  .map-data-panel {
    max-height: 34dvh;
    overflow-y: auto;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  #mapProjects {
    max-height: 24dvh;
  }

  .map-analysis-overlay {
    width: min(360px, calc(100% - 24px));
    max-height: min(52dvh, 460px);
    padding: 12px;
  }
}

@media (max-width: 720px) {
  :root {
    --shadow: 0 8px 22px rgba(30, 42, 52, 0.06);
  }

  .topbar {
    padding: max(12px, env(safe-area-inset-top)) 12px 12px;
  }

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

  .source-actions > * {
    min-height: 46px;
  }

  .database-sync-status {
    grid-column: 1 / -1;
  }

  .layout {
    gap: 10px;
    padding: 10px;
  }

  .filters {
    max-height: 52dvh;
    padding: 12px;
    border-radius: 14px;
  }

  .filter-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .filter-head button {
    width: auto;
  }

  .search-select-menu {
    max-height: min(44dvh, 280px);
  }

  .panel {
    padding: 12px;
    border-radius: 14px;
  }

  .panel-title,
  .toolbar,
  .comparison-controls,
  .ranking-controls,
  .structure-controls {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .structure-controls select,
  .ranking-controls select,
  .ranking-controls #absorptionSort,
  .ranking-controls #absorptionEntityCompare {
    width: 100%;
  }

  .comparison-controls .comparison-toggle,
  .comparison-controls .previous-year-button,
  .comparison-controls .corpus-detail-toggle {
    min-height: 44px;
  }

  .chart {
    min-height: 340px;
  }

  .chart-scroll {
    border-radius: 12px;
  }

  .dynamics-chart-card {
    border-radius: 14px;
  }

  .map-modal {
    padding: 0;
  }

  .map-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .map-dialog-head {
    gap: 8px;
    padding: max(10px, env(safe-area-inset-top)) 10px 8px;
    max-height: 32dvh;
    overflow-y: auto;
  }

  .map-dialog-head > div:first-child {
    flex: 1 1 100%;
    min-width: 0;
  }

  .map-dialog-head h2 {
    font-size: 18px;
  }

  .map-dialog-head span {
    display: block;
    font-size: 12px;
    overflow-wrap: anywhere;
  }

  .map-layer-toggle,
  .map-analytics-toggle {
    width: 100%;
    max-width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding: 4px;
  }

  .map-dialog-head .map-layer-toggle button {
    min-width: max-content;
    min-height: 40px;
    padding-inline: 12px;
  }

  #mapModalClose {
    position: absolute;
    top: max(10px, env(safe-area-inset-top));
    right: 10px;
    z-index: 4;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.94);
  }

  .map-dialog-body {
    grid-template-rows: minmax(420px, 62dvh) minmax(220px, 1fr);
    overflow-y: auto;
  }

  .yandex-map,
  .map-loading-state {
    min-height: 420px;
  }

  .map-period-strip {
    top: 8px;
    left: 8px;
    right: 8px;
    width: auto;
    min-width: 0;
    z-index: 4;
  }

  .map-period-strip.collapsed {
    left: 50%;
    right: auto;
    width: min(280px, calc(100vw - 82px));
    transform: translateX(-50%);
  }

  .map-period-toggle {
    width: 100%;
    min-height: 38px;
    padding-inline: 10px;
  }

  .map-period-toggle span {
    font-size: 10px;
  }

  .map-period-toggle strong {
    font-size: 12px;
  }

  .map-period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-analysis-overlay {
    top: 54px;
    left: 8px;
    width: min(330px, calc(100% - 16px));
    max-height: 42dvh;
    border-radius: 14px;
    padding: 10px;
  }

  .map-analysis-overlay-head h3 {
    font-size: 15px;
  }

  .map-analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .map-analysis-grid span {
    min-height: 48px;
    padding: 7px 8px;
  }

  .map-layer-legend,
  .map-analysis-insight,
  .map-analysis-tops {
    font-size: 11px;
  }

  .map-project-passport {
    inset: 8px auto auto 8px;
    width: min(390px, calc(100% - 16px));
    max-height: calc(100% - 16px);
    border-radius: 16px;
    padding: 14px;
  }

  .map-passport-kpis,
  .map-passport-radius-analysis .map-analysis-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .map-passport-corpuses ul {
    max-height: 30dvh;
  }

  .map-data-panel {
    max-height: none;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
  }

  .map-card-title-row {
    align-items: stretch;
    flex-direction: column;
  }

  .map-filter-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .map-filter-actions button {
    width: 100%;
  }

  .map-filter-grid {
    grid-template-columns: 1fr;
  }

  #mapProjects {
    max-height: 34dvh;
  }

  .pdf-export-modal {
    padding: 0;
  }

  .pdf-export-dialog {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }

  .pdf-export-preview {
    min-height: 280px;
  }

  .assistant-widget {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 20px;
  }

  .source-actions {
    grid-template-columns: 1fr;
  }

  .database-sync-button,
  .pdf-export-button,
  .map-open-button,
  .automation-status-button,
  .upload-button {
    height: 46px;
  }

  .period-grid,
  .map-period-grid,
  .map-analysis-grid,
  .map-passport-kpis,
  .map-passport-radius-analysis .map-analysis-grid {
    grid-template-columns: 1fr;
  }

  .filters {
    max-height: 48dvh;
  }

  .map-dialog-body {
    grid-template-rows: minmax(380px, 58dvh) auto;
  }

  .yandex-map,
  .map-loading-state {
    min-height: 380px;
  }

  .map-analysis-overlay {
    width: calc(100% - 16px);
    max-height: 38dvh;
  }

  .map-project-passport {
    width: calc(100% - 16px);
  }

  .map-project-passport h3 {
    font-size: 18px;
  }

  .map-passport-kpis b {
    font-size: 15px;
  }

  .assistant-message {
    max-width: 94%;
  }
}

/* Tiny visual theme switcher: intentionally hidden in the far top-left corner. */
.theme-mini-switcher {
  position: fixed;
  top: 7px;
  left: 7px;
  z-index: 1600;
  display: inline-flex;
  transform: scale(0.82);
  transform-origin: top left;
  opacity: 0.3;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.theme-mini-switcher:hover,
.theme-mini-switcher:focus-within {
  transform: scale(1);
  opacity: 1;
}

.theme-mini-button {
  width: 26px;
  height: 26px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 999px;
  color: var(--teal);
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  box-shadow: 0 8px 20px rgba(18, 28, 38, 0.08);
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  backdrop-filter: blur(10px);
}

.theme-mini-menu {
  position: absolute;
  top: 32px;
  left: 0;
  display: grid;
  width: 118px;
  gap: 3px;
  padding: 6px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 16px 40px rgba(18, 28, 38, 0.16);
  backdrop-filter: blur(16px);
}

.theme-mini-menu[hidden] {
  display: none;
}

.theme-mini-menu button {
  min-height: 24px;
  border: 0;
  border-radius: 8px;
  padding: 4px 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 850;
  text-align: left;
}

.theme-mini-menu button:hover,
.theme-mini-menu button.active {
  color: var(--ink);
  background: var(--accent-soft, rgba(15, 148, 136, 0.12));
}

body[data-visual-theme="dark"] {
  --bg: #07111f;
  --panel: #0f1b2b;
  --ink: #eef5ff;
  --muted: #9fb0c2;
  --line: rgba(158, 174, 190, 0.22);
  --teal: #2dd4bf;
  --blue: #60a5fa;
  --coral: #fb7185;
  --compare: #fb923c;
  --compare-border: rgba(251, 146, 60, 0.66);
  --compare-bg: rgba(124, 45, 18, 0.28);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  --accent-soft: rgba(45, 212, 191, 0.14);
  background:
    radial-gradient(circle at 12% 0%, rgba(45, 212, 191, 0.12), transparent 28%),
    radial-gradient(circle at 88% 8%, rgba(96, 165, 250, 0.14), transparent 30%),
    var(--bg);
}

body[data-visual-theme="glass"] {
  --bg: #eaf5f7;
  --panel: rgba(255, 255, 255, 0.62);
  --ink: #16222b;
  --muted: #607481;
  --line: rgba(151, 180, 190, 0.48);
  --teal: #0f9488;
  --blue: #2563eb;
  --coral: #d45d4c;
  --shadow: 0 22px 58px rgba(45, 76, 86, 0.16);
  --accent-soft: rgba(15, 148, 136, 0.13);
  background:
    radial-gradient(circle at 18% 4%, rgba(45, 212, 191, 0.2), transparent 30%),
    radial-gradient(circle at 78% 12%, rgba(37, 99, 235, 0.1), transparent 30%),
    linear-gradient(135deg, #f7fbfc 0%, #e8f5f5 46%, #f5f7fb 100%);
}

body[data-visual-theme="rose"] {
  --bg: #fff3f8;
  --panel: #fffafd;
  --ink: #291721;
  --muted: #826978;
  --line: #f0d5e3;
  --teal: #db2777;
  --blue: #a855f7;
  --coral: #fb7185;
  --compare: #be185d;
  --compare-border: #f9a8d4;
  --compare-bg: #fff1f7;
  --shadow: 0 16px 42px rgba(190, 24, 93, 0.1);
  --accent-soft: rgba(219, 39, 119, 0.12);
}

body[data-visual-theme="red"] {
  --bg: #fff5f2;
  --panel: #fffaf8;
  --ink: #281513;
  --muted: #83655f;
  --line: #f0d3cc;
  --teal: #c62828;
  --blue: #b91c1c;
  --coral: #e04f3f;
  --compare: #a84622;
  --compare-border: #f08a73;
  --compare-bg: #fff0eb;
  --shadow: 0 16px 42px rgba(198, 40, 40, 0.1);
  --accent-soft: rgba(198, 40, 40, 0.12);
}

body[data-visual-theme="ocean"] {
  --bg: #eefaff;
  --panel: #fbfeff;
  --ink: #102633;
  --muted: #607988;
  --line: #cfe4ee;
  --teal: #0284c7;
  --blue: #0ea5e9;
  --coral: #14b8a6;
  --compare: #0369a1;
  --compare-border: #7dd3fc;
  --compare-bg: #ecfeff;
  --shadow: 0 16px 44px rgba(2, 132, 199, 0.11);
  --accent-soft: rgba(14, 165, 233, 0.13);
  background:
    radial-gradient(circle at 12% 0%, rgba(14, 165, 233, 0.14), transparent 30%),
    linear-gradient(135deg, #f7fdff 0%, #eaf8ff 52%, #f1fbfb 100%);
}

body[data-visual-theme="amber"] {
  --bg: #fff9ed;
  --panel: #fffdf7;
  --ink: #2a2114;
  --muted: #816f55;
  --line: #ecd9b6;
  --teal: #d97706;
  --blue: #b45309;
  --coral: #ea580c;
  --compare: #92400e;
  --compare-border: #fbbf24;
  --compare-bg: #fff7dc;
  --shadow: 0 16px 42px rgba(217, 119, 6, 0.11);
  --accent-soft: rgba(217, 119, 6, 0.13);
  background:
    radial-gradient(circle at 10% 2%, rgba(251, 191, 36, 0.18), transparent 32%),
    linear-gradient(135deg, #fffaf0 0%, #fff6dc 46%, #fffdf8 100%);
}

body[data-visual-theme="violet"] {
  --bg: #f7f3ff;
  --panel: #fefcff;
  --ink: #21182f;
  --muted: #746483;
  --line: #ded0f2;
  --teal: #7c3aed;
  --blue: #6366f1;
  --coral: #c084fc;
  --compare: #6d28d9;
  --compare-border: #c4b5fd;
  --compare-bg: #f5f0ff;
  --shadow: 0 16px 42px rgba(124, 58, 237, 0.11);
  --accent-soft: rgba(124, 58, 237, 0.13);
  background:
    radial-gradient(circle at 14% 0%, rgba(124, 58, 237, 0.14), transparent 30%),
    radial-gradient(circle at 92% 10%, rgba(99, 102, 241, 0.1), transparent 28%),
    linear-gradient(135deg, #fbf8ff 0%, #f2ecff 48%, #fff9ff 100%);
}

body[data-visual-theme]:not([data-visual-theme="default"]) {
  color: var(--ink);
}

body[data-visual-theme]:not([data-visual-theme="default"]) .topbar,
body[data-visual-theme]:not([data-visual-theme="default"]) .filters,
body[data-visual-theme]:not([data-visual-theme="default"]) .panel,
body[data-visual-theme]:not([data-visual-theme="default"]) .content > section,
body[data-visual-theme]:not([data-visual-theme="default"]) .comparison-filter-panel,
body[data-visual-theme]:not([data-visual-theme="default"]) .comparison-side-card,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-dialog,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-data-panel,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-analysis-overlay,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-project-passport,
body[data-visual-theme]:not([data-visual-theme="default"]) .pdf-export-dialog,
body[data-visual-theme]:not([data-visual-theme="default"]) .assistant-panel {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
}

body[data-visual-theme="glass"] .topbar,
body[data-visual-theme="glass"] .filters,
body[data-visual-theme="glass"] .panel,
body[data-visual-theme="glass"] .content > section,
body[data-visual-theme="glass"] .comparison-filter-panel,
body[data-visual-theme="glass"] .comparison-side-card,
body[data-visual-theme="glass"] .map-dialog,
body[data-visual-theme="glass"] .map-data-panel,
body[data-visual-theme="glass"] .map-analysis-overlay,
body[data-visual-theme="glass"] .map-project-passport,
body[data-visual-theme="glass"] .pdf-export-dialog,
body[data-visual-theme="glass"] .assistant-panel {
  backdrop-filter: blur(18px) saturate(1.12);
}

body[data-visual-theme]:not([data-visual-theme="default"]) input,
body[data-visual-theme]:not([data-visual-theme="default"]) select,
body[data-visual-theme]:not([data-visual-theme="default"]) textarea,
body[data-visual-theme]:not([data-visual-theme="default"]) .searchable-select-input {
  border-color: var(--line);
  color: var(--ink);
  background: color-mix(in srgb, var(--panel) 82%, #ffffff 18%);
}

body[data-visual-theme="dark"] input,
body[data-visual-theme="dark"] select,
body[data-visual-theme="dark"] textarea,
body[data-visual-theme="dark"] .searchable-select-input {
  background: rgba(255, 255, 255, 0.06);
}

body[data-visual-theme]:not([data-visual-theme="default"]) .source-meta,
body[data-visual-theme]:not([data-visual-theme="default"]) .panel-title p,
body[data-visual-theme]:not([data-visual-theme="default"]) label,
body[data-visual-theme]:not([data-visual-theme="default"]) .muted,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-meta,
body[data-visual-theme]:not([data-visual-theme="default"]) .sales-table-subtitle {
  color: var(--muted);
}

body[data-visual-theme]:not([data-visual-theme="default"]) .kpis article,
body[data-visual-theme]:not([data-visual-theme="default"]) .stage-card,
body[data-visual-theme]:not([data-visual-theme="default"]) .structure-row,
body[data-visual-theme]:not([data-visual-theme="default"]) .sales-row,
body[data-visual-theme]:not([data-visual-theme="default"]) .ranking-row,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-project-card,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-analysis-grid span,
body[data-visual-theme]:not([data-visual-theme="default"]) .map-passport-kpis span {
  border-color: var(--line);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
}
