/* =====================================================
   Fish Pond Monitoring — stylesheet
   ===================================================== */

:root {
  --c-bg: #eef6f9;
  --c-surface: #ffffff;
  --c-ink: #0f2c38;
  --c-ink-soft: #55707c;
  --c-line: #d7e6ec;
  --c-brand: #0e7490;
  --c-brand-dark: #0b5c73;
  --c-brand-soft: #e2f4f8;
  --c-active: #16a34a;
  --c-active-soft: #dcfce7;
  --c-inactive: #dc2626;
  --c-inactive-soft: #fee2e2;
  --c-nodata: #94a3b8;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 44, 56, .06), 0 6px 18px -12px rgba(15, 44, 56, .35);
  --font: "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--c-ink);
  background:
    radial-gradient(1200px 600px at 90% -10%, #d9f1f7 0%, rgba(217, 241, 247, 0) 60%),
    radial-gradient(900px 500px at 0% 0%, #e6f7ee 0%, rgba(230, 247, 238, 0) 55%),
    var(--c-bg);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.7;
}

h1, h2, h3, p { margin: 0; }
code {
  font-family: "Consolas", "Menlo", monospace;
  font-size: .85em;
  background: rgba(14, 116, 144, .08);
  color: var(--c-brand-dark);
  padding: .1em .35em;
  border-radius: 5px;
  direction: ltr;
  display: inline-block;
}

/* ---------------- top bar ---------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px clamp(12px, 3vw, 28px);
  background: linear-gradient(100deg, #0b4f66 0%, #0e7490 52%, #1291ad 100%);
  color: #fff;
  box-shadow: 0 8px 24px -16px rgba(3, 42, 55, .9);
}

.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  font-size: 20px;
  color: #06313f;
  background: linear-gradient(150deg, #a5f3fc, #67e8f9);
  box-shadow: inset 0 -2px 0 rgba(6, 49, 63, .15);
  flex: 0 0 auto;
}

.brand-text { min-width: 0; }
.brand-text h1 {
  font-size: clamp(15px, 2.2vw, 19px);
  font-weight: 800;
  letter-spacing: -.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand-text p {
  font-size: 11.5px;
  color: #c7ecf3;
  margin-top: -2px;
}

.topbar-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.data-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .3);
  color: #eafaff;
  white-space: nowrap;
}

/* ---------------- buttons ---------------- */

.btn {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid #7dd3fc; outline-offset: 2px; }

.btn-ghost {
  background: rgba(255, 255, 255, .12);
  border-color: rgba(255, 255, 255, .28);
  color: #f3fdff;
}
.btn-ghost:hover { background: rgba(255, 255, 255, .22); }

.btn-primary {
  background: linear-gradient(180deg, #1189a8, #0e7490);
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(14, 116, 144, .95);
}
.btn-primary:hover { background: linear-gradient(180deg, #1297b8, #0b5c73); }

.btn-soft {
  background: #f1f7f9;
  border-color: var(--c-line);
  color: var(--c-ink);
}
.btn-soft:hover { background: #e6f1f5; }

.btn-danger-ghost {
  background: #fff;
  border-color: #f2c9c9;
  color: #b5261b;
}
.btn-danger-ghost:hover { background: #fff5f4; }

/* "run the real Sentinel analysis" — visually the most important action */
.btn-accent {
  background: linear-gradient(180deg, #16a34a, #12813c);
  color: #fff;
  box-shadow: 0 8px 18px -12px rgba(22, 163, 74, .95);
  border-color: #0f7a37;
}
.btn-accent:hover { background: linear-gradient(180deg, #1cb455, #0f7a37); }
.btn-accent:disabled { opacity: .68; cursor: progress; }

.btn-sm { padding: 6px 10px; font-size: 12px; }

.icon-btn {
  border: 1px solid var(--c-line);
  background: #fff;
  color: var(--c-ink-soft);
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.icon-btn:hover { color: var(--c-inactive); border-color: #f2c9c9; }

/* ---------------- layout ---------------- */

.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: clamp(12px, 2vw, 22px);
  padding: clamp(12px, 2vw, 24px);
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}

.sidebar { display: grid; gap: 16px; position: sticky; top: 84px; }
.content { display: grid; gap: 16px; min-width: 0; }

/* ---------------- cards ---------------- */

.card {
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--c-ink);
  margin-bottom: 12px;
}
.card-title i { color: var(--c-brand); font-size: 13px; }

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

.count-pill {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-brand-dark);
  background: var(--c-brand-soft);
  border-radius: 999px;
  padding: 2px 9px;
}

.head-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 11.5px;
  color: var(--c-ink-soft);
}
.head-legend span { display: inline-flex; align-items: center; gap: 5px; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--c-brand-dark);
  background: var(--c-brand-soft);
  border: 1px solid #c6e8f1;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.chip-month {
  background: #eef7fa;
  color: #146c7c;
  border-color: #d3ebf1;
  font-weight: 600;
}

.table-note {
  font-size: 11.5px;
  color: var(--c-ink-soft);
  margin-top: 8px;
}

/* ---------------- filters ---------------- */

.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--c-ink-soft);
  margin-bottom: 5px;
}

select,
input[type="search"],
input[type="number"] {
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  background: #fbfeff;
  color: var(--c-ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus,
input[type="search"]:focus,
input[type="number"]:focus {
  outline: none;
  border-color: var(--c-brand);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, .14);
}

.field-hint {
  font-size: 11px;
  color: var(--c-ink-soft);
  margin-top: 5px;
  line-height: 1.6;
}

/* دوره بررسی به سال و ماه شمسی */
.period-field > label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

.period-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.period-tag {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-brand-dark);
  background: var(--c-brand-soft);
  border-radius: 7px;
  padding: 5px 8px;
  min-width: 26px;
  text-align: center;
}

.period-row select {
  flex: 1 1 0;
  min-width: 0;
  padding: 7px 9px;
  font-size: 12px;
}

.period-row select#fromMonth,
.period-row select#toMonth { flex: 1.6 1 0; }

.period-hint {
  background: #f1f9fc;
  border: 1px dashed #c7e3ec;
  border-radius: 8px;
  padding: 6px 9px;
  color: var(--c-brand-dark);
  font-weight: 600;
}

/* fixed activity threshold badge (60 % — not user editable) */
.threshold-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #116c35;
  background: var(--c-active-soft);
  border: 1px solid #bbf7d0;
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 4px;
}
.threshold-note i { font-size: 12px; }
.threshold-note b { font-weight: 800; }

.slider-row { display: flex; align-items: center; gap: 10px; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, #cfe9f1, #1189a8);
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--c-brand);
  box-shadow: 0 2px 6px rgba(11, 92, 115, .35);
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--c-brand);
}

output {
  font-size: 12.5px;
  font-weight: 800;
  color: var(--c-brand-dark);
  background: var(--c-brand-soft);
  border-radius: 8px;
  padding: 3px 9px;
  min-width: 42px;
  text-align: center;
}

.btn-stack { display: grid; gap: 8px; margin-top: 14px; }

.help {
  margin-top: 14px;
  border-top: 1px dashed var(--c-line);
  padding-top: 10px;
  font-size: 12px;
  color: var(--c-ink-soft);
}
.help summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--c-brand-dark);
}
.help p { margin: 8px 0; }
.help code { display: block; padding: 6px 8px; line-height: 1.6; word-break: break-word; }

.sample-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-weight: 700;
  font-size: 11.5px;
  color: var(--c-brand-dark);
  background: var(--c-brand-soft);
  border: 1px solid #c6e8f1;
  border-radius: 8px;
  padding: 6px 10px;
  text-decoration: none;
}
.sample-link:hover { background: #d5eef5; }

.note p { font-size: 12.5px; color: var(--c-ink-soft); }

/* method explanation list */
.method-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 7px;
  font-size: 12.5px;
}
.method-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--c-ink-soft);
  line-height: 1.6;
}
.method-list li b { color: var(--c-ink); }
.method-text {
  font-size: 12px;
  line-height: 1.85;
  color: var(--c-ink-soft);
  border-top: 1px dashed var(--c-line);
  padding-top: 9px;
}
.method-text code { font-size: .82em; }

.legend-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.legend-list li { display: flex; align-items: center; gap: 7px; color: var(--c-ink-soft); }

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  flex: 0 0 auto;
}
.dot-active { background: var(--c-active); }
.dot-inactive { background: var(--c-inactive); }
.dot-nodata { background: var(--c-nodata); }

/* ---------------- status ---------------- */

.statusbar {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-brand-dark);
  background: #e8f7fb;
  border: 1px solid #c6e8f1;
  border-radius: 12px;
  padding: 10px 14px;
}
.statusbar.is-busy { color: #8a5b00; background: #fff8e6; border-color: #f6e0a8; }
.statusbar.is-busy i { animation: spin 1.1s linear infinite; }
.statusbar.is-ok { color: #146c43; background: #e8f8ef; border-color: #bfe8ce; }
.statusbar.is-error { color: #9f1c14; background: #fdecea; border-color: #f6c7c2; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- KPI ---------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.kpi {
  position: relative;
  background: var(--c-surface);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 13px 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.kpi::after {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 14px;
  bottom: 14px;
  width: 4px;
  border-radius: 4px;
  background: var(--kpi-color, var(--c-brand));
}
.kpi-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-ink-soft);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  font-size: clamp(19px, 2.6vw, 25px);
  font-weight: 800;
  color: var(--kpi-color, var(--c-ink));
  line-height: 1.35;
  letter-spacing: -.5px;
}
.kpi-sub { font-size: 11.5px; color: var(--c-ink-soft); }

/* ---------------- charts ---------------- */

.charts-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-box { position: relative; height: 260px; }
.chart-box-trend { height: 250px; }
.chart-sub {
  font-weight: 600;
  font-size: 11.5px;
  color: var(--c-ink-soft);
}

/* ---------------- گزارش مدیریتی ---------------- */

.exec-card { display: grid; gap: 10px; }

.exec-bullets { display: grid; gap: 8px; }

.exec-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12.8px;
  line-height: 1.85;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--c-line);
  background: #f8fcfd;
  color: var(--c-ink);
}
.exec-row i {
  font-size: 12px;
  margin-top: 4px;
  flex: 0 0 auto;
}
.exec-row span { flex: 1 1 auto; }

.exec-ok { border-color: #bfe8ce; background: #f0fbf5; }
.exec-ok i { color: #15803d; }
.exec-bad { border-color: #f6c7c2; background: #fef5f4; }
.exec-bad i { color: #b91c1c; }
.exec-warn { border-color: #f6e0a8; background: #fffbeb; }
.exec-warn i { color: #b45309; }
.exec-brand { border-color: #c6e8f1; background: #f2fafd; }
.exec-brand i { color: var(--c-brand); }
.exec-flat { border-color: var(--c-line); background: #f8fcfd; }
.exec-flat i { color: var(--c-ink-soft); }

/* ---------------- map ---------------- */

.bottom-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 16px;
}

.segmented {
  display: inline-flex;
  background: #f1f7f9;
  border: 1px solid var(--c-line);
  border-radius: 9px;
  padding: 2px;
}
.seg-btn {
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--c-ink-soft);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 4px 10px;
  cursor: pointer;
}
.seg-btn.is-active {
  background: #fff;
  color: var(--c-brand-dark);
  box-shadow: 0 1px 4px rgba(15, 44, 56, .15);
}

.map-wrap { position: relative; }

/* ---- map card that shows REAL polygon shape + position + status ---- */
.map-card { display: grid; gap: 10px; }

.map-box {
  width: 100%;
  height: clamp(320px, 45vh, 520px);
  border: 1px solid var(--c-line);
  border-radius: 12px;
  overflow: hidden;
  background: #eef6f9;
  position: relative;
}
.map-box.leaflet-container { font-family: var(--font); }
.map-box .leaflet-tooltip {
  font-family: var(--font);
  font-size: 11.5px;
  line-height: 1.7;
  direction: rtl;
  text-align: right;
  border: 0;
  border-radius: 8px;
  background: rgba(9, 40, 52, .94);
  color: #f2fdff;
  box-shadow: 0 10px 20px -14px #000;
  padding: 6px 9px;
}
.map-box .leaflet-tooltip::before { display: none; }
.map-box .leaflet-control-scale-line {
  background: rgba(255, 255, 255, .78);
  border-color: #6b8b98;
  color: #0f2c38;
  font-size: 10.5px;
}

/* ---- diagnostic panel: explains WHY a report is empty ---- */
.diag-body { display: grid; gap: 5px; }

.diag-warn {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 9px 11px;
  border-radius: 10px;
  background: #fff8e6;
  border: 1px solid #f6e0a8;
  color: #8a5b00;
  font-size: 12px;
  line-height: 1.85;
}
.diag-warn i { margin-top: 3px; flex: 0 0 auto; }
#pondMap {
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 380px;
  display: block;
  border-radius: 12px;
  border: 1px solid var(--c-line);
  background: #f0fbfd;
}

.map-pond { cursor: pointer; transition: opacity .15s ease; }
.map-pond:hover { opacity: .82; }
.map-pond.is-dim { opacity: .28; }
.map-pond:focus { outline: none; }

.map-tooltip {
  position: absolute;
  pointer-events: none;
  background: rgba(9, 40, 52, .94);
  color: #f2fdff;
  font-size: 11.5px;
  line-height: 1.6;
  padding: 6px 9px;
  border-radius: 8px;
  transform: translate(-50%, -115%);
  white-space: nowrap;
  box-shadow: 0 10px 20px -14px #000;
  z-index: 5;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--c-ink-soft);
}
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-hint { margin-inline-start: auto; font-style: italic; }

/* ---------------- table ---------------- */

.table-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.search-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--c-line);
  background: #fbfeff;
  border-radius: 10px;
  padding: 0 9px;
}
.search-field i { color: var(--c-ink-soft); font-size: 11.5px; }
.search-field input[type="search"] {
  border: 0;
  background: transparent;
  padding: 7px 0;
  width: 150px;
  font-size: 12.5px;
}
.search-field input[type="search"]:focus { box-shadow: none; }
.search-field:focus-within { border-color: var(--c-brand); box-shadow: 0 0 0 3px rgba(14, 116, 144, .14); }

.table-wrap {
  max-height: 430px;
  overflow: auto;
  border: 1px solid var(--c-line);
  border-radius: 11px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3fafc;
  color: var(--c-ink-soft);
  font-weight: 700;
  font-size: 11.5px;
  text-align: right;
  padding: 9px 10px;
  border-bottom: 1px solid var(--c-line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}
thead th i { font-size: 9px; opacity: .45; margin-inline-start: 3px; }
thead th.is-sorted { color: var(--c-brand-dark); }
thead th.is-sorted i { opacity: 1; }
thead th.num { text-align: left; }

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid #eef5f8;
  color: var(--c-ink);
  white-space: nowrap;
}
tbody td.num { text-align: left; font-variant-numeric: tabular-nums; }
tbody tr { cursor: pointer; transition: background .12s ease; }
tbody tr:hover { background: #f7fdfe; }
tbody tr.is-selected { background: #e9f8fc; box-shadow: inset 3px 0 0 var(--c-brand); }
tbody tr:last-child td { border-bottom: 0; }

.cell-name { font-weight: 600; }
.cell-muted { color: var(--c-ink-soft); font-size: 11.5px; }

.basin-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-inline-end: 6px;
  vertical-align: middle;
  flex: 0 0 auto;
}

.num-active { color: #116c35; font-weight: 800; }
.num-inactive { color: #a01d16; font-weight: 800; }

.share-cell { display: inline-flex; align-items: center; gap: 7px; }
.share-bar {
  width: 46px;
  height: 6px;
  border-radius: 999px;
  background: #e6eef3;
  overflow: hidden;
  display: inline-block;
}
.share-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #16a34a);
}
.share-val { font-size: 11.5px; font-weight: 700; }

/* monthly activity matrix */
.month-cell { line-height: 1.5; }
.month-cell .m-act { color: #116c35; }
.month-cell .m-inact { color: #a01d16; }
.month-cell .m-sep { color: #b6c8d0; margin: 0 2px; }
.month-cell .m-w {
  display: block;
  font-style: normal;
  font-size: 10.5px;
  color: var(--c-ink-soft);
}

tfoot td {
  padding: 9px 10px;
  font-weight: 800;
  background: #f6fbfd;
  border-top: 2px solid var(--c-line);
  position: sticky;
  bottom: 0;
  white-space: nowrap;
}
tfoot td.num { text-align: left; font-variant-numeric: tabular-nums; }
tbody tr.is-total td { background: #f6fbfd; font-weight: 800; border-top: 2px solid var(--c-line); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-active { background: var(--c-active-soft); color: #116c35; }
.badge-inactive { background: var(--c-inactive-soft); color: #a01d16; }
.badge-nodata { background: #eef2f6; color: #55636e; }

.trend-up { color: #b45309; }
.trend-down { color: #0e7490; }
.trend-flat { color: var(--c-nodata); }

.water-cell { display: flex; align-items: center; gap: 7px; }
.water-bar {
  width: 52px;
  height: 6px;
  border-radius: 999px;
  background: #e6eef3;
  overflow: hidden;
}
.water-bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #67e8f9, #0e7490);
}

.empty-state {
  padding: 26px 12px;
  text-align: center;
  color: var(--c-ink-soft);
  font-size: 12.5px;
}

/* ---------------- footer ---------------- */

.page-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
  font-size: 11.5px;
  color: var(--c-ink-soft);
  padding: 4px 6px 18px;
}

/* ---------------- modal ---------------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(6, 31, 40, .55);
  backdrop-filter: blur(2px);
}
.modal-panel {
  position: relative;
  background: #fff;
  border-radius: 16px;
  width: min(680px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
  padding: 18px;
  box-shadow: 0 30px 60px -30px rgba(3, 26, 34, .8);
  animation: pop .18s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.modal-head h2 { font-size: 16px; font-weight: 800; }
.modal-sub { font-size: 12px; color: var(--c-ink-soft); }

.modal-body { display: grid; gap: 12px; }
.modal-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.modal-stat {
  border: 1px solid var(--c-line);
  border-radius: 11px;
  padding: 9px 11px;
  background: #fbfeff;
}
.modal-stat b { display: block; font-size: 17px; font-weight: 800; }
.modal-stat span { font-size: 11px; color: var(--c-ink-soft); }
.modal-chart { position: relative; height: 200px; }

/* ---------------- toast ---------------- */

.toast {
  position: fixed;
  inset-inline: 0;
  bottom: 22px;
  margin-inline: auto;
  width: fit-content;
  max-width: calc(100% - 32px);
  z-index: 80;
  background: #0b3d4d;
  color: #f0fdff;
  border-radius: 11px;
  padding: 10px 16px;
  font-size: 12.5px;
  font-weight: 600;
  box-shadow: 0 18px 30px -18px #000;
  animation: pop .16s ease-out;
}
.toast[hidden] { display: none; }
.toast.is-error { background: #8f1a13; }

/* ---------------- responsive ---------------- */

@media (max-width: 1080px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; grid-row: 2; }
  .charts-grid { grid-template-columns: minmax(0, 1fr); }
  .bottom-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
  body { font-size: 13.5px; }
  .topbar { position: static; }
  .brand-text h1 { white-space: normal; }
  .topbar-actions { width: 100%; }
  .topbar-actions .btn { flex: 1 1 auto; font-size: 12px; padding: 8px 10px; }
  .data-badge { order: -1; }
  .kpi-grid { grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); }
  .chart-box { height: 230px; }
  .search-field input[type="search"] { width: 110px; }
  .table-wrap { max-height: 360px; }
  .legend-hint { margin-inline-start: 0; }
  #pondMap { max-height: 320px; }
}

@media print {
  .topbar-actions, .sidebar, .statusbar, .map-legend, .segmented, .table-tools, .btn { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; break-inside: avoid; }
  .layout { grid-template-columns: 1fr; }
  .table-wrap { max-height: none; overflow: visible; }
}
