@font-face {
  font-family: "DM Sans";
  src: url("/static/assets/fonts/DMSans-Variable.ttf") format("truetype");
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
}

:root {
  --hydro-dark: #003c46;
  --hydro-blue: #007c89;
  --bg: #f7f5f2;
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --border: #ded8cf;
  --border-strong: #c9c1b6;
  --text: #151515;
  --muted: #666666;
  --shadow: 0 12px 34px rgba(0, 30, 35, 0.08);
}

body.dark-mode {
  --hydro-dark: #d9f7fb;
  --hydro-blue: #27b7c7;
  --bg: #101719;
  --panel: #172123;
  --panel-soft: #1b2729;
  --border: #334144;
  --border-strong: #4a5b5e;
  --text: #eef5f6;
  --muted: #aebabc;
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", system-ui, sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea,
table {
  font: inherit;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.login-mode .topbar {
  display: none;
}

.login-mode main {
  width: 100%;
  margin: 0;
}

.control-workspace { padding: 18px 0; }
.processing-workspace { padding: 18px 0; }
.processing-workspace h2 { margin: 0 0 14px; }
.processing-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 185px), 1fr)); gap: 12px; }
.processing-filters > label { min-width: 0; }
.processing-filters :is(select, input) { width: 100%; min-width: 0; }
.processing-chart { display: grid; grid-template-rows: 40px minmax(0, 1fr); min-width: 0; height: 440px; margin-top: 12px; background: var(--panel); border: 1px solid var(--border); border-radius: 6px; }
.processing-plot-area { position: relative; min-width: 0; min-height: 0; }
.processing-chart-empty { position: absolute; inset: 0; display: grid; place-content: center; margin: 0; padding: 16px; text-align: center; color: var(--muted); }
.processing-point-picker { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 4px 8px; border-bottom: 1px solid var(--border); }
.processing-point-picker button { display: grid; place-items: center; flex: 0 0 32px; width: 32px; height: 32px; min-height: 0; padding: 0; }
.processing-point-picker svg { width: 16px; height: 16px; }
.processing-point-picker [aria-pressed="true"] { background: var(--hydro-blue); color: white; }
.processing-point-picker [role="status"], .processing-filters small { color: var(--muted); font-size: 12px; }
.processing-chart.is-picking .nsewdrag { cursor: crosshair; }
#processingForm { width: 100%; max-width: none; margin: 0; padding: 0; border: 0; box-shadow: none; background: none; }
.processing-workspace fieldset { margin: 14px 0 0; padding: 12px 0 0; border: 0; border-top: 1px solid var(--border); }
.processing-workspace legend { padding-right: 10px; font-weight: 700; }
.processing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; }
.processing-explanation { margin-top: 10px; }
.processing-explanation textarea { width: 100%; resize: vertical; }
#processingSummary { color: var(--muted); }
@media (max-width: 560px) {
  .processing-chart { height: 350px; }
}
.control-heading { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.control-heading h2 { margin: 0 0 4px; font-size: 22px; }
.control-preview, .control-sources { color: var(--muted); font-size: 13px; }
.control-heading button { width: 40px; height: 40px; padding: 9px; }
.control-heading svg { width: 20px; height: 20px; }
#controlForm { width: 100%; max-width: none; padding: 0 0 20px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; box-shadow: none; background: transparent; }
.control-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr) repeat(4, minmax(0, 1fr)) auto; gap: 12px; align-items: end; }
.control-form label, .control-model-toolbar label { display: grid; gap: 6px; min-width: 0; font-size: 12px; }
.control-form input, .control-form select, .control-model-toolbar select { width: 100%; min-width: 0; height: 40px; }
.control-form button { min-height: 40px; }
.control-availability { padding: 14px 0; border-bottom: 1px solid var(--border); }
.control-availability dl { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 24px; margin: 0; }
.control-availability dl div { min-width: 0; overflow-wrap: anywhere; }
.control-availability dt { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.control-availability dd { margin: 0; font-size: 14px; font-weight: 600; }
.control-availability p { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.control-availability p:empty { display: none; }
.control-model-toolbar { display: flex; gap: 12px; align-items: end; margin: 16px 0; }
.control-model-toolbar label { width: 520px; max-width: 65%; }
.control-search-toolbar { display: flex; align-items: center; gap: 8px; margin: 16px 0; }
.control-search-toolbar > button:first-child { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.control-search-toolbar svg { width: 18px; height: 18px; }
.control-search-results { padding: 16px 0; border-block: 1px solid var(--border); }
.control-search-results table { min-width: 850px; table-layout: auto; }
.control-search-results th, .control-search-results td { white-space: normal; text-overflow: clip; }
.control-search-results th:first-child, .control-search-results td:first-child { min-width: 170px; max-width: 240px; }
.control-search-results th:nth-child(2), .control-search-results td:nth-child(2) { min-width: 210px; white-space: nowrap; }
.control-candidate.secondary, .control-delete.secondary { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; flex: 0 0 40px; padding: 9px; }
.control-candidate svg, .control-delete svg { width: 20px; height: 20px; }
.control-delete:not(:disabled) { color: #b8342c; }
.control-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--border); padding: 16px 0; gap: 16px; }
.control-metrics div { min-width: 0; }
.control-metrics > div > span { display: flex; align-items: center; gap: 5px; min-height: 32px; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.control-metric-label { min-width: 0; overflow-wrap: anywhere; }
.control-metrics strong { font-size: 18px; overflow-wrap: anywhere; }
.control-warnings { padding-left: 20px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.control-save { display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--border); padding-bottom: 20px; }
.control-save label { display: flex; gap: 8px; align-items: start; font-size: 13px; max-width: 760px; }
.control-save input { width: 16px; height: 16px; flex: 0 0 16px; }
.control-save button { flex-shrink: 0; }
.control-chart-section { margin: 24px 0; }
.control-workspace h3 { font-size: 16px; margin: 0 0 12px; }
.control-chart-heading { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.control-chart-heading h3 { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.control-info.secondary { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 6px; flex: 0 0 32px; border-color: transparent; color: var(--muted); }
.control-info svg { width: 18px; height: 18px; }
.control-info:hover, .control-info:focus-visible { color: var(--hydro-blue); border-color: var(--border); }
.control-chart-mode { display: inline-flex; gap: 0; border: 1px solid var(--border); border-radius: 4px; padding: 0; margin: 0 0 8px; }
.control-chart-mode label { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 108px; height: 36px; padding: 0 12px; font-size: 13px; cursor: pointer; }
.control-chart-mode label + label { border-left: 1px solid var(--border); }
.control-chart-mode label:has(input:checked) { background: var(--hydro-blue); color: #fff; }
.control-chart-mode input { width: 14px; height: 14px; margin: 0; accent-color: var(--hydro-blue); }
.control-help-dialog { width: 600px; max-width: calc(100vw - 32px); max-height: calc(100dvh - 32px); box-sizing: border-box; padding: 24px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); color: var(--text); overflow-y: auto; }
.control-help-dialog::backdrop { background: rgba(0, 0, 0, 0.4); }
.control-help-dialog .control-chart-heading { justify-content: space-between; }
.control-help-dialog p { font-size: 14px; line-height: 1.65; }
.control-help-dialog a { font-size: 12px; overflow-wrap: anywhere; }
.control-chart { width: 100%; height: 360px; min-width: 0; }
.control-diagnostics { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
.control-diagnostics section { min-width: 0; }
.control-table-scroll { overflow-x: auto; }
.control-table-scroll table { min-width: 650px; }
.control-method { font-size: 12px; margin-top: 30px; }
@media (max-width: 1150px) { .control-form { grid-template-columns: repeat(3, minmax(0, 1fr)); } .control-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .control-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-availability dl { grid-template-columns: minmax(0, 1fr); }
  .control-form button { grid-column: 1 / -1; }
  .control-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .control-diagnostics { grid-template-columns: minmax(0, 1fr); }
  .control-save { flex-direction: column; align-items: start; }
  .control-model-toolbar { flex-wrap: wrap; }
}

.login-mode .site-footer {
  display: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5000;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(260px, auto) minmax(180px, 1fr);
  align-items: center;
  min-height: 100px;
  padding: 14px clamp(24px, 5vw, 110px);
  background: rgba(247, 245, 242, 0.96);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}

body.dark-mode .topbar {
  background: rgba(16, 23, 25, 0.94);
}

.header-logo {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-logo-left {
  justify-content: flex-start;
  padding-left: clamp(14px, 3vw, 58px);
}

.header-logo-right {
  justify-content: flex-end;
  padding-right: clamp(94px, 8vw, 132px);
}

.header-logo img {
  display: block;
  width: auto;
  object-fit: contain;
}

.header-logo a {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.header-logo-left img {
  max-height: 70px;
  max-width: min(310px, 100%);
}

.header-logo-right img {
  max-height: 76px;
  max-width: min(280px, 100%);
}

.header-title {
  color: var(--hydro-dark);
  font-size: clamp(24px, 2.2vw, 36px);
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  white-space: nowrap;
}

.logout-button {
  position: absolute;
  top: 12px;
  right: 18px;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

main {
  width: min(1500px, calc(100vw - 32px));
  margin: 22px auto 34px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto 26px;
  padding: 18px 4px 0;
  border-top: 1px solid var(--border);
  color: #526166;
  font-size: 13px;
}

.site-footer div {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--hydro-dark);
}

.footer-brand img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.site-footer a {
  color: var(--hydro-dark);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.login-panel {
  display: grid;
  place-items: center;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background:
    linear-gradient(135deg, rgba(0, 60, 70, 0.08), rgba(0, 124, 137, 0.04)),
    var(--bg);
}

form,
.filters,
.panel,
.summary > div {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

form {
  width: min(420px, 100%);
  padding: 24px;
}

textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
  resize: vertical;
}

textarea:focus {
  border-color: var(--hydro-blue);
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.12);
  outline: none;
}

.login-card {
  width: min(470px, 100%);
  padding: 34px;
}

.login-environment {
  margin: -8px 0 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.app-load-error {
  width: min(900px, calc(100% - 24px));
  margin: 12px auto;
  padding: 12px 16px;
  border: 1px solid #c47769;
  border-radius: 6px;
  background: #fff1ee;
  color: #8c2e21;
}

.login-logo {
  display: block;
  width: min(280px, 82%);
  height: auto;
  margin: 0 auto 22px;
}

.login-title {
  margin-bottom: 28px;
  color: var(--hydro-dark);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-align: center;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0 0 16px;
  color: var(--hydro-dark);
  font-weight: 800;
}

h2 {
  font-size: 17px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

input,
select,
button {
  min-height: 36px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--border);
  background: #fff;
  padding: 9px 10px;
  color: var(--text);
}

input:focus,
select:focus {
  border-color: var(--hydro-blue);
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.12);
  outline: none;
}

button {
  border: 1px solid var(--hydro-blue);
  background: var(--hydro-blue);
  color: #fff;
  padding: 7px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

button:hover {
  filter: brightness(0.96);
}

button.secondary,
button.ghost {
  background: #fff;
  color: var(--hydro-dark);
}

body.dark-mode button.secondary,
body.dark-mode button.ghost,
body.dark-mode input,
body.dark-mode select,
body.dark-mode textarea,
body.dark-mode .picker-button,
body.dark-mode .filter-option,
body.dark-mode .qa-toggle {
  background: #111b1d;
  color: var(--text);
  border-color: var(--border);
}

body.dark-mode table,
body.dark-mode .table-wrap,
body.dark-mode .pipe-info-item,
body.dark-mode .request-queue {
  background: var(--panel-soft);
}

body.dark-mode th {
  background: #182426;
}

body.dark-mode .map-popup,
body.dark-mode .point-label,
body.dark-mode .sgu-point-label,
body.dark-mode .smhi-point-label,
body.dark-mode .groundwater-gradient-legend,
body.dark-mode .map-layer-menu {
  background: rgba(24, 36, 38, 0.96);
  color: var(--text);
  border-color: var(--border);
}


.error {
  min-height: 20px;
  color: #b00020;
}

.filters {
  display: grid;
  gap: 8px;
  align-items: start;
  align-content: start;
  padding: 9px 10px;
  background: var(--panel-soft);
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.filter-header h2 {
  margin: 0;
}

.filter-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-items: end;
}

.filter-point {
  grid-column: 1 / -1;
}

.filter-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-items: start;
  align-content: start;
}

.date-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 6px;
}

.date-shortcuts button {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
  white-space: normal;
}

.filter-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 4px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 26px;
  padding: 3px 7px;
  border: 1px solid rgba(222, 216, 207, 0.85);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.filter-option input {
  width: 14px;
  min-height: 14px;
  margin: 0;
  accent-color: var(--hydro-blue);
}

.filter-option span {
  line-height: 1.15;
}

.filters label {
  gap: 5px;
  font-size: 11px;
}

.filters input:not([type="checkbox"]),
.filters select,
.filters .picker-button {
  min-height: 34px;
  padding: 7px 9px;
  font-size: 13px;
}

.groundwater-gradient-legend {
  position: absolute;
  right: 12px;
  top: 82px;
  bottom: 28px;
  z-index: 500;
  display: grid;
  grid-template: auto minmax(0, 1fr) / 12px 1fr;
  gap: 8px;
  max-height: 340px;
  padding: 10px 11px;
  border: 1px solid rgba(0, 60, 70, 0.18);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 24px rgba(0, 30, 35, 0.14);
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 800;
}

.legend-title {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.legend-bar {
  border-radius: 4px;
  background: linear-gradient(0deg, rgb(35, 95, 190), rgb(240, 55, 45));
}

.legend-scale {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  white-space: nowrap;
}

.is-measuring-distance { cursor: crosshair; }
.map-ruler-result { font-weight: 700; }

.qa-toggle {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.qa-toggle input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.filters.collapsed {
  padding: 14px 18px;
}

.filters.collapsed .filter-body {
  display: none;
}

.filter-toggle {
  display: none;
}

.filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 150px;
}

.filter-actions.compact {
  justify-content: flex-start;
}

.point-picker {
  position: relative;
}

.parameter-filter-field {
  min-width: 0;
}

.parameter-filter-field > label {
  display: block;
  margin-bottom: 5px;
}

.parameter-picker {
  position: relative;
}

.parameter-picker-menu {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 1001;
  width: max(100%, 305px);
  max-width: min(420px, calc(100vw - 32px));
  max-height: min(420px, 65vh);
  overflow: auto;
  padding: 7px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.parameter-picker-heading,
.parameter-picker-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.parameter-picker-heading {
  position: sticky;
  top: -7px;
  z-index: 1;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.parameter-picker-clear {
  display: grid;
  place-items: center;
  width: 26px;
  min-height: 26px;
  padding: 3px;
  background: transparent;
  border: 0;
  color: var(--muted);
}

.parameter-picker-clear svg { width: 16px; height: 16px; }

.parameter-picker-available { border-bottom: 1px solid var(--border); padding: 5px 0; }
.parameter-picker-section-title { color: var(--hydro-dark); }
.parameter-picker-group { border-bottom: 1px solid var(--border); }
.parameter-picker-group:last-child { border-bottom: 0; }

.parameter-picker-group summary,
.parameter-picker-option {
  width: 100%;
  min-height: 36px;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
}

.parameter-picker-group summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.parameter-picker-group summary::-webkit-details-marker {
  display: none;
}

.parameter-picker-group summary::before {
  content: "+";
  display: grid;
  place-items: center;
  flex: 0 0 17px;
  height: 17px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  line-height: 1;
}

.parameter-picker-group[open] summary::before {
  content: "−";
}

.parameter-picker-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
}

.parameter-picker-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.parameter-picker-group .parameter-picker-option {
  padding-left: 20px;
}

.parameter-picker-option input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  padding: 0;
  accent-color: var(--hydro-blue);
  flex: 0 0 15px;
}

.parameter-picker-option.is-selected { background: var(--panel-soft); color: var(--hydro-dark); font-weight: 700; }
.parameter-option-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.parameter-option-unit { color: var(--muted); font-size: 11px; white-space: nowrap; }
.parameter-axis-label { margin-left: 4px; padding-left: 7px; border-left: 1px solid var(--border-strong); color: var(--hydro-blue); font-size: 10px; white-space: nowrap; }
.parameter-picker .picker-button { overflow: hidden; text-overflow: ellipsis; }

.parameter-picker-group summary:hover,
.parameter-picker-option:hover,
.parameter-picker-group summary:focus-visible,
.parameter-picker-option:focus-visible {
  background: var(--panel-soft);
  outline: none;
}

.picker-button {
  width: 100%;
  border-color: var(--border);
  background: #fff;
  color: var(--text);
  font-weight: 600;
  text-align: left;
}

.picker-button::after {
  content: "▾";
  float: right;
  color: var(--muted);
}

.point-picker-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 1000;
  width: 100%;
  max-height: 260px;
  overflow: auto;
  padding: 8px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.point-option {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.point-option-all {
  background: var(--panel);
  color: var(--hydro-dark);
  font-weight: 800;
}

.point-picker-group + .point-picker-group,
.field-point-group + .field-point-group {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 6px;
}

.point-option.point-group-toggle,
.field-point-filter-option.point-group-toggle {
  color: var(--hydro-dark);
  background: var(--panel-soft);
  font-weight: 700;
}

.point-group-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.point-group-header {
  display: flex;
  align-items: center;
  background: var(--panel-soft);
}

.point-group-header .point-group-toggle {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.point-group-expand {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 5px;
  border: 0;
  background: transparent;
  color: var(--hydro-dark);
}

.point-group-expand:hover {
  background: var(--border);
}

.point-group-expand svg {
  width: 17px;
  height: 17px;
}

.point-group-expand[aria-expanded="true"] .point-group-plus,
.point-group-expand[aria-expanded="false"] .point-group-minus,
.point-group-options[hidden] {
  display: none;
}

.point-picker-group .point-group-options > .point-option {
  padding-left: 22px;
}

.field-point-group .point-group-options > .field-point-filter-option {
  padding-left: 20px;
}

.point-picker-divider {
  height: 1px;
  margin: 6px 4px;
  background: var(--border);
}

.point-option:hover {
  background: var(--panel-soft);
}

.point-option-muted {
  color: #6f7c80;
}

.point-option-muted span::after {
  content: " saknar vald parameter";
  color: #8b979b;
  font-size: 11px;
}

body.dark-mode .point-option-muted,
body.dark-mode .point-option-muted span::after {
  color: var(--muted);
}

.point-picker-menu.has-comparison .point-option-muted span::after {
  content: " saknar valda parametrar";
}

.point-option input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  accent-color: var(--hydro-blue);
}

.qa-cell {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 6px;
}

.qa-select {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--hydro-blue);
}

.qa-badge {
  display: inline-flex;
  align-items: center;
  max-width: calc(100% - 24px);
  min-height: 22px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff4df;
  color: #7a4a00;
  font-size: 11px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qa-ok {
  color: var(--muted);
}

.summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.workspace-tabs {
  --workspace-surface: #eef3f2;
  --workspace-hover: #e1eeec;
  --workspace-active: #096774;
  --workspace-active-text: #ffffff;
  --workspace-badge: #dfefdf;
  --workspace-badge-text: #245d3a;
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: 100%;
  margin: 8px 0 2px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--workspace-surface);
  overflow: auto hidden;
  scrollbar-width: thin;
  scroll-padding-inline: 4px;
}

.dark-mode .workspace-tabs {
  --workspace-surface: #202c2c;
  --workspace-hover: #2b3c3c;
  --workspace-active: #155660;
  --workspace-active-text: #edfbfc;
  --workspace-badge: #304839;
  --workspace-badge-text: #b7ebbe;
}

.workspace-tab {
  display: flex;
  position: relative;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  min-height: 38px;
  padding: 6px 11px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 640;
  letter-spacing: 0;
  white-space: nowrap;
}

.workspace-tab svg {
  width: 16px;
  height: 16px;
  flex: none;
  color: var(--hydro-blue);
}

.workspace-tab:hover {
  background: var(--workspace-hover);
  filter: none;
}

.workspace-tab.active {
  background: var(--workspace-active);
  color: var(--workspace-active-text);
  filter: none;
}

.workspace-tab.active svg { color: currentColor; }
.workspace-tab:focus-visible { outline: 2px solid var(--hydro-blue); outline-offset: 1px; }
.workspace-tab-caption { display: inline-flex; align-items: center; gap: 5px; }

.workspace-tab-count {
  display: inline-grid;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--workspace-badge);
  color: var(--workspace-badge-text);
  font-size: 10px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  place-items: center;
}

@media (max-width: 359px) {
  .workspace-tabs .workspace-tab {
    min-width: 44px;
    padding-inline: 2px;
  }
}

.top-workspace-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.96fr) minmax(300px, 1fr) minmax(300px, 1fr);
  justify-content: start;
  align-items: stretch;
  gap: 12px;
  margin: 12px 0;
}

.top-workspace-grid .filters,
.top-workspace-grid .project-info-card {
  height: 100%;
}

.top-workspace-grid .filters {
  margin: 0;
}

.project-info-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.44fr) minmax(300px, 0.56fr);
  justify-content: start;
  align-items: start;
  gap: 12px;
  margin: 12px 0;
}

.project-info-card {
  min-width: 0;
  padding: 9px 11px;
  background: var(--panel-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.project-info-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.project-info-header span,
.project-info-list dt,
.pipe-info-item dt {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.project-info-header strong {
  display: block;
  overflow: hidden;
  color: var(--hydro-dark);
  font-size: 18px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-info-list,
.pipe-info-item dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.project-info-list div {
  display: grid;
  grid-template-columns: minmax(118px, 1fr) minmax(90px, auto);
  gap: 10px;
  align-items: baseline;
  padding: 4px 0;
  border-top: 1px solid rgba(222, 216, 207, 0.55);
}

.project-info-list div:first-child {
  border-top: 0;
}

.project-info-list dd,
.pipe-info-item dd {
  margin: 0;
  color: var(--hydro-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.project-info-list dd.parameter-statistics {
  white-space: pre-line;
  overflow-wrap: anywhere;
  font-size: 0.85rem;
  line-height: 1.5;
}

.project-overview-card .theme-row {
  grid-column: 1 / -1;
}

.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 6px;
}

.project-archive-button {
  width: 100%;
  min-height: 32px;
  margin: 0 0 6px;
  padding: 5px 9px;
  font-size: 12px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 7px;
  border: 1px solid rgba(0, 124, 137, 0.2);
  border-radius: 999px;
  background: rgba(0, 124, 137, 0.07);
  color: var(--hydro-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.status-chip.muted {
  border-color: rgba(82, 97, 102, 0.18);
  background: rgba(82, 97, 102, 0.07);
  color: var(--muted);
}

.status-chip.external {
  border-color: rgba(123, 44, 191, 0.22);
  background: rgba(123, 44, 191, 0.08);
}

.status-chip.weather {
  border-color: rgba(40, 111, 150, 0.24);
  background: rgba(40, 111, 150, 0.08);
}

.status-chip.error {
  border-color: rgba(180, 75, 75, 0.35);
  background: rgba(180, 75, 75, 0.1);
  color: #9b3030;
}

body.dark-mode .status-chip.error {
  color: #ffb4b4;
}

.loading-target {
  position: relative;
}

.loading-target.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.48), transparent);
  background-size: 220% 100%;
  animation: loading-sheen 1.1s linear infinite;
}

.loading-target.is-loading::after {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  top: 8px;
  z-index: 21;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(0, 124, 137, 0.12), rgba(0, 124, 137, 0.62), rgba(0, 124, 137, 0.12));
  background-size: 220% 100%;
  animation: loading-sheen 1.1s linear infinite;
}

body.dark-mode .loading-target.is-loading::before {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  background-size: 220% 100%;
}

@keyframes loading-sheen {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}

.theme-row {
  margin-top: 8px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: none;
}

.theme-toggle input {
  width: 15px;
  min-height: 15px;
  margin: 0;
  accent-color: var(--hydro-blue);
}

.pipe-info-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 10px;
}

.pipe-info-actions select {
  width: 100%;
}

.pipe-info-content {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  max-height: none;
  overflow: visible;
  padding-right: 2px;
}

.pipe-info-item {
  padding: 8px 10px;
  border: 1px solid rgba(222, 216, 207, 0.85);
  border-radius: 8px;
  background: var(--panel-soft);
}

.pipe-info-item h3 {
  margin: 0 0 6px;
  color: var(--hydro-dark);
  font-size: 17px;
}

.pipe-info-item dl {
  position: relative;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 12px;
}

.pipe-info-item dl::after {
  content: "";
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 50%;
  width: 1px;
  background: rgba(201, 193, 182, 0.55);
  pointer-events: none;
  transform: translateX(-0.5px);
}

body.dark-mode .pipe-info-item dl::after {
  background: rgba(74, 91, 94, 0.72);
}

.pipe-info-item dl div {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(68px, auto);
  gap: 6px;
  align-items: baseline;
  min-width: 0;
  padding: 2px 0;
  border-top: 1px solid rgba(222, 216, 207, 0.55);
}

.pipe-info-item dt {
  color: var(--muted);
}

.pipe-info-item dd {
  font-size: 13px;
}

.pipe-info-item dl div:first-child {
  border-top: 0;
}

.pipe-info-item dd {
  text-align: right;
}

.pipe-info-empty,
.pipe-info-more {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.summary > div {
  padding: 12px 14px;
}

.summary span {
  display: block;
  color: var(--hydro-dark);
  font-size: 22px;
  font-weight: 800;
}

.summary small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
}

.panel {
  display: flex;
  flex-direction: column;
  padding: 16px;
  min-width: 0;
}

.data-request-panel {
  margin: 16px 0;
}

.inline-form {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.request-fields {
  display: grid;
  grid-template-columns: minmax(140px, 0.9fr) minmax(180px, 1fr) minmax(140px, 0.8fr) minmax(120px, 0.7fr) minmax(110px, 0.6fr);
  gap: 14px;
  margin-bottom: 14px;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.form-status {
  color: var(--hydro-dark);
  font-size: 13px;
  font-weight: 700;
}

.request-queue {
  margin-top: 18px;
}

.request-queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.request-queue-header h3 {
  margin: 0;
  color: var(--hydro-dark);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.request-table-wrap {
  max-height: 260px;
}

.mail-import-panel {
  margin-top: 16px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.import-list-wrap,
.import-detail {
  min-width: 0;
}

.import-detail {
  padding-left: 18px;
  border-left: 1px solid var(--border);
}

.import-batches {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.import-pagination {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}

.import-pagination .status-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.import-batch {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  border-color: var(--border);
  background: var(--panel-soft);
  color: var(--text);
  text-align: left;
}

.import-batch strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: var(--hydro-dark);
  font-size: 13px;
}

.import-batch span {
  color: var(--muted);
  font-size: 12px;
}

.import-batch.active {
  border-color: var(--hydro-blue);
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.1);
}

.import-detail-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.import-detail-toolbar label {
  flex: 1;
}

.import-detail-summary {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.import-cleanup-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 6px;
}

.danger-button:not(:disabled) {
  border-color: #b44b4b;
  color: #9b3030;
}

.danger-button:not(:disabled):hover {
  background: rgba(180, 75, 75, 0.08);
}

.import-table-wrap {
  max-height: 430px;
}

.import-table-wrap table {
  min-width: 1080px;
  table-layout: auto;
}

.import-table-wrap th:nth-child(4),
.import-table-wrap td:nth-child(4) {
  white-space: nowrap;
}

.import-table-wrap th:nth-child(5),
.import-table-wrap td:nth-child(5) {
  min-width: 200px;
}

.import-table-wrap th:nth-child(3),
.import-table-wrap td:nth-child(3) {
  min-width: 110px;
}

.import-table-wrap th:nth-child(8),
.import-table-wrap td:nth-child(8) {
  min-width: 90px;
}

.import-table-wrap th:nth-child(9),
.import-table-wrap td:nth-child(9) {
  min-width: 180px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.import-table-wrap input,
.import-table-wrap select {
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  font-size: 12px;
}

.import-table-wrap .import-row-checkbox {
  display: block;
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0 auto;
  padding: 0;
}

.import-value-editor {
  display: grid;
  grid-template-columns: 3.5rem minmax(6rem, 1fr);
  gap: 4px;
  align-items: center;
}

.import-table-wrap th:nth-child(6),
.import-table-wrap td:nth-child(6) {
  width: 96px;
  min-width: 96px;
}

.import-table-wrap th:nth-child(7),
.import-table-wrap td:nth-child(7) {
  width: 180px;
}

.import-table-wrap .import-value-editor select,
.import-table-wrap .import-value-editor input {
  min-width: 0;
  width: 100%;
}

.import-id-warning { max-width: 300px; margin: 5px 0 0; font-size: 12px; color: #946019; overflow-wrap: anywhere; }
.dark-mode .import-id-warning { color: #edc575; }
.import-row-error {
  background: rgba(244, 197, 66, 0.11);
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.remove-request-button {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 13px;
}

.chart-panel {
  padding: 14px 12px 10px;
}

.map-panel {
  position: relative;
}

.map-frame {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-title h2 {
  margin: 0;
}

.panel-heading {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.panel-subtitle span {
  display: block;
}

.map-tools {
  display: grid;
  grid-template-columns: minmax(150px, 180px);
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
}

.map-tools select {
  width: 100%;
  min-width: 0;
}

.chart-tools {
  display: grid;
  grid-template-columns: minmax(170px, 210px) auto auto;
  align-items: center;
  justify-content: end;
  gap: 8px;
  min-width: 0;
}

.chart-tools select {
  min-width: 0;
}

.analysis-button {
  display: inline-grid;
  position: relative;
  width: 44px;
  min-width: 44px;
  padding-inline: 0;
  place-items: center;
  overflow: hidden;
  border-color: rgba(0, 124, 137, 0.65);
  background: #fff;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: 0;
  color: var(--hydro-dark);
}

.analysis-button:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 124, 137, 0.18);
}

.chart-view-status {
  margin: 6px 4px 0;
  padding: 7px 9px;
  border: 1px solid rgba(0, 124, 137, 0.16);
  border-radius: 6px;
  background: #f6fbfb;
  color: #405155;
  font-size: 12px;
  line-height: 1.35;
}

.view-state {
  margin: 0 4px 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.view-state.is-loading {
  border-color: rgba(0, 124, 137, 0.24);
  color: var(--hydro-dark);
}

.view-state.is-error {
  border-color: rgba(180, 75, 75, 0.4);
  background: rgba(180, 75, 75, 0.07);
  color: #9b3030;
}

body.dark-mode .view-state.is-error {
  color: #ffb4b4;
}

.table-icon-button {
  display: inline-grid;
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  place-items: center;
}

.table-icon-button .lucide {
  width: 15px;
  height: 15px;
}

.col-action {
  width: 12%;
}

.measurement-actions,
.correction-status {
  display: inline-flex;
  align-items: center;
}

.measurement-actions {
  gap: 7px;
}

.correction-status {
  min-height: 24px;
  gap: 4px;
  padding: 2px 7px;
  border: 1px solid rgba(0, 124, 137, 0.22);
  border-radius: 999px;
  background: rgba(0, 124, 137, 0.08);
  color: var(--hydro-dark);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.correction-status .lucide {
  width: 13px;
  height: 13px;
}

.correction-card {
  width: min(620px, calc(100vw - 28px));
}

.correction-card h2,
.correction-card h3 {
  margin: 0 0 10px;
  color: var(--hydro-dark);
}

.correction-card h3 {
  margin-top: 18px;
  font-size: 14px;
}

.correction-original {
  margin: 14px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
}

.correction-original div,
.operation-card dl div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.correction-original dt,
.operation-card dt {
  color: var(--muted);
}

.correction-original dd,
.operation-card dd {
  margin: 0;
  color: var(--hydro-dark);
  font-weight: 650;
  text-align: right;
}

.correction-value-fields {
  display: grid;
  grid-template-columns: minmax(130px, 0.35fr) minmax(180px, 1fr);
  gap: 10px;
}

.correction-history {
  display: grid;
  gap: 7px;
  max-height: 190px;
  overflow: auto;
}

.correction-history-item {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-left: 3px solid var(--hydro-blue);
  background: var(--panel-soft);
  font-size: 12px;
}

.correction-history-item span,
.correction-history-item small {
  color: var(--muted);
}

.correction-history-explanation { white-space: pre-wrap; overflow-wrap: anywhere; }

.correction-history-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.correction-history-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.correction-history-edit {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  gap: 5px;
  padding: 3px 8px;
  font-size: 11px;
}

.correction-history-edit .lucide {
  width: 13px;
  height: 13px;
}

.correction-history-undo {
  border-color: rgba(180, 75, 75, 0.45);
  color: #9b3030;
}

body.dark-mode .correction-history-undo {
  color: #ffb4b4;
}

.app-notice {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 8000;
  width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.app-notice.is-success {
  border-left: 4px solid #2e8540;
}

.app-notice.is-error {
  border-left: 4px solid #b44b4b;
}

.operations-panel {
  margin-top: 16px;
}

.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px 18px; border-bottom: 1px solid var(--border); margin: 16px 0 22px; }
.admin-history-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; max-width: 900px; padding: 0; background: none; border: 0; box-shadow: none; }
.admin-history-form label { display: block; margin-bottom: 6px; }
.admin-history-form > div:nth-child(3), .admin-history-actions { grid-column: 1 / -1; }
.admin-history-form input[type="file"] { width: 100%; min-width: 0; }
.admin-history-actions { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.admin-history-result { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border); max-width: 900px; }
.admin-history-result h3 { font-size: 17px; overflow-wrap: anywhere; }
.admin-history-result dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; font-size: 14px; }
.admin-history-result dt { color: var(--muted); }
.admin-history-result dd { margin: 4px 0 0; overflow-wrap: anywhere; font-weight: 600; }
.admin-history-form .admin-history-option { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; }
.admin-history-option input { width: 17px; height: 17px; flex: 0 0 17px; margin: 0; }
.admin-history-issues { margin-top: 20px; max-width: 1100px; min-width: 0; }
.admin-history-issues > p { color: var(--muted); font-size: 13px; }
.admin-history-issue-group { border-top: 1px solid var(--border); padding: 12px 0; }
.admin-history-issue-group summary { cursor: pointer; font-size: 14px; font-weight: 600; padding: 4px 0; }
.admin-history-issue-group summary span { margin-left: 8px; font-weight: 400; color: var(--muted); }
.admin-history-issue-group .admin-table-scroll { margin-top: 10px; max-height: 420px; overflow: auto; }
.admin-history-issue-group .admin-table { min-width: 620px; table-layout: fixed; }
.admin-history-issue-group th:first-child { width: 60px; }
.admin-history-issue-group th:nth-child(2) { width: 160px; }
.admin-history-issue-group th:nth-child(3) { width: 230px; }
.admin-history-issue-group .admin-table th:last-child, .admin-history-issue-group .admin-table td:last-child { width: auto; }
.admin-history-issue-group td { vertical-align: top; overflow-wrap: anywhere; font-size: 13px; }
.admin-history-issue-group td small { display: block; color: var(--muted); margin-top: 5px; }
.admin-history-issue-values { display: grid; gap: 4px; margin-top: 8px; }
@media (max-width: 600px) {
  .admin-history-issue-group .admin-table { min-width: 0; display: block; }
  .admin-history-issue-group thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .admin-history-issue-group tbody { display: block; }
  .admin-history-issue-group tr { display: grid; grid-template-columns: 50px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--border); }
  .admin-history-issue-group .admin-table td { display: block; min-width: 0; padding: 0; border: 0; }
  .admin-history-issue-group td:nth-child(3), .admin-history-issue-group td:nth-child(4) { grid-column: 1 / -1; }
  .admin-history-issue-group td::before { content: attr(data-label); display: block; margin-bottom: 5px; color: var(--muted); font-size: 11px; font-weight: 600; }
}
@media (max-width: 600px) { .admin-history-form, .admin-history-result dl { grid-template-columns: 1fr; } }
.admin-tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 10px 0; box-shadow: none; }
.admin-tabs button[aria-selected="true"] { color: var(--hydro-dark); border-bottom-color: var(--hydro-blue); font-weight: 700; }
.admin-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 36px; max-width: 950px; }
.admin-form { display: grid; align-content: start; gap: 9px; }
.admin-form, .admin-user-form { width: 100%; min-width: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.admin-form h3, .admin-list-header h3 { margin: 0 0 10px; font-size: 17px; }
.admin-form button { justify-self: start; margin-top: 7px; }
.admin-section-title { margin: 28px 0 12px; font-size: 17px; }
.admin-customer-row { display: grid; grid-template-columns: 220px 1fr; gap: 20px; padding: 15px 0; border-top: 1px solid var(--border); }
.admin-customer-row > div { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.admin-user-form { display: grid; grid-template-columns: 1.1fr 1.2fr 150px auto; gap: 14px; align-items: end; }
.admin-user-form label, .admin-credential-dialog label { display: block; margin-bottom: 6px; }
.admin-list-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 25px 0 14px; }
.admin-list-header label { display: flex; align-items: center; gap: 9px; }
.admin-table-scroll { overflow-x: auto; }
.admin-table { width: 100%; min-width: 1000px; border-collapse: collapse; table-layout: auto; font-size: 13px; }
.admin-table th { white-space: nowrap; }
.admin-sort-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; border: 0; border-radius: 0; background: transparent; color: inherit; font: inherit; font-weight: inherit; box-shadow: none; }
.admin-sort-button:hover { background: transparent; color: var(--hydro-blue); }
.admin-sort-button:focus-visible { outline: 2px solid var(--hydro-blue); outline-offset: 4px; }
.admin-sort-icon { display: inline-flex; width: 14px; height: 14px; }
.admin-sort-icon .lucide { width: 14px; height: 14px; }
.admin-table td { vertical-align: top; overflow-wrap: anywhere; white-space: normal; }
.admin-access-row { display: grid; grid-template-columns: minmax(90px, 1fr) 95px; gap: 8px; align-items: center; margin-bottom: 6px; min-width: 200px; }
.admin-access-row select { padding: 5px; min-height: 32px; font-size: 12px; }
.admin-icon { display: inline-flex; align-items: center; justify-content: center; padding: 6px; width: 32px; height: 32px; min-height: 32px; flex: 0 0 32px; }
.admin-icon .lucide { width: 17px; height: 17px; }
.admin-actions { display: flex; align-items: center; flex-wrap: nowrap; gap: 6px; }
.admin-table th:last-child, .admin-table td:last-child { width: 152px; }
.admin-access-menu { position: fixed; inset: auto; margin: 0; width: 280px; max-width: calc(100vw - 24px); max-height: calc(100vh - 24px); overflow-y: auto; padding: 12px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel); color: var(--text); box-shadow: 0 8px 24px rgba(0, 0, 0, .14); }
.admin-access-menu-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.admin-access-menu p { margin: 8px 0 12px; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.admin-access-choice { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 6px; background: transparent; color: var(--text); border: 0; border-top: 1px solid var(--border); border-radius: 0; text-align: left; font-size: 13px; }
.admin-access-choice:hover { background: var(--panel-soft); }
.admin-access-choice .lucide { width: 17px; height: 17px; flex: 0 0 17px; }
.admin-access-choice span { overflow-wrap: anywhere; min-width: 0; }
.admin-muted { color: var(--muted); font-size: 13px; }
.admin-backup-jobs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.admin-backup-job { min-width: 0; padding: 14px 0; border-top: 2px solid var(--border-strong); }
.admin-backup-job h4 { margin: 0; font-size: 16px; }
.admin-backup-job p { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.admin-backup-job dl, .admin-backup-locations dl { display: grid; gap: 10px; font-size: 13px; }
.admin-backup-job dl > div { display: grid; gap: 4px; }
.admin-backup-job dd, .admin-backup-locations dd { margin: 0; overflow-wrap: anywhere; }
.admin-backup-job dt, .admin-backup-locations dt { color: var(--muted); }
.admin-backup-locations { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 8px; }
.admin-backup-locations dl > div { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; }
.admin-risk { border-left: 3px solid #b44b4b; padding-left: 10px; font-size: 13px; }
.admin-audit-log { max-height: 255px; overflow-y: auto; font-size: 12px; }
.admin-audit-log > div { display: grid; grid-template-columns: 175px 220px minmax(0, 1fr); gap: 14px; padding: 9px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.admin-drift-project { display: flex; align-items: center; gap: 12px; max-width: 480px; margin-bottom: 15px; }
.admin-credential-dialog { width: 520px; max-width: calc(100vw - 28px); border: 1px solid var(--border); border-radius: 7px; padding: 24px; background: var(--panel); color: var(--text); }
.admin-credential-dialog::backdrop { background: rgba(0, 0, 0, .4); }
.admin-credential-dialog .admin-list-header { margin-top: 0; }
.admin-credential-dialog h2 { font-size: 20px; margin: 0; }
.admin-credential-dialog p { font-size: 13px; overflow-wrap: anywhere; }
.admin-credential-dialog label { margin-top: 12px; }
#adminEraseForm { width: 100%; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }
#adminEraseDialog { max-height: calc(100dvh - 28px); overflow-y: auto; }
#adminEraseDialog .admin-list-header { flex-wrap: nowrap; align-items: flex-start; }
.admin-credential-value { display: flex; align-items: center; gap: 7px; }
.admin-credential-value input { min-width: 0; }

@media (max-width: 1080px) {
  .admin-user-form { grid-template-columns: 1fr 1fr; }
  .admin-backup-jobs { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .admin-tabs { gap: 14px; }
  .admin-tabs button { font-size: 13px; }
  .admin-form-grid, .admin-user-form { grid-template-columns: 1fr; gap: 20px; }
  .admin-list-header { flex-wrap: wrap; }
  .admin-customer-row, .admin-backup-locations dl > div { grid-template-columns: 1fr; gap: 6px; }
  .admin-table { min-width: 1000px; }
  .admin-audit-log > div { grid-template-columns: 1fr; gap: 3px; }
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.icon-text-button .lucide {
  width: 16px;
  height: 16px;
}

.operations-project-summary,
.operations-cards {
  display: grid;
  gap: 10px;
}

.operations-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 10px;
}

.operation-card {
  min-width: 0;
  padding: 12px 13px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-soft);
}

.operation-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.operation-card dl {
  display: grid;
  gap: 5px;
  margin: 8px 0 0;
  font-size: 12px;
}

.operation-card p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.operation-kicker {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 11px;
}

.operation-badge {
  flex: 0 0 auto;
  padding: 3px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.operation-badge.is-success {
  border-color: rgba(46, 133, 64, 0.32);
  background: rgba(46, 133, 64, 0.08);
  color: #246b34;
}

.operation-badge.is-failed,
.operation-badge.is-stale {
  border-color: rgba(180, 75, 75, 0.35);
  background: rgba(180, 75, 75, 0.08);
  color: #9b3030;
}

.operations-issues {
  margin-top: 14px;
}

.operations-issues h3 {
  margin: 0 0 7px;
  color: var(--hydro-dark);
  font-size: 14px;
}

.operation-issue,
.operation-all-clear {
  margin: 5px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--border-strong);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.operation-issue.is-failed,
.operation-issue.is-stale {
  border-left-color: #b44b4b;
}

.operation-all-clear {
  border-left-color: #2e8540;
}

body.dark-mode .operation-badge.is-success {
  color: #a8e3b3;
}

body.dark-mode .operation-badge.is-failed,
body.dark-mode .operation-badge.is-stale {
  color: #ffb4b4;
}

@media (max-width: 1080px) {
  .operations-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .operations-cards,
  .correction-value-fields {
    grid-template-columns: 1fr;
  }

  .app-notice {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 7000;
  display: grid;
  place-items: center;
  padding: 18px;
  margin: 0;
  box-sizing: border-box;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.modal:not([open]) { display: none; }
.modal::backdrop { background: transparent; }
body:has(dialog[open]) { overflow: hidden; }
dialog :focus-visible { outline: 2px solid var(--hydro-blue); outline-offset: 3px; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 35, 40, 0.34);
  backdrop-filter: blur(3px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100vw - 28px));
  max-height: min(780px, calc(100vh - 36px));
  overflow: auto;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 35, 40, 0.28);
  color: var(--text);
  font-size: 14px;
  box-sizing: border-box;
  max-width: 100%;
}

body.dark-mode .modal-card {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.55);
}

.modal-close {
  position: sticky;
  top: 0;
  float: right;
  width: 34px;
  height: 34px;
  min-height: 34px;
  margin: -8px -8px 4px 12px;
  padding: 0;
  border-color: var(--border);
  border-radius: 50%;
  background: #fff;
  color: var(--hydro-dark);
  font-size: 22px;
  line-height: 1;
}

body.dark-mode .modal-close,
body.dark-mode .analysis-export-button {
  background: #111b1d;
  color: var(--hydro-dark);
}

.analysis-modal-card {
  line-height: 1.45;
}

.analysis-scope-card {
  display: grid;
  gap: 12px;
  width: min(520px, calc(100vw - 28px));
}

.analysis-scope-card h3 {
  margin: 0;
  color: var(--hydro-dark);
  text-transform: uppercase;
}

.analysis-scope-card p {
  margin: 0;
  color: #405155;
  line-height: 1.45;
}

.analysis-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.analysis-title-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.analysis-export-button {
  display: inline-grid;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  place-items: center;
  border-color: var(--hydro-blue);
  border-radius: 6px;
  background: #fff;
  color: var(--hydro-dark);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.analysis-modal-card h3,
.analysis-modal-card h4 {
  margin: 0 0 6px;
  color: var(--hydro-dark);
  text-transform: uppercase;
}

.analysis-modal-card h4 {
  margin-top: 10px;
  font-size: 12px;
}

.analysis-note {
  margin: 8px 0 10px;
  color: #405155;
}

.analysis-modal-card ul {
  margin: 0;
  padding-left: 18px;
}

.analysis-modal-card li {
  margin: 4px 0;
}

.analysis-disclaimer {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(0, 124, 137, 0.2);
  border-radius: 8px;
  background: #f6fbfb;
  color: #405155;
  font-size: 13px;
}

.analysis-disclaimer strong {
  display: block;
  margin-bottom: 4px;
  color: var(--hydro-dark);
}

.analysis-disclaimer p {
  margin: 0;
  line-height: 1.45;
}

.export-modal-card {
  display: grid;
  gap: 12px;
  width: min(430px, calc(100vw - 28px));
}

.password-change-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  width: min(430px, calc(100vw - 28px));
}

.password-change-card h3,
.password-change-card p {
  margin: 0;
}

.password-change-card h3,
.password-change-card label {
  color: var(--hydro-dark);
  font-weight: 800;
}

.password-change-card h3 {
  text-transform: uppercase;
}

.password-change-card small {
  margin-top: -5px;
  color: var(--muted);
}

.password-change-card .error {
  min-height: 18px;
}

.export-modal-card h3 {
  margin: 0 0 2px;
  color: var(--hydro-dark);
  text-transform: uppercase;
}

.export-modal-card label,
.export-modal-card legend {
  color: var(--hydro-dark);
  font-size: 13px;
  font-weight: 800;
}

.export-modal-card fieldset {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.export-modal-card legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

body.dark-mode .radio-option {
  background: #111b1d;
  border-color: var(--border);
  color: var(--text);
}

.radio-option input {
  width: auto;
  margin: 0;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

dialog .modal-actions button {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

body.map-expanded {
  overflow: hidden;
}

.map-panel-expanded {
  position: fixed;
  inset: 76px 18px 18px;
  z-index: 2000;
  padding: 16px;
  background: var(--panel);
  box-shadow: 0 28px 80px rgba(0, 35, 40, 0.32);
}

.map-panel-expanded #map {
  height: calc(100vh - 172px);
  flex-basis: calc(100vh - 172px);
}

.map-panel-expanded .map-frame {
  flex: 1 1 auto;
}

.table-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

button:disabled {
  cursor: default;
  opacity: 0.45;
}

#map,
#chart {
  width: 100%;
  height: clamp(520px, 36vw, 590px);
  flex: 1 1 clamp(520px, 36vw, 590px);
}

#chart {
  height: clamp(520px, 36vw, 590px);
  flex-basis: clamp(520px, 36vw, 590px);
}

#map {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.map-control-strip {
  position: absolute;
  top: 152px;
  left: 12px;
  z-index: 600;
  display: flex;
  flex-direction: column;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  background: #fff;
  background-clip: padding-box;
}

.map-icon-button {
  display: inline-grid;
  position: relative;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  place-items: center;
  border: 0;
  border-bottom: 1px solid #ccc;
  border-radius: 0;
  background: #fff;
  color: #111;
  font: 700 18px/1 Arial, Helvetica, sans-serif;
  line-height: 1;
}

.map-icon-button .lucide {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.map-icon-button::after {
  content: attr(data-tooltip);
  position: absolute;
  top: 50%;
  left: calc(100% + 9px);
  z-index: 3;
  padding: 5px 7px;
  border-radius: 5px;
  background: rgba(18, 28, 31, 0.94);
  color: #fff;
  font: 600 11px/1.2 "DM Sans", system-ui, sans-serif;
  opacity: 0;
  pointer-events: none;
  transform: translate(-3px, -50%);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.map-icon-button:hover::after,
.map-icon-button:focus-visible::after {
  opacity: 1;
  transform: translate(0, -50%);
}

.map-icon-button:last-of-type {
  border-bottom: 0;
}

.map-icon-button:hover,
.map-icon-button.active {
  background: #f4f4f4;
}

.leaflet-draw-toolbar.leaflet-bar a {
  display: grid;
  width: 30px;
  height: 30px;
  background-image: none;
  color: #111;
  place-items: center;
}

.leaflet-draw-toolbar.leaflet-bar a .lucide {
  width: 16px;
  height: 16px;
  stroke: currentColor;
}

.map-layer-menu {
  position: absolute;
  top: 31px;
  left: 36px;
  display: grid;
  min-width: 190px;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(0, 60, 70, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 34px rgba(0, 35, 40, 0.18);
}

.map-layer-heading {
  padding: 4px 7px 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-layer-menu button {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--hydro-dark);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
}

.map-layer-menu button::before {
  content: "";
  display: inline-grid;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.map-layer-menu button.active::before {
  content: "✓";
  border-color: var(--hydro-blue);
  background: rgba(0, 124, 137, 0.09);
}

.map-layer-menu button:hover,
.map-layer-menu button.active {
  background: var(--panel-soft);
}

#chart {
  border: 0;
  border-radius: 0;
  overflow: visible;
}

#chart .js-plotly-plot,
#chart .plot-container {
  width: 100%;
}

.mobile-chart-legend {
  display: none;
}

.mobile-chart-legend.is-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 8px;
  flex: 0 0 auto;
  max-height: 150px;
  overflow-y: auto;
  margin: 5px 4px 0;
  padding: 7px 2px 3px;
  border-top: 1px solid var(--border);
  scrollbar-width: thin;
}

.chart-legend-group { min-width: 0; }
.chart-legend-group-title {
  margin: 0 4px 4px;
  color: var(--hydro-dark);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.chart-legend-items { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 100px), 1fr)); gap: 2px 4px; }

.chart-legend-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  min-height: 28px;
  padding: 4px 5px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  font-size: 11px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  white-space: normal;
}

.chart-legend-item:hover, .chart-legend-item:focus-visible { background: var(--panel-soft); }
.chart-legend-item.is-muted { opacity: 0.45; }
.chart-legend-name { min-width: 0; overflow-wrap: anywhere; }
.chart-legend-swatch { flex: 0 0 20px; margin-top: 6px; border-top: 3px solid var(--series-color); }
.chart-legend-swatch.is-manual { flex-basis: 9px; height: 9px; margin: 2px 5px 0; border: 2px solid var(--series-color); border-radius: 50%; }

.leaflet-container {
  font-family: "DM Sans", system-ui, sans-serif;
}

.map-status {
  position: absolute;
  left: 28px;
  bottom: 24px;
  z-index: 500;
  max-width: calc(100% - 56px);
  margin: 0;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 60, 70, 0.12);
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
}

.map-status:empty {
  display: none;
}

.user-location-icon {
  position: relative;
  width: 34px;
  height: 34px;
}

.user-location-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: #2f80ed;
  box-shadow: 0 2px 10px rgba(0, 50, 120, 0.34);
  transform: translate(-50%, -50%);
}

.user-location-heading {
  position: absolute;
  left: 50%;
  top: 2px;
  width: 0;
  height: 0;
  border-right: 7px solid transparent;
  border-bottom: 19px solid rgba(47, 128, 237, 0.62);
  border-left: 7px solid transparent;
  transform-origin: 50% 15px;
  translate: -50% 0;
  filter: drop-shadow(0 1px 2px rgba(0, 50, 120, 0.28));
}

.user-location-heading.hidden {
  display: none;
}

.point-label {
  display: inline-block;
  box-sizing: border-box;
  width: max-content !important;
  height: auto !important;
  min-width: 40px;
  max-width: 96px;
  min-height: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 60, 70, 0.24);
  border-radius: 6px;
  color: var(--hydro-dark);
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  overflow: hidden;
  padding: 3px 7px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 30, 35, 0.12);
}

.sgu-point-label {
  display: inline-block;
  box-sizing: border-box;
  width: max-content !important;
  height: auto !important;
  min-width: 48px;
  max-width: 116px;
  min-height: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(123, 44, 191, 0.35);
  border-radius: 6px;
  color: #53208d;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  overflow: hidden;
  padding: 3px 7px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 30, 35, 0.12);
}

.sgu-marker {
  width: 20px !important;
  height: 20px !important;
  margin: 0 !important;
  border: 0;
  background: transparent;
}

.sgu-marker span {
  display: block;
  width: 14px;
  height: 14px;
  margin: 3px;
  transform: rotate(45deg);
  border: 2px solid #53208d;
  border-radius: 3px;
  background: #ffffff;
  box-shadow: 0 2px 10px rgba(0, 30, 35, 0.18);
}

.sgu-marker-selected span {
  background: #7b2cbf;
  border-color: #ffffff;
  outline: 2px solid #53208d;
}

.smhi-marker {
  width: 22px !important;
  height: 22px !important;
  margin: 0 !important;
  border: 0;
  background: transparent;
}

.smhi-marker span {
  display: block;
  width: 16px;
  height: 16px;
  margin: 3px;
  border: 2px solid #ffffff;
  border-radius: 50% 50% 50% 0;
  background: #286f96;
  transform: rotate(-45deg);
  box-shadow: 0 2px 10px rgba(0, 30, 35, 0.18);
}

.smhi-point-label {
  display: inline-block;
  box-sizing: border-box;
  width: max-content !important;
  height: auto !important;
  min-width: 52px;
  max-width: 132px;
  min-height: 22px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(40, 111, 150, 0.35);
  border-radius: 6px;
  color: #17546f;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  overflow: hidden;
  padding: 3px 7px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 30, 35, 0.12);
}

.map-popup {
  display: grid;
  gap: 4px;
  min-width: 160px;
  color: var(--text);
}

.map-popup strong {
  color: var(--hydro-dark);
  font-size: 14px;
}

.map-popup span {
  font-size: 13px;
}

.map-popup small {
  color: var(--muted);
  font-size: 11px;
}

.table-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.col-ror {
  width: 8%;
}

.col-date {
  width: 21%;
}

.col-parameter {
  width: 23%;
}

.col-value {
  width: 12%;
}

.col-unit {
  width: 9%;
}

.col-qa {
  width: 15%;
}

.empty-table-row td {
  padding: 22px 14px;
  color: var(--muted);
  text-align: center;
  white-space: normal;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: var(--panel-soft);
  color: var(--hydro-dark);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sort-button {
  min-height: 0;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  font-size: inherit;
  font-weight: 800;
  letter-spacing: inherit;
  text-transform: inherit;
}

.sort-button:hover,
.sort-button.active {
  filter: none;
  color: var(--hydro-blue);
}

@media (max-width: 1400px) {
  .topbar {
    min-height: 96px;
    padding-inline: clamp(18px, 3vw, 42px);
  }

  .header-logo-left {
    padding-left: clamp(0px, 1vw, 16px);
  }

  .header-logo-right {
    padding-right: clamp(78px, 7vw, 104px);
  }

  .header-logo-left img {
    max-height: 56px;
    max-width: 230px;
  }

  .header-logo-right img {
    max-height: 60px;
    max-width: 210px;
  }
}

@media (max-width: 1220px) {
  .topbar {
    grid-template-columns: minmax(150px, 1fr) minmax(230px, auto) minmax(150px, 1fr);
  }

  .header-logo-left img {
    max-height: 48px;
    max-width: 190px;
  }

  .header-logo-right img {
    max-height: 52px;
    max-width: 175px;
  }

  .header-title {
    padding: 7px 14px;
    font-size: 22px;
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr auto 1fr;
    gap: 10px;
    padding: 12px 18px;
  }

  .header-logo,
  .header-logo-left,
  .header-logo-right {
    padding-left: 0;
    padding-right: 0;
  }

  .header-logo-left {
    justify-content: flex-start;
  }

  .header-logo-right {
    justify-content: flex-end;
  }

  .header-title {
    font-size: 20px;
    white-space: normal;
  }

  .header-logo-left img,
  .header-logo-right img {
    max-width: min(260px, 78vw);
  }

  .logout-button {
    top: auto;
    right: 12px;
    bottom: 6px;
  }

  .top-workspace-grid,
  .filters,
  .filter-body,
  .filter-fields,
    .request-fields,
    .grid,
    .project-info-grid,
    .summary,
    .table-controls {
      grid-template-columns: 1fr;
  }

  .filter-actions {
    justify-content: flex-start;
  }

  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .import-layout {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .import-detail {
    padding-top: 14px;
    padding-left: 0;
    border-top: 1px solid var(--border);
    border-left: 0;
  }

  .import-detail-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-header {
    align-items: baseline;
    flex-direction: row;
  }

  .map-tools {
    display: grid;
    grid-template-columns: minmax(145px, 1fr);
    align-items: center;
    width: 100%;
  }

  .map-tools select {
    width: 100%;
    min-width: 0;
  }

  .request-queue-header {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  main {
    width: min(100%, calc(100vw - 18px));
    margin: 10px auto 22px;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "left right"
      "title title"
      "logout logout";
    gap: 10px 14px;
    min-height: 0;
    padding: 11px 12px 16px;
  }

  .header-logo-left {
    grid-area: left;
  }

  .header-logo-right {
    grid-area: right;
  }

  .header-logo-left img {
    max-height: 30px;
    max-width: min(160px, 42vw);
  }

  .header-logo-right img {
    max-height: 32px;
    max-width: min(150px, 40vw);
  }

  .header-title {
    grid-area: title;
    justify-self: center;
    padding: 7px 13px;
    font-size: 18px;
    line-height: 1.2;
  }

  .logout-button {
    grid-area: logout;
    justify-self: center;
    position: static;
    min-height: 30px;
    padding: 5px 10px;
    font-size: 12px;
  }

  .site-footer {
    align-items: center;
    flex-direction: column;
    gap: 8px;
    width: min(100%, calc(100vw - 18px));
    margin-bottom: 18px;
    padding-top: 14px;
    font-size: 12px;
    text-align: center;
  }

  .site-footer div {
    justify-content: center;
    gap: 8px 12px;
  }

  .summary {
    gap: 8px;
  }

  .top-workspace-grid,
  .project-info-grid {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 8px;
  }

  .top-workspace-grid .filters,
  .top-workspace-grid .project-info-card {
    height: auto;
  }

  .summary > div,
  .project-info-card,
  .panel,
  .filters {
    padding: 10px;
  }

  .project-info-header strong {
    font-size: 17px;
  }

  .project-info-list div {
    grid-template-columns: minmax(88px, 0.7fr) minmax(0, 1fr);
    gap: 6px;
  }

  .project-overview-card .project-info-list div {
    grid-template-columns: minmax(88px, 0.7fr) minmax(0, 1fr);
    gap: 6px;
    min-height: 0;
  }

  .project-overview-card .project-info-list dd {
    overflow-wrap: anywhere;
    text-align: right;
  }

  .status-chips {
    gap: 4px;
  }

  .status-chip {
    min-height: 20px;
    padding: 3px 6px;
    font-size: 10px;
  }

  .filter-fields,
  .date-shortcuts {
    grid-template-columns: 1fr;
  }

  .pipe-info-content {
    max-height: none;
    overflow: visible;
  }

  .pipe-info-actions {
    grid-template-columns: 1fr;
  }

  .summary span {
    font-size: 20px;
  }

  .map-tools {
    grid-template-columns: minmax(132px, 1fr);
    gap: 6px;
  }

  .chart-tools {
    width: 100%;
    grid-template-columns: 1fr 1fr;
  }

  .chart-tools select {
    grid-column: 1 / -1;
  }

  .map-tools select {
    min-height: 36px;
    padding: 7px 8px;
    font-size: 12px;
  }

  #map,
  #chart {
    height: 360px;
    flex-basis: 360px;
  }

  #chart {
    height: 340px;
    flex-basis: 340px;
  }

  .mobile-chart-legend {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding: 8px 4px 2px;
    color: var(--hydro-dark);
    scrollbar-width: thin;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-legend-item {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 5px;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #fff;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
  }

  .mobile-legend-swatch {
    width: 18px;
    height: 3px;
    border-radius: 999px;
  }

  .mobile-legend-swatch.manual {
    width: 9px;
    height: 9px;
    border-radius: 50%;
  }

  #expandMapButton {
    display: none;
  }

  .map-control-strip {
    top: 146px;
    left: 9px;
  }

  .map-layer-menu {
    top: 31px;
    left: 36px;
    min-width: 174px;
  }

  .map-icon-button {
    width: 31px;
    height: 31px;
    min-height: 31px;
    font-size: 15px;
  }

  .chart-panel {
    padding-left: 6px;
    padding-right: 6px;
  }

  .table-controls {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
    gap: 6px;
  }

  #tablePageInfo {
    grid-column: 1 / -1;
    margin-right: 0;
  }

  .table-controls .secondary {
    width: 100%;
    min-height: 36px;
    padding: 7px 12px;
  }

  .table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
  }

  th,
  td {
    padding: 9px 10px;
  }

  #exportCsvButton {
    grid-column: 1;
  }

  #exportShapeButton {
    grid-column: 2;
  }

  #prevPageButton,
  #nextPageButton {
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 34px;
    padding: 4px 0;
    border-color: var(--hydro-blue);
    border-radius: 6px;
    color: var(--hydro-dark);
    background: #fff;
    overflow: hidden;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
  }

  #prevPageButton {
    grid-column: 1;
  }

  #nextPageButton {
    grid-column: 2;
  }

  .compact-page-button {
    border-radius: 6px;
  }

  .compact-page-button::before {
    content: none;
    color: var(--hydro-dark);
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
  }

  #prevPageButton.compact-page-button::before {
    content: "\2190";
  }

  #nextPageButton.compact-page-button::before {
    content: "\2192";
  }

  #chart {
    min-width: 0;
  }

  .table-wrap {
    max-height: 430px;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
  }

  table {
    display: table;
    min-width: 680px;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 12px;
  }

  colgroup {
    display: table-column-group;
  }

  thead {
    display: table-header-group;
  }

  tbody {
    display: table-row-group;
  }

  tbody tr {
    display: table-row;
    background: transparent;
  }

  th,
  td {
    display: table-cell;
    padding: 7px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  th {
    font-size: 10px;
  }

  td::before {
    content: none;
  }

  .col-ror {
    width: 9%;
  }

  .col-date {
    width: 20%;
  }

  .col-parameter {
    width: 20%;
  }

  .col-value {
    width: 11%;
  }

  .col-unit {
    width: 7%;
  }

  .col-qa {
    width: 17%;
  }

  .col-action {
    width: 16%;
  }

  .qa-cell {
    justify-content: flex-start;
  }

  .correction-status .lucide {
    display: none;
  }
}

/* Visual refresh: calm typography, lighter surfaces and clearer hierarchy. */
:root {
  --hydro-dark: #073f47;
  --hydro-blue: #087f8c;
  --bg: #f4f6f5;
  --panel: #ffffff;
  --panel-soft: #fbfcfb;
  --border: #dce3df;
  --border-strong: #bcc9c4;
  --text: #17201f;
  --muted: #65706d;
  --shadow: 0 4px 16px rgba(10, 48, 49, 0.055);
}

body.dark-mode {
  --hydro-dark: #d9f7f8;
  --hydro-blue: #42bdc9;
  --bg: #101718;
  --panel: #172021;
  --panel-soft: #1a2425;
  --border: #344243;
  --border-strong: #536365;
  --text: #f0f5f4;
  --muted: #aeb9b7;
  --shadow: 0 5px 18px rgba(0, 0, 0, 0.2);
}

body {
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 15px;
  font-feature-settings: normal;
  letter-spacing: 0;
  line-height: 1.45;
}

.topbar {
  grid-template-columns: minmax(190px, 1fr) auto minmax(240px, 1fr);
  min-height: 82px;
  padding: 10px clamp(20px, 3.5vw, 64px);
  background: rgba(244, 246, 245, 0.95);
  box-shadow: 0 1px 10px rgba(10, 48, 49, 0.035);
}

body.dark-mode .topbar {
  background: rgba(16, 23, 24, 0.95);
}

.header-logo-left,
.header-logo-right {
  padding: 0;
}

.header-logo-left img {
  max-height: 50px;
  max-width: min(240px, 100%);
}

.header-logo-right img {
  max-height: 52px;
  max-width: min(210px, 100%);
}

.header-title {
  font-size: clamp(24px, 2vw, 30px);
  font-weight: 590;
  letter-spacing: 0;
  line-height: 1.1;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.header-actions .header-logo-right {
  min-width: 0;
}

.logout-button {
  position: static;
  flex: 0 0 auto;
  min-height: 34px;
  padding: 6px 11px;
  font-size: 12.5px;
}

main {
  width: min(1580px, calc(100vw - 36px));
  margin: 18px auto 38px;
}

.site-footer {
  width: min(1580px, calc(100vw - 36px));
  color: var(--muted);
  font-size: 13px;
}

.site-footer a,
.footer-brand {
  font-weight: 620;
}

form,
.filters,
.panel,
.summary > div,
.project-info-card {
  border-color: var(--border);
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.login-panel {
  background: var(--bg);
}

.login-card {
  padding: 36px;
}

.login-title {
  color: var(--muted);
  font-size: 15px;
  font-weight: 570;
  letter-spacing: 0;
  text-transform: none;
}

h1,
h2 {
  font-weight: 620;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  text-transform: none;
}

label,
.filters label,
.project-info-header span,
.project-info-list dt,
.pipe-info-item dt,
.summary small,
.map-layer-heading,
th {
  font-weight: 620;
  letter-spacing: 0;
}

label,
.filters label {
  font-size: 11.5px;
  text-transform: none;
}

input,
select,
button {
  min-height: 38px;
  border-radius: 7px;
}

input,
select,
textarea,
.picker-button {
  background: var(--panel);
}

button {
  padding: 7px 13px;
  font-size: 13.5px;
  font-weight: 640;
  transition: border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

button:hover {
  filter: none;
}

button.secondary:hover,
button.ghost:hover {
  border-color: var(--hydro-dark);
  background: var(--panel-soft);
}

.top-workspace-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(300px, 0.9fr) minmax(390px, 1.2fr);
  gap: 10px;
  margin: 10px 0 12px;
}

.filters,
.project-info-card {
  padding: 12px 13px;
  background: var(--panel);
}

.filter-header {
  min-height: 28px;
}

.filter-body {
  gap: 7px;
}

.filter-fields {
  gap: 7px 8px;
}

.filters input:not([type="checkbox"]),
.filters select,
.filters .picker-button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 13.5px;
}

.date-shortcuts {
  gap: 5px;
}

.date-shortcuts button {
  min-height: 31px;
  padding: 5px 7px;
  font-size: 12px;
}

.filter-options {
  gap: 4px;
}

.filter-option {
  min-height: 29px;
  padding: 4px 8px;
  border-color: var(--border);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 610;
}

.filter-option input {
  width: 14px;
  min-height: 14px;
}

.project-info-header {
  min-height: 26px;
  margin-bottom: 7px;
}

.project-info-header span,
.project-info-list dt,
.pipe-info-item dt {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: none;
}

.project-info-header strong {
  font-size: 20px;
  font-weight: 620;
}

.project-info-list div {
  min-height: 27px;
  padding: 4px 0;
  border-color: rgba(220, 227, 223, 0.72);
}

.pipe-info-item dl div {
  min-height: 24px;
  padding: 2px 0;
  border-color: rgba(220, 227, 223, 0.72);
}

.pipe-info-item dt {
  font-size: 10.5px;
}

.pipe-info-item dd {
  font-size: 12.5px;
}

.project-info-list dd,
.pipe-info-item dd {
  font-size: 13.5px;
  font-weight: 590;
}

.pipe-info-item {
  border-color: var(--border);
  background: var(--panel-soft);
}

.pipe-info-item h3 {
  font-size: 18px;
  font-weight: 620;
}

.status-chips {
  margin-bottom: 7px;
}

.status-chip {
  min-height: 22px;
  font-weight: 590;
}

.project-archive-button {
  width: auto;
  min-height: 31px;
  margin-bottom: 7px;
  font-size: 12px;
}

.theme-toggle,
.qa-toggle,
.filter-option,
.point-option-all {
  font-weight: 610;
}

.grid {
  gap: 12px;
}

.panel {
  padding: 14px;
}

.chart-panel {
  padding: 14px 12px 11px;
}

.panel-title {
  min-height: 40px;
  margin-bottom: 8px;
}

.chart-tools {
  gap: 7px;
}

.analysis-button {
  font-weight: 640;
}

#map,
#chart {
  height: clamp(540px, 38vw, 620px);
  flex-basis: clamp(540px, 38vw, 620px);
}

#map {
  border-radius: 6px;
}

.leaflet-container {
  font-family: "DM Sans", system-ui, sans-serif;
}

.chart-view-status {
  border-color: var(--border);
  background: var(--panel-soft);
}

.table-wrap {
  border-color: var(--border);
  border-radius: 7px;
}

th {
  font-size: 11px;
  text-transform: none;
}

td {
  font-size: 13.5px;
}

.modal-card {
  border-radius: 7px;
  box-shadow: 0 18px 48px rgba(7, 40, 43, 0.16);
}

@media (max-width: 1220px) {
  .topbar {
    grid-template-columns: minmax(150px, 1fr) auto minmax(190px, 1fr);
    min-height: 76px;
    padding: 9px 18px;
  }

  .header-logo-left img {
    max-height: 43px;
    max-width: 190px;
  }

  .header-logo-right img {
    max-height: 44px;
    max-width: 165px;
  }

  .header-title {
    padding: 0;
    font-size: 23px;
  }

  .header-actions {
    gap: 9px;
  }
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: minmax(140px, 1fr) auto minmax(170px, 1fr);
  }

  .top-workspace-grid,
  .grid {
    grid-template-columns: 1fr;
  }

  .top-workspace-grid .filters,
  .top-workspace-grid .project-info-card {
    height: auto;
  }

  .panel-title {
    align-items: center;
    flex-direction: row;
  }
}

@media (max-width: 720px) {
  main {
    width: min(100%, calc(100vw - 16px));
    margin: 8px auto 24px;
  }

  .topbar {
    position: static;
    grid-template-columns: minmax(90px, 1fr) auto;
    grid-template-areas:
      "left actions"
      "title title";
    gap: 3px 8px;
    min-height: 68px;
    padding: 7px 10px 9px;
  }

  .header-logo-left {
    grid-area: left;
  }

  .header-logo-left img {
    max-height: 28px;
    max-width: min(118px, 29vw);
  }

  .header-title {
    grid-area: title;
    padding: 0;
    font-size: 16px;
    line-height: 1.1;
    white-space: nowrap;
  }

  .header-actions {
    grid-area: actions;
    gap: 5px;
  }

  .header-logo-right img {
    max-height: 25px;
    max-width: min(74px, 20vw);
  }

  .logout-button {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 11px;
  }

  .workspace-tabs {
    width: 100%;
    gap: 3px;
  }

  .workspace-tab {
    flex: 1 0 auto;
    flex-direction: column;
    gap: 4px;
    min-width: 60px;
    min-height: 48px;
    padding: 4px 5px;
    font-size: 11px;
    line-height: 1.2;
  }

  .workspace-tab-count {
    min-width: 13px;
    height: 13px;
    padding: 0 3px;
    font-size: 9px;
  }

  .top-workspace-grid {
    gap: 8px;
  }

  .filter-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-point {
    grid-column: 1 / -1;
  }

  .date-shortcuts {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .date-shortcuts button {
    font-size: 10.5px;
  }

  .summary > div,
  .project-info-card,
  .panel,
  .filters {
    padding: 10px;
  }

  h2 {
    font-size: 17px;
  }

  .project-info-header strong {
    font-size: 18px;
  }

  .project-info-list div,
  .pipe-info-item dl div {
    min-height: 25px;
  }

  .filter-options {
    gap: 3px;
  }

  .filter-option {
    min-height: 28px;
    padding: 3px 7px;
  }

  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  #dataPanel .panel-title,
  #dataPanel .panel-heading,
  #dataPanel .table-controls {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  #dataPanel .table-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dataPanel .table-controls .secondary {
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    overflow-wrap: anywhere;
    line-height: 1.2;
    white-space: normal;
  }

  #map,
  #chart {
    height: 370px;
    flex-basis: 370px;
  }

  #chart {
    height: 350px;
    flex-basis: 350px;
  }

  .chart-panel {
    padding-right: 7px;
    padding-left: 7px;
  }

  .site-footer {
    width: min(100%, calc(100vw - 16px));
  }

  .pipe-info-item dl {
    grid-template-columns: 1fr;
  }

  .pipe-info-item dl::after,
  .map-icon-button::after {
    display: none;
  }
}

@media (max-width: 430px) {
  .topbar {
    grid-template-columns: minmax(80px, 1fr) auto;
  }

  .header-logo-left img {
    max-width: 92px;
  }

  .header-logo-right img {
    max-width: 58px;
  }

  .header-title {
    font-size: 16px;
  }

  .logout-button {
    padding-inline: 6px;
  }
}
.manual-import-form {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(240px, 380px) auto;
  gap: 10px;
  align-items: end;
  justify-content: start;
  padding: 0;
  margin-bottom: 12px;
  border: 0;
  background: transparent;
  border-radius: 0;
}

.manual-import-form label,
.manual-file-field {
  display: grid;
  gap: 4px;
}

.manual-file-picker {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: inherit;
}

.manual-import-form > .status-text {
  grid-column: 1 / -1;
}

.import-header-actions {
  display: grid;
  grid-template-columns: minmax(190px, auto);
  align-items: stretch;
}

.import-header-actions button {
  width: 100%;
}

.manual-file-picker button {
  min-height: 32px;
  padding: 5px 10px;
  flex: 0 0 auto;
}

.manual-file-selection {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.manual-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.manual-upload-feedback {
  margin: 0 0 18px;
  min-width: 0;
}

.manual-upload-results {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  border-top: 1px solid var(--border);
}

.manual-upload-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px);
  gap: 4px 20px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.manual-upload-outcome { color: var(--muted); }
.manual-upload-reason { grid-column: 1 / -1; white-space: pre-wrap; }
.manual-upload-result.is-failed .manual-upload-outcome { font-weight: 700; color: inherit; }
#manualUploadRetry { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; white-space: normal; }
#manualUploadRetry svg { width: 16px; height: 16px; flex-shrink: 0; }

@media (max-width: 600px) {
  .manual-upload-result { grid-template-columns: minmax(0, 1fr); gap: 4px; }
}

@media (max-width: 900px) {
  .manual-import-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .manual-file-picker {
    width: 100%;
  }

  .import-detail-summary,
  .import-cleanup-actions {
    width: 100%;
    justify-items: stretch;
    justify-content: stretch;
  }

  .import-cleanup-actions > button {
    flex: 1 1 150px;
  }
}

/* Mobile field view reuses the portal API but keeps the field workflow focused. */
.field-workspace-tab,
.field-view {
  display: none;
}

.field-map-button svg,
.field-sheet-close svg,
.field-point-sheet button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  body.field-mode main {
    width: 100%;
    max-width: none;
    margin: 0;
  }

  body.field-mode .site-footer {
    display: none;
  }

  body.field-mode .workspace-tabs {
    width: calc(100% - 16px);
    margin: 6px auto;
  }

  .field-workspace-tab {
    display: inline-flex;
  }

  .field-view:not(.hidden) {
    display: block;
  }

  .field-view {
    padding: 0 8px 8px;
  }

  .field-view-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 2px 9px;
  }

  .field-view-header > div {
    display: grid;
    min-width: 0;
    gap: 1px;
  }

  .field-view-kicker {
    color: var(--muted);
    font-size: 11px;
    font-weight: 620;
  }

  .field-view-header strong {
    overflow: hidden;
    color: var(--hydro-dark);
    font-size: 20px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #fieldProjectField {
    width: min(52%, 240px);
  }

  #fieldProjectField.hidden {
    display: none;
  }

  #fieldProjectSelect {
    width: 100%;
    min-height: 36px;
    padding: 6px 9px;
  }

  .field-map-shell {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--panel);
    box-shadow: var(--shadow);
  }

  #fieldMap {
    width: 100%;
    height: calc(100dvh - 206px);
    min-height: 500px;
    background: #e8eeee;
  }

  .field-map-button,
  .field-sheet-close {
    display: inline-grid;
    place-items: center;
    padding: 0;
    background: var(--panel);
    color: var(--hydro-dark);
  }

  .field-map-button {
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 900;
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-color: var(--border-strong);
    box-shadow: 0 3px 12px rgba(0, 35, 40, 0.18);
  }

  .field-map-button.active {
    border-color: #2f80ed;
    background: #eef6ff;
    color: #1f67c2;
  }

  .field-basemap-button {
    top: 62px;
  }

  .field-project-fit-button {
    top: 212px;
  }

  .field-ruler-button {
    top: 262px;
  }

  .field-basemap-menu {
    position: absolute;
    top: 62px;
    left: 62px;
    z-index: 910;
    display: grid;
    width: min(220px, calc(100% - 76px));
    gap: 3px;
    padding: 7px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 6px 20px rgba(0, 35, 40, 0.2);
    backdrop-filter: blur(8px);
  }

  .field-basemap-menu.hidden {
    display: none;
  }

  .field-basemap-menu button {
    min-height: 34px;
    padding: 6px 10px;
    border: 0;
    background: transparent;
    color: var(--text);
    text-align: left;
  }

  .field-basemap-menu button:hover,
  .field-basemap-menu button.active {
    background: var(--panel-soft);
  }

  body.dark-mode .field-basemap-menu {
    background: rgba(23, 32, 33, 0.97);
  }

  .field-parameter-button {
    top: 112px;
  }

  .field-point-filter-button {
    top: 162px;
  }

  .field-parameter-menu {
    position: absolute;
    top: 112px;
    left: 62px;
    z-index: 910;
    display: grid;
    width: min(260px, calc(100% - 76px));
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 6px 20px rgba(0, 35, 40, 0.2);
    backdrop-filter: blur(8px);
  }

  .field-parameter-menu.hidden {
    display: none;
  }

  .field-parameter-menu label {
    color: var(--muted);
    font-size: 11px;
  }

  .field-parameter-menu select {
    width: 100%;
    min-height: 38px;
  }

  body.dark-mode .field-parameter-menu {
    background: rgba(23, 32, 33, 0.97);
  }

  .field-point-filter-menu {
    position: absolute;
    top: 162px;
    left: 62px;
    z-index: 910;
    display: flex;
    flex-direction: column;
    width: min(260px, calc(100% - 76px));
    max-height: calc(100% - 174px);
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border-strong);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 6px 20px rgba(0, 35, 40, 0.2);
  }

  .field-point-filter-menu.hidden,
  .field-point-filter-option.hidden {
    display: none;
  }

  .field-point-filter-menu > label[for="fieldPointSearch"] {
    color: var(--muted);
    font-size: 11px;
  }

  #fieldPointSearch {
    min-height: 36px;
  }

  .field-point-options {
    min-height: 0;
    overflow-y: auto;
  }

  .field-point-filter-option {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 5px 7px;
    color: var(--text);
    font-size: 13px;
  }

  .field-point-filter-option input {
    width: 16px;
    min-height: 16px;
    margin: 0;
    accent-color: var(--hydro-blue);
  }

  .field-point-filter-all {
    border-bottom: 1px solid var(--border);
    font-weight: 650;
  }

  .field-point-filter-empty {
    display: block;
    padding: 8px 7px;
    color: var(--muted);
    font-size: 12px;
  }

  body.dark-mode .field-point-filter-menu {
    background: rgba(23, 32, 33, 0.97);
  }

  body.dark-mode .field-map-button.active {
    background: #153451;
    color: #8fc4ff;
  }

  .field-map-status {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 850;
    max-width: calc(100% - 72px);
    padding: 7px 9px;
    border: 1px solid rgba(0, 60, 70, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.94);
    color: #405155;
    font-size: 11px;
    line-height: 1.3;
    box-shadow: 0 3px 12px rgba(0, 35, 40, 0.12);
  }

  .field-map-status:empty {
    display: none;
  }

  body.dark-mode .field-map-status {
    background: rgba(17, 27, 29, 0.94);
    border-color: var(--border);
    color: var(--text);
  }

  .field-point-sheet {
    position: absolute;
    right: 10px;
    bottom: 10px;
    left: 10px;
    z-index: 900;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.97);
    color: var(--text);
    box-shadow: 0 12px 34px rgba(0, 35, 40, 0.24);
    backdrop-filter: blur(8px);
  }

  body.dark-mode .field-point-sheet {
    background: rgba(23, 32, 33, 0.97);
  }

  .field-point-sheet.hidden {
    display: none;
  }

  .field-point-type {
    align-self: end;
    color: var(--muted);
    font-size: 11px;
    font-weight: 620;
  }

  .field-point-sheet > strong {
    grid-column: 1;
    color: var(--hydro-dark);
    font-size: 22px;
    font-weight: 650;
  }

  .field-sheet-close {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: start;
    width: 32px;
    height: 32px;
    min-height: 32px;
    border-color: var(--border);
  }

  .field-point-meta {
    display: flex;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 4px 14px;
    color: var(--muted);
    font-size: 12px;
  }

  .field-point-latest {
    display: grid;
    grid-column: 1 / -1;
    gap: 1px;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .field-point-latest > span,
  .field-point-latest > small {
    color: var(--muted);
    font-size: 11px;
  }

  .field-point-latest > strong {
    overflow-wrap: anywhere;
    color: var(--hydro-dark);
    font-size: 14px;
    font-weight: 650;
  }

  .field-point-sheet > #fieldReportButton {
    display: inline-flex;
    grid-column: 1 / -1;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 100%;
    margin-top: 5px;
  }

  .field-point-marker {
    width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    border: 0;
    background: transparent;
  }

  .field-point-marker span {
    display: block;
    width: 18px;
    height: 18px;
    margin: 10px;
    border: 3px solid #ffffff;
    border-radius: 50%;
    background: #087f8c;
    box-shadow: 0 2px 9px rgba(0, 35, 40, 0.4);
  }

  .field-point-marker.selected span {
    background: #f4c542;
    outline: 3px solid #073f47;
  }

  .field-point-marker.no-parameter-data span {
    border-color: rgba(255, 255, 255, 0.9);
    background: #829195;
    opacity: 0.5;
  }

  .field-point-marker.selected.no-parameter-data span {
    background: #f4c542;
    opacity: 1;
  }

  .field-point-label {
    display: inline-block;
    box-sizing: border-box;
    width: max-content !important;
    height: auto !important;
    min-width: 38px;
    max-width: 110px;
    padding: 2px 6px;
    overflow: hidden;
    border: 1px solid rgba(0, 60, 70, 0.25);
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.94);
    color: #073f47;
    font-size: 9px;
    font-weight: 650;
    line-height: 16px;
    text-align: center;
    text-overflow: ellipsis;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(0, 35, 40, 0.14);
  }

  #fieldMap.field-labels-overview .field-point-label {
    min-width: 34px;
    max-width: 92px;
    padding: 2px 5px;
    opacity: 0.9;
    line-height: 15px;
  }

  #fieldMap.field-labels-detailed .field-point-label {
    min-width: 38px;
    max-width: 116px;
    padding: 3px 7px;
    opacity: 1;
    font-size: 11px;
    line-height: 16px;
  }

  #fieldMap .field-point-label.no-parameter-data {
    opacity: 0.52;
  }

  .field-report-modal {
    align-items: end;
    padding: 0;
  }

  .field-report-card {
    display: grid;
    width: 100%;
    max-height: 92dvh;
    gap: 9px;
    padding: 16px;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .field-report-card h3 {
    margin: -2px 0 3px;
    color: var(--hydro-dark);
    font-size: 22px;
  }

  .field-report-card label {
    display: grid;
    gap: 4px;
  }

  .field-report-card input,
  .field-report-card select,
  .field-report-card textarea {
    width: 100%;
  }

  .field-report-card .modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    margin: 0;
    border-radius: 7px;
  }

  .field-report-calculation,
  .field-report-card .form-status {
    min-height: 17px;
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.35;
  }

  .field-report-card .modal-actions {
    display: grid;
    grid-template-columns: 0.8fr 1.2fr;
  }
}
.light-map-tiles {
  filter: saturate(0.55) brightness(1.08) contrast(0.86);
}

.dark-map-tiles {
  filter: brightness(0.62) invert(1) contrast(0.9) hue-rotate(180deg) saturate(0.5);
}
