@font-face {
  font-family: "MTSText";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("assets/fonts/MTSText-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "MTSText";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("assets/fonts/MTSText-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "MTSText";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("assets/fonts/MTSText-Bold.woff2") format("woff2");
}

@font-face {
  font-family: "MTSText";
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url("assets/fonts/MTSText-Black.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --background: #f2f3f7;
  --surface: #ffffff;
  --surface-soft: #f6f6f8;
  --surface-strong: #eceef2;
  --text: #1d2023;
  --muted: #797b80;
  --line: #e7e8ec;
  --line-strong: #d2d4d9;
  --accent: #ff0032;
  --accent-hover: #e6002d;
  --accent-soft: #fff0f3;
  --dark: #1b1b1d;
  --success: #13a463;
  --warning: #d98200;
  --error: #d7263d;
  --shadow: 0 8px 32px rgba(29, 32, 35, 0.06);
  --header-background: rgba(255, 255, 255, 0.97);
  --header-shadow: 0 2px 14px rgba(29, 32, 35, 0.045);
  --decor-accent: rgba(255, 0, 50, 0.035);
  --decor-neutral: rgba(20, 20, 20, 0.025);
  --field-title: #2d2d30;
  --control-hover: #a9a9ad;
  --button-hover: #f3f3f3;
  --map-background: #dfe3e5;
  --map-filter: none;
  --map-control-border: rgba(20, 20, 20, 0.16);
  --map-control-shadow: 0 4px 14px rgba(20, 20, 20, 0.1);
  --map-attribution-background: rgba(255, 255, 255, 0.86);
  --map-attribution-text: #737378;
  --map-attribution-link: #404044;
  --preview-background: #f1f3f4;
  --preview-grid: rgba(27, 27, 29, 0.055);
  --preview-scene-fill: rgba(27, 27, 29, 0.1);
  --neutral-accent: #78787d;
  --state-warning-background: #fff8ed;
  --state-success-background: #effaf5;
  --state-error-background: #fff3f5;
  --state-error-hover: #ffe8ec;
  --table-heading: #f6f6f6;
  --table-text: #303034;
  --progress-track: #f1e6d6;
  --warning-text: #78510d;
  --toast-shadow: 0 18px 50px rgba(20, 20, 20, 0.16);
  font-family:
    "MTSText", Arial, "Helvetica Neue", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #0f1013;
  --surface: #1a1b20;
  --surface-soft: #222329;
  --surface-strong: #2b2c33;
  --text: #f4f4f6;
  --muted: #a5a6ae;
  --line: #30323a;
  --line-strong: #4a4c56;
  --accent: #ff0032;
  --accent-hover: #ff3156;
  --accent-soft: rgba(255, 0, 50, 0.13);
  --dark: #f0f0f2;
  --success: #38c98a;
  --warning: #f0a13a;
  --error: #ff6475;
  --shadow: 0 12px 38px rgba(0, 0, 0, 0.32);
  --header-background: rgba(17, 18, 22, 0.95);
  --header-shadow: 0 4px 24px rgba(0, 0, 0, 0.28);
  --decor-accent: rgba(255, 0, 50, 0.07);
  --decor-neutral: rgba(255, 255, 255, 0.025);
  --field-title: #e2e2e6;
  --control-hover: #666873;
  --button-hover: #292a31;
  --map-background: #23252a;
  --map-filter: none;
  --map-control-border: rgba(255, 255, 255, 0.16);
  --map-control-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  --map-attribution-background: rgba(25, 26, 32, 0.88);
  --map-attribution-text: #acadb5;
  --map-attribution-link: #f0f0f2;
  --preview-background: #24262c;
  --preview-grid: rgba(255, 255, 255, 0.055);
  --preview-scene-fill: rgba(255, 255, 255, 0.11);
  --neutral-accent: #92949d;
  --state-warning-background: rgba(240, 161, 58, 0.12);
  --state-success-background: rgba(56, 201, 138, 0.12);
  --state-error-background: rgba(255, 100, 117, 0.12);
  --state-error-hover: rgba(255, 100, 117, 0.2);
  --table-heading: #202127;
  --table-text: #dedee2;
  --progress-track: #3a3228;
  --warning-text: #f3bf78;
  --toast-shadow: 0 18px 50px rgba(0, 0, 0, 0.48);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--text);
}

body::before {
  content: none;
}

.mode-gate {
  position: fixed;
  z-index: 3000;
  inset: 0;
  display: grid;
  overflow-y: auto;
  padding: 32px;
  place-items: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 0, 50, 0.1), transparent 30%),
    radial-gradient(circle at 85% 80%, rgba(27, 27, 29, 0.08), transparent 34%),
    var(--background);
}

.mode-gate[hidden] {
  display: none;
}

.mode-gate-card {
  width: min(1080px, 100%);
  padding: clamp(28px, 5vw, 58px);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(29, 32, 35, 0.12);
}

.mode-gate-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mode-gate-brand img {
  width: 52px;
  height: 52px;
}

.mode-gate-brand h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  font-weight: 900;
  letter-spacing: -0.055em;
}

.mode-gate-copy {
  max-width: 760px;
  margin: 54px 0 30px;
}

.mode-gate-copy h2 {
  margin: 18px 0 12px;
  font-size: clamp(32px, 5vw, 58px);
  font-weight: 900;
  letter-spacing: -0.055em;
}

.mode-gate-copy p,
.mode-gate-note {
  color: var(--muted);
  line-height: 1.6;
}

.mode-options {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr 1fr;
}

.mode-option {
  position: relative;
  display: flex;
  min-height: 250px;
  flex-direction: column;
  align-items: flex-start;
  padding: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface-soft);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: 0.2s ease;
}

.mode-option::after {
  position: absolute;
  right: -30px;
  bottom: -50px;
  width: 170px;
  height: 170px;
  border: 32px solid rgba(255, 0, 50, 0.07);
  border-radius: 50%;
  content: "";
}

.mode-option:hover,
.mode-option:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 18px 46px rgba(255, 0, 50, 0.12);
  outline: none;
  transform: translateY(-3px);
}

.mode-option-index {
  position: absolute;
  top: 24px;
  right: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mode-option-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 28px;
  place-items: center;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 24px;
}

.mode-option strong {
  margin-bottom: 8px;
  font-size: 23px;
  letter-spacing: -0.03em;
}

.mode-option small {
  max-width: 390px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.mode-option-action {
  margin-top: auto;
  padding-top: 28px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.mode-gate-note {
  margin: 24px 0 0;
  font-size: 11px;
}

.mode-switch {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.mode-switch:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

.app-header {
  position: sticky;
  z-index: 1000;
  top: 0;
  display: block;
  border-bottom: 1px solid var(--line);
  background: var(--header-background);
  box-shadow: var(--header-shadow);
  backdrop-filter: blur(16px);
}

.utility-bar,
.primary-nav {
  display: flex;
  width: min(100% - 48px, 1520px);
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
}

.utility-bar {
  min-height: 26px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 10px;
}

.audience-nav,
.utility-meta,
.product-nav {
  display: flex;
  align-items: center;
}

.audience-nav {
  gap: 25px;
}

.audience-nav span {
  white-space: nowrap;
}

.audience-nav-active {
  color: var(--accent);
  font-weight: 700;
}

.utility-meta {
  gap: 18px;
}

.utility-meta span + span {
  position: relative;
}

.utility-meta span + span::before {
  position: absolute;
  top: 50%;
  left: -10px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--line-strong);
  content: "";
  transform: translateY(-50%);
}

.primary-nav {
  min-height: 56px;
  gap: 28px;
}

.brand,
.header-actions,
.header-status,
.status-item,
.map-toolbar,
.results-heading,
.panel-heading,
.region-heading {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  flex: 0 0 auto;
  gap: 13px;
}

.mws-logo {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  overflow: hidden;
  border-radius: 0;
}

.mws-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.product-nameplate {
  min-width: 0;
}

.product-nameplate h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.product-nameplate p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.product-nav {
  align-self: stretch;
  gap: 27px;
  margin-right: auto;
}

.product-nav a {
  position: relative;
  display: inline-flex;
  height: 100%;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: color 0.16s ease;
}

.product-nav a::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.5);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.product-nav a:hover {
  color: var(--accent);
}

.product-nav a:hover::after {
  opacity: 1;
  transform: scaleX(1);
}

.header-status {
  gap: 10px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 9px;
}

.header-actions {
  justify-content: flex-end;
  gap: 9px;
}

.theme-toggle {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 7px 12px 7px 7px;
  gap: 8px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-soft);
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--accent-soft);
  color: var(--accent);
}

.theme-toggle:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
}

.theme-toggle-icon {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
}

.status-item {
  gap: 8px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(217, 130, 0, 0.09);
}

.status-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(19, 164, 99, 0.09);
}

.status-dot.error {
  background: var(--error);
  box-shadow: 0 0 0 4px rgba(215, 38, 61, 0.09);
}

.separator {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.workspace {
  display: grid;
  max-width: 1568px;
  margin: 0 auto;
  padding: 10px 24px 30px;
  gap: 16px;
  grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.panel {
  border: 0;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.control-panel {
  align-self: start;
  padding: 16px;
}

.panel-heading,
.map-toolbar,
.results-heading,
.region-heading {
  justify-content: space-between;
}

.panel-heading {
  margin-bottom: 14px;
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
}

.step-badge,
.region-ready {
  padding: 6px 10px;
  border: 0;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.region-ready.missing {
  border-color: rgba(215, 38, 61, 0.2);
  background: var(--state-error-background);
  color: var(--error);
}

.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 11px;
  gap: 6px;
}

.field > span,
.field-title {
  color: var(--field-title);
  font-size: 12px;
  font-weight: 600;
}

.field small,
.region-heading small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

select,
input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 10px;
  outline: none;
  background: var(--surface-soft);
  color: var(--text);
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

select:hover,
input:hover {
  border-color: var(--line-strong);
  background: var(--surface);
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(255, 0, 50, 0.08);
}

input:disabled {
  cursor: not-allowed;
  background: var(--surface-strong);
  opacity: 0.6;
}

.input-suffix {
  position: relative;
}

.input-suffix input {
  padding-right: 35px;
}

.input-suffix > span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: var(--muted);
  font-size: 11px;
  transform: translateY(-50%);
}

.region-block {
  margin: 2px 0 14px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: var(--surface-soft);
}

.region-block::before {
  display: block;
  width: 34px;
  height: 4px;
  margin-bottom: 10px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.region-heading {
  align-items: flex-start;
  gap: 12px;
}

.region-heading > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.region-block p {
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.button-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 1fr;
}

.button {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  transition:
    transform 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

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

.button.secondary {
  border-color: transparent;
  background: var(--surface);
}

.button.secondary:hover:not(:disabled) {
  border-color: var(--control-hover);
  background: var(--button-hover);
}

.button.ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.button.ghost:hover:not(:disabled) {
  border-color: var(--line-strong);
  color: var(--text);
}

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

.button.primary:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 9px 22px rgba(255, 0, 50, 0.22);
}

.search-button {
  display: flex;
  width: 100%;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.search-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-width: 2;
}

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

.storage-check-button {
  padding-inline: 10px;
  border-color: var(--line-strong);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 11px;
}

.storage-check-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.delete-all-cache-button {
  grid-column: 1 / -1;
  min-height: 36px;
  border-color: transparent;
  background: var(--state-error-background);
  color: var(--error);
}

.delete-all-cache-button:hover:not(:disabled) {
  border-color: var(--error);
  background: var(--state-error-hover);
}

.map-panel {
  position: relative;
  z-index: 0;
  display: flex;
  min-height: 602px;
  flex-direction: column;
  order: 1;
  overflow: hidden;
  isolation: isolate;
}

.map-class-legend {
  position: absolute;
  z-index: 700;
  top: 88px;
  right: 16px;
  display: grid;
  min-width: 205px;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 10px;
  pointer-events: none;
}

.map-class-legend[hidden] {
  display: none;
}

.map-class-legend strong {
  margin-bottom: 2px;
  font-size: 11px;
}

.map-class-legend span {
  display: flex;
  align-items: center;
  gap: 8px;
}

.map-class-legend i {
  width: 13px;
  height: 13px;
  flex: 0 0 13px;
  border-radius: 3px;
}

.class-stable { background: #2ea157; }
.class-weak { background: #ffa914; }
.class-strong { background: #ef1f2f; }
.class-recovery { background: #0da6bf; }
.class-no-data { background: transparent; border: 1px solid #a9adb5; }

.control-panel {
  order: 1;
}

.map-toolbar {
  flex: 0 0 auto;
  min-height: 72px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 17px;
  color: var(--muted);
  font-size: 9px;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 22px;
  height: 3px;
  border-radius: 99px;
}

.legend-region {
  background: var(--accent);
}

.legend-scenes {
  background: var(--neutral-accent);
}

.legend-scene-selected {
  background: var(--dark);
}

#map {
  width: 100%;
  min-height: 488px;
  flex: 1 1 auto;
  background: var(--map-background);
}

#map .leaflet-tile-pane {
  filter: var(--map-filter);
}

.scene-timeline {
  flex: 0 0 auto;
  padding: 12px 18px 10px;
  border-top: 3px solid var(--accent-soft);
  background: var(--surface);
}

.scene-timeline[hidden] {
  display: none;
}

.scene-timeline-header,
.scene-timeline-boundaries {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.scene-timeline-header {
  color: var(--muted);
  font-size: 10px;
}

.scene-timeline-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.scene-timeline-label {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.scene-timeline-current,
#sceneTimelineCurrent {
  color: var(--text);
  font-size: 12px;
}

.scene-timeline input[type="range"] {
  width: 100%;
  height: auto;
  margin: 8px 0 5px;
  padding: 0;
  accent-color: var(--accent);
}

.scene-timeline-boundaries {
  color: var(--muted);
  font-size: 9px;
}

.map-attribution-note {
  display: flex;
  flex: 0 0 auto;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.scene-visibility-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  color: var(--text);
  white-space: nowrap;
}

.scene-visibility-control input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.map-opacity-control {
  display: flex;
  min-width: 230px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  font-size: 9px;
}

.map-opacity-control[hidden] {
  display: none;
}

.map-opacity-control input[type="range"] {
  width: 135px;
  height: auto;
  padding: 0;
  accent-color: var(--accent);
}

.map-result-controls {
  display: flex;
  flex-wrap: wrap;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.clear-map-results-button {
  min-height: 30px;
  padding: 6px 12px;
  border-color: rgba(215, 38, 61, 0.26);
  background: var(--state-error-background);
  color: var(--error);
  font-size: 9px;
}

.clear-map-results-button:hover:not(:disabled) {
  border-color: var(--error);
  background: var(--state-error-hover);
}

.clear-map-results-button[hidden] {
  display: none;
}

.leaflet-container {
  font-family: inherit;
}

.leaflet-bar {
  overflow: hidden;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: var(--map-control-shadow) !important;
}

.leaflet-bar a {
  border-color: var(--line) !important;
  background-color: var(--surface) !important;
  color: var(--text) !important;
}

.leaflet-bar a:hover {
  background-color: var(--accent-soft) !important;
  color: var(--accent) !important;
}

.leaflet-control-attribution {
  background: var(--map-attribution-background) !important;
  color: var(--map-attribution-text) !important;
}

.leaflet-control-attribution a {
  color: var(--map-attribution-link) !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface);
  color: var(--text);
}

.results-panel[hidden] {
  display: none;
}

.results-panel {
  min-height: 330px;
  grid-column: 1 / -1;
  order: 4;
  overflow: hidden;
}

.results-heading {
  min-height: 94px;
  padding: 21px 28px;
  border-bottom: 1px solid var(--line);
}

.request-state {
  padding: 8px 12px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 10px;
}

.request-state.loading {
  border-color: rgba(217, 130, 0, 0.25);
  background: var(--state-warning-background);
  color: var(--warning);
}

.request-state.success {
  border-color: rgba(19, 164, 99, 0.25);
  background: var(--state-success-background);
  color: var(--success);
}

.request-state.error {
  border-color: rgba(215, 38, 61, 0.25);
  background: var(--state-error-background);
  color: var(--error);
}

.empty-state {
  display: flex;
  min-height: 270px;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

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

.empty-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin-bottom: 15px;
  place-items: center;
  border: 0;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--accent);
}

.empty-icon svg {
  width: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.empty-state h3 {
  margin-bottom: 7px;
  font-size: 17px;
}

.empty-state p {
  max-width: 420px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 19px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--table-heading);
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

td {
  color: var(--table-text);
  font-size: 11px;
}

tbody tr {
  cursor: pointer;
  transition: background 0.15s ease;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.scene-row-selected,
.scene-row-selected:hover {
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--dark);
}

.scene-row-selected .scene-preview {
  border-color: var(--dark);
}

.scene-row-selected .scene-preview-footprint {
  stroke-width: 2.3;
}

.scene-preview-cell {
  width: 146px;
  min-width: 146px;
  padding-right: 8px;
}

.scene-preview {
  position: relative;
  display: grid;
  width: 122px;
  height: 78px;
  overflow: hidden;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background-color: var(--preview-background);
  background-image:
    linear-gradient(var(--preview-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--preview-grid) 1px, transparent 1px);
  background-size: 18px 18px;
}

.scene-preview svg {
  display: block;
  width: 108px;
  height: 68px;
}

.scene-preview path {
  fill-rule: evenodd;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.scene-preview-region {
  fill: var(--accent-soft);
  stroke: var(--accent);
  stroke-dasharray: 3 2;
  stroke-width: 1.1;
}

.scene-preview-footprint {
  fill: var(--preview-scene-fill);
  stroke: var(--dark);
  stroke-width: 1.6;
}

.scene-preview-empty {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.product-name {
  display: block;
  max-width: 540px;
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
}

.download-button {
  min-width: 118px;
  border-color: transparent;
  background: var(--accent-soft);
  color: var(--accent);
}

.download-button.running {
  border-color: rgba(217, 130, 0, 0.3);
  background: var(--state-warning-background);
  color: var(--warning);
}

.download-button.completed {
  border-color: rgba(19, 164, 99, 0.3);
  background: var(--state-success-background);
  color: var(--success);
}

.download-button.failed {
  border-color: rgba(215, 38, 61, 0.3);
  background: var(--state-error-background);
  color: var(--error);
}

.download-panel {
  min-width: 211px;
}

.download-meta {
  display: block;
  min-height: 14px;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  white-space: nowrap;
}

.scene-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.archive-safe-button {
  min-width: 100%;
  color: var(--accent);
  font-size: 10px;
}

.tile-group-row {
  cursor: pointer;
}

.process-scene-button {
  min-width: 92px;
  border-color: transparent;
  background-color: var(--surface-soft);
  color: var(--text);
}

.process-scene-button:hover:not(:disabled) {
  border-color: var(--accent);
  background-color: var(--accent-soft);
  color: var(--accent);
}

/* =========================
   Обработка Sentinel-1
   ========================= */

.processing-panel {
  margin-top: -16px;
  grid-column: 2;
  order: 2;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-radius: 0 0 20px 20px;
}

.map-panel:has(~ #processingPanel:not([hidden])) {
  border-radius: 20px 20px 0 0;
}

.processing-panel[hidden] {
  display: none;
}

.processing-panel > .results-heading {
  min-height: 62px;
  padding: 11px 16px;
}

.processing-layout {
  display: block;
  min-height: 0;
}

.processing-controls {
  display: grid;
  align-items: start;
  padding: 14px;
  gap: 8px 10px;
  background: var(--surface-soft);
  grid-template-columns:
    minmax(180px, 1fr)
    minmax(320px, 2fr)
    minmax(150px, 0.8fr);
}

.selected-scene {
  display: flex;
  min-height: 58px;
  flex-direction: column;
  justify-content: center;
  height: 100%;
  margin-bottom: 0;
  padding: 10px 12px;
  gap: 3px;
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
}

.selected-scene strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-scene small {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-fields .field {
  margin-bottom: 0;
}

.processing-fields {
  gap: 8px;
  grid-template-columns: repeat(4, minmax(76px, 1fr));
}

.processing-fields .field > span {
  min-height: 27px;
  line-height: 1.25;
}

.processing-fields select,
.processing-fields input {
  height: 36px;
  padding-inline: 9px;
}

.processing-actions {
  display: grid;
  gap: 8px;
}

.processing-actions .search-button {
  min-height: 40px;
  padding-inline: 10px;
  font-size: 11px;
}

.delete-source-button {
  width: 100%;
  min-height: 36px;
  border-color: transparent;
  background: var(--state-error-background);
  color: var(--error);
}

.delete-source-button:hover:not(:disabled) {
  border-color: var(--error);
  background: var(--state-error-hover);
}

.processing-help {
  margin: 0;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

.processing-result {
  padding: 14px 16px;
  border-top: 1px solid var(--line);
}

.processing-empty {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  gap: 19px;
  color: var(--muted);
}

.processing-empty[hidden] {
  display: none;
}

.processing-empty-mark {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.processing-empty h3 {
  margin-bottom: 7px;
  color: var(--text);
  font-size: 17px;
}

.processing-empty p {
  max-width: 430px;
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

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

.metric-card {
  min-height: 78px;
  padding: 11px 12px;
  border: 0;
  border-top: 3px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface-soft);
}

.metric-card > span {
  display: block;
  min-height: 18px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin: 3px 0 2px;
  font-size: clamp(17px, 1.7vw, 22px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--muted);
  font-size: 9px;
}

.ice-metric {
  border-top-color: #9cecf5;
}

.water-metric {
  border-top-color: #0870d8;
}

.uncertain-metric {
  border-top-color: #ff9f00;
}

.concentration-metric {
  border-top-color: var(--accent);
}

.coverage-metric {
  border-top-color: #7657ff;
}

.overlay-controls {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-top: 9px;
  padding: 8px 10px;
  gap: 18px;
  border: 0;
  border-radius: 14px;
  background: var(--surface-soft);
}

.overlay-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 13px;
  color: var(--muted);
  font-size: 9px;
}

.overlay-legend span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.overlay-legend i {
  width: 11px;
  height: 11px;
  border-radius: 2px;
}

.overlay-ice {
  border: 1px solid #6acbd8;
  background: #c7f7ff;
}

.overlay-water {
  background: #0759cf;
}

.overlay-uncertain {
  background: #ff9f00;
}

.result-warning {
  margin: 9px 0;
  padding: 8px 10px;
  border-left: 4px solid var(--warning);
  border-radius: 0 12px 12px 0;
  background: var(--state-warning-background);
  color: var(--warning-text);
  font-size: 9px;
  line-height: 1.5;
}

.export-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.export-buttons .button {
  min-height: 32px;
  padding-block: 6px;
}

.export-buttons .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.export-buttons [aria-disabled="true"] {
  pointer-events: none;
  opacity: 0.5;
}

.toast {
  position: fixed;
  z-index: 2000;
  right: 24px;
  bottom: 24px;
  max-width: min(420px, calc(100vw - 48px));
  padding: 13px 16px;
  border: 0;
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--toast-shadow);
  color: var(--text);
  font-size: 10px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast.error {
  border-left-color: var(--error);
}

.app-footer {
  display: flex;
  max-width: 1568px;
  align-items: center;
  justify-content: space-between;
  margin: 0 auto;
  padding: 0 24px 34px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.land-processing-panel {
  margin-top: 0;
  grid-column: 1 / -1;
  order: 5;
  overflow: hidden;
  border-radius: 20px;
}

.land-processing-layout {
  display: grid;
  min-height: 430px;
  grid-template-columns: minmax(300px, 0.75fr) minmax(0, 1.55fr);
}

.land-processing-layout:has(.land-dashboard[hidden]) {
  grid-template-columns: 1fr;
}

.land-processing-layout:has(.land-dashboard[hidden]) .land-controls {
  border-right: 0;
}

.land-dashboard[hidden] {
  display: none;
}

.land-controls {
  display: flex;
  flex-direction: column;
  padding: 26px;
  gap: 18px;
  border-right: 1px solid var(--line);
}

.land-controls .selected-scene {
  height: auto;
  min-height: 0;
  justify-content: flex-start;
}

.land-controls .selected-scene strong,
.land-controls .selected-scene small {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.land-controls .selected-scene strong {
  font-family: inherit;
  font-size: 14px;
}

.land-controls .selected-scene small {
  line-height: 1.5;
}

.land-controls .processing-fields {
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.land-controls .processing-fields .field > span {
  min-height: 36px;
  white-space: normal;
}

.land-controls > .search-button {
  width: 100%;
  min-height: 48px;
}

.land-processing-actions {
  display: grid;
  width: 100%;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.land-processing-actions[hidden] {
  display: none;
}

.land-processing-actions .delete-all-cache-button {
  grid-column: auto;
}

.land-processing-state {
  margin: -6px 2px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.land-controls .processing-help {
  line-height: 1.5;
  white-space: normal;
}

.land-selected-list {
  display: flex;
  max-height: 132px;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
  overflow-y: auto;
}

.land-selected-chip {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  white-space: normal;
}

.land-selected-chip button {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-weight: 900;
}

.land-dashboard {
  padding: 26px;
}

.land-trend-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.land-trend-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.land-trend-chart {
  position: relative;
  min-height: 330px;
  margin-top: 14px;
  overflow: hidden;
}

.land-trend-chart svg {
  display: block;
  width: 100%;
  height: 330px;
  overflow: hidden;
}

.land-chart-legend,
.land-chart-legend span {
  display: flex;
  align-items: center;
}

.land-chart-legend {
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 10px;
}

.land-chart-legend span {
  gap: 6px;
}

.land-chart-legend i {
  width: 18px;
  height: 3px;
  border-radius: 99px;
}

.trend-ndvi { background: #20a45b; }
.trend-ndmi { background: #1875d1; }
.trend-bsi { background: #e98400; }

.land-result {
  margin-top: 16px;
}

.scene-series-selected {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  color: var(--accent) !important;
}

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

  .land-controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

}

@media (max-width: 620px) {
  .mode-gate {
    padding: 12px;
  }

  .mode-gate-card {
    padding: 22px;
    border-radius: 22px;
  }

  .mode-gate-copy {
    margin-top: 34px;
  }

  .mode-option {
    min-height: 215px;
    padding: 22px;
  }

  .land-trend-chart,
  .land-trend-chart svg {
    min-height: 230px;
    height: 230px;
  }
}

@media (min-width: 1021px) and (max-height: 800px) {
  .workspace {
    padding-bottom: 12px;
  }

  .app-footer {
    display: none;
  }
}

@media (max-width: 1020px) {
  .utility-bar,
  .primary-nav {
    width: min(100% - 32px, 1520px);
  }

  .primary-nav {
    min-height: auto;
    flex-wrap: wrap;
    padding: 11px 0 0;
    gap: 10px 20px;
  }

  .product-nav {
    width: 100%;
    min-height: 42px;
    order: 3;
    gap: 24px;
    border-top: 1px solid var(--line);
  }

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

  .workspace {
    grid-template-columns: 1fr;
  }

  .map-panel {
    min-height: 570px;
  }

  #map {
    min-height: 460px;
  }

  .processing-layout {
    gap: 0;
    grid-template-columns: 1fr;
  }

  .processing-panel {
    grid-column: 1;
  }

  .processing-controls {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  .app-header {
    position: static;
  }

  .utility-bar {
    display: none;
  }

  .primary-nav {
    width: 100%;
    padding: 12px;
  }

  .mws-logo {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
  }

  .brand {
    gap: 10px;
  }

  .header-status {
    width: 100%;
    flex-wrap: wrap;
  }

  .header-actions {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    order: 3;
  }

  .theme-toggle {
    align-self: flex-end;
  }

  .product-nav {
    min-height: 40px;
    overflow-x: auto;
    order: 2;
    gap: 20px;
  }

  .product-nav a {
    flex: 0 0 auto;
  }

  .workspace {
    padding: 14px 12px 28px;
    gap: 14px;
  }

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

  .processing-controls,
  .processing-result {
    padding: 14px;
  }

  .processing-controls {
    display: block;
  }

  .processing-controls .selected-scene {
    height: auto;
    margin-bottom: 10px;
  }

  .processing-fields .field {
    margin-bottom: 8px;
  }

  .processing-actions,
  .processing-help {
    margin-top: 10px;
  }

  .field-grid,
  .button-grid,
  .scene-source-actions,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .legend {
    display: none;
  }

  .map-toolbar {
    min-height: 66px;
    padding: 16px 18px;
  }

  #map {
    min-height: 390px;
  }

  .map-attribution-note,
  .app-footer,
  .overlay-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .map-opacity-control {
    width: 100%;
    min-width: 0;
    justify-content: space-between;
  }

  .scene-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
