:root {
  color-scheme: dark;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07111f;
  color: #e5e7eb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(56, 189, 248, 0.20), transparent 35%),
    linear-gradient(135deg, #07111f 0%, #111827 100%);
}

.page {
  max-width: 1320px;
  margin: 0 auto;
  padding: 42px 20px;
}

.hero { margin-bottom: 28px; }

.eyebrow {
  color: #38bdf8;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 10px;
}

h1 {
  font-size: clamp(34px, 7vw, 70px);
  line-height: 0.95;
  margin: 0;
}

.muted { color: #94a3b8; }

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(340px, 0.8fr);
  gap: 20px;
  align-items: stretch;
  margin-top: 20px;
}

.card {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 28px;
  padding: 24px;
  background: rgba(15, 23, 42, 0.78);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.card-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.chart-header {
  align-items: center;
  flex-wrap: wrap;
}

.label {
  margin: 0 0 6px;
  color: #94a3b8;
  font-size: 14px;
}

h2 {
  margin: 0;
  font-size: clamp(22px, 3vw, 34px);
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(148, 163, 184, 0.16);
  color: #cbd5e1;
  font-size: 14px;
  white-space: nowrap;
}

.status.ok {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.status.error {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
}

.table-card,
.map-card { margin-top: 20px; }

.table-wrap {
  margin-top: 18px;
  overflow-x: auto;
}

.sensor-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  min-width: 980px;
}

.sensor-table th {
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  padding: 0 12px 6px;
}

.sensor-table td {
  background: rgba(15, 23, 42, 0.82);
  border-top: 1px solid rgba(148, 163, 184, 0.16);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
  padding: 13px 12px;
  vertical-align: middle;
}

.sensor-table td:first-child {
  border-left: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px 0 0 14px;
}

.sensor-table td:last-child {
  border-right: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0 14px 14px 0;
}

.place strong {
  display: block;
  color: #e0f2fe;
}

.place span {
  display: block;
  color: #94a3b8;
  font-size: 12px;
  margin-top: 2px;
}

.value-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(56, 189, 248, 0.13);
  color: #e0f2fe;
  font-weight: 750;
  white-space: nowrap;
}

.value-pill.humidity { background: rgba(45, 212, 191, 0.13); color: #99f6e4; }
.value-pill.soil { background: rgba(132, 204, 22, 0.13); color: #bef264; }
.value-pill.battery { background: rgba(250, 204, 21, 0.13); color: #fde68a; }
.value-empty { color: #64748b; }

.sensor-map {
  height: 520px;
  margin-top: 18px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 22px;
  overflow: hidden;
  background: #0f172a;
}

.leaflet-container {
  background: #0f172a;
  font-family: inherit;
}

.temp-map-marker {
  min-width: 108px;
  padding: 8px 10px;
  border: 2px solid rgba(14, 165, 233, 0.95);
  border-radius: 18px;
  background: rgba(2, 6, 23, 0.92);
  color: #e0f2fe;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
  text-align: center;
  font-weight: 800;
  line-height: 1.05;
}

.temp-map-marker .temp {
  display: block;
  font-size: 20px;
}

.temp-map-marker .name {
  display: block;
  margin-top: 5px;
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 700;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.range-btn {
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  transition: 0.16s ease;
}

.range-btn:hover,
.range-btn.active {
  border-color: rgba(56, 189, 248, 0.85);
  background: rgba(56, 189, 248, 0.18);
  color: #e0f2fe;
}

.chart-wrap {
  position: relative;
  height: 420px;
  margin-top: 18px;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.tooltip {
  position: absolute;
  z-index: 5;
  min-width: 145px;
  padding: 10px 12px;
  border: 1px solid rgba(56, 189, 248, 0.40);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.94);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.36);
  color: #e5e7eb;
  font-size: 13px;
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 14px));
  white-space: nowrap;
}

.tooltip strong {
  display: block;
  color: #7dd3fc;
  font-size: 20px;
  margin-bottom: 4px;
}

.chart-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: #94a3b8;
  font-size: 14px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 14px;
  margin-top: 12px;
}

.live-card {
  display: flex;
  flex-direction: column;
}

.temperature {
  margin: 34px 0;
  font-size: clamp(72px, 12vw, 138px);
  font-weight: 800;
  letter-spacing: -0.08em;
}

.unit {
  color: #38bdf8;
  font-size: 0.38em;
  letter-spacing: -0.03em;
  margin-left: 8px;
}

.meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: auto 0 0;
}

.meta div {
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 14px;
}

dt {
  color: #94a3b8;
  font-size: 13px;
  margin-bottom: 4px;
}

dd {
  margin: 0;
  overflow-wrap: anywhere;
}

@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .chart-wrap { height: 330px; }
  .sensor-map { height: 400px; }
}

@media (max-width: 640px) {
  .card-header { display: grid; grid-template-columns: 1fr; }
  .chart-controls { justify-content: flex-start; }
  .card { padding: 20px; }
}


.rain-table .value-pill {
  background: rgba(96, 165, 250, 0.14);
  color: #bfdbfe;
}


.rain-chart-card { margin-top: 20px; }
.rain-header { align-items: center; flex-wrap: wrap; }
.rain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 20px; }
.rain-location-card { border: 1px solid rgba(148, 163, 184, 0.18); border-radius: 22px; padding: 18px; background: rgba(2, 6, 23, 0.32); }
.rain-location-head h3 { margin: 0; font-size: 28px; }
.rain-chart-wrap { position: relative; height: 300px; margin-top: 12px; }
.rain-range-btn { border: 1px solid rgba(148, 163, 184, 0.25); border-radius: 999px; padding: 8px 12px; background: rgba(15, 23, 42, 0.72); color: #cbd5e1; cursor: pointer; font: inherit; font-size: 14px; transition: 0.16s ease; }
.rain-range-btn:hover, .rain-range-btn.active { border-color: rgba(34, 197, 94, 0.85); background: rgba(34, 197, 94, 0.18); color: #dcfce7; }
.rain-table-wrap { margin-top: 14px; overflow-x: auto; }
.rain-period-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.rain-period-table th, .rain-period-table td { padding: 11px 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.16); text-align: left; }
.rain-period-table th { color: #94a3b8; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }
.rain-period-table td:last-child { color: #bbf7d0; font-weight: 800; text-align: right; }
.rain-summary-row.active { background: rgba(34, 197, 94, 0.12); }
.rain-tooltip { position: absolute; z-index: 8; min-width: 120px; padding: 9px 11px; border: 1px solid rgba(34, 197, 94, 0.42); border-radius: 13px; background: rgba(2, 6, 23, 0.94); color: #e5e7eb; font-size: 13px; pointer-events: none; transform: translate(-50%, calc(-100% - 8px)); white-space: nowrap; }
.rain-tooltip strong { display: block; color: #bbf7d0; font-size: 18px; margin-bottom: 3px; }
.rain-hit-area { position: absolute; z-index: 4; border: 0; padding: 0; background: transparent; cursor: pointer; }
@media (max-width: 900px) { .rain-grid { grid-template-columns: 1fr; } .rain-chart-wrap { height: 260px; } }


/* Light meteo theme override */
:root {
  color-scheme: light;
  background: #eef7fb;
  color: #172033;
}

body {
  background:
    radial-gradient(circle at top left, rgba(125, 211, 252, 0.42), transparent 34%),
    radial-gradient(circle at 85% 8%, rgba(187, 247, 208, 0.44), transparent 28%),
    linear-gradient(135deg, #f8fbff 0%, #e7f5ee 100%);
  color: #172033;
}

.eyebrow { color: #047857; }
.muted, .label, .chart-footer, dt { color: #5f7187; }

.card {
  border: 1px solid rgba(15, 118, 110, 0.14);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 18px 50px rgba(29, 78, 216, 0.12);
}

.status {
  background: rgba(14, 116, 144, 0.10);
  color: #0f5f73;
}
.status.ok { background: rgba(22, 163, 74, 0.14); color: #166534; }
.status.error { background: rgba(220, 38, 38, 0.12); color: #991b1b; }

.sensor-table th { color: #64748b; }
.sensor-table td {
  background: rgba(255, 255, 255, 0.92);
  border-top-color: rgba(15, 118, 110, 0.12);
  border-bottom-color: rgba(15, 118, 110, 0.12);
}
.sensor-table td:first-child { border-left-color: rgba(15, 118, 110, 0.12); }
.sensor-table td:last-child { border-right-color: rgba(15, 118, 110, 0.12); }
.place strong { color: #0f172a; }
.place span { color: #64748b; }
.value-pill { background: rgba(14, 165, 233, 0.14); color: #075985; }
.value-pill.humidity { background: rgba(20, 184, 166, 0.14); color: #0f766e; }
.value-pill.soil { background: rgba(132, 204, 22, 0.16); color: #3f6212; }
.value-pill.battery { background: rgba(234, 179, 8, 0.18); color: #854d0e; }
.value-empty { color: #94a3b8; }

.sensor-map, .leaflet-container { background: #dbeafe; }
.temp-map-marker {
  border-color: rgba(14, 165, 233, 0.95);
  background: rgba(255, 255, 255, 0.95);
  color: #075985;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
}
.temp-map-marker .name { color: #475569; }

.range-btn, .rain-range-btn {
  border-color: rgba(14, 116, 144, 0.20);
  background: rgba(255, 255, 255, 0.76);
  color: #334155;
}
.range-btn:hover, .range-btn.active, .rain-range-btn:hover, .rain-range-btn.active {
  border-color: rgba(14, 165, 233, 0.72);
  background: rgba(14, 165, 233, 0.14);
  color: #075985;
}

.tooltip, .rain-tooltip {
  border-color: rgba(14, 165, 233, 0.28);
  background: rgba(255, 255, 255, 0.96);
  color: #172033;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.16);
}
.tooltip strong, .rain-tooltip strong { color: #0369a1; }

.temperature .unit, .unit { color: #0284c7; }
.rain-location-card, .rain-period-table td, .rain-period-table th {
  background: rgba(255, 255, 255, 0.72);
  color: #172033;
}


/* Kornelijus readability tweaks */
.rain-table .value-pill {
  background: rgba(2, 132, 199, 0.16);
  color: #064e7a;
  font-size: 16px;
  font-weight: 850;
  padding: 8px 12px;
  border: 1px solid rgba(2, 132, 199, 0.18);
}
.rain-table .value-pill.humidity {
  background: rgba(13, 148, 136, 0.16);
  color: #115e59;
}
.rain-period-table td:last-child {
  color: #064e3b;
  font-size: 17px;
  font-weight: 900;
}
.footer-author {
  margin-top: 28px;
  padding: 18px 8px 4px;
  color: #475569;
  text-align: center;
  font-size: 14px;
}


/* Final Meteo stotelė refinements */
.sensor-row { cursor: pointer; transition: background 0.15s ease, transform 0.15s ease; }
.sensor-row:hover td, .sensor-row:focus td { background: rgba(224, 242, 254, 0.92); }
.sensor-row:focus { outline: 2px solid #38bdf8; outline-offset: 2px; }
.value-pill.rain, .rain-table .value-pill { min-width: 74px; justify-content: center; background: #e0f2fe; color: #075985; font-size: 18px; font-weight: 900; padding: 9px 13px; border: 1px solid rgba(2, 132, 199, 0.22); box-shadow: inset 0 -1px 0 rgba(2, 132, 199, 0.12); }
.rain-period-table { background: #ffffff; border-radius: 14px; overflow: hidden; }
.rain-period-table th { color: #334155; background: #eaf6fb; }
.rain-period-table td { color: #0f172a; background: #ffffff; }
.rain-period-table td:last-child { color: #064e3b; font-size: 19px; font-weight: 950; }
.rain-chart-wrap canvas, .sensor-popup-chart-wrap canvas { touch-action: none; user-select: none; -webkit-tap-highlight-color: transparent; }
body.modal-open { overflow: hidden; }
.sensor-modal[hidden] { display: none; }
.sensor-modal { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 18px; background: rgba(15, 23, 42, 0.46); backdrop-filter: blur(5px); }
.sensor-modal-panel { position: relative; width: min(1040px, 100%); max-height: min(88vh, 820px); overflow: auto; border: 1px solid rgba(15, 118, 110, 0.18); border-radius: 28px; padding: 24px; background: rgba(255, 255, 255, 0.98); box-shadow: 0 24px 80px rgba(15, 23, 42, 0.28); }
.sensor-modal-close { position: absolute; top: 14px; right: 16px; width: 38px; height: 38px; border: 1px solid rgba(15, 118, 110, 0.18); border-radius: 999px; background: #ffffff; color: #0f172a; font-size: 28px; line-height: 1; cursor: pointer; }
.sensor-range-btn { border: 1px solid rgba(14, 116, 144, 0.20); border-radius: 999px; padding: 8px 12px; background: rgba(255, 255, 255, 0.86); color: #334155; cursor: pointer; font: inherit; font-size: 14px; }
.sensor-range-btn:hover, .sensor-range-btn.active { border-color: rgba(14, 165, 233, 0.72); background: rgba(14, 165, 233, 0.14); color: #075985; }
.sensor-chart-title { margin: 16px 0 0; color: #334155; font-size: 18px; }
.sensor-popup-chart-wrap { height: 420px; }
.footer-author { font-weight: 650; }
@media (max-width: 700px) { .sensor-modal-panel { padding: 18px; border-radius: 22px; } .sensor-popup-chart-wrap { height: 310px; } .value-pill.rain, .rain-table .value-pill { font-size: 16px; min-width: 66px; } }

/* IKMIS rizikų puslapis */
.nav-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.nav-links a { display: inline-flex; align-items: center; border: 1px solid rgba(14, 116, 144, 0.20); border-radius: 999px; padding: 8px 13px; background: rgba(255,255,255,0.76); color: #075985; font-weight: 800; text-decoration: none; }
.nav-links a:hover { background: rgba(14, 165, 233, 0.14); }
.ikmis-page .hero { margin-bottom: 22px; }
.ikmis-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ikmis-summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.ikmis-summary-grid div { border: 1px solid rgba(14, 116, 144, 0.14); border-radius: 18px; padding: 14px; background: rgba(255,255,255,0.72); }
.ikmis-summary-grid span { display: block; color: #64748b; font-size: 13px; margin-bottom: 6px; }
.ikmis-summary-grid strong { color: #0f172a; font-size: 20px; overflow-wrap: anywhere; }
.ikmis-groups { display: grid; gap: 16px; margin-top: 18px; }
.ikmis-group { border: 1px solid rgba(14, 116, 144, 0.16); border-radius: 22px; padding: 18px; background: rgba(255,255,255,0.68); }
.ikmis-group-head, .ikmis-model-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.ikmis-group-head { width: 100%; border: 0; padding: 0; background: transparent; cursor: pointer; text-align: left; color: inherit; font: inherit; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.ikmis-group-head::after { content: '▾'; color: #64748b; font-size: 18px; font-weight: 900; line-height: 1; margin-top: 5px; transition: transform 0.18s ease; }
.ikmis-group:not(.is-open) .ikmis-group-head::after { transform: rotate(-90deg); }
.ikmis-group h3, .ikmis-model h4 { margin: 0; }
.ikmis-group-title-wrap { display: grid; gap: 2px; }
.ikmis-group-title { display: block; color: #0f172a; font-size: 1.17em; font-weight: 900; line-height: 1.2; }
.ikmis-model-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.ikmis-model-grid[hidden] { display: none !important; }
.ikmis-model { border: 1px solid rgba(100, 116, 139, 0.16); border-radius: 18px; padding: 14px; background: #fff; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05); }
.ikmis-model.risk-high { border-color: rgba(239, 68, 68, 0.34); background: #fff7f7; }
.ikmis-model.risk-medium { border-color: rgba(245, 158, 11, 0.34); background: #fffbeb; }
.ikmis-model.risk-low { border-color: rgba(34, 197, 94, 0.28); background: #f7fff9; }
.risk-badge { display: inline-flex; border-radius: 999px; padding: 6px 10px; background: #e2e8f0; color: #334155; font-size: 13px; font-weight: 900; white-space: nowrap; }
.risk-badge.high { background: #fee2e2; color: #991b1b; }
.risk-badge.medium { background: #fef3c7; color: #92400e; }
.risk-badge.low { background: #dcfce7; color: #166534; }
.risk-badge.none { background: #e0f2fe; color: #075985; }
.risk-badge.unknown { background: #e2e8f0; color: #475569; }
.ikmis-risk-value { margin: 14px 0 4px; color: #0f172a; font-size: 34px; font-weight: 950; letter-spacing: -0.04em; }
.ikmis-risk-time { margin: 0 0 12px; color: #64748b; font-size: 13px; font-weight: 750; }
.ikmis-series { display: grid; gap: 7px; list-style: none; margin: 0; padding: 0; }
.ikmis-series li { display: flex; justify-content: space-between; gap: 8px; border-top: 1px solid rgba(100,116,139,0.12); padding-top: 7px; color: #475569; font-size: 13px; }
.ikmis-series strong { color: #0f172a; }
@media (max-width: 1000px) { .ikmis-model-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ikmis-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .ikmis-model-grid, .ikmis-summary-grid { grid-template-columns: 1fr; } .ikmis-group, .ikmis-model { padding: 14px; } .ikmis-risk-value { font-size: 28px; } }

/* MATIF puslapis */
.matif-contracts { display: grid; gap: 16px; margin-top: 18px; }
.matif-contract { border: 1px solid rgba(14, 116, 144, 0.16); border-radius: 22px; padding: 18px; background: rgba(255,255,255,0.68); }
.matif-contract-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 10px; }
.matif-contract h3 { margin: 0; }
.matif-empty { margin: 14px 0 0; }
.matif-table-wrap { margin-top: 12px; }
.matif-table th, .matif-table td { white-space: nowrap; }
@media (max-width: 640px) { .matif-contract { padding: 14px; } .matif-contract-head { align-items: flex-start; } }

.sensor-series-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 4px;
}
.series-toggle {
  --series-color: #0ea5e9;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 999px;
  padding: 7px 10px;
  background: rgba(15, 23, 42, 0.70);
  color: #dbeafe;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.series-toggle input { accent-color: var(--series-color); }
.series-toggle span {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--series-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--series-color) 18%, transparent);
}
.series-toggle em {
  color: #94a3b8;
  font-style: normal;
}
.ikmis-default-note { margin: 12px 0 0; }


/* Mobile-first refinements for Info Site V2 */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
button, a, .sensor-row { -webkit-tap-highlight-color: rgba(14, 165, 233, 0.16); }

@media (max-width: 760px) {
  .page {
    width: 100%;
    padding: 18px 10px 28px;
  }

  .hero {
    margin-bottom: 14px;
    padding: 2px 2px 0;
  }

  h1 {
    font-size: clamp(34px, 13vw, 48px);
    line-height: 0.98;
    letter-spacing: -0.04em;
  }

  h2 { font-size: 23px; }
  .hero .muted { margin: 10px 0 0; font-size: 15px; line-height: 1.42; }
  .eyebrow { font-size: 11px; letter-spacing: 0.12em; margin-bottom: 7px; }

  .nav-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .nav-links a {
    min-height: 42px;
    justify-content: center;
    padding: 9px 10px;
    font-size: 14px;
    text-align: center;
  }
  .nav-links a:last-child:nth-child(odd) { grid-column: 1 / -1; }

  .card {
    border-radius: 18px;
    padding: 14px;
    box-shadow: 0 10px 28px rgba(29, 78, 216, 0.10);
  }

  .table-card,
  .map-card,
  .rain-chart-card { margin-top: 12px; }

  .card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .ikmis-actions {
    justify-content: flex-start;
  }

  .status {
    padding: 6px 10px;
    font-size: 13px;
  }

  .chart-controls {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }
  .range-btn,
  .rain-range-btn,
  .sensor-range-btn {
    min-height: 40px;
    padding: 8px 9px;
    font-size: 13px;
    text-align: center;
    justify-content: center;
  }

  .table-wrap {
    margin-top: 12px;
    overflow: visible;
  }

  .sensor-table {
    min-width: 0;
    width: 100%;
    border-spacing: 0;
  }

  .sensor-table thead { display: none; }
  .sensor-table tbody,
  .sensor-table tr,
  .sensor-table td { display: block; width: 100%; }

  .sensor-table tr {
    margin: 0 0 10px;
    border: 1px solid rgba(15, 118, 110, 0.12);
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.90);
  }

  .sensor-table td,
  .sensor-table td:first-child,
  .sensor-table td:last-child {
    display: grid;
    grid-template-columns: minmax(92px, 0.92fr) minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 9px 10px;
    border: 0;
    border-bottom: 1px solid rgba(15, 118, 110, 0.09);
    border-radius: 0;
    background: transparent;
  }

  .sensor-table td:last-child { border-bottom: 0; }
  .sensor-table td::before {
    content: attr(data-label);
    color: #64748b;
    font-size: 12px;
    font-weight: 800;
    text-transform: none;
  }
  .sensor-table td.place {
    grid-template-columns: 1fr;
    background: rgba(224, 242, 254, 0.55);
  }
  .sensor-table td.place::before { display: none; }

  .value-pill {
    justify-self: end;
    padding: 6px 9px;
    font-size: 14px;
  }
  .sensor-table .value-empty { justify-self: end; }

  .rain-grid { gap: 12px; margin-top: 12px; }
  .rain-location-card { padding: 12px; border-radius: 16px; }
  .rain-location-head h3 { font-size: 22px; }
  .rain-chart-wrap { height: 220px; margin-top: 8px; }
  .rain-period-table th,
  .rain-period-table td { padding: 9px 8px; }
  .rain-period-table td:last-child { font-size: 17px; }
  .rain-tooltip { max-width: calc(100vw - 34px); }

  .sensor-map {
    height: 320px;
    border-radius: 16px;
  }
  .temp-map-marker {
    min-width: 92px;
    padding: 7px 8px;
    border-radius: 15px;
  }
  .temp-map-marker .temp { font-size: 18px; }
  .temp-map-marker .name { font-size: 10px; }

  .sensor-modal {
    align-items: stretch;
    padding: 8px;
  }
  .sensor-modal-panel {
    width: 100%;
    max-height: calc(100vh - 16px);
    border-radius: 18px;
    padding: 14px;
  }
  .sensor-modal-close {
    top: 8px;
    right: 8px;
    width: 40px;
    height: 40px;
  }
  .sensor-popup-chart-wrap { height: 280px; }
  .sensor-series-legend { gap: 6px; }
  .series-toggle { padding: 7px 9px; font-size: 12px; }
  .chart-footer { gap: 8px; font-size: 12px; }

  .ikmis-groups,
  .matif-contracts { gap: 10px; margin-top: 12px; }
  .ikmis-group,
  .ikmis-model,
  .matif-contract {
    border-radius: 16px;
    padding: 12px;
  }
  .ikmis-group-head,
  .ikmis-model-head,
  .matif-contract-head {
    align-items: center;
    gap: 8px;
  }
  .ikmis-group-title { font-size: 16px; }
  .risk-badge { padding: 5px 8px; font-size: 12px; }
  .ikmis-risk-value { font-size: 28px; margin-top: 10px; }
  .ikmis-series li { font-size: 12px; }

  .matif-contract .muted { font-size: 13px; line-height: 1.36; }
  .matif-table td {
    grid-template-columns: minmax(104px, 0.82fr) minmax(0, 1fr);
  }
  .matif-table td:not(.place) { text-align: right; }
  .matif-table td::before { text-align: left; }

  .footer-author {
    margin-top: 16px;
    font-size: 12px;
  }
}

@media (max-width: 380px) {
  .page { padding-left: 8px; padding-right: 8px; }
  .card { padding: 12px; }
  .chart-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sensor-table td,
  .sensor-table td:first-child,
  .sensor-table td:last-child {
    grid-template-columns: minmax(82px, 0.86fr) minmax(0, 1fr);
    padding: 8px;
  }
  .value-pill { font-size: 13px; padding: 5px 8px; }
}
