/* Fit the original tools on phones without replacing their layouts. */
.nrs-original-plan-receipt{margin-block:12px;padding:12px;border:1px solid #528697;border-radius:10px;background:#102f40;color:#e6f6fa;font:14px/1.6 Sarabun,sans-serif;overflow-wrap:anywhere}
.nrs-original-plan-receipt p{margin:0 0 8px}.nrs-original-plan-receipt button{min-height:44px;padding:8px 10px;margin:3px;border:1px solid #72abb9;border-radius:7px;background:#234a60;color:white;font:inherit;cursor:pointer}
#nrs-open-operations{position:static;margin:12px;max-width:100%}
.nrs-original-area{display:flex;flex-wrap:wrap;gap:12px;align-items:end;padding:12px;background:#fff;border:1px solid #cbd5e1;border-radius:12px;color:#0f172a}.nrs-original-area label{display:grid;gap:6px;flex:1 1 180px}.nrs-original-area select,.nrs-original-area input,.nrs-original-area button{min-height:44px;min-width:0;max-width:100%;padding:8px;border:1px solid #94a3b8;border-radius:8px}.nrs-original-area button{background:#0e7490;color:white;padding-inline:18px}

/* ==========================================================================
   ADVANCED CYBER-HYDRO TELEMETRY DASHBOARD DESIGN SYSTEM
   Modern, Professional, High-Contrast Mission-Control Visual Cards
   ========================================================================== */
#dashboard-tab{min-width:0;overflow-x:hidden}
#dashboard-tab article{overflow-wrap:anywhere}
#dashboard-tab button,#dashboard-tab a{min-height:40px}

/* Base Situation Telemetry Card */
#dashboard-tab .nrs-situation-card{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:16px;
  margin-block:10px;
  background:#ffffff;
  border-radius:18px;
  border:1px solid #e2e8f0;
  border-left:6px solid #0284c7;
  box-shadow:0 3px 12px rgba(15,23,42,0.04);
  transition:transform 0.15s ease,box-shadow 0.15s ease,border-color 0.15s ease;
}
#dashboard-tab .nrs-situation-card:hover{
  transform:translateY(-2px);
  box-shadow:0 8px 20px rgba(15,23,42,0.08);
}

/* Level Specific Tints & Glows */
#dashboard-tab .nrs-situation-card.level-3{
  border-color:#fecdd3;
  border-left:6px solid #e11d48;
  background:linear-gradient(135deg,#ffffff 0%,#fff5f6 100%);
  box-shadow:0 4px 16px rgba(225,29,72,0.07);
}
#dashboard-tab .nrs-situation-card.level-2{
  border-color:#fde68a;
  border-left:6px solid #d97706;
  background:linear-gradient(135deg,#ffffff 0%,#fffdf5 100%);
  box-shadow:0 4px 16px rgba(217,119,6,0.07);
}
#dashboard-tab .nrs-situation-card.level-1{
  border-color:#bae6fd;
  border-left:6px solid #0284c7;
  background:linear-gradient(135deg,#ffffff 0%,#f0f9ff 100%);
  box-shadow:0 4px 16px rgba(2,132,199,0.07);
}

/* Card Header & Station Metadata */
.nrs-card-header{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
  border-bottom:1px solid rgba(226,232,240,0.6);
  padding-bottom:8px;
}
.nrs-station-title-group{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
  flex:1;
}
.nrs-station-name{
  font-size:15px;
  font-weight:800;
  color:#0f172a;
  line-height:1.3;
  display:flex;
  align-items:center;
  gap:6px;
  margin:0;
}
.nrs-header-icon{
  font-size:16px;
  flex-shrink:0;
}
.nrs-station-loc{
  font-size:11px;
  color:#64748b;
  display:flex;
  align-items:center;
  gap:4px;
}

/* Badges with Live Pulsing Dot */
.nrs-status-badge{
  display:inline-flex;
  align-items:center;
  gap:5px;
  padding:4px 10px;
  border-radius:9999px;
  font-size:11px;
  font-weight:800;
  letter-spacing:0.01em;
  white-space:nowrap;
  flex-shrink:0;
}
.nrs-status-badge.crit{
  background:#ffe4e6;
  color:#9f1239;
  border:1px solid #fecdd3;
}
.nrs-status-badge.warn{
  background:#fef3c7;
  color:#92400e;
  border:1px solid #fde68a;
}
.nrs-status-badge.watch{
  background:#e0f2fe;
  color:#075985;
  border:1px solid #bae6fd;
}
.nrs-badge-dot{
  width:7px;
  height:7px;
  border-radius:50%;
  background:currentColor;
  display:inline-block;
  flex-shrink:0;
}
.nrs-badge-dot.pulse{
  animation:nrsPulse 1.5s infinite;
}
@keyframes nrsPulse{
  0%,100%{opacity:1;transform:scale(1);}
  50%{opacity:0.35;transform:scale(0.85);}
}

/* Telemetry Metric Cluster Layout */
.nrs-metric-cluster{
  display:grid;
  grid-template-columns:minmax(140px,auto) 1fr;
  align-items:center;
  gap:12px;
  padding:10px 14px;
  background:rgba(255,255,255,0.9);
  border:1px solid rgba(226,232,240,0.9);
  border-radius:14px;
  box-shadow:inset 0 1px 2px rgba(0,0,0,0.02);
}
@media (max-width:540px){
  .nrs-metric-cluster{
    grid-template-columns:1fr;
    gap:10px;
  }
}

.nrs-metric-hero{
  display:flex;
  flex-direction:column;
  min-width:0;
}
.nrs-metric-tag{
  font-size:10px;
  font-weight:700;
  text-transform:uppercase;
  color:#64748b;
  display:flex;
  align-items:center;
  gap:4px;
  margin-bottom:2px;
}
.nrs-metric-val-row{
  display:flex;
  align-items:baseline;
  gap:4px;
}
.nrs-metric-val{
  font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Prompt",monospace;
  font-size:26px;
  font-weight:900;
  line-height:1.1;
  color:#0f172a;
  letter-spacing:-0.03em;
}
#dashboard-tab .nrs-situation-card.level-3 .nrs-metric-val{color:#be123c}
#dashboard-tab .nrs-situation-card.level-2 .nrs-metric-val{color:#b45309}
#dashboard-tab .nrs-situation-card.level-1 .nrs-metric-val{color:#0369a1}
.nrs-metric-unit{
  font-size:12px;
  font-weight:800;
  color:#475569;
}
.nrs-metric-sub{
  font-size:10px;
  color:#64748b;
  margin-top:2px;
}

/* Graphical Gauge & Progress Bar */
.nrs-gauge-box{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:0;
}
.nrs-gauge-label{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:10px;
  font-weight:700;
  color:#475569;
}
.nrs-gauge-track{
  height:9px;
  width:100%;
  background:#e2e8f0;
  border-radius:9999px;
  overflow:hidden;
  position:relative;
  box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);
}
.nrs-gauge-fill{
  height:100%;
  border-radius:9999px;
  transition:width 0.4s ease;
}
.nrs-gauge-fill.rain{
  background:linear-gradient(90deg,#38bdf8 0%,#0284c7 50%,#f59e0b 80%,#e11d48 100%);
}
.nrs-gauge-fill.water-crit{
  background:linear-gradient(90deg,#f59e0b 0%,#ea580c 50%,#e11d48 100%);
  animation:nrsWaveGlow 2s infinite alternate;
}
.nrs-gauge-fill.water-warn{
  background:linear-gradient(90deg,#38bdf8 0%,#f59e0b 80%,#ea580c 100%);
}
.nrs-gauge-fill.water-watch{
  background:linear-gradient(90deg,#38bdf8 0%,#0284c7 100%);
}
@keyframes nrsWaveGlow{
  0%{filter:brightness(1);}
  100%{filter:brightness(1.15);}
}
.nrs-gauge-ticks{
  display:flex;
  align-items:center;
  justify-content:space-between;
  font-size:9px;
  color:#94a3b8;
  font-weight:600;
  padding-inline:2px;
}

/* Criteria Callout Strip */
.nrs-reason-strip{
  display:flex;
  align-items:center;
  gap:6px;
  padding:7px 10px;
  border-radius:8px;
  font-size:11px;
  font-weight:600;
  line-height:1.4;
}
#dashboard-tab .nrs-situation-card.level-3 .nrs-reason-strip{
  background:rgba(225,29,72,0.07);
  color:#9f1239;
  border-left:3px solid #e11d48;
}
#dashboard-tab .nrs-situation-card.level-2 .nrs-reason-strip{
  background:rgba(217,119,6,0.07);
  color:#92400e;
  border-left:3px solid #d97706;
}
#dashboard-tab .nrs-situation-card.level-1 .nrs-reason-strip{
  background:rgba(2,132,199,0.07);
  color:#075985;
  border-left:3px solid #0284c7;
}

/* Footer Metadata */
.nrs-card-footer{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
  padding-top:8px;
  border-top:1px solid rgba(226,232,240,0.6);
  font-size:11px;
  color:#64748b;
}
.nrs-source-pill{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:2px 8px;
  border-radius:6px;
  background:#f1f5f9;
  color:#334155;
  font-weight:800;
  font-size:10px;
  text-transform:uppercase;
  border:1px solid #e2e8f0;
}
.nrs-source-pill.source-rid{background:#eff6ff;color:#1e40af;border-color:#dbeafe}
.nrs-source-pill.source-dwr,.nrs-source-pill.source-dwr-ews{background:#fffbeb;color:#92400e;border-color:#fef3c7}
.nrs-source-pill.source-thaiwater{background:#ecfeff;color:#155e75;border-color:#cffafe}
.nrs-source-pill.source-tmd{background:#f0fdf4;color:#166534;border-color:#dcfce7}
.nrs-time-pill{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-size:10.5px;
  color:#64748b;
}

/* ==========================================================================
   SOS RESCUE REQUESTS CARDS (Pillar 3)
   ========================================================================== */
#dash-real-incidents-list article{
  position:relative;
  display:flex;
  flex-direction:column;
  gap:9px;
  padding:14px;
  margin-block:9px;
  background:#ffffff;
  border:1px solid #fecdd3;
  border-left:5px solid #e11d48;
  border-radius:16px;
  box-shadow:0 3px 12px rgba(225,29,72,0.05);
  transition:transform 0.15s ease,box-shadow 0.15s ease;
}
#dash-real-incidents-list article:hover{
  transform:translateY(-2px);
  box-shadow:0 6px 18px rgba(225,29,72,0.1);
}
.nrs-sos-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  flex-wrap:wrap;
}
.nrs-sos-title{
  font-size:14px;
  font-weight:800;
  color:#0f172a;
  display:flex;
  align-items:center;
  gap:6px;
  margin:0;
}
.nrs-sos-phase-badge{
  display:inline-flex;
  align-items:center;
  gap:4px;
  padding:3px 9px;
  border-radius:9999px;
  font-size:11px;
  font-weight:800;
  background:#fff1f2;
  color:#be123c;
  border:1px solid #fecdd3;
}
.nrs-sos-meta-grid{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  font-size:11px;
  color:#475569;
}
.nrs-sos-area{
  display:inline-flex;
  align-items:center;
  gap:4px;
  font-weight:700;
  color:#1e293b;
}
.nrs-sos-id-pill{
  font-family:ui-monospace,SFMono-Regular,monospace;
  font-size:10px;
  color:#64748b;
  background:#f8fafc;
  padding:2px 7px;
  border-radius:6px;
  border:1px solid #e2e8f0;
}
#dash-real-incidents-list button{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  margin-top:4px;
  padding:9px 16px;
  background:linear-gradient(135deg,#e11d48 0%,#be123c 100%);
  color:#ffffff;
  font-weight:800;
  font-size:12px;
  border-radius:12px;
  border:none;
  cursor:pointer;
  box-shadow:0 3px 10px rgba(190,18,60,0.25);
  transition:all 0.15s ease;
  min-height:38px;
}
#dash-real-incidents-list button:hover{
  background:linear-gradient(135deg,#f43f5e 0%,#e11d48 100%);
  box-shadow:0 4px 14px rgba(190,18,60,0.35);
  transform:translateY(-1px);
}
#dash-real-incidents-list button:active{
  transform:scale(0.98);
}

/* Empty Safe Banners */
.nrs-empty-safe-banner{
  display:flex;
  align-items:center;
  gap:10px;
  padding:14px 16px;
  border-radius:14px;
  background:#f8fafc;
  border:1px solid #e2e8f0;
  color:#475569;
  font-size:12px;
  line-height:1.5;
}
.nrs-empty-icon{
  font-size:18px;
  flex-shrink:0;
}
.nrs-empty-text{
  margin:0;
}
.nrs-placeholder-msg{
  padding:12px 14px;
  background:#f8fafc;
  border:1px dashed #cbd5e1;
  border-radius:12px;
  text-align:center;
  margin:0;
}

@media(max-width:640px){
  #antenna-modal>div,#route-modal>div,#geofence-modal>div{width:calc(100vw - 20px)!important;max-height:calc(100dvh - 24px)!important;overflow:auto!important;min-width:0!important}
  #dashboard-tab h2{flex-wrap:wrap}
  #dashboard-tab .shrink-0{flex-shrink:1}
  #dashboard-tab .nrs-original-area{display:grid;grid-template-columns:minmax(0,1fr)}
  .nrs-original-plan-receipt button{width:100%;margin:3px 0}
}
