:root {
  --bg: #f2f7f4;
  --panel: #ffffff;
  --panel-alt: #f7fbfa;
  --text: #103136;
  --muted: #4a6b71;
  --line: #d7e5e3;
  --brand: #0e8a6a;
  --brand-deep: #06624b;
  --accent: #ffac44;
  --danger: #c64545;
  --shadow: 0 14px 36px rgba(16, 49, 54, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar-width: clamp(290px, 24vw, 500px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 8% 8%, #ffffff 0%, #edf6f2 44%, #e7f0ed 100%);
  color: var(--text);
  font-family: "Source Sans 3", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.topnav {
  height: 96px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(110deg, #fefefe 0%, #f4fbf8 60%, #eef9f5 100%);
  display: grid;
  grid-template-columns: 1.2fr 2fr 1fr;
  align-items: center;
  gap: 12px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.brand-icon img {
  /* width: 78px; */
  height: 90px;
  display: block;
}

.brand-title {
  font-family: "Sora", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.15;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  transition: 0.25s ease;
}

.step span {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  background: #ecf4f2;
  color: #4d6f74;
  font-size: 12px;
  font-weight: 700;
}

.step.active {
  border-color: #9ad6c6;
  color: #065f4a;
  box-shadow: 0 0 0 4px rgba(14, 138, 106, 0.09);
}

.step.active span {
  background: linear-gradient(160deg, var(--brand) 0%, #11a57e 100%);
  color: #fff;
}

.status-row {
  display: flex;
  justify-content: flex-end;
}

.gee-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 999px;
  border: 1px solid #b7d9d0;
  background: #fff;
  font-weight: 700;
  color: #055640;
}

.gee-badge .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #f39c2f;
}

.gee-badge.ready .dot {
  background: #21b56c;
}

.main-layout {
  height: calc(100% - 74px);
  display: grid;
  grid-template-columns: var(--sidebar-width) 8px minmax(0, 1fr);
}

.main-layout.sidebar-collapsed {
  grid-template-columns: 1fr;
}

.main-layout.sidebar-collapsed .sidebar {
  display: none;
}

.main-layout.sidebar-collapsed .sidebar-resize-handle {
  display: none;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fbfefd 0%, #f4fbf8 100%);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 300px;
  width: 100%;
  overflow: hidden;
}

.sidebar-scroll {
  overflow: auto;
  padding: 16px 14px;
  flex: 1;
  min-height: 0;
}

.sidebar-resize-handle {
  width: 8px;
  cursor: col-resize;
  background: linear-gradient(180deg, rgba(14, 138, 106, 0.04) 0%, rgba(14, 138, 106, 0.12) 100%);
  border-right: 1px solid rgba(16, 49, 54, 0.06);
  border-left: 1px solid rgba(16, 49, 54, 0.06);
  transition: background 0.2s ease;
}

.sidebar-resize-handle:hover {
  background: linear-gradient(180deg, rgba(14, 138, 106, 0.12) 0%, rgba(14, 138, 106, 0.22) 100%);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(16, 49, 54, 0.06);
  padding: 14px;
}

.panel + .panel {
  margin-top: 14px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title i {
  color: var(--brand-deep);
}

.panel-title h3 {
  margin: 0;
  font-family: "Sora", sans-serif;
  font-size: 18px;
}

.subpanel {
  border: 1px solid #d9e7e4;
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fcfb 100%);
  padding: 12px;
}

.subpanel + .subpanel {
  margin-top: 12px;
}

.subpanel-header {
  margin-bottom: 10px;
}

.subpanel-header strong {
  display: block;
  font-family: "Sora", sans-serif;
  font-size: 14px;
  color: #15464f;
}

.subpanel-header small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.upload-zone {
  border: 2px dashed #9fcdbf;
  border-radius: 14px;
  background: linear-gradient(180deg, #f6fdf9 0%, #eef7f3 100%);
  text-align: center;
  padding: 20px 12px;
  cursor: pointer;
  transition: 0.25s ease;
}

.upload-zone:hover,
.upload-zone.drag {
  border-color: var(--brand);
  background: #ecfaf4;
}

.upload-zone i {
  font-size: 26px;
  color: var(--brand-deep);
}

.upload-zone p {
  margin: 8px 0 4px;
}

.upload-zone small {
  color: var(--muted);
}

.or-divider {
  margin: 14px 0;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 12px;
}

.draw-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.btn-soft {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #13424a;
  padding: 8px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: 0.2s ease;
}

.btn-soft:hover,
.btn-soft.active-tool {
  border-color: #89c9b4;
  background: #ecf9f3;
}

.btn-soft.danger {
  color: var(--danger);
  border-color: #f2c8c8;
}

.aoi-info {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  padding: 10px;
}

.aoi-info-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
}

.aoi-info-row + .aoi-info-row {
  margin-top: 6px;
}

.aoi-info-row span {
  color: var(--muted);
}

.geometry-report {
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid #d9e7e4;
  background: linear-gradient(180deg, #fcfffe 0%, #f4fbf8 100%);
  padding: 10px;
}

.geometry-report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.geometry-report-header strong {
  font-family: "Sora", sans-serif;
  font-size: 14px;
  color: #15464f;
}

.geometry-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.geometry-metric {
  border: 1px solid #d7e5e2;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.geometry-metric span {
  color: var(--muted);
  font-size: 12px;
}

.geometry-metric strong {
  color: #103136;
  font-size: 16px;
}

.geometry-report-note {
  margin: 10px 0 0;
  color: #496a70;
  font-size: 13px;
  line-height: 1.4;
}

.geometry-report .btn-secondary.full {
  margin-top: 10px;
}

.btn-primary,
.btn-secondary {
  border-radius: 11px;
  border: 1px solid transparent;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 700;
  transition: 0.2s ease;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(160deg, var(--brand) 0%, #149c7b 100%);
  box-shadow: 0 9px 22px rgba(14, 138, 106, 0.27);
}

.btn-primary:hover {
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  border-color: #c8ddda;
  background: #fff;
  color: #24555d;
}

.btn-secondary.small {
  padding: 8px 10px;
  font-size: 13px;
}

.btn-secondary.active-display {
  border-color: #84c9b0;
  background: #e8f8f1;
  color: #0b6a53;
  box-shadow: 0 8px 18px rgba(14, 138, 106, 0.16);
}

.full {
  width: 100%;
  margin-top: 14px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  margin-bottom: 5px;
  color: #29535a;
  font-weight: 700;
}

.form-group label.inline-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.form-input {
  width: 100%;
  border: 1px solid #cfe0dd;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  min-height: 40px;
  padding: 8px 10px;
}

.slider {
  width: 100%;
}

.btn-row {
  margin-top: 14px;
  display: flex;
  gap: 9px;
}

.btn-row .btn-secondary,
.btn-row .btn-primary {
  flex: 1;
}

.analysis-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.domain-tabs {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.domain-note {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.task-tab {
  border: 1px solid #c7ddd8;
  border-radius: 10px;
  background: #fff;
  color: #1f5660;
  padding: 8px 10px;
  font-weight: 700;
  cursor: pointer;
}

.task-tab.active {
  border-color: #89cdb7;
  background: #dbf2ea;
  color: #0b6a53;
}

.task-pane.active {
  display: block;
}

.analysis-item {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.analysis-item strong {
  font-size: 15px;
}

.analysis-item small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.analysis-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.domain-placeholder {
  border-style: dashed;
  background: #f7fcfa;
}

.index-selector {
  margin-top: 2px;
  border: 1px solid #d8e8e5;
  background: #f7fcfa;
  border-radius: 12px;
  padding: 10px;
}

.indices-mode {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px dashed #c8ddda;
  border-radius: 10px;
  background: #ffffff;
}

.indices-mode label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1e5e59;
}

.indices-mode input[type="radio"] {
  accent-color: var(--brand);
}

.chip {
  display: inline-block;
  border: 1px solid #b9d8cf;
  padding: 5px 10px;
  border-radius: 999px;
  margin: 0 7px 7px 0;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: #1e5e59;
  background: #fff;
}

.chip.active {
  background: #dbf2ea;
  border-color: #89cdb7;
}

.transition-range {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed #c8ddda;
  background: #f7fcfa;
}

.task-config {
  margin-top: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed #c8ddda;
  background: #f7fcfa;
}

}

.mode-switch {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px dashed #c8ddda;
  border-radius: 10px;
  background: #fff;
}

.mode-switch label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #1e5e59;
}

.mode-switch input[type="radio"] {
  accent-color: var(--brand);
}

.config-grid.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.training-upload-box {
  display: grid;
  gap: 10px;
}

.training-upload-box + .training-upload-box {
  margin-top: 10px;
}

.upload-zone.compact {
  padding: 14px 10px;
}

.training-upload-status {
  border: 1px solid #d7e5e2;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.training-upload-status.ready {
  border-color: #9ad6c6;
  box-shadow: 0 0 0 3px rgba(14, 138, 106, 0.08);
}

.training-upload-title {
  font-weight: 700;
  color: #184950;
  margin-bottom: 4px;
}

.training-upload-status p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.class-config-box {
  margin-top: 10px;
  border: 1px solid #d7e5e2;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
}

.class-config-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.class-config-header strong {
  font-family: "Sora", sans-serif;
  color: #174b54;
  font-size: 13px;
}

.class-config-note {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
}

.class-editor-list {
  display: grid;
  gap: 8px;
  margin-bottom: 8px;
}

.class-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px 34px;
  gap: 8px;
  align-items: center;
}

.class-color-input {
  width: 46px;
  height: 36px;
  border: 1px solid #cfe0dd;
  border-radius: 8px;
  background: #fff;
  padding: 2px;
  cursor: pointer;
}

.year-pair + .year-pair {
  margin-top: 7px;
}

.config-grid.two-col .year-pair + .year-pair {
  margin-top: 0;
}

.year-pair label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.layer-control {
  border-top: 1px solid var(--line);
  padding: 10px 14px 14px;
  background: #f5faf8;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  height: min(42vh, 360px);
  min-height: 180px;
  overflow: hidden;
}

.layer-control.collapsed {
  height: auto !important;
  min-height: 0;
  max-height: none;
}

.layer-control.collapsed .lc-list,
.layer-control.collapsed .layer-resize-handle {
  display: none;
}

.layer-control-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.layer-title {
  font-family: "Sora", sans-serif;
  font-weight: 700;
  margin-bottom: 0;
}

.lc-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow: auto;
  padding-right: 4px;
}

.layer-resize-handle {
  height: 10px;
  margin: 0 0 8px;
  border-radius: 999px;
  cursor: row-resize;
  background:
    radial-gradient(circle, rgba(16, 49, 54, 0.24) 1.2px, transparent 1.3px)
    center / 14px 6px repeat-x,
    linear-gradient(180deg, rgba(14, 138, 106, 0.05) 0%, rgba(14, 138, 106, 0.12) 100%);
}

.mini-btn.icon-only {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
}

.lc-item {
  border: 1px solid #d5e4e1;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.lc-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lc-item label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #1b555f;
}

.lc-item input[type="checkbox"] {
  accent-color: var(--brand);
}

.lc-extra {
  margin-top: 7px;
}

.ts-rgb-controls {
  border: 1px dashed #c8ddda;
  border-radius: 8px;
  background: #f7fcfa;
  padding: 7px;
}

.ts-rgb-title {
  font-size: 11px;
  font-weight: 700;
  color: #2a646e;
  margin-bottom: 6px;
}

.ts-rgb-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 6px;
}

.ts-band-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ts-band-group label {
  font-size: 11px;
  font-weight: 700;
}

.ts-band-group select {
  width: 100%;
  height: 30px;
  padding: 4px 6px;
  font-size: 11px;
}

.ts-rgb-controls .mini-btn {
  width: 100%;
}

.mini-btn {
  border: 1px solid #c6ddd8;
  border-radius: 8px;
  background: #f8fcfb;
  color: #1c5962;
  cursor: pointer;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.map-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.map-stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

#map {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.basemap-switcher {
  position: absolute;
  z-index: 700;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.basemap-switcher {
  top: 14px;
  right: 14px;
}

.map-toolbar {
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.bm-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(220, 236, 233, 0.9);
  background: rgba(255, 255, 255, 0.95);
  color: #1a4a52;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.tool-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  background: #fff;
  color: #333;
  box-shadow: none;
  cursor: pointer;
  padding: 0;
  appearance: none;
}

.tool-btn:last-child {
  border-bottom: 0;
}

.tool-btn:hover {
  background: #f4f4f4;
}

.tool-btn.active {
  background: #e8f8f1;
}

.tool-btn i {
  color: #333;
  font-size: 14px;
  line-height: 1;
}

.bm-btn.active {
  border-color: #84c9b0;
  background: #ebf8f2;
  color: #0a7057;
}

.map-loading {
  position: absolute;
  inset: 0;
  background: rgba(11, 43, 49, 0.36);
  z-index: 900;
  display: grid;
  place-items: center;
}

.loader-box {
  background: #fff;
  width: min(320px, 88vw);
  border-radius: 16px;
  border: 1px solid #d4e5e2;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.19);
  text-align: center;
  padding: 16px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid #cae5de;
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 10px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.legend-panel {
  position: absolute;
  left: 14px;
  bottom: 70px;
  width: min(310px, calc(100% - 28px));
  max-height: 45%;
  overflow: auto;
  z-index: 700;
  border: 1px solid #d9e6e4;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
}

.swipe-panel {
  position: absolute;
  top: 120px;
  left: 14px;
  right: auto;
  z-index: 700;
  width: min(300px, calc(100% - 28px));
  border: 1px solid #d9e6e4;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: var(--shadow);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.swipe-title {
  font-family: "Sora", sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #15464f;
  padding-bottom: 4px;
  border-bottom: 1px solid #e4eeeb;
}

.swipe-panel-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.swipe-panel-row.full {
  grid-template-columns: 1fr;
}

.swipe-panel-row label {
  font-size: 12px;
  font-weight: 700;
  color: #2a646e;
}

.swipe-panel .form-input {
  min-height: 34px;
  padding: 6px 8px;
}

.swipe-divider {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  z-index: 680;
  background: rgba(255, 255, 255, 0.95);
  border-left: 1px solid #0f8a9e;
  border-right: 1px solid #0f8a9e;
  pointer-events: none;
}

.legend-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid #e1ece9;
}

.legend-header button {
  border: 1px solid #d9e6e4;
  border-radius: 8px;
  background: #fff;
  width: 28px;
  height: 28px;
  cursor: pointer;
}

#legendBody {
  padding: 10px;
}

.legend-group + .legend-group {
  margin-top: 12px;
}

.legend-group h4 {
  margin: 0 0 7px;
  font-size: 14px;
  color: #174b54;
}

.legend-swatch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  font-size: 13px;
}

.legend-swatch-row + .legend-swatch-row {
  margin-top: 4px;
}

.swatch {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  border: 1px solid rgba(0, 0, 0, 0.18);
}

.gradient-bar {
  height: 12px;
  border-radius: 999px;
  margin: 7px 0;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.gradient-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.stats-bar {
  position: absolute;
  left: 14px;
  bottom: 16px;
  z-index: 700;
  display: flex;
  gap: 14px;
  padding: 8px 12px;
  border: 1px solid #d8e6e3;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  font-size: 13px;
  box-shadow: var(--shadow);
}

.stats-bar span {
  white-space: nowrap;
}

.field-monitor-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 708;
  display: flex;
  align-items: stretch;
  border: 1px solid #1f3442;
  border-radius: 12px;
  background: rgba(5, 13, 21, 0.95);
  box-shadow: 0 16px 28px rgba(3, 8, 14, 0.46);
  overflow: visible;
}

.field-tool-select-wrap,
.field-tool-icon-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border-right: 1px solid rgba(175, 208, 235, 0.18);
}

.field-tool-select-wrap {
  min-width: 116px;
}

.field-tool-select {
  appearance: none;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f0f7ff;
  width: 100%;
  min-height: 44px;
  padding: 10px 30px 10px 14px;
  font-family: "Sora", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.field-tool-select:focus {
  outline: none;
}

.field-tool-select:disabled {
  opacity: 0.68;
  cursor: not-allowed;
}

.field-tool-select option,
.field-tool-select optgroup {
  color: #091722;
}

.field-tool-caret {
  position: absolute;
  right: 11px;
  color: #d3e6fa;
  font-size: 11px;
  pointer-events: none;
}

.field-tool-icon-btn {
  width: 52px;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #edf6ff;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.field-tool-icon-btn i {
  font-size: 15px;
}

.field-tool-icon-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.field-tool-icon-btn:not(:disabled):hover,
.field-tool-icon-btn.active {
  background: #112e47;
}

.field-monitor-controls > .field-tool-icon-btn:last-child {
  border-right: 0;
}

.field-profile-menu {
  position: absolute;
  bottom: calc(100% + 8px);
  right: 0;
  max-width: min(260px, calc(100vw - 20px));
  min-width: 228px;
  padding: 6px;
  display: grid;
  gap: 4px;
  border: 1px solid #2a4760;
  border-radius: 10px;
  background: rgba(6, 15, 24, 0.96);
  box-shadow: 0 14px 26px rgba(3, 8, 14, 0.46);
}

.field-profile-item {
  border: 1px solid transparent;
  border-radius: 8px;
  background: #0d1d2d;
  color: #dceeff;
  font-size: 11px;
  font-weight: 700;
  font-family: "Sora", sans-serif;
  padding: 7px 8px;
  cursor: pointer;
  text-align: left;
  line-height: 1.25;
}

.field-profile-item:hover,
.field-profile-item.active {
  border-color: #2d5f87;
  background: #12314a;
}

.leaflet-interactive:focus {
  outline: none !important;
}

.field-monitor-legend {
  position: absolute;
  right: 14px;
  bottom: 76px;
  z-index: 709;
  width: 282px;
  max-height: min(58vh, 520px);
  overflow: auto;
  border: 1px solid #263746;
  border-radius: 10px;
  background: rgba(5, 11, 17, 0.94);
  color: #e6f1ff;
  box-shadow: 0 14px 30px rgba(4, 9, 14, 0.42);
}

.field-monitor-legend-body {
  padding: 10px 11px 11px;
  display: grid;
  gap: 4px;
}

.field-legend-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.field-legend-swatch {
  width: 18px;
  height: 14px;
  border-radius: 2px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.field-legend-range {
  color: #f4f8ff;
}

.field-legend-class {
  color: #9fc2e8;
  text-align: right;
}


.field-monitor-timeline {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 704;
  border: 1px solid #223340;
  border-radius: 12px;
  background: rgba(4, 9, 14, 0.88);
  box-shadow: 0 10px 28px rgba(4, 9, 14, 0.45);
  overflow-x: auto;
  overflow-y: hidden;
}

}

.field-date-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.field-monitor-dates {
  display: flex;
  gap: 6px;
  padding: 8px;
  min-width: max-content;
}

.field-date-btn {
  border: 1px solid #304352;
  background: #0e1a24;
  color: #cfe5fb;
  border-radius: 8px;
  padding: 6px 9px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.field-date-btn.active {
  border-color: #2f7de1;
  background: #133357;
  color: #e9f3ff;
}

.pixel-chart-panel {
  position: absolute;
  right: 14px;
  bottom: 70px;
  width: min(430px, calc(100% - 28px));
  min-height: 180px;
  max-height: 50%;
  z-index: 710;
  border: 1px solid #d9e6e4;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 38px rgba(16, 49, 54, 0.18);
  backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chart-rise 0.28s ease;
}

.map-wrapper.profile-chart-open .map-stage {
  min-height: 220px;
}

.pixel-chart-panel.is-docked {
  position: relative;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  min-height: 240px;
  max-height: 44%;
  z-index: 705;
  border-radius: 14px 14px 0 0;
  border-left: 0;
  border-right: 0;
  border-bottom: 0;
  box-shadow: 0 -12px 28px rgba(16, 49, 54, 0.24);
  backdrop-filter: none;
}

.pixel-chart-panel.is-docked .pixel-chart-canvas-wrap {
  min-height: 240px;
}

.pixel-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px 10px;
  border-bottom: 1px solid #e3eeeb;
  background: linear-gradient(140deg, #ffffff 0%, #f4fbf8 100%);
}

.pixel-chart-header strong {
  font-family: "Sora", sans-serif;
  color: #103136;
}

.pixel-chart-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-chart-controls {
  margin-top: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.profile-metric-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #d6e5e2;
  border-radius: 10px;
  background: #f8fcfb;
}

.profile-aggregation-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #c8d8d5;
  border-radius: 10px;
  background: #f3f9f7;
}

.profile-aggregation-group .profile-metric-btn.active {
  border-color: #1a6e5a;
  background: #cceee4;
  color: #0c3d31;
}

.profile-smoothing-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid #d6e5e2;
  border-radius: 10px;
  background: #f8fcfb;
}

.profile-metric-btn {
  border: 1px solid #ccddda;
  border-radius: 8px;
  background: #ffffff;
  color: #1a3a3f;
  font-family: "Sora", sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 9px;
  cursor: pointer;
}

.profile-metric-btn:hover,
.profile-metric-btn.active {
  border-color: #2e7f6a;
  background: #dff3ec;
  color: #11453a;
}


.pixel-chart-actions #pixelChartClose {
  width: 30px;
  height: 30px;
  border: 1px solid #d5e4e1;
  border-radius: 9px;
  background: #fff;
  cursor: pointer;
  flex: 0 0 30px;
}

.pixel-chart-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pixel-chart-actions .mini-btn {
  white-space: nowrap;
  flex-shrink: 0;
}

.pixel-chart-message {
  padding: 18px 14px;
  color: var(--muted);
  font-size: 14px;
}

.pixel-chart-canvas-wrap {
  position: relative;
  min-height: 250px;
  padding: 8px 12px 4px;
}

.pixel-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 12px 12px;
}

.pixel-legend-item {
  border: 1px solid #d4e4e0;
  border-radius: 999px;
  background: #fff;
  color: #13424a;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: 0.2s ease;
}

.pixel-legend-item.is-off {
  opacity: 0.45;
  background: #f5f8f7;
}

.pixel-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.95) inset;
}

.leaflet-popup.pixel-popup .leaflet-popup-content-wrapper {
  border-radius: 14px;
  box-shadow: 0 16px 32px rgba(16, 49, 54, 0.16);
  border: 1px solid #dce9e6;
}

.leaflet-popup.pixel-popup .leaflet-popup-content {
  margin: 12px 14px;
  min-width: 210px;
  font-size: 13px;
}

.pixel-popup-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pixel-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: #19424a;
}

.pixel-popup-row span {
  color: var(--muted);
}

.pixel-popup-stack {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
}

.pixel-popup-stack div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pixel-popup-stack div span {
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef6f3;
  color: #16444d;
}

.pixel-popup-empty {
  color: var(--muted);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(8, 28, 33, 0.5);
  display: grid;
  place-items: center;
  padding: 16px;
}

.modal {
  width: min(1000px, 96vw);
  max-height: min(85vh, 820px);
  border: 1px solid #d4e2df;
  border-radius: 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
}

.lulc-modal {
  width: min(1100px, 96vw);
}

.chip-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.lulc-view-panel {
  min-height: 140px;
}

.lulc-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.lulc-card,
.lulc-stat-card,
.chart-panel {
  border: 1px solid #d8e6e3;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
}

.lulc-card h4 {
  margin: 0 0 10px;
  font-family: "Sora", sans-serif;
  color: #174b54;
}

.lulc-card p {
  margin: 0;
  color: var(--muted);
}

.legend-inline {
  display: grid;
  gap: 6px;
}

.lulc-stat-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.lulc-stat-card strong {
  font-family: "Sora", sans-serif;
  font-size: 24px;
  color: #133e46;
}

.chart-panel {
  min-height: 360px;
}

.chart-panel canvas {
  width: 100% !important;
  height: 320px !important;
}

.modal-header {
  border-bottom: 1px solid #e4ecea;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-header h3 {
  margin: 0;
  font-family: "Sora", sans-serif;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.modal-actions button:last-child {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid #d3e2de;
  background: #fff;
  cursor: pointer;
}

.modal-body {
  overflow: auto;
  padding: 12px;
}

.table-wrapper {
  overflow: auto;
  max-width: 100%;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead th {
  position: sticky;
  top: 0;
  background: #edf8f4;
  border: 1px solid #d5e4e1;
  padding: 8px 6px;
  white-space: nowrap;
}

.data-table tbody td {
  border: 1px solid #dce8e6;
  padding: 7px 6px;
  text-align: right;
  white-space: nowrap;
}

.data-table tbody tr.report-row {
  cursor: pointer;
  transition: background 0.18s ease;
}

.data-table tbody tr.report-row:hover {
  background: #f4fbf8;
}

.data-table tbody td:first-child,
.data-table thead th:first-child {
  text-align: center;
}

.toast-container {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  min-width: 250px;
  max-width: 360px;
  border-radius: 10px;
  padding: 10px 12px;
  border: 1px solid #c8ded9;
  background: #fff;
  color: #19424a;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
}

.toast.success {
  border-left: 5px solid #18a967;
}

.toast.error {
  border-left: 5px solid #cf4f4f;
}

.toast.info {
  border-left: 5px solid #0f8a9e;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chart-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1080px) {
  .topnav {
    grid-template-columns: 1fr;
    height: auto;
    gap: 9px;
  }

  .status-row {
    justify-content: flex-start;
  }

  .main-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: calc(100% - 128px);
  }

  .sidebar {
    max-height: 52vh;
    min-width: 0;
  }

  .sidebar-resize-handle {
    display: none;
  }

  .map-wrapper {
    min-height: 48vh;
  }

  .stats-bar {
    gap: 8px;
    border-radius: 14px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    justify-content: space-between;
  }

  .pixel-chart-panel {
    left: 10px;
    right: 10px;
    bottom: 72px;
    width: auto;
    max-height: 46%;
  }

  .pixel-chart-canvas-wrap {
    min-height: 220px;
  }

  .config-grid.two-col,
  .lulc-card-grid {
    grid-template-columns: 1fr;
  }

  .domain-tabs {
    grid-template-columns: 1fr;
  }

  .swipe-panel {
    top: 110px;
    left: 10px;
    right: auto;
    width: auto;
  }

  .field-monitor-controls {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: 10px;
    max-width: calc(100% - 20px);
    overflow: visible;
    flex-wrap: wrap;
  }

  .field-monitor-legend {
    left: 10px;
    right: 10px;
    width: auto;
    top: 64px;
    bottom: auto;
    max-height: 42vh;
  }

  .field-monitor-timeline {
    bottom: 8px;
  }

  .pixel-chart-panel.is-docked {
    max-height: 48%;
    min-height: 220px;
    border-radius: 12px 12px 0 0;
  }

  .pixel-chart-actions {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .profile-chart-controls {
    gap: 8px;
  }

  .profile-metric-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .profile-aggregation-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .profile-smoothing-group {
    width: 100%;
    flex-wrap: wrap;
  }

  .pixel-chart-panel.is-docked .pixel-chart-canvas-wrap {
    min-height: 210px;
  }

  .class-row {
    grid-template-columns: minmax(0, 1fr) 44px 32px;
  }
}
