/* =====================================================================
 * ธีมสี: น้ำเงินกรมท่า → ฟ้าไซแอน (ตามภาพหน้าเข้าสู่ระบบ)
 * ===================================================================== */
:root {
  /* โทนหลักจากภาพ */
  --navy-950: #021238;
  --navy-900: #06153a;
  --navy-800: #0a2152;
  --navy-700: #0f2f6b;
  --teal-700: #0b5d7a;
  --cyan-500: #19b6e6;
  --cyan-300: #7fdcff;
  --green-400: #3ccf6e;

  /* หน้าหลัก */
  --bg: #eef3f9;
  --panel: #ffffff;
  --ink: #0f1d38;
  --ink-2: #55637d;
  --line: #d9e2ee;
  --brand: #0f4c9a;
  --brand-2: #1593c8;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1fb;
  --brand-grad: linear-gradient(90deg, #1565d8 0%, #17b0de 100%);
  --danger: #c62828;
  --radius: 10px;
  --shadow: 0 8px 28px rgba(6, 21, 58, .14);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'IBM Plex Sans Thai', system-ui, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px;
  display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }

/* ---------- แถบด้านบน ---------- */
.topbar {
  position: relative; z-index: 1100;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; color: #fff;
  background: linear-gradient(90deg, var(--navy-900) 0%, var(--navy-700) 55%, var(--teal-700) 100%);
}
.topbar::after {           /* เส้นแสงไซแอนบางๆ ใต้แถบ */
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan-500) 30%, var(--cyan-300) 70%, transparent);
  opacity: .8;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 0; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, #1e6fe0 0%, #19b6e6 100%);
  box-shadow: 0 0 0 1px rgba(127, 220, 255, .35), 0 6px 16px rgba(25, 182, 230, .35);
}
.brand h1 { font-size: 17px; margin: 0; font-weight: 600; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text { min-width: 0; }
.brand .org { font-size: 12.5px; color: #b9d6f2; }
.top-actions { display: flex; align-items: center; gap: 8px; justify-content: flex-end; flex: 1 1 0; }
.user { font-size: 13px; color: #cfe6fb; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid transparent;
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 500; white-space: nowrap;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn.primary { background: var(--brand-grad); color: #fff; box-shadow: 0 4px 12px rgba(21, 101, 216, .25); }
.btn.primary:hover { filter: brightness(1.07); }
.topbar .btn.primary { box-shadow: 0 0 0 1px rgba(127, 220, 255, .35), 0 6px 16px rgba(25, 182, 230, .35); }
.btn.ghost { background: transparent; border-color: currentColor; }
.topbar .btn.ghost { color: #e6f3ff; border-color: rgba(127, 220, 255, .45); }
.topbar .btn.ghost:hover { background: rgba(127, 220, 255, .12); border-color: var(--cyan-300); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn:disabled { opacity: .55; cursor: wait; }
.link { background: none; border: 0; color: var(--brand-2); cursor: pointer; padding: 0; font-weight: 500; }

/* ---------- แท็บเมนู ---------- */
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(2, 18, 56, .45);
  border: 1px solid rgba(127, 220, 255, .18); flex: none; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; border: 0; cursor: pointer;
  padding: 7px 16px; border-radius: 9px; background: transparent; color: #b9d6f2; font-weight: 500;
  transition: background .15s, color .15s;
}
.tab:hover { color: #fff; background: rgba(127, 220, 255, .1); }
.tab.active { color: #fff; background: linear-gradient(90deg, #1565d8, #17b0de); box-shadow: 0 4px 14px rgba(25, 182, 230, .35); }

/* ---------- เมนูผู้ใช้ ---------- */
.user-menu { position: relative; }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: #e6f3ff;
  background: rgba(2, 18, 56, .35); border: 1px solid rgba(127, 220, 255, .3); border-radius: 999px;
  padding: 3px 10px 3px 3px; max-width: 240px;
}
.user-btn:hover { border-color: var(--cyan-300); background: rgba(127, 220, 255, .1); }
.user-btn .user { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  font-weight: 700; font-size: 14px; color: #fff; background: linear-gradient(135deg, #1e6fe0, #19b6e6);
}
.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 230px; z-index: 2000;
  background: #fff; color: var(--ink); border-radius: 12px; padding: 6px;
  box-shadow: 0 16px 40px rgba(2, 18, 56, .28); border: 1px solid var(--line);
}
.user-role { padding: 10px 12px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; gap: 2px; }
.user-role b { font-size: 14.5px; }
.user-role span { font-size: 12.5px; color: var(--ink-2); }
.user-pop button {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
  padding: 9px 12px; border-radius: 8px; cursor: pointer; text-align: left; color: var(--ink);
}
.user-pop button:hover { background: #f1f6fc; }
.user-pop button.danger { color: var(--danger); }
.user-pop button.danger:hover { background: #fdecec; }

/* ---------- เลย์เอาต์ ---------- */
.layout { flex: 1; display: grid; grid-template-columns: 340px 1fr; grid-template-rows: auto minmax(0, 1fr); min-height: 0; transition: grid-template-columns .25s ease; }
.layout.side-collapsed { grid-template-columns: 0 1fr; }
.layout.side-collapsed .side { visibility: hidden; }
.side {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
}
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 4px 14px; }
.side-head h2 { margin: 0; font-size: 16px; color: var(--navy-800); }
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
}
.icon-btn:hover { color: var(--brand); border-color: #a9cbe8; background: #f3f8fd; }

/* แถบตัวกรองด้านบน (เต็มความกว้าง) */
.fbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0; }
.fbar-filters { flex: 1; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; min-width: 0; }
.fbar-filters .search { grid-column: span 2; }
.fbar-filters input, .fbar-filters select { padding-top: 6px; padding-bottom: 6px; font-size: 13.5px; }
.fbar-filters select { text-overflow: ellipsis; }
.fbar-kpis { flex: none; display: flex; gap: 6px; }
.fbar-kpis .kpi { padding: 4px 10px; gap: 0; min-width: 84px; background: linear-gradient(180deg, #f6faff 0%, #fff 100%); }
.fbar-kpis .kpi .k { font-size: 11px; }
.fbar-kpis .kpi .v { font-size: 15px; }
.search { position: relative; }
.search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #8695ad; pointer-events: none; }
.search input { padding-left: 34px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
input, select, textarea {
  width: 100%; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; min-width: 0;
}
select.mini { width: auto; padding: 4px 8px; font-size: 13px; border-radius: 7px; }
input[type=radio], input[type=checkbox] { width: auto; padding: 0; margin: 0 6px 0 0; vertical-align: middle; accent-color: var(--brand-2); }
.leaflet-control-layers label { font-size: 13.5px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-2); outline-offset: -1px; }
.muted { color: var(--ink-2); }

.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #f6faff 0%, #fff 100%); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: grid; gap: 2px; min-width: 0; }
.kpi .k { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--navy-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.list-head {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px 6px; font-size: 13px; color: var(--ink-2);
}
.list-tools { display: flex; align-items: center; gap: 10px; }
.list-head > span, .list-tools .link { white-space: nowrap; }
.list { list-style: none; margin: 0; padding: 2px 10px 12px; overflow: auto; flex: 1; display: grid; gap: 6px; align-content: start; }
.list li {
  position: relative; padding: 9px 10px 9px 14px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; display: grid; gap: 4px;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.list li::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--c, var(--line)); }
.list li:hover { border-color: #a9cbe8; box-shadow: 0 3px 10px rgba(6, 21, 58, .08); }
.list li.active { background: var(--brand-soft); border-color: var(--brand-2); box-shadow: 0 0 0 1px var(--brand-2); }
.list .g { font-size: 12px; color: var(--brand-2); font-weight: 600; line-height: 1.3; }
.list .t { font-weight: 600; line-height: 1.35; color: var(--ink); }
.list .m { font-size: 12.5px; color: var(--ink-2); display: flex; gap: 4px 10px; flex-wrap: wrap; }
.list .n { font-size: 12.5px; color: var(--ink-2); }
select.set { border-color: var(--brand-2); background: #f2f9ff; color: var(--brand); font-weight: 500; }
.list .n b { color: var(--navy-700); font-weight: 600; font-variant-numeric: tabular-nums; }
.list .n i { font-style: normal; margin: 0 6px; color: #b3c0d3; }
.list .empty { border: 1px dashed #c4d3e6; background: #f8fbfe; color: var(--ink-2); text-align: center; padding: 28px 10px; cursor: default; }
.list .empty::before { display: none; }
.side-foot { border-top: 1px solid var(--line); padding: 9px 12px; }
.side-foot .link { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; }

.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }

/* ---------- แผนที่ ---------- */
.map-wrap { position: relative; min-height: 0; min-width: 0; }
#map { position: absolute; inset: 0; background: #dfe7f1; }
.side-open {
  position: absolute; top: 12px; left: 12px; z-index: 900; display: inline-flex; align-items: center; gap: 7px;
  border: 0; border-radius: 9px; padding: 8px 13px; cursor: pointer; font-weight: 500;
  background: var(--navy-800); color: #fff; box-shadow: 0 6px 18px rgba(2, 18, 56, .3);
}
.side-open:hover { background: var(--navy-700); }

.map-tools {
  display: grid; gap: 0;
  background: #fff; border-radius: 8px; box-shadow: 0 1px 5px rgba(0, 0, 0, .25); overflow: hidden;
}
.tool { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: #fff; color: #334563; cursor: pointer; }
.tool + .tool { border-top: 1px solid #e3e9f1; }
.tool:hover { background: #eef5fc; color: var(--brand); }
.tool[aria-pressed="true"] { background: var(--brand-soft); color: var(--brand); }
#toolDist[aria-pressed="true"], #toolArea[aria-pressed="true"] { background: var(--navy-800); color: var(--cyan-300); }
.tool-sep { height: 4px; background: #e3e9f1; }

.legends.leaflet-control { display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  overflow: auto; padding: 0 2px 4px; max-width: calc(100vw - 80px); }
.legend { background: rgba(255, 255, 255, .96); border-radius: 10px; box-shadow: var(--shadow); display: grid; }
/* ตัวกรองบนแผนที่ */
.map-filter { width: 250px; max-width: calc(100% - 24px); padding: 0; gap: 0; overflow: hidden; }
.mf-head { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 8px 8px 12px; background: var(--navy-800); color: #eaf5ff; font-size: 13.5px; font-weight: 600; }
.mf-head span { display: inline-flex; align-items: center; gap: 6px; }
.mf-toggle { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 6px;
  background: rgba(127, 220, 255, .12); color: #cfe6fb; cursor: pointer; }
.mf-toggle:hover { background: rgba(127, 220, 255, .25); color: #fff; }
.mf-toggle svg { transition: transform .2s; }
.map-filter.collapsed .mf-toggle svg { transform: rotate(180deg); }
.map-filter.collapsed .mf-body { display: none; }
.mf-body { display: grid; gap: 8px; padding: 10px 12px 12px; }
.mf-body label { display: grid; gap: 3px; font-size: 12px; color: var(--ink-2); }
.mf-body select { padding: 5px 8px; font-size: 13.5px; }
.mf-legend { border-top: 1px solid var(--line); padding-top: 8px; display: grid; gap: 5px; }
.mf-legend-title { font-size: 12px; color: var(--ink-2); }
.legend-items { display: grid; gap: 4px; }
.legend-title { font-size: 12px; color: var(--ink-2); font-weight: 600; }

.coords {
  position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 850;
  font-size: 12px; font-variant-numeric: tabular-nums; white-space: pre; color: #e8f4ff;
  background: rgba(6, 21, 58, .78); padding: 4px 10px; border-radius: 6px;
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.coords.on { opacity: 1; }

.measure-panel {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 950; min-width: 260px; max-width: calc(100% - 120px);
  background: rgba(6, 21, 58, .92); color: #eaf5ff; border: 1px solid rgba(127, 220, 255, .35);
  border-radius: 12px; padding: 10px 14px 12px; box-shadow: 0 12px 30px rgba(2, 18, 56, .35);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); text-align: center;
}
.mp-title { font-size: 12.5px; color: var(--cyan-300); }
.mp-value { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 2px 0; }
.mp-sub { font-size: 12.5px; color: #b9d6f2; min-height: 1em; }
.mp-acts { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
.measure-panel .btn.ghost { color: #dbeeff; border-color: rgba(127, 220, 255, .45); }
.measuring { cursor: crosshair !important; }
.measuring .leaflet-interactive,
.measuring.leaflet-container .leaflet-pane > svg path.leaflet-interactive { pointer-events: none; }

/* ชื่อแปลงบนแผนที่ (แสดงเมื่อซูมระดับ 13 ขึ้นไป) */
.leaflet-tooltip.plabel {
  display: none; background: transparent; border: 0; box-shadow: none; padding: 0;
  font-size: 12px; font-weight: 600; color: #0b1d48; white-space: nowrap; max-width: 200px; overflow: hidden; text-overflow: ellipsis;
  text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff;
}
.leaflet-tooltip.plabel::before { display: none; }
.show-labels .leaflet-tooltip.plabel { display: block; }

/* ชื่อจังหวัด/อำเภอ/ตำบล */
.leaflet-tooltip.adm-label {
  background: transparent; border: 0; box-shadow: none; padding: 0; white-space: nowrap;
  color: #fff; font-weight: 600; text-shadow: 0 0 3px rgba(0,0,0,.9), 0 0 6px rgba(0,0,0,.6);
}
.leaflet-tooltip.adm-label::before { display: none; }
.leaflet-tooltip.adm-label.prov { font-size: 14px; color: #ffe066; letter-spacing: .2px; }
.leaflet-tooltip.adm-label.amp { font-size: 12.5px; }
.leaflet-tooltip.adm-label.tam { font-size: 11.5px; color: #d7f5ff; font-weight: 500; }
.adm-light .leaflet-tooltip.adm-label { color: #263238; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 5px #fff; }
.adm-light .leaflet-tooltip.adm-label.prov { color: #6a1b9a; }
.adm-light .leaflet-tooltip.adm-label.tam { color: #455a64; }
.leaflet-control-layers small { color: var(--ink-2); font-size: 11.5px; }

.leaflet-popup-content { font-family: inherit; font-size: 14px; margin: 12px 14px; min-width: 240px; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.pop h3 { margin: 0 0 8px; font-size: 15px; color: var(--navy-800); line-height: 1.35; }
.pop table { border-collapse: collapse; width: 100%; }
.pop td { padding: 3px 0; vertical-align: top; }
.pop td:first-child { color: var(--ink-2); padding-right: 12px; white-space: nowrap; }
.pop .acts { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.pop .acts .btn { padding: 4px 10px; font-size: 13px; }

/* ---------- หน้าสรุปภาพรวม ---------- */
.dash { flex: 1; overflow: auto; background: var(--bg); }
.dash-inner { max-width: 1280px; margin: 0 auto; padding: 18px 20px 32px; display: grid; gap: 14px; }
.dash-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.dash-head h2 { margin: 0; font-size: 20px; color: var(--navy-800); }
.dash-sub { margin: 2px 0 0; font-size: 13px; color: var(--ink-2); }
.dash-filters { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; width: 100%; }
.dash-filters select { width: 100%; min-width: 0; padding: 7px 22px 7px 9px; text-overflow: ellipsis; font-size: 13.5px; background-position: right 6px center; }

.dash-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.dkpi {
  position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 14px 16px; display: grid; gap: 2px;
}
.dkpi::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--accent, linear-gradient(90deg, #1565d8, #17b0de)); }
.dkpi .k { display: flex; align-items: center; gap: 6px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.dkpi .k .dot { margin: 0; }
.dkpi .k { font-size: 13px; color: var(--ink-2); }
.dkpi .v { font-size: 26px; font-weight: 700; color: var(--navy-800); font-variant-numeric: tabular-nums; line-height: 1.25; }
.dkpi .v small { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.dkpi .u { font-size: 12.5px; color: var(--ink-2); }

.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px 16px; min-width: 0; }
.card.span-2 { grid-column: span 2; }
.card h3 { margin: 0 0 12px; font-size: 15px; color: var(--navy-800); }
.card h3 small { font-weight: 400; color: var(--ink-2); font-size: 12.5px; margin-left: 4px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.hint { font-size: 12.5px; color: var(--ink-2); }
.empty-chart { color: var(--ink-2); font-size: 13.5px; text-align: center; padding: 36px 0; }

/* แท่งแนวตั้ง */
.vbars { display: flex; align-items: stretch; gap: 2px; height: 220px; padding-top: 4px; }
.vb { flex: 1 1 0; min-width: 0; display: grid; grid-template-rows: auto 1fr auto; gap: 4px; text-align: center; cursor: default; padding: 0 3px; border-radius: 6px; }
.vb:hover { background: #f1f6fc; }
.vb-val { font-size: 11.5px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vb-track { position: relative; border-bottom: 1px solid #c9d5e4; }
.vb-bar { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); width: min(70%, 44px); border-radius: 4px 4px 0 0; }
.vb-lab { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* แท่งแนวนอน */
.hbars { display: grid; gap: 2px; }
.hb { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 6px; }
.hb:hover { background: #f1f6fc; }
.hb.click { cursor: pointer; }
.hb.click:hover .hb-lab { color: var(--brand); text-decoration: underline; }
.hb-lab { font-size: 13px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.hb-lab i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.hb-track { height: 14px; position: relative; }
.hb-bar { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.hb-val { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink); min-width: 48px; text-align: right; }

.table-wrap { overflow: auto; }
.sum-table { width: 100%; border-collapse: collapse; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.sum-table th { text-align: right; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); background: #f6f9fd; white-space: nowrap; }
.sum-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid #edf1f7; }
.sum-table th:first-child, .sum-table td:first-child { text-align: left; }
.sum-table tbody tr:hover { background: #f6faff; }
.sum-table tfoot td { font-weight: 700; color: var(--navy-800); border-top: 2px solid var(--line); border-bottom: 0; background: #f6f9fd; }

.viz-tip {
  position: fixed; z-index: 9000; pointer-events: none; max-width: 260px;
  background: var(--navy-900); color: #eaf5ff; font-size: 12.5px; line-height: 1.5;
  padding: 7px 10px; border-radius: 8px; box-shadow: 0 8px 20px rgba(2, 18, 56, .35);
}
.viz-tip span { color: #a9c9e8; }

/* ---------- หน้าต่าง (dialog) ---------- */
.dlg { border: 0; border-radius: 14px; padding: 0; box-shadow: var(--shadow); width: min(96vw, 420px); }
.dlg.wide { width: min(96vw, 1040px); }
.dlg::backdrop { background: rgba(2, 18, 56, .55); backdrop-filter: blur(2px); }
.dlg form { padding: 18px 20px; display: grid; gap: 12px; }
.dlg h2 { margin: 0; font-size: 18px; color: var(--navy-800); }
.dlg label { display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); }
.dlg fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px; margin: 0; display: grid; gap: 10px; }
.dlg legend { font-weight: 600; padding: 0 6px; font-size: 14px; color: var(--navy-700); }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.err { color: var(--danger); margin: 0; min-height: 1em; font-size: 13.5px; white-space: pre-line; }
.req { color: var(--danger); }

.import-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; max-height: 68vh; overflow: auto; }
.import-left { display: grid; gap: 12px; align-content: start; }
.import-right { display: grid; grid-template-rows: auto auto auto; gap: 8px; align-content: start; align-self: start; position: sticky; top: 0; }
#previewMap { border-radius: var(--radius); border: 1px solid var(--line); height: clamp(260px, 36vh, 380px); }
.preview-area { font-size: 14px; color: var(--ink-2); }
.preview-area b { color: var(--ink); font-size: 16px; }

.drop {
  border: 2px dashed #b9cde4; border-radius: var(--radius); padding: 16px; text-align: center;
  cursor: pointer; display: grid; gap: 2px; background: #f5f9fe;
}
.drop:hover, .drop.over { border-color: var(--brand-2); background: var(--brand-soft); }
.drop input { display: none; }
.drop strong { color: var(--brand); }
.drop span { font-size: 12.5px; }
.drop .fname { color: var(--ink); font-weight: 500; }
.import-info { font-size: 13px; color: var(--ink-2); display: grid; gap: 3px; }
.import-info .warn { color: #8a5a00; }

/* ฟอร์ม: ช่องค้นหาแบบมีรายการ, พื้นที่ตั้ง, คำอธิบายช่อง */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 50; left: 0; right: 0; top: calc(100% + 4px); max-height: 260px; overflow: auto;
  margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 28px rgba(6, 21, 58, .18);
}
.combo-list li { padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--ink);
  display: flex; justify-content: space-between; gap: 10px; }
.combo-list li small { color: var(--ink-2); white-space: nowrap; }
/* รายการแบบข้อความเต็ม (ชื่อรายการงาน): ตัดบรรทัดได้ ข้อมูลประกอบอยู่บรรทัดล่าง */
.combo-list.full { max-height: 320px; }
.combo-list.full li { display: block; line-height: 1.4; white-space: normal; overflow-wrap: anywhere; }
.combo-list.full li small { display: block; white-space: normal; font-size: 12px; margin-top: 1px; }
.combo-list li:hover, .combo-list li.on { background: var(--brand-soft); }
.combo-list li.empty { color: var(--ink-2); cursor: default; font-size: 13px; }
.combo-list li.empty:hover { background: transparent; }
.combo-list mark { background: #fff0b3; color: inherit; border-radius: 2px; }
input.valid { border-color: #6cc39a; background: #f4fbf7; }
.hint-line { font-size: 12.5px; color: var(--ink-2); margin-top: -4px; }
.hint-line.ok { color: #137a4b; }
.hint-line.new { color: var(--brand); }
.field-help { font-size: 12px; color: var(--ink-2); min-height: 1.2em; line-height: 1.4; }
.field-help b { color: var(--ink); }
.field-help .link { font-size: 12px; }
input.auto { background: #f2f7fd; color: var(--navy-700); font-weight: 600; }
.loc-box { border: 1px dashed #c4d3e6; border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: #fafcff; }
.loc-title { font-size: 13px; color: var(--ink); font-weight: 600; }
.loc-title .muted { font-weight: 400; font-size: 12px; }
.loc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 10px; border-radius: 999px;
  background: var(--brand-soft); border: 1px solid #b9dcf3; color: var(--navy-700); font-size: 13px; }
.chip button { border: 0; background: transparent; color: #6b7d96; cursor: pointer; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; }
.chip button:hover { background: #fdecec; color: var(--danger); }
.small { font-size: 12.5px; }
.loc-add { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 6px; align-items: start; }
.loc-add select, .loc-add input { font-size: 13.5px; padding: 6px 8px; }
.loc-add .btn { height: 34px; }
.vill-box { border: 1px dashed #c4d3e6; border-radius: 10px; padding: 10px; display: grid; gap: 8px; background: #fafcff; }
.vill-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.dlg label.vill-near { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.vill-near select { width: auto; padding: 3px 6px; font-size: 12.5px; }
.vill-status { font-size: 12.5px; color: var(--ink-2); }
.vill-status.busy { color: var(--brand); }
.vill-list { display: grid; gap: 2px; max-height: 220px; overflow: auto; }
.vill-list:empty { display: none; }
.dlg label.vill-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: 7px; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.vill-item:hover { background: #f1f6fc; }
.vill-item input { margin: 0; }
.vill-item small { color: var(--ink-2); font-size: 12px; }
.vill-item .tag { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; white-space: nowrap; }
.vill-item .tag.in { background: #e3f6ec; color: #137a4b; }
.vill-item .tag.near { background: #fff4e0; color: #8a5a00; }
.vill-sep { font-size: 12px; color: var(--ink-2); padding: 6px 8px 2px; }
.vill-import { max-width: 620px; }
.dlg:has(.vill-import) { width: min(96vw, 640px); }
.vill-log { font-size: 13px; display: grid; gap: 4px; max-height: 180px; overflow: auto; }
.vill-log .ok { color: #137a4b; } .vill-log .warn { color: #8a5a00; } .vill-log .err { color: var(--danger); }
.import-info .ok { color: #137a4b; }
.import-info .busy { color: var(--brand); display: flex; align-items: center; gap: 8px; }
.import-info .busy::before { content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #b9d3ee; border-top-color: var(--brand-2); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px);
  background: var(--navy-800); color: #fff; padding: 10px 16px; border-radius: 8px;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 9999; max-width: 90vw;
  box-shadow: 0 8px 24px rgba(2, 18, 56, .35);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--danger); }

/* ---------- จอขนาดกลาง ---------- */
@media (max-width: 1200px) {
  .dash-kpis { grid-template-columns: repeat(3, 1fr); }
  .org { display: none; }
}
@media (max-width: 1000px) {
  .brand-text { display: none; }
  .user-btn .user { display: none; }
}

/* ---------- มือถือ ---------- */
@media (max-width: 820px) {
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 10px; }
  .top-actions { flex: 0 0 auto; }
  .tabs { order: 3; width: 100%; }
  .tab { flex: 1; justify-content: center; }
  .brand-text { display: block; }
  .brand h1 { font-size: 14.5px; }
  #btnImport span { display: none; }
  .layout, .layout.side-collapsed { grid-template-columns: 1fr; grid-template-rows: auto 58vh auto; }
  .fbar { order: -2; flex-direction: column; align-items: stretch; gap: 8px; }
  .fbar-filters { grid-template-columns: 1fr 1fr; }
  .fbar-kpis .kpi { flex: 1; }
  .layout.side-collapsed .side { visibility: visible; }
  .map-wrap { order: -1; }
  .side { border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  #btnSideClose, .side-open { display: none !important; }
  .list { overflow: visible; }
  .coords { display: none; }
  .map-filter { width: 230px; }
  .measure-panel { max-width: calc(100% - 24px); top: auto; bottom: 12px; }
  .dash-inner { padding: 14px 12px 24px; }
  .dash-kpis { grid-template-columns: 1fr 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .card.span-2 { grid-column: auto; }
  .dash-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .import-grid { grid-template-columns: 1fr; max-height: none; }
  .loc-add { grid-template-columns: 1fr 1fr; }
  .import-right { position: static; }
  #previewMap { height: 260px; }
}

/* =====================================================================
 * หน้าเข้าสู่ระบบ
 * จอกว้าง : ภาพเต็มจอ ข้อความในภาพอยู่ซ้าย กล่องเข้าสู่ระบบอยู่ขวา
 * จอแคบ/สูง: ภาพเป็นแบนเนอร์ด้านบน กล่องเข้าสู่ระบบอยู่ด้านล่าง
 * ===================================================================== */
body.auth-pending > .topbar, body.auth-pending > .layout,
body.locked > .topbar, body.locked > .layout,
body.auth-pending > .dash, body.locked > .dash { visibility: hidden; }
body.auth-pending, body.locked { background: var(--navy-950); }

.login-screen {
  position: fixed; inset: 0; z-index: 3000; overflow: auto;
  display: flex; align-items: center; justify-content: flex-end;
  padding: 32px clamp(16px, 4vw, 120px);
  background: var(--navy-950) url('../img/login-bg.jpg') left center / cover no-repeat;
}
.login-screen[hidden] { display: none !important; }
.login-banner { display: none; }
.login-wrap { width: min(100%, 400px); display: grid; gap: 14px; }
.login-org {
  justify-self: center; text-align: center; font-size: 13px; color: rgba(220, 238, 255, .9);
  background: rgba(2, 18, 56, .6); border: 1px solid rgba(127, 220, 255, .18);
  padding: 5px 14px; border-radius: 999px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.login-org:empty { display: none; }

.login-card {
  position: relative; padding: 30px 26px 22px; display: grid; gap: 14px; margin: 0;
  background: linear-gradient(180deg, rgba(10, 33, 82, .62) 0%, rgba(4, 20, 58, .72) 100%);
  -webkit-backdrop-filter: blur(16px) saturate(140%); backdrop-filter: blur(16px) saturate(140%);
  border-radius: 20px; border: 1px solid rgba(127, 220, 255, .28);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  color: #eaf5ff;
}
.login-head { text-align: center; display: grid; justify-items: center; gap: 6px; margin-bottom: 6px; }
.login-logo {
  width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #1e6fe0 0%, #19b6e6 100%);
  box-shadow: 0 0 0 1px rgba(127, 220, 255, .45), 0 8px 24px rgba(25, 182, 230, .45);
}
.login-head h2 { margin: 4px 0 0; font-size: 21px; color: #fff; }
.login-sub { margin: 0; font-size: 13px; color: rgba(205, 228, 250, .78); }
.login-sub:empty { display: none; }

.login-field {
  display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 14px;
  background: rgba(255, 255, 255, .96); border: 1.5px solid transparent; border-radius: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.login-field:focus-within { border-color: var(--cyan-500); box-shadow: 0 0 0 4px rgba(25, 182, 230, .28); }
.login-field.invalid { border-color: #ff6b6b; box-shadow: 0 0 0 4px rgba(255, 107, 107, .2); }
.login-field .ico { color: #5b6a86; flex: none; }
.login-field input {
  flex: 1; min-width: 0; border: 0; outline: 0 !important; background: transparent;
  padding: 0; font-size: 16px; color: #0f1d38; height: 100%;
}
.login-field input::placeholder { color: #7d89a0; }
.login-field .eye {
  flex: none; border: 0; background: transparent; color: #5b6a86; cursor: pointer;
  width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; margin-right: -6px;
}
.login-field .eye:hover { background: #eef3f9; color: #0f2f6b; }
.login-field .eye .eye-off { display: none; }
.login-field .eye[aria-pressed="true"] .eye-open { display: none; }
.login-field .eye[aria-pressed="true"] .eye-off { display: block; }

.login-btn {
  height: 54px; border: 0; border-radius: 14px; cursor: pointer;
  font-size: 17px; font-weight: 600; color: #fff; letter-spacing: .2px;
  background: linear-gradient(90deg, #1565d8 0%, #19b6e6 100%);
  box-shadow: 0 10px 28px rgba(25, 182, 230, .4), inset 0 1px 0 rgba(255, 255, 255, .25);
  transition: transform .1s, box-shadow .15s, filter .15s;
}
.login-btn:hover { filter: brightness(1.08); box-shadow: 0 12px 32px rgba(25, 182, 230, .55), inset 0 1px 0 rgba(255, 255, 255, .25); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { filter: saturate(.6) brightness(.9); cursor: wait; }
.login-card .err { text-align: center; min-height: 0; color: #ff9b9b; }
.login-card .err:empty { display: none; }
.login-foot { margin: 2px 0 0; text-align: center; font-size: 13px; color: rgba(205, 228, 250, .72); }

/* จอที่ไม่กว้างพอจะวางกล่องข้างข้อความในภาพ (แคบกว่า 16:10) -> ภาพเป็นแบนเนอร์ด้านบน */
@media (max-aspect-ratio: 159/100), (max-width: 820px) {
  .login-screen {
    flex-direction: column; justify-content: flex-start; align-items: center;
    padding: 0 0 28px; gap: 20px;
    background: radial-gradient(900px 500px at 80% 0%, rgba(11, 93, 122, .5), transparent 70%), var(--navy-950);
  }
  .login-banner {
    display: block; width: 100%; height: auto; max-height: 44vh; flex: none;
    object-fit: cover; object-position: left center;
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent);
    mask-image: linear-gradient(180deg, #000 78%, transparent);
  }
  .login-wrap { width: min(calc(100% - 32px), 400px); }
}

/* =====================================================================
   สถานะพื้นที่ / การขอซ้ำ
   ===================================================================== */
/* ป้ายสถานะในรายการและป๊อปอัป */
.sts { display: flex; flex-wrap: wrap; gap: 4px; }
.sts:empty { display: none; }
.st { display: inline-flex; align-items: center; font-size: 11.5px; font-weight: 600; line-height: 1.5;
  padding: 0 7px; border-radius: 999px; border: 1px solid transparent; white-space: nowrap; }
.st-ok   { background: #e6f6ef; color: #0b6b45; border-color: #b9e6d2; }
.st-part { background: #eef4fb; color: #2b4c74; border-color: #cfdcec; }
.st-wait { background: #e8f1fd; color: #1a5bb0; border-color: #bcd5f5; }
.st-warn { background: #fff3e6; color: #a2470f; border-color: #f6d0ae; }
.st-dup  { background: #fdecec; color: #b3261e; border-color: #f4bcb9; }

/* สลับโหมดสีของแผนที่ + คำอธิบายสัญลักษณ์ */
.legend { width: 270px; max-width: 100%; }
.lg-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  border: 0; background: none; font: inherit; cursor: pointer; padding: 8px 10px 6px 12px; border-radius: 10px; text-align: left; }
.lg-name { font-size: 13px; font-weight: 600; color: var(--navy-800); }
.lg-act { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-2); border-radius: 6px; padding: 2px 6px; }
.lg-head:hover .lg-act { background: #eef3f9; color: var(--ink); }
.lg-eye .off { display: none; }
.lg-card.off .lg-eye .on { display: none; }
.lg-card.off .lg-eye .off { display: inline; }
.lg-body { display: grid; gap: 5px; padding: 0 12px 10px; }
.lg-card.off { width: auto; background: rgba(255, 255, 255, .88); }
.lg-card.off .lg-body { display: none; }
.lg-card.off .lg-head { padding-bottom: 8px; }
.lg-card.off .lg-name { color: var(--ink-2); font-weight: 500; }
.lg-card.off .lg-act { color: var(--brand); }
.legend .pill.line::before { background: transparent; border: 2px solid var(--c); width: 10px; height: 10px; border-radius: 2px; }
.legend .pill.cov { display: flex; gap: 6px; font-size: 12.5px; }
.legend .pill.cov::before { width: 12px; height: 12px; border-radius: 3px; opacity: .85; }
.legend .pill.cov.dup::before { background: repeating-linear-gradient(45deg, var(--c) 0 3px, #fff 3px 5px); border: 1px solid var(--c); }
.legend .pill.cov b { margin-left: auto; padding-left: 10px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.legend-note { font-size: 11.5px; color: var(--ink-2); line-height: 1.4; width: 0; min-width: 100%; }

/* ป๊อปอัป: สถานะ ณ จุดที่คลิก */
.pt-box { background: #f4f8fd; border: 1px solid #dbe6f3; border-radius: 8px; padding: 7px 9px; margin-bottom: 10px; }
.pt-title { font-size: 11.5px; color: var(--ink-2); margin-bottom: 4px; }
.pt-line { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pst { font-size: 13px; font-weight: 600; }
.pst.yes { color: var(--ink); }
.pst.yes::first-letter { color: var(--c); }
.pst.no { color: #8c98ab; font-weight: 500; }
.pst small { font-weight: 400; color: var(--ink-2); }
.pt-dup { margin-top: 5px; font-size: 12.5px; font-weight: 600; color: #b3261e; }
.pt-others { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); display: grid; gap: 2px; }
.pt-others .link, .dup-list .link { text-align: left; font-size: 13px; display: inline-flex; align-items: baseline; gap: 2px; }
.pt-others .link small, .dup-list .link small { color: var(--ink-2); margin-left: 4px; }
.pt-empty { margin: 0; font-size: 13px; }
.pt-where { margin: 6px 0 0; font-size: 12.5px; }
.dup-list { margin-top: 4px; display: grid; gap: 2px; font-size: 12.5px; color: var(--ink-2); }
.pop td .st { margin: 0 4px 2px 0; }

/* ฟอร์ม: ผลตรวจพื้นที่ทับซ้อน */
.ov-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; background: #fbfdff; display: grid; gap: 6px; }
.ov-box.bad { border-color: #f0a9a4; background: #fff8f7; box-shadow: 0 0 0 1px #f0a9a4; }
.ov-title { font-weight: 600; font-size: 13.5px; color: var(--navy-800); }
.ov-msg { font-size: 13px; line-height: 1.45; padding-left: 2px; }
.ov-msg.ok { color: #0b6b45; }
.ov-msg.warn { color: #a2470f; }
.ov-msg.bad { color: #b3261e; font-weight: 600; }
.ov-msg.info { color: var(--ink-2); }
.ov-msg.busy { color: var(--ink-2); font-style: italic; }
.ov-list { display: grid; gap: 4px; }
.ov-list:empty { display: none; }
.ov-head { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.ov-item { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 13px;
  padding: 5px 8px; border-radius: 8px; background: #fff; border: 1px solid #e6edf6; }
.ov-item.hit { border-color: #f0a9a4; background: #fff1f0; }
.ov-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ov-name small, .ov-amt small { display: block; font-size: 11.5px; color: var(--ink-2); }
.ov-amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ov-more { font-size: 12px; }
.ov-confirm { display: flex !important; gap: 8px; align-items: flex-start; font-size: 13px; color: #b3261e; font-weight: 600;
  background: #fff; border: 1px dashed #f0a9a4; border-radius: 8px; padding: 7px 9px; cursor: pointer; }
.ov-confirm[hidden] { display: none !important; }
.ov-confirm input { width: auto !important; margin-top: 3px; }
.ov-confirm small { display: block; font-weight: 400; color: var(--ink-2); }

/* หน้าสรุป: สถานะพื้นที่ */

.cov-tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.cov-tiles .dkpi .v { font-size: 22px; }
.cov-stack { display: flex; height: 26px; border-radius: 7px; overflow: hidden; margin-top: 14px; background: #eef3f9; gap: 2px; }
.cov-stack span { display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 600; min-width: 3px; }
.cov-keys { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 8px; color: var(--ink-2); }
.dup-table td { vertical-align: top; }
.dup-table td:nth-child(2), .dup-table td:nth-child(3), .dup-table th:nth-child(2), .dup-table th:nth-child(3) { text-align: left; }
.dup-table .link { text-align: left; font-weight: 600; }

/* =====================================================================
   ชั้นข้อมูลอ้างอิงจาก SHP
   ===================================================================== */
.ref-sw { display: inline-block; width: 16px; height: 3px; border-radius: 2px; background: var(--c); margin: 0 6px 0 2px; vertical-align: middle; }
.ref-sw[data-k="point"] { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(15, 29, 56, .35); }
.ref-sw[data-k="polygon"] { width: 12px; height: 10px; background: transparent; border: 2px solid var(--c); border-radius: 2px; }
.ref-sw[data-k="mixed"] { width: 12px; height: 9px; border-radius: 2px; }
.leaflet-control-layers-overlays label small { color: var(--ink-2); }
.ref-tip { font-weight: 600; font-size: 12.5px; }
.pop-kicker { font-size: 12px; color: var(--ink-2); margin-bottom: 2px; display: flex; align-items: center; }
.dlg.mid { width: min(96vw, 720px); }
.layer-table td { vertical-align: middle; }
.layer-table td:first-child { text-align: left; }
.layer-table input[type=color] { width: 38px; height: 28px; padding: 2px; border-radius: 6px; cursor: pointer; }

/* หน้าต่างตั้งค่าระบบ */
.settings { gap: 14px; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.set-tabs { display: flex; gap: 2px; background: #eef3f9; border-radius: 9px; padding: 3px; }
.set-tabs button { border: 0; background: transparent; border-radius: 7px; padding: 6px 14px; font: inherit; font-size: 13.5px;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.set-tabs button:hover { color: var(--ink); }
.set-tabs button.active { background: #fff; color: var(--navy-800); font-weight: 600; box-shadow: 0 1px 3px rgba(6, 21, 58, .15); }
.set-pane { display: grid; gap: 12px; min-height: 360px; align-content: start; }
.set-pane[hidden] { display: none; }
.set-pane > p.small { margin: 0; }
.settings .vill-import, .set-pane.vill-import { max-width: none; }

/* การ์ดสถานะพื้นที่ (คลิกดูรายการได้) : สีพื้นอ่อนตามสถานะ + ไอคอน */
.cov-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.cov-tile {
  --tint: color-mix(in srgb, var(--accent) 7%, #fff);
  font: inherit; text-align: left; cursor: pointer; display: grid; align-content: start; gap: 4px; width: 100%; min-width: 0;
  background: var(--tint); border: 1px solid color-mix(in srgb, var(--accent) 22%, #fff); border-radius: 14px; padding: 12px 14px 10px;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.cov-tile:hover { border-color: color-mix(in srgb, var(--accent) 55%, #fff); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 16%, transparent); transform: translateY(-1px); }
.cov-tile.active { border-color: var(--accent); box-shadow: 0 0 0 1.5px var(--accent), 0 6px 18px color-mix(in srgb, var(--accent) 18%, transparent); }
.cov-tile.sub { border-style: dashed; }
.ct-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ct-ic { flex: none; width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff; background: var(--accent); }
.ct-k { font-size: 13px; font-weight: 600; color: color-mix(in srgb, var(--accent) 70%, #0f1d38); line-height: 1.3; }
.ct-v { font-size: 25px; font-weight: 700; color: color-mix(in srgb, var(--accent) 80%, #0f1d38); font-variant-numeric: tabular-nums; line-height: 1.2; margin-top: 4px; }
.ct-v small { font-size: 13px; font-weight: 500; margin-left: 4px; color: var(--ink-2); }
.ct-u { font-size: 12px; color: var(--ink-2); line-height: 1.4; min-height: 2.8em; }
.ct-more { display: inline-flex; align-items: center; gap: 3px; justify-self: start; margin-top: 2px; font-size: 12px; font-weight: 600;
  color: color-mix(in srgb, var(--accent) 80%, #0f1d38); background: color-mix(in srgb, var(--accent) 12%, #fff); border-radius: 999px; padding: 2px 9px; }
@media (max-width: 1280px) { .cov-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 1100px) and (min-width: 821px) { .dash-filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 640px) { .cov-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cov-detail { margin-top: 14px; border: 1px solid var(--line); border-top: 3px solid var(--accent); border-radius: 12px; padding: 10px 12px 8px; }
.cov-detail-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.cov-detail-head b { color: var(--navy-800); font-size: 15px; }
.cov-detail-head .link { margin-left: auto; font-size: 13px; }
.cov-detail .table-wrap { max-height: 420px; }
.cov-table td:nth-child(2), .cov-table th:nth-child(2) { text-align: left; }
.cov-table .link { text-align: left; font-weight: 600; }
.cov-table td.num { text-align: right; }
.cov-table td.note, .cov-table th:last-child { text-align: left; color: var(--ink-2); font-size: 12.5px; }
.cov-detail p.small { margin: 6px 0 0; }

/* การ์ดตัวเลขสรุป (ใช้สไตล์เดียวกับการ์ดสถานะพื้นที่) */
.dash-kpis .kpi-tile { padding: 12px 14px 10px; }
.kpi-tile .ct-v { font-size: 27px; }
.kpi-tile .ct-u { min-height: 0; }
#kpiDetail:empty { display: none; }
#kpiDetail .cov-detail { margin-top: 0; background: #fff; }
.kpi-table th, .kpi-table td { white-space: nowrap; }
.kpi-table td:nth-child(2) { white-space: normal; min-width: 240px; text-align: left; }
.kpi-table td:nth-child(3), .kpi-table th:nth-child(3), .kpi-table td:nth-child(5), .kpi-table td:nth-child(6),
.kpi-table th:nth-child(5), .kpi-table th:nth-child(6) { text-align: left; }
.kpi-table td:nth-child(3) { white-space: normal; min-width: 160px; }
.kpi-table td.hl { font-weight: 700; color: color-mix(in srgb, var(--accent) 75%, #0f1d38); background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* ตัวกรองสถานะพื้นที่ที่หัวการ์ดสถานะพื้นที่ */
.cov-head { align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.cov-head h3 { margin: 0; }
.cov-filter { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-left: auto; }
.cov-filter select { width: auto; min-width: 200px; max-width: 300px; padding: 6px 10px; font-size: 13.5px; }

/* หัวตารางกดเรียงลำดับได้ */
.th-sort { border: 0; background: none; font: inherit; font-weight: 600; color: inherit; cursor: pointer; padding: 0; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.th-sort span { font-size: 10px; color: #a3b0c2; }
.th-sort.on { color: var(--navy-800); }
.th-sort.on span { color: var(--brand-2); }
.th-sort:hover span { color: var(--brand-2); }
.cov-table tfoot td.num, .kpi-table tfoot td.num { text-align: right !important; }

/* หน้าต่างยืนยันการลบ */
.dlg.confirm { width: min(94vw, 440px); }
.cf { display: grid; gap: 12px; justify-items: stretch; }
.cf-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; justify-self: center;
  color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, #fff); }
.cf h2 { text-align: center; }
.cf-body { display: grid; gap: 8px; font-size: 14px; color: var(--ink); }
.cf-body p { margin: 0; color: var(--ink-2); }
.cf-item { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; background: #f6f9fd; border: 1px solid var(--line); }
.cf-item b { color: var(--navy-800); line-height: 1.4; }
.cf-item span { font-size: 12.5px; color: var(--ink-2); }
.cf-check { display: flex !important; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); cursor: pointer;
  padding: 8px 10px; border: 1px dashed color-mix(in srgb, var(--danger) 45%, #fff); border-radius: 8px; background: #fff; }
.cf .actions { justify-content: stretch; }
.cf .actions .btn { flex: 1; justify-content: center; }
.btn.danger-solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.danger-solid:hover { filter: brightness(1.06); }
.btn.danger-solid:disabled { opacity: 1; background: #f6dcda; border-color: #efc3bf; color: #b3261e; cursor: not-allowed; filter: none; box-shadow: none; }

/* สัญลักษณ์ข้อมูลแบบจุด */
.ref-ic { background: none; border: 0; }
.ref-ic svg { display: block; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .45)); }
.ref-sw-ic { display: inline-flex; vertical-align: middle; margin: 0 5px 0 0; }
.ref-sw-ic svg { display: block; }
.layer-table select.mini { margin-left: 6px; vertical-align: middle; }
.sym-row { display: grid; grid-template-columns: minmax(160px, 220px) 1fr; gap: 12px; align-items: end; }
.sym-row[hidden] { display: none; }
.sym-preview { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px; }
.sym-preview span { display: grid; justify-items: center; gap: 2px; font-size: 11px; color: var(--ink-2); cursor: pointer; padding: 4px; border-radius: 8px; }
.sym-preview span.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }

/* เลือกสีชั้นข้อมูล */
.color-pick { display: grid; gap: 6px; align-content: start; font-size: 13px; color: var(--ink-2); }
.cp-title small { color: #b3261e; font-weight: 600; }
.cp-title small.ok { color: #0b6b45; }
.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 5px; }
.swatches .sw { position: relative; aspect-ratio: 1; min-width: 0; border-radius: 7px; border: 1px solid rgba(15, 29, 56, .18);
  background: var(--c); cursor: pointer; padding: 0; transition: transform .1s; }
.swatches .sw:hover { transform: scale(1.08); }
.swatches .sw.on { outline: 2.5px solid var(--navy-800); outline-offset: 2px; }
.swatches .sw.used::after { content: ''; position: absolute; right: -3px; top: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: #0f1d38; border: 1.5px solid #fff; }
.cp-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cp-custom { display: inline-flex !important; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.cp-custom input[type=color] { width: 30px; height: 26px; padding: 1px; border-radius: 6px; cursor: pointer; }

.layer-mgr .row { align-items: start; }

/* แผนที่ตัวอย่างก่อนนำเข้าชั้นข้อมูล */
.ly-map-wrap { display: grid; gap: 6px; }
.ly-map-wrap[hidden] { display: none; }
.ly-map-head { font-size: 13px; font-weight: 600; color: var(--navy-800); }
.ly-map-head small { font-weight: 400; color: var(--ink-2); margin-left: 4px; }
#lyMap { height: 340px; border-radius: var(--radius); border: 1px solid var(--line); }

/* ป๊อปอัป: ลำดับความพร้อม สำรวจ -> ออกแบบ -> ก่อสร้าง */
.psteps { display: flex; align-items: flex-start; margin: 4px 0 2px; }
.ps { display: grid; justify-items: center; gap: 1px; min-width: 64px; text-align: center; }
.ps i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-style: normal; font-size: 12px; font-weight: 700;
  border: 2px solid #c3cddb; color: #8c98ab; background: #fff; }
.ps.on i { background: var(--c); border-color: var(--c); color: #fff; }
.ps b { font-size: 12.5px; color: #8c98ab; font-weight: 600; }
.ps.on b { color: var(--ink); }
.ps small { font-size: 11px; color: var(--ink-2); line-height: 1.2; }
.ps-bar { flex: 1; height: 2px; background: #d3dbe6; margin-top: 11px; min-width: 14px; }
.ps-bar.on { background: var(--c); }
.pt-verdict { margin-top: 8px; padding: 6px 9px; border-radius: 8px; font-size: 13px; font-weight: 600; line-height: 1.4; }
.pt-verdict.ok { background: #e6f6ef; color: #0b6b45; }
.pt-verdict.wait { background: #e8f1fd; color: #1a5bb0; }
.pt-verdict.warn { background: #fff3e6; color: #a2470f; }
.pt-verdict.none { background: #f1f4f8; color: var(--ink-2); font-weight: 500; }
.pop-kicker2 { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); margin: 2px 0 2px; }
.po-tag { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; white-space: nowrap;
  color: color-mix(in srgb, var(--c) 75%, #0f1d38); background: color-mix(in srgb, var(--c) 14%, #fff); border: 1px solid color-mix(in srgb, var(--c) 35%, #fff); }
.pt-others { display: grid; gap: 4px; }
.po-title { font-size: 12.5px; font-weight: 600; color: var(--navy-800); }
.po-sub { font-size: 11.5px; color: var(--ink-2); margin-top: 2px; }
.po-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; padding: 4px 6px; border-radius: 7px; background: #f6f9fd; }
.po-row .link { text-align: left; font-size: 12.5px; line-height: 1.35; }
.po-yr { font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
/* คำอธิบายสัญลักษณ์: ลายเส้นทแยงของพื้นที่ออกแบบ */
.legend .pill.cov.k-both::before, .legend .pill.cov.k-design_only::before {
  background: repeating-linear-gradient(45deg, var(--c) 0 2.5px, color-mix(in srgb, var(--c) 18%, #fff) 2.5px 5px); border: 1.5px solid var(--c); opacity: 1; }
.legend .pill.cov.k-design_only::before { background: repeating-linear-gradient(-45deg, var(--c) 0 2.5px, color-mix(in srgb, var(--c) 18%, #fff) 2.5px 5px); }
.legend .pill.cov.k-survey_only::before { background: color-mix(in srgb, var(--c) 45%, #fff); border: 1.5px solid var(--c); opacity: 1; }
.legend .pill.cov.dup::before { background: repeating-linear-gradient(90deg, var(--c) 0 1.5px, #fff 1.5px 4px); border: 1.5px dashed var(--c); }

/* เมนูชั้นข้อมูล SHP บนแผนที่ (แยกตามโครงการ) */
.ref-tree { display: grid; gap: 8px; max-height: 300px; overflow: auto; margin-right: -6px; padding-right: 6px; }
.rt-grp { display: grid; gap: 1px; }
.rt-ghead { display: flex !important; align-items: center; gap: 6px; font-size: 12.5px; color: var(--navy-800); padding: 2px 0 3px;
  border-bottom: 1px solid var(--line); cursor: pointer; }
.rt-ghead b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-ghead small { color: var(--ink-2); font-weight: 400; white-space: nowrap; }
.rt-ghead { cursor: default; }
.rt-gtoggle { flex: 1; min-width: 0; display: flex; align-items: flex-start; gap: 6px; border: 0; background: none; padding: 0; margin: 0;
  font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
.rt-gtoggle:hover b { color: var(--brand); }
.rt-gtoggle small { margin-top: 1px; }
.rt-caret { flex: none; color: var(--ink-2); transition: transform .18s; margin-top: 1px; }
.rt-grp.folded .rt-caret { transform: rotate(-90deg); }
.rt-grp.folded .rt-items { display: none; }
.rt-grp.folded .rt-ghead { border-bottom-color: transparent; }
.rt-items { display: grid; gap: 1px; }
.rt-row { display: flex; align-items: center; gap: 4px; padding-left: 14px; }
.rt-row label { flex: 1; min-width: 0; display: flex !important; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink); cursor: pointer; padding: 2px 0; }
.rt-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-name small { color: var(--ink-2); }
.rt-zoom { flex: none; width: 24px; height: 24px; display: grid; place-items: center; border: 0; background: none; color: var(--ink-2); border-radius: 6px; cursor: pointer; }
.rt-zoom:hover { background: #eef3f9; color: var(--brand); }
.ref-tree input[type=checkbox] { margin: 0 2px 0 0; }
#lgRef .lg-act svg { display: block; }
.layer-table select.mini.grp { max-width: 170px; }

/* รายการชั้นข้อมูลในตั้งค่าระบบ (การ์ด แยกกลุ่มตามโครงการ) */
.layer-list { display: grid; gap: 12px; max-height: 340px; overflow: auto; padding-right: 4px; }
.ll-empty { margin: 0; padding: 12px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; }
.ll-grp { display: grid; gap: 6px; }
.ll-ghead { font-size: 13px; font-weight: 700; color: var(--navy-800); padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.ll-ghead small { font-weight: 400; color: var(--ink-2); margin-left: 4px; }
.ll-item { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: #fff; display: grid; gap: 8px; }
.ll-item:hover { border-color: #b9cde4; }
.ll-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.ll-name { font-size: 14px; color: var(--navy-800); }
.ll-meta { font-size: 12px; color: var(--ink-2); }
.ll-del { margin-left: auto; }
.ll-ctrls { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(170px, 1.4fr) minmax(130px, 1fr) auto; gap: 8px; align-items: end; }
.ll-ctrls label { display: grid; gap: 2px; font-size: 11.5px; color: var(--ink-2); min-width: 0; }
.ll-ctrls select { padding: 5px 8px; font-size: 13px; min-width: 0; }
.ll-color input[type=color] { width: 44px; height: 31px; padding: 2px; border-radius: 7px; cursor: pointer; }
@media (max-width: 640px) { .ll-ctrls { grid-template-columns: 1fr 1fr; } }

/* แถบชั้นข้อมูล SHP: ชิดซ้ายของแผนที่ ยาวเกือบเต็มความสูง ซ่อนได้ */
.ref-panel { position: absolute; left: 12px; top: 12px; bottom: 34px; z-index: 900; width: 300px; max-width: calc(100% - 90px);
  display: flex; flex-direction: column; background: rgba(255, 255, 255, .97); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.ref-panel[hidden] { display: none; }
.layout.side-collapsed .ref-panel, .layout.side-collapsed .ref-open { top: 60px; }
.rp-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 8px 14px;
  background: var(--navy-800); color: #eaf5ff; }
.rp-title { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; }
.rp-hide { display: inline-flex; align-items: center; gap: 3px; border: 0; border-radius: 7px; padding: 4px 8px; font: inherit; font-size: 12.5px;
  background: rgba(127, 220, 255, .14); color: #cfe6fb; cursor: pointer; }
.rp-hide:hover { background: rgba(127, 220, 255, .28); color: #fff; }
.ref-panel .ref-tree { flex: 1; max-height: none; overflow: auto; padding: 10px 12px 12px; margin: 0; gap: 12px; }
.ref-open { position: absolute; left: 12px; top: 12px; z-index: 900; display: inline-flex; align-items: center; gap: 7px; border: 0; border-radius: 9px;
  padding: 8px 12px; background: var(--navy-800); color: #eaf5ff; font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer; box-shadow: var(--shadow); }
.ref-open:hover { background: var(--navy-700); }
.ref-open[hidden] { display: none; }
.ref-open span { color: #9fd8f5; font-size: 12px; }
/* ชื่อโครงการ/ชั้นข้อมูลแสดงเต็ม (ขึ้นบรรทัดใหม่ได้) */
.ref-panel .rt-ghead { align-items: flex-start; font-size: 13px; padding-bottom: 5px; }
.ref-panel .rt-ghead b { white-space: normal; overflow: visible; line-height: 1.35; }
.ref-panel .rt-ghead input { margin-top: 2px; }
.ref-panel .rt-row { padding-left: 8px; align-items: flex-start; }
.ref-panel .rt-row label { align-items: flex-start; }
.ref-panel .rt-row label input, .ref-panel .rt-row label .ref-sw, .ref-panel .rt-row label .ref-sw-ic { margin-top: 3px; }
.ref-panel .rt-name { white-space: normal; overflow: visible; line-height: 1.4; }
@media (max-width: 820px) { .ref-panel { top: 12px !important; bottom: 12px; width: min(300px, calc(100% - 80px)); } }
.ref-panel .ref-tree { align-content: start; }
.ref-panel .rt-grp { align-content: start; }
.ref-tree input[type=checkbox] { flex: none; width: 14px; height: 14px; }

/* ===== จัดหน้าแผนที่ให้โล่ง ===== */
/* แถบซ้าย: แท็บ รายการงาน / ชั้นข้อมูล SHP */
.side-tabs { display: flex; gap: 2px; background: #eef3f9; border-radius: 9px; padding: 3px; min-width: 0; }
.side-tabs button { border: 0; background: transparent; border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 14px; font-weight: 600;
  color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.side-tabs button.active { background: #fff; color: var(--navy-800); box-shadow: 0 1px 3px rgba(6, 21, 58, .15); }
.side-tabs button span { font-size: 11.5px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.side-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.side-pane[hidden] { display: none; }
#paneRef .ref-tools { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 8px 14px 4px; font-size: 12px; }
#paneRef .ref-tools .link { font-size: 12.5px; }
#paneRef .ref-tree { flex: 1; max-height: none; overflow: auto; padding: 6px 14px 14px; margin: 0; gap: 14px; align-content: start; }
#paneRef .rt-ghead { align-items: flex-start; font-size: 13.5px; padding-bottom: 5px; }
#paneRef .rt-ghead b { white-space: normal; overflow: visible; line-height: 1.35; }
#paneRef .rt-row { padding-left: 8px; align-items: flex-start; }
#paneRef .rt-row label { align-items: flex-start; font-size: 13px; }
#paneRef .rt-row label input, #paneRef .rt-row label .ref-sw, #paneRef .rt-row label .ref-sw-ic { margin-top: 3px; }
#paneRef .rt-name { white-space: normal; overflow: visible; line-height: 1.4; }
#paneRef .rt-grp { align-content: start; }
/* คำอธิบายแผนที่: กล่องเดียว ย่อได้ */
.lg-one { width: 280px; max-width: 100%; display: grid; overflow: hidden; }
.lg-onehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; border: 0; background: var(--navy-800);
  color: #eaf5ff; font: inherit; font-size: 13.5px; font-weight: 600; padding: 8px 12px; cursor: pointer; text-align: left; }
.lg-onetoggle { font-size: 12px; font-weight: 500; color: #9fd8f5; }
.lg-one.collapsed { width: auto; }
.lg-one.collapsed .lg-onebody { display: none; }
.lg-one .lg-card { width: auto; box-shadow: none; background: transparent; border-radius: 0; }
.lg-one .lg-card + .lg-card { border-top: 1px solid var(--line); }
.lg-one .lg-head { padding: 8px 12px 4px; }
.lg-one .lg-card.off .lg-head { padding-bottom: 8px; }
.lg-one .lg-card.off { background: transparent; }
.lg-one #legendItems { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.lg-switch { position: relative; width: 30px; height: 17px; border-radius: 999px; background: #c3cddb; transition: background .15s; flex: none; }
.lg-switch::after { content: ''; position: absolute; left: 2px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.lg-card:not(.off) .lg-switch { background: var(--brand-2); }
.lg-card:not(.off) .lg-switch::after { left: 15px; }
.lg-one .lg-act { gap: 6px; }
/* ไอคอนจุดเล็กลงเมื่อซูมออก (ลดการทับกัน) */
.ref-small .ref-ic svg { transform: scale(.55); transform-origin: center; }
