/* ธีมแดงสหไทย + โครงเมนูซ้าย (คอม) / เมนูล่าง (มือถือ) — ใช้ร่วม index.html และ accounts.html */
:root{--brand:#e32227;--brand-dk:#b3141a;--brand-dkr:#8c0f14;--brand-lt:#fdecec;--brand-ln:#f3b9bb;
 --accent:var(--brand);--accent-2:var(--brand-lt);--bg:#edf0f5;--card:#fff;--line:#e6e9f0;--ink:#1f2430;--muted:#6b7280;--pending:#d96a00;--shadow:0 1px 3px rgba(31,36,48,.07)}
html{-webkit-text-size-adjust:100%}
[hidden]{display:none!important}
body{font-size:15px;background:var(--bg)!important;color:var(--ink)}
/* ---------- โครงหน้า ---------- */
body{display:block!important;height:100%}
.shell{display:flex;gap:14px;padding:14px;height:100%;box-sizing:border-box}
.side{flex:0 0 244px;display:flex;flex-direction:column;gap:12px;min-height:0;overflow:auto}
.content{flex:1 1 0;min-width:0;display:flex;flex-direction:column;background:#f8f9fc;border-radius:26px;box-shadow:var(--shadow);overflow:hidden}
.sidebrand{background:#fff;border-radius:22px;padding:12px 14px;display:flex;align-items:center;gap:10px;box-shadow:var(--shadow)}
.sidebrand .lg{height:42px;width:auto;display:block}
.sidebrand .lg-sa{width:42px;border-radius:11px}
.sidebrand .lg-gp{max-width:150px;object-fit:contain}
.usercard,.sidenote{border-radius:22px;padding:14px;box-shadow:var(--shadow)}
.usercard{background:#fff;display:flex;flex-direction:column;gap:6px}
.sidenote{background:var(--brand-lt);color:var(--brand-dk);font-size:12.5px;line-height:1.6}
.userchip{display:flex;flex-direction:column;gap:2px;font-size:13px;align-items:flex-start}
.userchip .ulinks{display:flex;gap:12px;margin-top:4px}
.userchip .lnk{border:0;background:none;color:var(--brand-dk);text-decoration:underline;padding:0;font:inherit;cursor:pointer}
.rt{font-size:11px;color:#b3141a}.rt.on{color:#2f9e44}
.usercard .ctl{flex-direction:column;align-items:stretch;gap:4px}
/* ---------- เมนูแท็บ (แนวตั้งทางซ้าย) ---------- */
.tabs{display:flex!important;flex-direction:column;gap:4px;background:#f8f9fc;border:0!important;border-radius:22px;padding:10px;box-shadow:var(--shadow);overflow:visible!important}
.tabs button{display:flex;align-items:center;gap:10px;border:0;background:none;padding:11px 14px;border-radius:16px;text-align:left;color:#4b5563;font-weight:500;border-bottom:0!important;white-space:nowrap}
.tabs button::before{content:"";width:20px;height:20px;flex:none;background-size:contain;background-repeat:no-repeat;background-position:center}
.tabs button[aria-selected="true"]{background:#fff;color:var(--ink);font-weight:700;box-shadow:0 1px 4px rgba(31,36,48,.1)}
.tabs .cnt{margin-left:auto;background:var(--brand);color:#fff;border-radius:999px;font-size:11px;font-weight:700;padding:1px 8px}
.tabs [data-t="detail"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238A93A3%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 6v16l7-4 8 4 7-4V2l-7 4-8-4-7 4z%22/%3E%3Cpath d=%22M8 2v16M16 6v16%22/%3E%3C/svg%3E")}
.tabs [data-t="detail"][aria-selected="true"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E32227%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M1 6v16l7-4 8 4 7-4V2l-7 4-8-4-7 4z%22/%3E%3Cpath d=%22M8 2v16M16 6v16%22/%3E%3C/svg%3E")}
.tabs [data-t="queue"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238A93A3%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M22 12h-6l-2 3h-4l-2-3H2%22/%3E%3Cpath d=%22M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z%22/%3E%3C/svg%3E")}
.tabs [data-t="queue"][aria-selected="true"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E32227%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M22 12h-6l-2 3h-4l-2-3H2%22/%3E%3Cpath d=%22M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z%22/%3E%3C/svg%3E")}
.tabs [data-t="mine"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238A93A3%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z%22/%3E%3Cpath d=%22M14 2v6h6M8 13h8M8 17h6%22/%3E%3C/svg%3E")}
.tabs [data-t="mine"][aria-selected="true"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E32227%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Cpath d=%22M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z%22/%3E%3Cpath d=%22M14 2v6h6M8 13h8M8 17h6%22/%3E%3C/svg%3E")}
.tabs [data-t="history"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238A93A3%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpath d=%22M12 6v6l4 2%22/%3E%3C/svg%3E")}
.tabs [data-t="history"][aria-selected="true"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E32227%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Ccircle cx=%2212%22 cy=%2212%22 r=%2210%22/%3E%3Cpath d=%22M12 6v6l4 2%22/%3E%3C/svg%3E")}
/* ---------- หัวเว็บ (แถบบนของเนื้อหา) ---------- */
header{display:flex;align-items:center;flex-wrap:wrap;gap:10px 14px;padding:18px 24px 6px;background:transparent!important;color:var(--ink);border:0!important;box-shadow:none!important;position:relative;z-index:30}
.brand{display:flex;align-items:center;gap:10px;min-width:0;text-decoration:none;color:var(--ink)}
.brand .tt{display:flex;flex-direction:column;line-height:1.2;min-width:0}
.brand .tt b,header h1{font-size:26px;font-weight:700;margin:0;color:var(--ink)}
.brand .tt small{font-size:13px;color:var(--muted)}
header .proto{background:#fff4e0;color:#7a4b00;border-color:#f0c88a}
.bell{background:#fff!important;color:#4b5563;border:0!important;border-radius:999px!important;padding:9px 16px!important;box-shadow:var(--shadow);font-weight:500}
.bell .n{background:var(--brand);color:#fff}
.btn{background:var(--brand);border-color:var(--brand);font-weight:500;border-radius:12px}
.btn:hover{background:var(--brand-dk);border-color:var(--brand-dk)}
.btn.ghost{background:#fff;color:var(--brand-dk);border-color:var(--brand)}
.btn.ghost:hover{background:var(--brand-lt)}
.btn.warn{color:#8c0f14;border-color:#8c0f14}
/* ---------- แถบเครื่องมือและแผง ---------- */
.toolbar{background:transparent!important;border:0!important;padding:8px 24px;gap:8px 12px}
.seg{border:0;border-radius:999px;box-shadow:var(--shadow);background:#fff}
.seg button{border:0!important;background:transparent;padding:7px 16px;border-radius:999px;color:var(--ink)}
.seg button[aria-pressed="true"]{background:var(--brand);color:#fff}
.search,.ctl select,form input,form select,form textarea{border:1px solid #dde1ea;border-radius:12px}
.search{border-radius:999px;padding:8px 16px;box-shadow:var(--shadow);border-color:transparent}
.search:focus,form input:focus,form select:focus,form textarea:focus,.ctl select:focus{outline:2px solid var(--brand-ln);border-color:var(--brand)}
.chip{border-color:transparent;box-shadow:var(--shadow);border-radius:999px}
main{padding:0 14px 14px;gap:14px}
#maps{padding:0;gap:14px}
.pane,aside{border:0!important;border-radius:22px!important;box-shadow:var(--shadow);background:#fff}
.pane .overview:hover{background:var(--brand-lt)}
aside{border-left:0}
details.guide,.box.info{background:var(--brand-lt);border-color:var(--brand-ln)}
.req{border-radius:16px;border-color:var(--line)}
button:focus-visible,a:focus-visible,summary:focus-visible{outline:3px solid #ffb4b6;outline-offset:2px}
/* ---------- หน้าเข้าสู่ระบบ ---------- */
#login form,#pwBox form{border-top:6px solid var(--brand);border-radius:20px}
.lg-head{display:flex;align-items:center;gap:12px;margin-bottom:6px}
.lg-head img{height:54px;width:auto}
.lg-head .lg-sa{width:54px;border-radius:11px}
/* ---------- หน้า accounts.html ---------- */
body > header{background:#fff!important;margin:14px;border-radius:22px;box-shadow:var(--shadow);padding:12px 20px}
body > header .brand .tt b{font-size:17px}
body > header .lg{height:40px;width:auto}body > header .lg-sa{width:40px;border-radius:10px}
body > header a{color:var(--brand-dk)}
/* ---------- มือถือ/แท็บเล็ต ---------- */
@media (max-width:900px){
  html,body{height:auto;min-height:100%}
  .shell{display:block;padding:8px 8px 84px;height:auto}
  .side{display:block;overflow:visible}
  .sidebrand{margin-bottom:8px}
  .usercard{margin-bottom:8px}
  .sidenote{display:none}
  .content{border-radius:20px;overflow:visible}
  /* เมนูล่าง */
  .tabs{position:fixed!important;left:8px;right:8px;bottom:8px;z-index:40;flex-direction:row;gap:2px;padding:6px;border-radius:22px;background:#fff;box-shadow:0 4px 18px rgba(31,36,48,.25)}
  .tabs button{flex:1 1 0;flex-direction:column;gap:2px;padding:7px 2px;font-size:11.5px;min-width:0;white-space:normal;text-align:center;position:relative}
  .tabs .cnt{position:absolute;top:2px;right:18%;margin:0;padding:0 6px}
  main{display:block;padding:0 8px 8px}
  #maps{min-height:0!important}
  .pane{flex:none;height:44vh;min-height:300px;margin-bottom:10px}
  aside{width:auto;max-width:none;min-height:0}
  #panelBody{overflow:visible;padding-bottom:20px}
  header{padding:14px 14px 4px}
  .brand .tt b,header h1{font-size:20px}
  .toolbar{padding:8px 12px}
  .search{flex:1 1 100%;min-width:0}
  .legend{overflow-x:auto;flex-wrap:nowrap;max-width:100%;padding-bottom:2px}
  .chip{white-space:nowrap}
  .pane .cap{display:none}
  #notif{position:fixed;left:8px;right:8px;top:70px;width:auto}
}
@media (max-width:600px){
  .sidebrand .lg{height:38px}.sidebrand .lg-sa{width:38px}
  .brand .tt small{font-size:12px}
  header .proto{font-size:11px;padding:2px 8px}
  .seg button{padding:9px 14px}
  .btn,.seg button,.bell{min-height:42px}
  .row2{grid-template-columns:1fr}
  input,select,textarea,.search{font-size:16px!important}
  .req .top{flex-direction:column}
  table.kv th{width:36%}
}
@media print{.side,.toolbar,.tabs{display:none}.shell{display:block}}

/* ---- โมดูล 2: ใบผ่านขนของ ---- */
.tabs [data-t="gate"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%238A93A3%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%221%22 y=%223%22 width=%2215%22 height=%2213%22/%3E%3Cpath d=%22M16 8h4l3 3v5h-7z%22/%3E%3Ccircle cx=%225.5%22 cy=%2218.5%22 r=%222.5%22/%3E%3Ccircle cx=%2218.5%22 cy=%2218.5%22 r=%222.5%22/%3E%3C/svg%3E")}
.tabs [data-t="gate"][aria-selected="true"]::before{background-image:url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2224%22 height=%2224%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%23E32227%22 stroke-width=%222%22 stroke-linecap=%22round%22 stroke-linejoin=%22round%22%3E%3Crect x=%221%22 y=%223%22 width=%2215%22 height=%2213%22/%3E%3Cpath d=%22M16 8h4l3 3v5h-7z%22/%3E%3Ccircle cx=%225.5%22 cy=%2218.5%22 r=%222.5%22/%3E%3Ccircle cx=%2218.5%22 cy=%2218.5%22 r=%222.5%22/%3E%3C/svg%3E")}
.gchip{display:inline-block;font-size:11.5px;padding:2px 9px;border-radius:999px;border:1px solid #d6dae3;background:#f3f5f9;color:#4a5160;white-space:nowrap}
.gchip.ok{background:#e6f4ea;border-color:#9fd1ae;color:#216a36}.gchip.done{background:#e8eefc;border-color:#a9bdea;color:#2b4a9a}
.gchip.bad{background:var(--brand-lt);border-color:#f1b3b5;color:#9d1218}.gchip.wait{background:#fff4de;border-color:#f0cf8e;color:#8a5a00}
.gchip.off{background:#eee;color:#777}.gchip.rs{background:#fff;border-color:#f1b3b5;color:#9d1218}.gchip.in{background:#eaf6ff;border-color:#a8d3f0;color:#1a5d8a}.gchip.out{background:#fff1e6;border-color:#f3c79c;color:#8a4a0a}
.gpc{border:1px solid var(--line,#e3e6ee);border-radius:14px;padding:11px 13px;margin:10px 0;background:#fff;box-shadow:0 1px 3px rgba(20,30,60,.05)}
.gtop{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-bottom:3px}
.glines{margin:6px 0 4px;padding-left:18px;font-size:13px}.glines li{margin:2px 0}
.gtrail{margin-top:6px;border-top:1px dashed #dde1ea;padding-top:5px;font-size:12px;color:#556}.grs{margin-top:4px;font-size:12px}
.gact{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}.gqr{margin-top:8px;text-align:center}.gqr svg{border:1px solid #e3e6ee;border-radius:10px}
.gph{display:flex;gap:6px;flex-wrap:wrap;margin-top:6px}.gph img{width:72px;height:72px;object-fit:cover;border-radius:8px;border:1px solid #e3e6ee}
.gh{font-size:14px;margin:16px 0 4px}.seg2{display:flex;gap:16px}.seg2 label{display:inline-flex;gap:5px;align-items:center}
.f2{display:grid;grid-template-columns:1fr 1fr;gap:8px}.gpf input,.gpf select,.gpf textarea{width:100%;box-sizing:border-box}.gpf input[name=prox]{margin-bottom:5px}
.gline{display:grid;grid-template-columns:1fr 64px 112px 34px;gap:5px;margin-bottom:5px}
.gcnt{display:grid;grid-template-columns:1fr 92px 54px;gap:8px;align-items:center;padding:8px 0;border-bottom:1px solid #eef0f5}.gcnt input{font-size:18px;text-align:center}
.gfind{display:flex;gap:6px;flex-wrap:wrap;margin:8px 0}.gfind input{flex:1 1 160px;font-size:16px}
.box.warn{background:#fff4de;border-color:#f0cf8e}
@media(max-width:600px){.gline{grid-template-columns:1fr 56px 96px 32px}.f2{grid-template-columns:1fr}}
.gpf input[type=radio],.gpf input[type=checkbox]{width:auto;margin:0}
.gline{grid-template-columns:minmax(0,1fr) 58px 104px 34px}.gline>*{min-width:0}.gline .btn{padding:0}
.seg2 label{white-space:nowrap}

/* ---- แท็บที่ไม่ใช่ "รายละเอียดพื้นที่": ซ่อนแปลน/3D ให้พื้นที่ทำงานเต็มจอ ---- */
body[data-tab]:not([data-tab="detail"]) .toolbar,
body[data-tab]:not([data-tab="detail"]) #maps{display:none!important}
body[data-tab]:not([data-tab="detail"]) aside{width:auto;max-width:none;flex:1;min-height:0}
body[data-tab]:not([data-tab="detail"]) #panelBody{width:100%;max-width:1040px;margin:0 auto}
