:root{
  --bg:#0b2a3b;
  --bg2:#083145;
  --card:#0c3a52;
  --card2:#0a3349;

  --line:rgba(255,255,255,.10);
  --txt:rgba(255,255,255,.92);
  --muted:rgba(255,255,255,.65);

  --accent:#22c7ff;
  --accent2:#7dd3fc;

  --good:#66d17a;
  --warn:#ffd34d;
  --bad:#ff3b30;
}

*{box-sizing:border-box}
html,body{height:100%}

body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: radial-gradient(1100px 650px at 20% -10%, #0f5877 0%, var(--bg) 55%, #071f2b 100%);
  color:var(--txt);
}

/* =========================
   TOP BAR
========================= */
.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:14px 18px;
  border-bottom:1px solid var(--line);
  background: linear-gradient(180deg, rgba(0,0,0,.20), rgba(0,0,0,.06));
}

.brand{display:flex;gap:12px;align-items:center}
.logo{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;
  background:rgba(255,255,255,.08);
  border:1px solid var(--line);
}
.brand-title{font-weight:900;letter-spacing:.08em}
.brand-sub{font-size:12px;color:var(--muted)}

.topbar-right{display:flex;gap:10px;align-items:center}
.clock{text-align:right}
.clock-time{font-size:22px;font-weight:900}
.clock-date{font-size:12px;color:var(--muted)}
.chip{
  padding:8px 10px;border-radius:999px;
  border:1px solid var(--line);
  background:rgba(255,255,255,.06);
  font-size:12px;color:var(--accent2);
}

/* =========================
   TABS
========================= */
.tabs{
  display:flex;gap:8px;
  padding:10px 12px;
  border-bottom:1px solid var(--line);
  background: rgba(0,0,0,.10);
}
.tab{
  border:1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--txt);
  padding:10px 12px;
  border-radius:12px;
  font-weight:800;
  cursor:pointer;
}
.tab.is-active{
  background: rgba(34,199,255,.12);
  border-color: rgba(34,199,255,.35);
  color: var(--accent2);
}

/* =========================
   LAYOUT
========================= */
.wrap{padding:14px;max-width:1400px;margin:0 auto}
.panel{display:none}
.panel.is-active{display:block}

.panel-title{
  font-size:26px;font-weight:900;
  letter-spacing:.06em;
  margin:10px 4px 12px;
  color: rgba(255,255,255,.88);
}

.hint{
  color:var(--muted);
  margin:0 4px 12px;
  font-size:13px;
}

/* =========================
   GRID + CARD
========================= */
.grid{display:grid;gap:12px}

/* --- WEATHER GRID --- */
.grid-weather{grid-template-columns: repeat(12, 1fr)}
.grid-weather .metric{grid-column: span 2}
.grid-weather .gauge{grid-column: span 6}
.grid-weather .forecast{grid-column: span 12}

@media (max-width: 1200px){
  .grid-weather .metric{grid-column: span 4}
  .grid-weather .gauge{grid-column: span 12}
}
@media (max-width: 720px){
  .grid-weather{grid-template-columns: 1fr}
  .grid-weather .metric,
  .grid-weather .gauge,
  .grid-weather .forecast{grid-column: 1 / -1}
}

/* --- CARD (ปรับให้คม/โปร) --- */
.card{
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border:1px solid var(--line);
  border-radius:18px;
  padding:14px;
  box-shadow: 0 8px 24px rgba(0,0,0,.30);
}

.card-hd{
  font-size:12px;
  color: var(--muted);
  letter-spacing:.05em;
  margin-bottom:10px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

/* =========================
   METRICS
========================= */
.metric-val{
  font-size:34px;
  font-weight:900;
  line-height:1.1;
}
.unit{font-size:14px;color:var(--muted);margin-left:6px}
.metric-sub{font-size:12px;color:var(--muted);margin-top:6px}

/* =========================
   GAUGE
========================= */
.gauge-row{display:flex;gap:12px;align-items:center}
.gauge-wrap{position:relative;width:140px;height:140px;flex:0 0 auto}
.gauge-svg{width:140px;height:140px;transform:rotate(-90deg)}
.gauge-bg{fill:none;stroke:rgba(255,255,255,.10);stroke-width:10}
.gauge-fg{
  fill:none;
  stroke: var(--accent);
  stroke-width:10;
  stroke-linecap:round;
  stroke-dasharray: 289;
  stroke-dashoffset: 289;
}
.gauge-center{
  position:absolute;inset:0;
  display:grid;place-items:center;
  text-align:center;
}
.gauge-big{font-size:28px;font-weight:900}
.gauge-unit{font-size:12px;color:var(--muted);margin-top:-6px}
.gauge-side{flex:1}
.kv{display:flex;justify-content:space-between;gap:10px;margin:6px 0;color:var(--muted)}
.kv b{color:var(--txt)}

/* =========================
   FORECAST
========================= */
.forecast-row{
  display:grid;
  grid-template-columns: repeat(7, 1fr);
  gap:10px;
}
@media (max-width: 900px){
  .forecast-row{grid-template-columns: repeat(2, 1fr)}
}
.forecast-item{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background: rgba(0,0,0,.10);
}
.forecast-day{font-weight:900}
.forecast-meta{color:var(--muted);font-size:12px;margin-top:6px}

.badge{
  display:inline-flex;align-items:center;gap:6px;
  font-size:12px;
  padding:4px 8px;border-radius:999px;
  border:1px solid var(--line);
  color: var(--accent2);
  background: rgba(34,199,255,.10);
}

/* =========================
   TABLE (ลดความหนา/ดูสะอาดขึ้น)
========================= */
.table{
  width:100%;
  border-collapse: collapse;
  overflow:hidden;
  border-radius:14px;
}
.table th, .table td{
  border: 1px solid rgba(255,255,255,.08);
  padding:8px 10px;
  text-align:left;
  font-size:13px;
}
.table th{
  background: rgba(34,199,255,.16);
  color: rgba(255,255,255,.92);
  font-weight:900;
}
.table td{background: rgba(255,255,255,.03)}
.table .rowlabel{width:110px;font-weight:900}
.table .station{
  background: rgba(34,199,255,.22);
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.03em;
}

/* =========================
   LEVEL
========================= */
.grid-level{grid-template-columns: repeat(3, 1fr)}
@media (max-width: 1100px){ .grid-level{grid-template-columns: repeat(2, 1fr)} }
@media (max-width: 720px){ .grid-level{grid-template-columns: 1fr} }

.level-card{
  display:grid;
  grid-template-columns: 1fr;
  gap:10px;
}
.level-img{
  height:170px;
  border-radius:14px;
  border:1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(0,0,0,.10)),
    repeating-linear-gradient(90deg, rgba(255,255,255,.04), rgba(255,255,255,.04) 8px, rgba(255,255,255,.02) 8px, rgba(255,255,255,.02) 16px);
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  padding:10px;
}
.level-img .area{font-weight:900}

.level-mini{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:10px;
}

.mini{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background: rgba(0,0,0,.10);
}
.mini .hd{font-size:12px;color:var(--muted)}
.mini .val{font-size:18px;font-weight:900;margin-top:4px}
.mini .sub{font-size:12px;color:var(--muted);margin-top:2px}

/* =========================
   PUMP GRID (6 Stations)
========================= */
/* =========================
   PUMP GRID (2 Columns)
========================= */
.grid-pump{
  display:grid;
  grid-template-columns: repeat(2, 1fr); /* 2 คอลัมน์ */
  gap:14px;
}

@media (max-width: 980px){
  .grid-pump{ grid-template-columns: 1fr; }
}

/* =========================
   PUMP CARD (กระชับ + รองรับรูปจริง)
========================= */
.pump-card{
  display:grid;
  grid-template-columns: 120px 1fr;
  gap:14px;
  align-items:stretch;
}

.pump-photo{
  border-radius:16px;
  overflow:hidden;
  border:1px solid var(--line);
  background:#0b2b3c;
}

/* ใส่รูปตู้จริงใน HTML เป็น <img> */
.pump-photo img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.pump-content{display:grid;gap:12px}

.pump-top{
  display:grid;
  grid-template-columns: 1fr auto;
  gap:12px;
  align-items:start;
}

.pump-title{
  font-weight:900;
  letter-spacing:.05em;
  font-size:16px;
}

/* ปุ่มไม่เป็น 2x2 แล้ว (ดูโปรกว่า) */
.pump-buttons{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

/* =========================
   STATS
========================= */
.pump-stats{
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap:8px;
}

.stat{
  border:1px solid var(--line);
  border-radius:14px;
  padding:10px;
  background: rgba(0,0,0,.12);
}

.stat .hd{font-size:12px;color:var(--muted)}
.stat .val{font-size:22px;font-weight:900;margin-top:4px}
.stat .unit{font-size:12px;color:var(--muted);margin-left:6px}

/* =========================
   BUTTONS
========================= */
.btn{
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px 14px;
  font-weight:900;
  cursor:pointer;
  background: rgba(255,255,255,.06);
  color: var(--txt);
  min-width:88px;
}
.btn-ghost{background: rgba(255,255,255,.04)}
.btn-good{background: rgba(102,209,122,.18); border-color: rgba(102,209,122,.35)}
.btn-bad{background: rgba(255,59,48,.18); border-color: rgba(255,59,48,.35)}
.btn-warn{background: rgba(255,211,77,.18); border-color: rgba(255,211,77,.35); color: rgba(255,255,255,.92)}
.btn:hover{filter:brightness(1.06)}

/* =========================
   FOOTER
========================= */
.footer{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px 14px;
  border-top:1px solid var(--line);
  color:var(--muted);
  background: rgba(0,0,0,.14);
}

.footer-right{display:flex;gap:8px;align-items:center}
a.btn{display:inline-flex;align-items:center;justify-content:center;text-decoration:none}
