    :root{
      --pcd-blue:#0B5FB8;
      --pcd-cyan:#0AA6E8;
      --pcd-green:#7BC043;

      --bg:#ffffff;
      --subtle:#f6f8fb;
      --border: rgba(11,18,32,.12);
      --ink:#0b1220;
      --muted:#5c677a;

      --good:#27c26b;
      --mod:#f5c542;
      --bad:#ff4d4d;
    }

    body{ font-family: Kanit, system-ui, -apple-system, Segoe UI, Roboto, sans-serif; background: var(--bg); color: var(--ink); }
    .shell{ max-width: 1180px; }

    .navwrap{ position: sticky; top:0; z-index:10; background:#fff; border-bottom:1px solid var(--border); }
    .brand{ display:flex; align-items:center; gap:.75rem; }
    .brand img{ width:44px; height:44px; object-fit:contain; }
    .brand .t1{ line-height:1.1; }
    .brand .t2{ color: var(--muted); font-size:.95rem; }

    .hero{
      border-bottom: 1px solid var(--border);
      background:
        radial-gradient(900px 380px at 20% 10%, rgba(10,166,232,.16), transparent 60%),
        radial-gradient(900px 380px at 85% 5%, rgba(123,192,67,.14), transparent 60%),
        linear-gradient(180deg, #ffffff, #fbfdff);
    }

    .cardx{ background:#fff; border:1px solid var(--border); border-radius: 18px; }
    .chip{
      display:inline-flex; align-items:center; gap:8px;
      padding:.35rem .7rem;
      border-radius:999px;
      border:1px solid var(--border);
      background: var(--subtle);
      color: var(--ink);
    }
    .sw{ width:10px; height:10px; border-radius:999px; }
    .sw.good{ background:var(--good); }
    .sw.mod{ background:var(--mod); }
    .sw.bad{ background:var(--bad); }

    .map{
      aspect-ratio: 16 / 8;
      border-radius: 16px;
      border: 1px solid var(--border);
      background:
        radial-gradient(260px 180px at 25% 45%, rgba(123,192,67,.16), transparent 60%),
        radial-gradient(280px 180px at 55% 35%, rgba(10,166,232,.14), transparent 60%),
        radial-gradient(240px 170px at 80% 55%, rgba(245,197,66,.14), transparent 60%),
      linear-gradient(180deg, #ffffff, #f7fbff);
      position:relative; overflow:hidden;
    }
    .map.is-loading{
      opacity:.92;
    }
    .map-loading-note,
    .map-empty-note{
      position:absolute;
      left:16px;
      top:16px;
      z-index:4;
      border-radius:12px;
      padding:10px 14px;
      background:rgba(255,255,255,.94);
      border:1px solid rgba(11,18,32,.08);
      box-shadow:0 12px 24px rgba(11,18,32,.08);
    }
    .map-loading-note{
      display:inline-flex;
      align-items:center;
      gap:10px;
      color:var(--pcd-blue);
      font-weight:700;
    }
    .map-empty-note{
      max-width:280px;
      color:var(--muted);
      font-weight:600;
    }
    .dashboard-split{
      display:grid;
      grid-template-columns:minmax(0, 7fr) minmax(0, 5fr);
      gap:18px;
      align-items:stretch;
    }
    .map--split{
      margin-top:0;
      min-height:640px;
      aspect-ratio:auto;
      height:clamp(560px, 72vh, 760px);
    }
    .status-panel{
      border:1px solid var(--border);
      border-radius:16px;
      background:#fff;
      overflow:hidden;
      display:flex;
      flex-direction:column;
      min-height:640px;
      height:clamp(560px, 72vh, 760px);
    }
    .status-panel__head{
      display:flex;
      justify-content:space-between;
      align-items:center;
      gap:12px;
      padding:18px 18px 14px;
      border-bottom:1px solid var(--border);
      background:linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    }
    .status-panel__body{
      padding:16px;
      overflow:auto;
      flex:1 1 auto;
    }
    .status-badges{
      display:flex;
      flex-wrap:wrap;
      gap:10px;
      margin-bottom:14px;
    }
    .status-badge{
      display:inline-flex;
      align-items:center;
      gap:8px;
      border-radius:999px;
      padding:.55rem .95rem;
      color:#fff;
      font-weight:700;
      box-shadow:0 10px 18px rgba(11,18,32,.08);
    }
    .status-badge.is-clickable{
      cursor:pointer;
      transition:transform .18s ease, box-shadow .18s ease;
    }
    .status-badge.is-clickable:hover{
      transform:translateY(-1px);
      box-shadow:0 14px 24px rgba(11,18,32,.12);
    }
    .status-badge--online{
      background:#36bf91;
    }
    .status-badge--offline{
      background:#ef5b6a;
    }
    .status-badge--stale{
      background:#7f8a9b;
    }
    .status-badge--abnormal{
      background:#ef5b6a;
    }
    .status-grid{
      width:100%;
      border-collapse:separate;
      border-spacing:0;
      font-size:.94rem;
    }
    .status-grid th,
    .status-grid td{
      padding:10px 8px;
      border-bottom:1px solid rgba(11,18,32,.08);
      vertical-align:middle;
    }
    .status-grid thead th{
      position:static;
      top:auto;
      background:#eef4fb;
      z-index:auto;
      font-size:.88rem;
    }
    .status-grid td:nth-child(2),
    .status-grid td:nth-child(3),
    .status-grid td:nth-child(4){
      text-align:center;
      width:72px;
    }
    .status-grid th:nth-child(2){ color:#36bf91; text-align:center; }
    .status-grid th:nth-child(3){ color:#7f8a9b; text-align:center; }
    .status-grid th:nth-child(4){ color:#ef5b6a; text-align:center; }
    .status-count-btn{
      display:inline-flex;
      align-items:center;
      justify-content:center;
      min-width:40px;
      padding:4px 10px;
      border-radius:999px;
      border:1px solid rgba(11,18,32,.12);
      background:#fff;
      color:inherit;
      font:inherit;
      font-weight:700;
      cursor:pointer;
      transition:background .18s ease, border-color .18s ease, transform .18s ease;
    }
    .status-count-btn:hover{
      background:#f5faff;
      border-color:rgba(11,95,184,.28);
      transform:translateY(-1px);
    }
    .status-count-btn.is-disabled{
      cursor:default;
      opacity:.45;
      pointer-events:none;
    }
    .status-bar{
      height:20px;
      border-radius:999px;
      background:#edf1f6;
      overflow:hidden;
      position:relative;
    }
    .status-bar > span{
      display:block;
      height:100%;
      border-radius:999px;
      color:#fff;
      font-size:.74rem;
      line-height:20px;
      padding-left:8px;
      white-space:nowrap;
      min-width:10px;
    }
    .status-bar__low{ background:#ef5b6a; }
    .status-bar__mid{ background:#f4b942; }
    .status-bar__high{ background:#36bf91; }
    .status-bar-note{
      margin-top:4px;
      display:block;
      font-size:.76rem;
      color:var(--muted);
    }
    .status-province{
      display:flex;
      flex-direction:column;
      align-items:flex-start;
      width:100%;
      border:0;
      background:transparent;
      padding:0;
      text-align:left;
      font:inherit;
      color:inherit;
      cursor:pointer;
    }
    .status-province small{
      color:var(--muted);
      font-size:.75rem;
    }
    .status-grid tbody tr.is-clickable{
      cursor:pointer;
    }
    .status-grid tbody tr.is-clickable:hover{
      background:#f6faff;
    }
    .dot{ width:12px; height:12px; border-radius:999px; position:absolute; box-shadow: 0 0 0 7px rgba(11,18,32,.06); }
    .dot.good{ background: var(--good); }
    .dot.mod{ background: var(--mod); }
    .dot.bad{ background: var(--bad); }

    thead th{ position: sticky; top: 0; background:#fff; z-index: 2; }
    .muted{ color: var(--muted); }

    .btn-primary{ background: var(--pcd-blue); border-color: var(--pcd-blue); font-weight:900; border-radius:12px; }
    .btn-success{ background: var(--pcd-green); border-color: var(--pcd-green); color:#0b1a10; font-weight:900; border-radius:12px; }
    .btn-danger{ font-weight:900; border-radius:12px; }
    .btn-outline-primary{ border-radius:12px; font-weight:900; }
    .top-actions{
      flex: 0 0 auto;
    }
    .controls-row{
      row-gap: 12px;
    }
    .controls-filters{
      flex: 1 1 560px;
      min-width: 0;
    }
    .header-actions{
      flex: 0 1 440px;
      min-width: 280px;
    }
    .header-actions #header-search{
      flex: 1 1 260px;
    }
    .btn-login{
      min-width: 104px;
      height: 40px;
      padding: 0 22px;
      display:inline-flex;
      align-items:center;
      justify-content:center;
      line-height:1;
      white-space:nowrap;
    }
    .report-config{
      background: linear-gradient(180deg, #f5faff 0%, #eef6ff 100%);
      border: 1px solid rgba(11,95,184,.12);
      border-radius: 18px;
      padding: 18px;
    }
    .report-tabs{
      display:flex;
      flex-wrap:wrap;
      gap:10px;
      margin-bottom:16px;
    }
    .report-tab{
      border:1px solid rgba(11,18,32,.18);
      background:#fff;
      color:var(--ink);
      border-radius:999px;
      padding:.5rem 1.2rem;
      font-weight:700;
      line-height:1;
    }
    .report-tab.active{
      background:var(--pcd-blue);
      border-color:var(--pcd-blue);
      color:#fff;
      box-shadow:0 10px 24px rgba(11,95,184,.18);
    }
    .report-grid{
      display:grid;
      grid-template-columns:minmax(0,2fr) minmax(180px,.7fr);
      gap:14px;
      align-items:end;
      margin-bottom:16px;
    }
    .report-loading-note{
      display:inline-flex;
      align-items:center;
      gap:10px;
      padding:10px 14px;
      border-radius:12px;
      background:rgba(11,95,184,.08);
      color:var(--pcd-blue);
      font-weight:700;
      margin-bottom:16px;
    }
    .report-loading-spinner{
      width:18px;
      height:18px;
      border-radius:50%;
      border:2px solid rgba(11,95,184,.18);
      border-top-color:var(--pcd-blue);
      animation:spin 1s linear infinite;
      flex:0 0 auto;
    }
    .report-config.is-loading,
    #station-table-section.is-loading .table-responsive,
    #station-table-section.is-loading #pagination,
    #station-table-section.is-loading #status-filter-chips{
      opacity:.65;
    }
    .report-period{
      display:grid;
      grid-template-columns:minmax(0, 280px);
      gap:14px;
      margin-bottom:16px;
    }
    .report-period__field{
      max-width:280px;
    }
    .report-period__grid{
      display:grid;
      grid-template-columns:minmax(0, 1fr) minmax(110px, .8fr);
      gap:10px;
    }
    .report-period__grid--triple{
      grid-template-columns:minmax(70px, .75fr) minmax(0, 1.2fr) minmax(100px, .9fr);
    }
    .report-field{
      min-width:0;
    }
    .report-field--wide{
      grid-column:auto;
    }
    .report-field--actions{
      display:flex;
      align-items:end;
    }
    .station-list{
      display:grid;
      gap:12px;
    }
    .station-list__item{
      border:1px solid rgba(11,18,32,.08);
      border-radius:14px;
      padding:12px 14px;
      background:#fff;
    }
    .station-list__item-header{
      display:flex;
      justify-content:space-between;
      gap:12px;
      align-items:flex-start;
      margin-bottom:4px;
    }
    .station-list__item-sub{
      color:var(--muted);
      font-size:.88rem;
    }
    .station-list__empty{
      text-align:center;
      color:var(--muted);
      padding:28px 12px;
    }
    .report-label{
      display:block;
      font-size:.92rem;
      font-weight:600;
      margin-bottom:6px;
      color:var(--muted);
    }
    .report-submit{
      width:100%;
      min-height:48px;
    }
    .report-param-toolbar{
      display:flex;
      align-items:center;
      justify-content:space-between;
      gap:12px;
      margin-bottom:10px;
    }
    .report-param-title{
      font-size:1rem;
      font-weight:800;
    }
    .report-param-groups{
      display:grid;
      gap:14px;
    }
    .report-param-group{
      display:flex;
      flex-wrap:wrap;
      align-items:center;
      gap:14px 18px;
    }
    .report-group-title{
      min-width:100px;
      font-weight:700;
      color:var(--muted);
    }
    .param-item{
      display:inline-flex;
      align-items:center;
      gap:8px;
      font-weight:500;
      cursor:pointer;
      user-select:none;
    }
    .param-item input{
      margin:0;
    }
	#page-loader{
	position: fixed;
	inset: 0;
	background: rgba(255,255,255,.92);
	backdrop-filter: blur(2px);
	z-index: 9999;
	
	display: flex;
	align-items: center;
	justify-content: center;
	}
	
	.loader-box{
	text-align: center;
	font-family: Kanit, sans-serif;
	color: #0b1220;
	}
	
	.spinner{
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 4px solid rgba(11,18,32,.12);
	border-top-color: var(--pcd-blue);
	animation: spin 1s linear infinite;
	margin: 0 auto 12px;
	}
	
	.loader-text{
	font-size: .95rem;
	color: var(--muted);
	}
	
	@keyframes spin{
	to{ transform: rotate(360deg); }
	}
.ol-popup {
  position:absolute; background:#fff;
  box-shadow:0 1px 4px rgba(0,0,0,.2);
  padding:15px; border-radius:10px;
  border:1px solid #ccc; bottom:12px; left:-50px; min-width:220px;
}
.ol-popup:after,.ol-popup:before{ top:100%; border:solid transparent; content:" "; height:0; width:0; position:absolute; pointer-events:none; }
.ol-popup:after  { border-top-color:#fff; border-width:10px; left:48px; margin-left:-10px; }
.ol-popup:before { border-top-color:#ccc; border-width:11px; left:48px; margin-left:-11px; }
.ol-popup-closer { text-decoration:none; position:absolute; top:2px; right:8px; color:#999; font-size:16px; }
.ol-popup-closer:after { content:"✖"; }

.sw.bad { background: var(--bad); }
.page-item.active .page-link { background: var(--pcd-blue); border-color: var(--pcd-blue); }
.page-link { color: var(--pcd-blue); }

@media (max-width: 767.98px){
  .dashboard-split{
    grid-template-columns:1fr;
  }
  .status-panel,
  .map--split{
    min-height:460px;
    height:auto;
  }
  .status-panel__body{
    max-height:520px;
  }
  .controls-filters,
  .header-actions{
    width:100%;
    min-width: 0;
  }
  .header-actions #header-search{
    max-width:none !important;
    width:100%;
  }
  .report-config{
    padding:14px;
  }
  .report-grid{
    grid-template-columns:1fr;
  }
  .report-period{
    grid-template-columns:1fr;
  }
  .report-period__field{
    max-width:none;
  }
  .report-period__grid{
    grid-template-columns:1fr;
  }
  .report-param-toolbar{
    align-items:flex-start;
    flex-direction:column;
  }
  .report-param-group{
    gap:10px 14px;
  }
  .report-group-title{
    width:100%;
    min-width:0;
  }
}

    /* station history modal */
    #station-tbody tr.station-row{
      cursor:pointer;
    }
    .history-range{
      display:grid;
      grid-template-columns:1fr 1fr;
      gap:14px;
    }
    @media (max-width: 768px){
      .history-range{
        grid-template-columns:1fr;
      }
    }
    .history-range__grid{
      display:flex;
      flex-wrap:wrap;
      gap:8px;
      margin-top:6px;
    }
    .history-range__grid .form-select{
      width:auto;
      min-width:96px;
      flex:1 1 auto;
    }
    .history-params{
      display:flex;
      flex-wrap:wrap;
      gap:12px 18px;
    }
    .history-chart-wrap{
      position:relative;
      height:340px;
    }

    /* main page date range */
    .main-range{
      display:flex;
      flex-wrap:wrap;
      align-items:flex-end;
      gap:14px 24px;
    }
    .main-range__col{
      min-width:0;
    }
    .main-range__actions{
      display:flex;
      gap:8px;
      padding-bottom:2px;
    }

    .main-login-brand{
      display:flex;
      flex-direction:column;
      align-items:center;
      text-align:center;
      gap:4px;
      padding:4px 0 20px;
    }
    .main-login-brand img{
      width:88px;
      height:88px;
      object-fit:contain;
      filter:drop-shadow(0 10px 18px rgba(11,95,184,.16));
    }
    .main-login-brand__title{
      font-weight:800;
      color:var(--ink);
      line-height:1.15;
    }
    .main-login-brand__subtitle{
      color:var(--muted);
      font-size:.85rem;
      line-height:1.1;
    }
