:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  font-synthesis: none;
  --app-background: #e9eef3;
  --panel-background: #f8fafc;
  --panel-muted: #f1f5f9;
  --line: #d5dde6;
  --line-strong: #bcc8d4;
  --text: #213142;
  --text-muted: #6b7a89;
  --accent: #004898;
  --accent-dark: #00366f;
  --accent-soft: #e5eef8;
  --danger: #a3443c;
  --danger-soft: #f8ebe9;
  --focus: #1264b4;
  --left-panel-width: 260px;
  --right-panel-width: 310px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  min-width: 1120px;
  overflow: hidden;
  color: var(--text);
  background: var(--app-background);
  font-size: 14px;
  line-height: 1.45;
}

.access-gate {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
  background: #e9eef3;
}

.access-panel {
  width: min(430px, 100%);
  padding: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(31, 48, 64, 0.16);
}

.access-panel-compact {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 2px 14px;
}

.access-panel-compact .brand-mark {
  grid-row: 1 / span 2;
}

.access-panel-compact strong {
  font-size: 16px;
}

.access-panel-compact span:last-child {
  color: var(--text-muted);
  font-size: 12px;
}

.access-panel.is-error {
  border-color: #cb8c86;
}

.access-panel.is-error .brand-mark {
  box-shadow: 0 0 0 2px rgba(163, 68, 60, 0.45);
}

.access-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.access-brand span {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.access-brand h1 {
  margin: 2px 0 0;
  font-size: 22px;
}

.login-form {
  padding-top: 22px;
}

.login-form h2 {
  margin: 0;
  font-size: 18px;
}

.login-form > div > p {
  margin: 5px 0 18px;
  color: var(--text-muted);
  font-size: 12px;
}

.login-form .field input,
.password-change-fields .field input,
.account-create-form .field input,
.account-create-form .field select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
}

.access-submit {
  width: 100%;
  margin-top: 4px;
}

.access-footnote {
  margin: 17px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  text-align: center;
}

.form-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--danger);
  color: #843c36;
  background: var(--danger-soft);
  font-size: 12px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 9px 16px 9px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 250, 252, 0.98);
}

.country-home {
  width: 100%;
  height: 100%;
  overflow: auto;
  background: #eef2f5;
}

.country-home-header,
.country-home-body,
.country-home-footer {
  width: min(1440px, calc(100% - 48px));
  margin: 0 auto;
}

.country-home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 88px;
  border-bottom: 1px solid var(--line);
}

.country-home-actions,
.cloud-account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.country-home-actions {
  justify-content: flex-end;
}

.cloud-account-actions {
  min-width: 0;
}

.cloud-account-actions-header {
  flex: 0 0 auto;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.account-name {
  max-width: 130px;
  overflow: hidden;
  color: #40546a;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-role {
  padding: 3px 6px;
  border: 1px solid #b7c9da;
  border-radius: 4px;
  color: #3c5870;
  background: #edf3f8;
  font-size: 10px;
  font-weight: 700;
}

.country-home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.country-home-brand h1 {
  margin: 0;
  font-size: 24px;
}

.country-home-brand p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.country-home-body {
  padding: 26px 0 32px;
}

.country-home-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 16px;
}

.country-home-heading h2 {
  margin: 3px 0 0;
  font-size: 20px;
}

.country-home-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #496252;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4d8a60;
}

.country-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.country-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #cad5df;
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(37, 55, 72, 0.06);
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.country-card:hover {
  border-color: #88a5b6;
  box-shadow: 0 8px 20px rgba(37, 55, 72, 0.12);
  transform: translateY(-2px);
}

.country-card.is-research-ready {
  border-color: #5f9299;
  box-shadow: inset 0 0 0 1px rgba(52, 125, 135, 0.18);
}

.country-card-main {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: #ffffff;
  text-align: left;
  cursor: pointer;
}

.country-card-main:disabled {
  cursor: wait;
  opacity: 0.65;
}

.country-card-media {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 8.6;
  overflow: hidden;
  background: #dfe6eb;
}

.country-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 220ms ease;
}

.country-card:hover .country-card-media img {
  transform: scale(1.025);
}

.country-card-media.is-placeholder {
  display: grid;
  place-items: center;
  color: #82909d;
  font-size: 28px;
  font-weight: 750;
}

.country-card-status {
  position: absolute;
  top: 9px;
  right: 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 4px;
  background: rgba(25, 42, 56, 0.82);
  color: #ffffff;
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
}

.country-card.is-research-ready .country-card-status {
  background: rgba(26, 103, 83, 0.9);
}

.country-card-body {
  padding: 11px 12px 9px;
}

.country-card-body > div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.country-card-body strong {
  font-size: 16px;
}

.country-card-body span,
.country-card-body small {
  color: var(--text-muted);
  font-size: 10.5px;
}

.country-card-body p {
  min-height: 36px;
  margin: 6px 0 5px;
  color: #405162;
  font-size: 12px;
  line-height: 1.5;
}

.country-card-credit {
  display: block;
  overflow: hidden;
  border-top: 1px solid #edf0f3;
  padding: 5px 12px 6px;
  color: #748392;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 9px;
  text-decoration: none;
}

.country-card-credit:hover {
  color: #1f6f78;
  text-decoration: underline;
}

.country-home-footer {
  border-top: 1px solid var(--line);
  padding: 14px 0 24px;
  color: var(--text-muted);
  font-size: 11px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  border-radius: 8px;
}

.brand-home-button {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.brand-logo-image {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-home-button:hover .brand-logo-image {
  filter: brightness(1.08);
}

.product-workspace-nav {
  display: flex;
  align-self: stretch;
  gap: 2px;
}

.product-workspace-nav button {
  position: relative;
  min-width: 92px;
  border: 0;
  background: transparent;
  color: #526579;
  font-weight: 700;
  cursor: pointer;
}

.product-workspace-nav button:hover {
  background: #eef3f7;
}

.product-workspace-nav button.is-active {
  color: #004898;
}

.product-workspace-nav button.is-active::after {
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 3px;
  background: #004898;
  content: "";
}

.app-header[data-active-workspace="report"] .header-actions,
.app-header[data-active-workspace="research"] .header-actions {
  display: none;
}

.app-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.app-context {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 11px;
}

.country-picker {
  display: block;
  margin-left: 5px;
  padding-left: 13px;
  border-left: 1px solid var(--line);
}

.country-picker select {
  width: 132px;
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.country-import-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #40546a;
  background: #ffffff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.country-import-button:hover {
  border-color: #91a5ba;
  background: #f2f6fa;
}

.header-actions,
.action-group {
  display: flex;
  align-items: center;
}

.header-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.app-header[data-active-workspace="map"] .product-workspace-nav {
  flex: 0 0 auto;
}

.app-header[data-active-workspace="map"] .save-status {
  flex: 0 0 auto;
  white-space: nowrap;
}

.action-group {
  gap: 5px;
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.save-status {
  flex: 0 0 42px;
  min-width: 42px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: right;
  white-space: nowrap;
}

.app-header[data-active-workspace="map"] .header-actions {
  justify-content: flex-start;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-header[data-active-workspace="map"] .header-actions::-webkit-scrollbar {
  display: none;
}

.button,
.icon-text-button,
.danger-button {
  min-height: 34px;
  border-radius: 6px;
  cursor: pointer;
  transition:
    background-color 120ms ease,
    border-color 120ms ease,
    color 120ms ease;
}

.button {
  padding: 0 12px;
  border: 1px solid transparent;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 600;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.button-quiet {
  color: #526579;
  background: transparent;
}

.button-quiet:hover:not(:disabled) {
  background: #eef2f6;
}

.button-secondary {
  border-color: var(--line-strong);
  background: #ffffff;
}

.button-secondary:hover:not(:disabled) {
  border-color: #91a5ba;
  background: #f2f6fa;
}

.button-primary {
  border-color: var(--accent);
  color: #ffffff;
  background: var(--accent);
}

.button-primary:hover:not(:disabled) {
  border-color: var(--accent-dark);
  background: var(--accent-dark);
}

.research-data-dialog {
  width: 100%;
  height: calc(100vh - 64px);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  box-shadow: none;
}

.research-data-shell {
  display: grid;
  grid-template-rows: auto 50px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.research-data-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.research-data-header h2 {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 18px;
}

.research-data-dialog .dialog-close-button {
  display: none;
}

.research-data-dialog[data-workspace="report"] .research-tabs,
.research-data-dialog[data-workspace="report"] .research-search-filter {
  display: none;
}

.research-data-dialog[data-workspace="report"] .research-toolbar {
  grid-template-columns: minmax(0, 1fr) 160px auto;
}

.research-data-dialog[data-workspace="report"] .research-filter:has(#researchLanguageSelect) {
  grid-column: 2;
}

.research-toolbar {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) 160px auto;
  gap: 10px;
  align-items: center;
  height: 50px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.research-tabs {
  display: inline-flex;
  gap: 4px;
}

.research-tab {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.research-tab.is-active {
  border-color: #004898;
  background: #004898;
  color: #ffffff;
  box-shadow: 0 0 0 2px rgba(0, 72, 152, 0.12);
}

.research-filter {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.research-filter input,
.research-filter select,
.research-period-select {
  min-width: 0;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0 9px;
}

.research-body {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.research-dataset-list,
.research-detail-panel,
.research-action-panel {
  min-width: 0;
  overflow: auto;
  padding: 12px;
}

.research-dataset-list {
  border-right: 1px solid var(--line);
  background: #f7f9fb;
}

.research-action-panel {
  border-left: 1px solid var(--line);
  background: #fbfcfd;
}

.research-dataset-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
}

.research-dataset-item + .research-dataset-item {
  margin-top: 8px;
}

.research-dataset-item.is-active {
  border-color: #347d87;
  box-shadow: inset 3px 0 0 #347d87;
}

.research-dataset-item span,
.policy-card span,
.source-card small,
.eligibility-card span {
  color: var(--text-muted);
  font-size: 11px;
}

.research-detail-panel h2 {
  margin: 0 0 6px;
  color: var(--text);
  font-size: 20px;
}

.research-detail-panel p {
  margin: 0 0 10px;
  color: #415061;
  line-height: 1.55;
}

.research-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.research-meta-grid span {
  overflow: hidden;
  border-radius: 5px;
  background: #f3f6f7;
  color: #415061;
  padding: 6px 8px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
}

.research-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.research-table th,
.research-table td {
  border-bottom: 1px solid #e4e9ee;
  padding: 7px 8px;
  text-align: left;
  vertical-align: top;
}

.research-table th {
  background: #f5f7f9;
  color: #415061;
  font-weight: 750;
}

.policy-list,
.source-card-list,
.applied-layer-list {
  display: grid;
  gap: 8px;
}

.policy-card,
.source-card,
.eligibility-card,
.applied-layer-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px;
}

.policy-card p {
  margin: 6px 0;
}

.source-card {
  display: grid;
  gap: 5px;
}

.source-card a {
  color: #1f6f78;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.eligibility-card {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
}

.eligibility-card.is-eligible {
  border-color: #82a98c;
  background: #f0f7f2;
}

.eligibility-card.is-partial {
  border-color: #d49a3a;
  background: #fff8e9;
}

.eligibility-card[class*="blocked"] {
  border-color: #d8a1a1;
  background: #fff3f3;
}

.research-map-settings > .button {
  width: 100%;
  margin-bottom: 8px;
}

.applied-layer-list {
  margin-top: 8px;
}

.applied-layer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 6px;
  align-items: center;
  font-size: 12px;
}

.applied-layer-row.is-active {
  border-color: #347d87;
  box-shadow: inset 3px 0 0 #347d87;
}

.applied-layer-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.applied-layer-row button {
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #ffffff;
  color: #415061;
  padding: 4px 7px;
  cursor: pointer;
}

.research-chart-svg {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.research-export-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

.research-empty {
  color: var(--text-muted);
  font-size: 13px;
}

.research-report {
  display: grid;
  gap: 18px;
  color: var(--text);
}

.report-header {
  padding-bottom: 14px;
  border-bottom: 2px solid #347d87;
}

.report-header h2 {
  margin-top: 4px;
  font-size: 24px;
}

.report-header p {
  max-width: 920px;
  margin-bottom: 0;
}

.report-source-band {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  border-left: 4px solid #d49a3a;
  background: #fff8e9;
  padding: 10px 12px;
  color: #415061;
  font-size: 12px;
}

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

.report-metric {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 11px 12px;
}

.report-metric span,
.report-metric small,
.report-section-heading span,
.report-chart-panel figcaption,
.report-procedure span {
  color: var(--text-muted);
  font-size: 11px;
}

.report-metric strong {
  color: #1f6f78;
  font-size: 18px;
}

.report-section,
.report-table-section,
.report-quality,
.report-source-streams {
  display: grid;
  gap: 10px;
}

.report-source-stream {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e4e9ee;
  color: #415061;
  font-size: 12px;
}

.report-section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}

.report-section-heading h3 {
  margin: 0;
  font-size: 16px;
}

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

.report-finding {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  border-bottom: 1px solid #e4e9ee;
  padding: 8px 0 10px;
}

.report-finding > b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #347d87;
  color: #ffffff;
  font-size: 11px;
}

.report-finding p {
  margin: 4px 0;
  font-size: 12px;
}

.report-finding small {
  color: var(--text-muted);
  font-size: 10.5px;
}

.report-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(280px, 520px));
  justify-content: start;
  gap: 14px;
}

.report-chart-panel {
  display: grid;
  gap: 5px;
  min-width: 0;
  max-width: 520px;
  margin: 0;
}

.report-chart-panel .research-chart-svg {
  max-height: 320px;
}

.report-chart-panel figcaption {
  padding: 0 2px;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.research-catalog-group {
  display: grid;
  gap: 7px;
}

.research-catalog-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  margin: 3px 0 0;
  padding: 7px 3px 5px;
  color: #526579;
  background: #f7f9fb;
  font-size: 11px;
  font-weight: 750;
}

.research-dataset-item.is-guide-table span::before {
  content: "指南表格 · ";
}

.report-topic-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.report-topic-strip span {
  border: 1px solid #cdd9e2;
  border-radius: 4px;
  background: #f3f6f7;
  padding: 4px 7px;
  color: #415061;
  font-size: 11px;
}

.report-status {
  display: inline-block;
  border-radius: 4px;
  background: #fff0d7;
  color: #875b10;
  padding: 2px 5px;
  font-size: 10px;
  font-weight: 750;
}

.report-status.is-critical {
  background: #fde7e7;
  color: #9b3131;
}

.report-quality {
  border-left: 4px solid #c86558;
  background: #fff5f4;
  padding: 12px;
}

.report-quality ul {
  margin: 0;
  padding-left: 20px;
  color: #5a4242;
  font-size: 12px;
  line-height: 1.65;
}

.report-procedures {
  display: grid;
  gap: 10px;
}

.report-procedure {
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.report-procedure > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.report-procedure ol {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  margin: 8px 0 0;
  padding-left: 24px;
  color: #415061;
  font-size: 12px;
}

@media (max-width: 900px) {
  .report-metric-grid,
  .report-findings,
  .report-chart-grid {
    grid-template-columns: 1fr;
  }
}

.map-dataset-checklist {
  display: grid;
  gap: 8px;
}

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

#heatmapLabelControls[hidden] {
  display: none;
}

.map-dataset-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 48px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  cursor: pointer;
}

.map-dataset-row input {
  width: 16px;
  height: 16px;
}

.map-dataset-row span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.map-dataset-row strong {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map-dataset-row small {
  color: var(--text-muted);
  font-size: 11px;
}

.research-legend-editor {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.research-overview-card,
.research-state-card,
.research-layer-legend {
  cursor: move;
}

.map-workspace-panel {
  display: grid;
  gap: 10px;
}

.map-workspace-heading,
.map-layer-summary {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
  padding: 10px;
}

.map-workspace-heading strong,
.map-layer-summary strong {
  color: var(--text);
  font-size: 15px;
}

.map-workspace-heading span,
.map-layer-summary span,
.map-workspace-note,
.map-workflow-step span {
  color: var(--text-muted);
  font-size: 12px;
}

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

.map-workflow-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 2px 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 9px;
}

.map-workflow-step b {
  display: grid;
  grid-row: span 2;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: #ffffff;
  background: #004898;
  font-size: 12px;
}

.map-workflow-step strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
}

.map-layer-summary ul {
  margin: 4px 0 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 12px;
}

.map-workspace-note {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--left-panel-width) minmax(560px, 1fr) var(--right-panel-width);
  height: calc(100vh - 64px);
  min-height: 0;
  transition: grid-template-columns 180ms ease;
}

.panel {
  display: grid;
  grid-template-rows: 54px minmax(0, 1fr);
  min-width: 0;
  overflow: hidden;
  background: var(--panel-background);
}

.left-panel {
  border-right: 1px solid var(--line);
}

.right-panel {
  border-left: 1px solid var(--line);
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  min-width: 0;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #f2f6fa;
}

.sidebar-identity {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.sidebar-identity-right {
  margin-left: auto;
  text-align: right;
}

.sidebar-heading-copy {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.sidebar-heading-copy strong {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-heading-copy small {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: 10px;
}

.sidebar-mark {
  position: relative;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border: 1px solid #b9c7d5;
  border-radius: 6px;
  background: #ffffff;
}

.sidebar-mark-layers::before,
.sidebar-mark-layers::after {
  position: absolute;
  left: 6px;
  width: 12px;
  height: 7px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  content: "";
}

.sidebar-mark-layers::before {
  top: 6px;
}

.sidebar-mark-layers::after {
  top: 11px;
  background: rgba(0, 72, 152, 0.12);
}

.sidebar-mark-settings::before {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px #ffffff;
  background: var(--accent);
  content: "";
}

.sidebar-toggle-button {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #4d6176;
  background: #ffffff;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.sidebar-toggle-button:hover {
  border-color: #8fa5ba;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.sidebar-body {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
}

body.is-left-collapsed {
  --left-panel-width: 52px;
}

body.is-right-collapsed {
  --right-panel-width: 52px;
}

body.is-left-collapsed .left-panel .sidebar-body,
body.is-right-collapsed .right-panel .sidebar-body,
body.is-left-collapsed .left-panel .sidebar-identity,
body.is-right-collapsed .right-panel .sidebar-identity {
  display: none;
}

body.is-left-collapsed .left-panel .sidebar-header,
body.is-right-collapsed .right-panel .sidebar-header {
  justify-content: center;
  padding-right: 8px;
  padding-left: 8px;
}

.panel-section {
  padding: 19px 18px;
}

.panel-section + .panel-section {
  border-top: 1px solid var(--line);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.section-heading h2 {
  margin: 2px 0 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}

.step-heading {
  align-items: center;
}

.section-title-block {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.section-title-block h2 {
  margin: 0;
}

.step-badge {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 11px;
  font-weight: 750;
}

.property-heading {
  margin-bottom: 17px;
}

.section-kicker {
  display: block;
  color: #7c8b87;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  color: var(--accent-dark);
  background: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.icon-text-button span {
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
}

.icon-text-button:hover {
  border-color: #8ea39e;
  background: var(--accent-soft);
}

.group-list {
  display: grid;
  gap: 3px;
}

.group-list-empty {
  display: grid;
  place-items: center;
  min-height: 68px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--text-muted);
  background: #fbfcfc;
  font-size: 12px;
}

.group-item {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 43px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.group-item:hover {
  background: #f0f4f2;
}

.group-item.is-active {
  border-color: #c4d6d1;
  background: var(--accent-soft);
}

.group-color {
  width: 13px;
  height: 13px;
  border: 1px solid rgba(22, 36, 33, 0.18);
  border-radius: 3px;
}

.group-name {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-count {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.province-section {
  min-height: 0;
}

.range-section {
  min-height: 0;
}

.mode-control {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.mode-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 42px;
  padding: 0 7px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.mode-button:last-child {
  border-right: 0;
}

.mode-button:hover {
  background: #f0f4f2;
}

.mode-button:disabled,
.tool-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.mode-button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.mode-icon {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 16px;
  line-height: 1;
}

.range-controls[hidden] {
  display: none;
}

.subsection-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  color: #4e5f5b;
  font-size: 12px;
  font-weight: 700;
}

.drawing-tool-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

.tool-button {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  min-width: 0;
  height: 39px;
  padding: 0 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.tool-button:nth-child(2n) {
  border-right: 0;
}

.tool-button:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.tool-button:hover {
  background: #f0f4f2;
}

.tool-button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.tool-icon {
  flex: 0 0 auto;
  width: 17px;
  color: var(--accent);
  font-size: 17px;
  line-height: 1;
  text-align: center;
}

.drawing-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  margin: 0 0 10px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #4e5f5b;
  background: #f8faf9;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.drawing-option-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.custom-shape-list {
  display: grid;
  gap: 3px;
  min-height: 44px;
}

.custom-shape-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.custom-shape-item:hover {
  background: #f0f4f2;
}

.custom-shape-item.is-active {
  border-color: #c4d6d1;
  background: var(--accent-soft);
}

.shape-symbol {
  color: var(--accent);
  font-size: 15px;
  line-height: 1;
  text-align: center;
}

.shape-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shape-type {
  color: var(--text-muted);
  font-size: 10px;
}

.shape-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 11px;
}

.shape-action-row button {
  min-width: 0;
  min-height: 32px;
  padding: 0 6px;
  font-size: 11px;
}

.secondary-action-button {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: #53635f;
  background: #ffffff;
  cursor: pointer;
  font-weight: 650;
}

.secondary-action-button:hover:not(:disabled) {
  color: var(--accent-dark);
  border-color: #8ea39e;
  background: var(--accent-soft);
}

.secondary-action-button:disabled,
.shape-action-row .danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.province-heading {
  align-items: flex-end;
  margin-bottom: 12px;
}

.count-label {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
}

.search-field {
  display: block;
  margin-bottom: 10px;
}

.search-field input,
.field input[type="text"],
.field textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
}

.search-field input {
  height: 35px;
  padding: 0 10px;
}

.search-field input::placeholder,
.field input::placeholder,
.field textarea::placeholder {
  color: #9aa6a3;
}

.province-list {
  display: grid;
  gap: 1px;
}

.province-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 12px;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 4px 6px;
  border-radius: 5px;
  cursor: pointer;
}

.province-row:has(.province-drill-button) {
  grid-template-columns: 18px minmax(0, 1fr) 12px auto;
}

.province-row:hover {
  background: #eef2f1;
}

.province-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
}

.province-name-wrap {
  display: block;
  min-width: 0;
}

.province-name {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.province-owner {
  width: 9px;
  height: 9px;
  border: 1px solid rgba(24, 34, 32, 0.12);
  border-radius: 2px;
  background: #d7dddb;
}

.province-drill-button {
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--accent-dark);
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
}

.province-drill-button:hover {
  background: var(--accent-soft);
}

.empty-list {
  padding: 22px 8px;
  color: var(--text-muted);
  font-size: 12px;
  text-align: center;
}

.group-empty-state {
  min-height: 120px;
  padding: 38px 12px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--text-muted);
  background: #fbfcfc;
  text-align: center;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(58px, auto) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  background: #e4e9ef;
}

.workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 5px 18px;
  border-bottom: 1px solid #cfd9e3;
  background: #eef2f6;
}

.workspace-bar > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.workspace-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  min-width: 0;
}

.zoom-control {
  display: grid;
  flex: 0 0 116px;
  grid-template-columns: 30px 56px 30px;
  overflow: hidden;
  border: 1px solid #b8c6d4;
  border-radius: 6px;
  background: #ffffff;
}

.zoom-control button {
  height: 29px;
  padding: 0;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.zoom-control button:last-child {
  border-right: 0;
}

.zoom-control button:hover:not(:disabled) {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.zoom-control button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.zoom-control .zoom-value {
  color: #4f6276;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.workspace-title {
  font-size: 12px;
  font-weight: 700;
}

.workspace-meta {
  margin-left: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.active-group-indicator {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: #526579;
  font-size: 11px;
}

.active-group-indicator .indicator-color {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.active-group-indicator .indicator-name {
  max-width: 220px;
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: auto;
  padding: 16px;
}

.map-composition {
  position: relative;
  width: min(100%, calc((100vh - 154px) * 1.7778));
  min-width: 520px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid rgba(45, 64, 60, 0.16);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(34, 50, 46, 0.16);
  background: #eef2f1;
}

.map-composition > .basemap-viewport {
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  background: #dce8e8;
  transition: opacity 120ms ease;
}

.map-canvas {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.basemap-attribution {
  position: absolute;
  z-index: 2;
  right: 8px;
  bottom: 8px;
  max-width: calc(100% - 16px);
  padding: 2px 5px;
  color: #4f615d;
  background: rgba(248, 250, 249, 0.86);
  font-size: 8px;
  line-height: 1.25;
  pointer-events: auto;
}

.basemap-attribution a {
  color: inherit;
}

.basemap-status {
  min-height: 18px;
  margin: -4px 0 14px;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.basemap-status.is-error {
  color: var(--danger);
}

.map-canvas.is-drawing {
  cursor: crosshair;
}

.map-canvas.is-polygon-drawing {
  cursor: crosshair;
}

.map-canvas.is-selecting-shape .custom-shape {
  cursor: move;
}

.map-canvas .polygon-node-handle {
  cursor: grab;
}

.map-canvas.is-pan-ready {
  cursor: grab;
}

.map-canvas.is-pan-ready .map-region {
  cursor: grab;
}

.map-canvas.is-panning,
.map-canvas.is-panning * {
  cursor: grabbing !important;
}

.loading-state {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(480px, 70%);
  min-height: 72px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text-muted);
  background: rgba(248, 250, 249, 0.96);
  box-shadow: 0 10px 28px rgba(32, 48, 44, 0.12);
}

.loading-state.is-error {
  border-color: #dab5b0;
  color: #8a3d36;
  background: #fff7f6;
}

.loading-state[hidden] {
  display: none;
}

.map-region {
  cursor: pointer;
  transition:
    filter 120ms ease,
    stroke-width 120ms ease;
}

.map-region:hover,
.map-region.is-active {
  filter: brightness(1.08) drop-shadow(0 0 2px rgba(22, 45, 39, 0.28));
  stroke-width: 2.8px !important;
}

.region-label,
.canvas-copy,
.callout-copy,
.water-label {
  pointer-events: none;
  user-select: none;
}

.callout-card {
  cursor: move;
}

body[data-access-role="viewer"] .callout-card,
body[data-access-role="viewer"] .anchor-marker {
  cursor: default;
}

.panel.is-readonly .sidebar-body {
  opacity: 0.74;
}

.anchor-marker {
  cursor: grab;
}

.anchor-marker:active {
  cursor: grabbing;
}

.callout-card:hover .callout-background,
.callout-card.is-active .callout-background {
  stroke-width: 2px;
}

.field {
  display: block;
  margin: 0 0 14px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label,
.field-label-row {
  color: #4e5f5b;
  font-size: 12px;
  font-weight: 650;
}

.field-label {
  display: block;
  margin-bottom: 6px;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
}

.field-label-row .field-label {
  margin-bottom: 0;
}

.field-label-row output {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  font-weight: 500;
}

.field input[type="text"] {
  height: 37px;
  padding: 0 10px;
}

.field textarea {
  display: block;
  min-height: 62px;
  max-height: 210px;
  padding: 8px 10px;
  resize: vertical;
  line-height: 1.55;
}

#calloutBodyInput {
  min-height: 132px;
}

.fieldset-reset {
  min-width: 0;
  padding: 0;
  border: 0;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

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

.theme-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 0;
  height: 35px;
  padding: 0 5px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.theme-button:last-child {
  border-right: 0;
}

.theme-button:hover {
  background: #f0f4f2;
}

.theme-button.is-active {
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-weight: 700;
}

.theme-preview {
  width: 11px;
  height: 11px;
  border: 1px solid rgba(21, 36, 32, 0.22);
  border-radius: 3px;
}

.region-breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 12px;
}

.breadcrumb-button {
  padding: 0;
  border: 0;
  color: var(--accent-dark);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.breadcrumb-button:disabled {
  color: var(--text);
  cursor: default;
}

.breadcrumb-separator,
.region-info {
  color: var(--text-muted);
}

.region-info {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 7px;
  max-width: 100%;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
}

.region-info-item {
  white-space: nowrap;
}

.region-info-item:not(:last-child)::after {
  margin-left: 7px;
  content: "·";
}

.drill-down-button {
  flex: 0 0 auto;
  min-width: 104px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 34px;
  color: #4e5f5b;
  font-size: 12px;
  font-weight: 650;
}

.toggle-row input {
  position: relative;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
  margin: 0;
  border: 1px solid #a9b6b2;
  border-radius: 10px;
  appearance: none;
  background: #d6dddb;
  cursor: pointer;
  transition:
    border-color 120ms ease,
    background-color 120ms ease;
}

.toggle-row input::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(25, 40, 36, 0.24);
  content: "";
  transition: transform 120ms ease;
}

.toggle-row input:checked {
  border-color: var(--accent);
  background: var(--accent);
}

.toggle-row input:checked::after {
  transform: translateX(16px);
}

.watermark-toggle-row {
  margin-bottom: 12px;
}

.watermark-text-field {
  margin-bottom: 0;
}

.color-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 8px;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.color-swatch {
  position: relative;
  min-width: 0;
  height: 30px;
  border: 2px solid transparent;
  border-radius: 5px;
  cursor: pointer;
}

.color-swatch:hover {
  border-color: rgba(24, 40, 36, 0.34);
}

.color-swatch.is-active {
  border-color: #203732;
  box-shadow: inset 0 0 0 2px #ffffff;
}

.custom-color {
  width: 34px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #ffffff;
  cursor: pointer;
}

.range-field input[type="range"] {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.danger-button {
  width: 100%;
  margin-top: 16px;
  padding: 0 12px;
  border: 1px solid #d9aaa5;
  color: var(--danger);
  background: transparent;
  font-size: 12px;
  font-weight: 650;
}

.danger-button:hover:not(:disabled) {
  border-color: #c47f78;
  background: var(--danger-soft);
}

.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.inline-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-top: 6px;
  color: #4e5f5b;
  font-size: 12px;
  font-weight: 650;
}

.inline-action-button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--accent-dark);
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.inline-action-button:hover:not(:disabled) {
  border-color: #8ea39e;
  background: var(--accent-soft);
}

.inline-action-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.property-tab-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 12px 14px 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #edf2f7;
}

.property-tab {
  min-width: 0;
  height: 33px;
  padding: 0 7px;
  border: 0;
  border-radius: 5px;
  color: #607286;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  white-space: nowrap;
}

.property-tab:hover {
  color: var(--text);
}

.property-tab.is-active {
  color: var(--accent-dark);
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(31, 50, 71, 0.12);
  font-weight: 700;
}

[data-property-panel][hidden] {
  display: none;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 10px 14px;
  border: 1px solid rgba(34, 65, 99, 0.22);
  border-radius: 6px;
  color: #ffffff;
  background: #24384d;
  box-shadow: 0 10px 28px rgba(21, 39, 58, 0.22);
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transform: translate(-50%, 8px);
  transition:
    opacity 150ms ease,
    transform 150ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.is-error {
  border-color: #8c4841;
  background: #7d3f39;
}

.import-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #f8fafc;
  box-shadow: 0 24px 70px rgba(25, 42, 61, 0.28);
}

.import-dialog::backdrop {
  background: rgba(22, 33, 46, 0.46);
}

.management-dialog {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 22px 24px;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: #f8fafc;
  box-shadow: 0 24px 70px rgba(25, 42, 61, 0.28);
}

.management-dialog::backdrop {
  background: rgba(22, 33, 46, 0.46);
}

.management-dialog-wide {
  width: min(980px, calc(100vw - 32px));
}

.password-change-dialog {
  width: min(520px, calc(100vw - 32px));
}

.dialog-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.management-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.management-status {
  min-height: 20px;
  margin: 12px 0;
  color: var(--text-muted);
  font-size: 12px;
}

.management-status.is-error {
  color: var(--danger);
}

.management-list {
  display: grid;
  gap: 8px;
}

.management-empty {
  padding: 28px 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  color: var(--text-muted);
  text-align: center;
}

.management-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.management-row.is-active {
  border-color: #6d98aa;
  box-shadow: inset 3px 0 0 #347d87;
}

.management-row-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.management-row-copy strong,
.management-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.management-row-copy span,
.management-row-copy small {
  color: var(--text-muted);
}

.management-row-copy small {
  font-size: 11px;
}

.management-row-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.account-create-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(160px, 1fr) 150px auto;
  align-items: end;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.account-create-form .field {
  margin: 0;
}

.temporary-password-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, auto) auto;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #d5b76d;
  border-radius: 6px;
  background: #fff9e8;
}

.temporary-password-panel > div {
  display: grid;
  gap: 2px;
}

.temporary-password-panel span {
  color: #765f2e;
  font-size: 11px;
}

.temporary-password-panel code {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 700;
}

.account-list .management-row {
  grid-template-columns: minmax(190px, 1fr) 130px 130px auto;
}

.account-list select {
  height: 36px;
  padding: 0 28px 0 9px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
}

.password-change-fields {
  display: grid;
  gap: 0;
}

.import-form {
  padding: 22px 24px 20px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.dialog-header h2 {
  margin: 3px 0 0;
  font-size: 19px;
  line-height: 1.25;
}

.dialog-close-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.dialog-close-button:hover {
  border-color: var(--line);
  background: var(--panel-muted);
}

.import-file-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  margin-bottom: 18px;
  padding: 9px 12px;
  border-left: 3px solid var(--accent);
  color: #40566d;
  background: #eaf1f8;
}

.import-file-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-file-summary span {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 12px;
}

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

.import-field-grid-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.import-dialog .field input,
.import-dialog .field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--text);
  background: #ffffff;
}

.dialog-section-heading {
  margin: 5px 0 11px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  color: #455752;
  font-size: 12px;
  font-weight: 700;
}

.import-name-preview {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: -2px 0 16px;
  color: var(--text-muted);
  font-size: 12px;
}

.import-name-preview span {
  flex: 0 0 auto;
}

.import-name-preview strong {
  min-width: 0;
  color: #40524e;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.export-dialog {
  width: min(430px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-background);
  box-shadow: 0 24px 60px rgba(28, 42, 39, 0.24);
}

.export-form {
  padding: 20px;
}

.export-mode-fieldset {
  margin-top: 18px;
}

.export-mode-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
}

.export-mode-control label {
  position: relative;
  min-width: 0;
}

.export-mode-control label + label {
  border-left: 1px solid var(--line-strong);
}

.export-mode-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.export-mode-control span {
  display: grid;
  min-height: 42px;
  place-items: center;
  padding: 8px 10px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  font-weight: 650;
}

.export-mode-control input:checked + span {
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.export-mode-control input:disabled + span {
  cursor: not-allowed;
  color: var(--text-muted);
  background: var(--panel-muted);
  opacity: 0.65;
}

.export-mode-control input:focus-visible + span {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.export-notice {
  min-height: 36px;
  margin: 12px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 1600px) {
  .save-status,
  .cloud-account-actions-header .account-name,
  .cloud-account-actions-header .access-role {
    display: none;
  }
}

@media (max-width: 1350px) {
  :root {
    --left-panel-width: 238px;
    --right-panel-width: 282px;
  }

  body {
    min-width: 0;
  }

  .app-shell {
    grid-template-columns: var(--left-panel-width) minmax(0, 1fr) var(--right-panel-width);
  }

  .map-composition {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .panel-section {
    padding-right: 15px;
    padding-left: 15px;
  }

  .button {
    padding-right: 9px;
    padding-left: 9px;
  }

  .save-status {
    display: none;
  }

  .cloud-account-actions-header .account-name {
    display: none;
  }

  body.is-left-collapsed {
    --left-panel-width: 52px;
  }

  body.is-right-collapsed {
    --right-panel-width: 52px;
  }
}

@media (max-width: 1200px) {
  .country-card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 981px) and (max-width: 1120px) {
  .workspace-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 6px;
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .workspace-bar > div:first-child {
    width: 100%;
  }

  .workspace-tools {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
  }

  .active-group-indicator {
    display: none;
  }
}

@media (max-width: 980px) {
  body {
    min-width: 0;
    height: auto;
    overflow: auto;
  }

  .app-header {
    position: sticky;
    top: 0;
    flex-wrap: wrap;
  }

  .cloud-account-actions-header {
    margin-left: auto;
  }

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

  .header-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .account-create-form,
  .account-list .management-row {
    grid-template-columns: 1fr 1fr;
  }

  .temporary-password-panel {
    grid-template-columns: 1fr auto;
  }

  .temporary-password-panel > div {
    grid-column: 1 / -1;
  }

  .app-shell {
    display: flex;
    height: auto;
    flex-direction: column;
  }

  .workspace {
    order: 1;
    min-height: 470px;
  }

  .panel {
    display: block;
    overflow: visible;
  }

  .sidebar-toggle-button {
    display: none;
  }

  body.is-left-collapsed .left-panel .sidebar-body,
  body.is-right-collapsed .right-panel .sidebar-body,
  body.is-left-collapsed .left-panel .sidebar-identity,
  body.is-right-collapsed .right-panel .sidebar-identity {
    display: block;
  }

  .sidebar-identity {
    display: flex !important;
  }

  .left-panel {
    order: 2;
    border-top: 1px solid var(--line);
    border-right: 0;
  }

  .left-panel .sidebar-body {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
  }

  .right-panel {
    order: 3;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .left-panel .panel-section + .panel-section {
    border-top: 0;
    border-left: 1px solid var(--line);
  }

  .map-canvas {
    width: 100%;
  }

  .map-composition {
    width: min(100%, 920px);
    min-width: 0;
  }
}

@media (max-width: 680px) {
  .access-gate {
    padding: 14px;
  }

  .access-panel {
    padding: 22px 18px;
  }

  .country-home-header,
  .country-home-body,
  .country-home-footer {
    width: min(100% - 28px, 1440px);
  }

  .country-home-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .country-home-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 16px 0;
  }

  .country-home-actions {
    width: 100%;
    align-items: flex-start;
    flex-direction: column;
  }

  .cloud-account-actions {
    width: 100%;
  }

  .country-card-grid {
    grid-template-columns: 1fr;
  }
  .brand-block {
    width: 100%;
  }

  .country-picker {
    margin-left: auto;
  }

  .country-import-button span:last-child {
    display: none;
  }

  .import-field-grid,
  .import-field-grid-three {
    grid-template-columns: 1fr;
  }

  .management-dialog {
    padding: 18px;
  }

  .management-toolbar,
  .management-row-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .management-row,
  .account-create-form,
  .account-list .management-row,
  .temporary-password-panel {
    grid-template-columns: 1fr;
  }

  .temporary-password-panel > div {
    grid-column: auto;
  }

  .import-file-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .left-panel,
  .right-panel {
    display: block;
  }

  .left-panel .sidebar-body {
    display: block !important;
  }

  .panel-section + .panel-section {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .workspace {
    min-height: 360px;
  }

  .workspace-meta,
  .active-group-indicator {
    display: none;
  }

  .canvas-stage {
    padding: 12px;
  }
}
