/* tokens — ธีม Windows 11 + แดง PMK (#ed1b24 จากโลโก้) · sidebar แดง (แบบ B, เจ้าของ OK 2026-11-20) */
:root {
  --red: #ed1b24; --red-d: #c4141c; --red-dd: #9e1017; --red-l: #fdecec; --red-ll: #fff6f6; --red-soft: #fbd5d7;
  --mica: #f3f3f3; --layer: #fbfbfb; --card: #fff; --line: #e5e5e5; --line2: #d1d1d1; --row: #efefef;
  --text: #1a1a1a; --muted: #616161; --hover: rgba(0,0,0,.04);
  --zebra: #fafafa; --ok: #0f7b0f; --warn: #9d5d00; --bad: #c42b1c;
  --r: 4px; --r2: 8px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Segoe UI Variable Text", "Segoe UI", "Leelawadee UI", Sarabun, Tahoma, sans-serif; font-size: 14px; color: var(--text); background: var(--mica); }
a { color: var(--red-d); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 1px; }

/* form — ขีดล่างแดงเมื่อโฟกัสแบบ Windows */
label { display: block; font-size: 13px; margin: 12px 0 6px; }
input, select, textarea { width: 100%; min-height: 32px; padding: 5px 10px; border: 1px solid var(--line2); border-bottom-color: #8a8a8a; border-radius: var(--r); font: inherit; background: var(--card); color: var(--text); }
input:hover, select:hover, textarea:hover { background: #f9f9f9; }
input:focus, select:focus, textarea:focus { outline: 0; background: #fff; border-bottom: 2px solid var(--red); padding-bottom: 4px; }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--red); vertical-align: middle; }
input[type=file] { padding: 4px; }
input:disabled, select:disabled { background: #f5f5f5; color: var(--muted); border-bottom-color: var(--line2); }
input.invalid, select.invalid, textarea.invalid { border-color: var(--bad); border-bottom: 2px solid var(--bad); background: #fdf3f2; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.err-text { color: var(--bad); font-size: 12px; margin-top: 4px; min-height: 0; }
.err-text:empty { display: none; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.note.lead { margin: -6px 0 14px; }
.center { text-align: center; }
.right { margin-top: 14px; text-align: right; }

/* alerts — InfoBar แบบ Windows */
.alert { padding: 9px 14px; border-radius: var(--r); font-size: 13px; margin-bottom: 12px; border: 1px solid; }
.alert.error { background: #fde7e9; border-color: #f4b8bd; color: #6b1a12; }
.alert.success { background: #dff6dd; border-color: #b6e3b2; color: #0b4f0b; }
.alert.warn { background: #fff4ce; border-color: #f3d38a; color: #5c3b00; }
.alert.info { background: #f2f2f2; border-color: var(--line); color: var(--text); margin-top: 14px; }

/* buttons (ไม่มีเงา) — .btn = ปุ่มหลักสีแดง, .ghost = ปุ่มรองแบบ Windows */
.btn { min-height: 32px; border: 1px solid var(--red); border-radius: var(--r); padding: 0 14px; font: inherit; cursor: pointer; background: var(--red); color: #fff; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--red-d); border-color: var(--red-d); text-decoration: none; }
.btn:active { background: var(--red-dd); border-color: var(--red-dd); color: #fde3e4; }
.btn.block { width: 100%; justify-content: center; margin-top: 18px; min-height: 36px; }
.btn.ghost { background: var(--card); color: var(--text); border-color: var(--line2); }
.btn.ghost:hover { background: #f6f6f6; }
.btn.ghost:active { background: #f0f0f0; color: var(--muted); }
.btn.sm { min-height: 26px; padding: 0 10px; font-size: 13px; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { background: #a52317; border-color: #a52317; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icon-btn { background: none; border: 0; color: inherit; cursor: pointer; padding: 4px; border-radius: var(--r); }
.icon-btn:hover { background: var(--hover); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; background:
  radial-gradient(1200px 600px at 10% 10%, #ffd9db 0%, transparent 60%),
  radial-gradient(900px 600px at 90% 90%, #ffc2c5 0%, transparent 55%), #f6eeee; }
.login-box { width: 100%; max-width: 400px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: var(--r2); padding: 32px; }
.login-box .logo { height: 34px; display: block; margin-bottom: 18px; }
.login-box h1 { margin: 0 0 4px; font-size: 22px; font-weight: 600; }
.login-box p.sub { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.debug { white-space: pre-wrap; font-size: 11px; background: #f3f3f3; padding: 8px; border-radius: var(--r); }

/* titlebar — หัวหน้าต่างแบบ Windows */
.titlebar { position: sticky; top: 0; z-index: 40; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--red-dd); color: #fff; }
.titlebar .logo { height: 24px; background: #fff; padding: 3px 6px; border-radius: var(--r); display: block; }
.titlebar .tt { font-size: 12px; color: var(--red-soft); white-space: nowrap; }
.titlebar .search { margin: 0 auto; width: min(420px, 40vw); position: relative; }
.titlebar .search input { padding-left: 32px; min-height: 30px; border-color: transparent; }
.titlebar .search .ico { position: absolute; left: 10px; top: 8px; width: 14px; height: 14px; color: var(--muted); }

/* shell — sidebar แดง */
.shell { display: flex; min-height: calc(100vh - 48px); background: var(--red-d); }
.side { width: 250px; flex-shrink: 0; position: sticky; top: 48px; align-self: flex-start; height: calc(100vh - 48px); overflow-y: auto; display: flex; flex-direction: column; padding: 4px 8px 8px; background: linear-gradient(180deg, var(--red-dd), var(--red-d)); color: #fff; }
.ucard { display: flex; gap: 12px; align-items: center; padding: 12px 10px 16px; }
.uinfo { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ucard small { display: block; color: var(--red-soft); font-size: 12px; font-weight: 400; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #fff; color: var(--red-d); display: grid; place-items: center; font-weight: 600; font-size: 17px; flex-shrink: 0; }
.nav { flex: 1; }
.nav a { position: relative; display: flex; gap: 12px; align-items: center; min-height: 36px; padding: 0 12px; border-radius: var(--r); color: #fff; text-decoration: none; margin-bottom: 2px; }
.nav a .ico { color: var(--red-soft); }
.nav a:hover { background: rgba(255,255,255,.10); }
.nav a.on { background: rgba(255,255,255,.18); font-weight: 600; }
.nav a.on::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: #fff; }
.nav a.on .ico { color: #fff; }
.nav .grp { font-size: 12px; color: var(--red-soft); padding: 14px 12px 4px; }
.side-foot { margin-top: 8px; }
.side-foot form { margin: 0; }
.side-foot .icon-btn { width: 100%; display: flex; gap: 12px; align-items: center; min-height: 36px; padding: 0 12px; color: #fff; font: inherit; text-align: left; }
.side-foot .icon-btn:hover { background: rgba(255,255,255,.10); }
.side-foot .icon-btn .ico { color: var(--red-soft); }
.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.main { flex: 1; min-width: 0; padding: 24px 28px; background: var(--layer); border-top-left-radius: var(--r2); }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head h2 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.2px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions form { margin: 0; }

/* chips */
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 3px 10px; font-size: 12px; color: var(--muted); text-decoration: none; }
a.chip:hover { border-color: var(--line2); text-decoration: none; }
.chip b { color: var(--text); margin-left: 4px; }
.chip.on { border-color: var(--red); background: var(--red-ll); color: var(--red-d); }
.chip.on b { color: var(--red-d); }
.chip.warn { border-color: #f3d38a; background: #fff8e6; }
.chip.warn b { color: var(--warn); }

/* filters (แถวเดียว) */
.filters { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.filters input, .filters select { width: auto; min-width: 130px; }
.filters input.q { flex: 1; min-width: 180px; }
.filters label.chk { display: flex; gap: 6px; align-items: center; margin: 0; font-size: 13px; white-space: nowrap; }
.filters label.chk input { width: 16px; min-width: 0; }

/* card / table */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); overflow: auto; }
.card.pad { padding: 18px 20px; }
.card.empty, td.empty { color: var(--muted); text-align: center; padding: 24px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--row); white-space: nowrap; vertical-align: top; }
th { background: var(--card); font-weight: 600; font-size: 12px; color: var(--muted); }
tbody tr:nth-child(even) { background: var(--zebra); }
tbody tr:hover { background: var(--red-ll); }
tbody tr.row-warn { background: #fff8e6; }
td.no, th.no { width: 56px; text-align: center; color: var(--muted); }
td small { display: block; color: var(--muted); font-size: 12px; }
td small.warn-text { color: var(--warn); }
td small.bad-text { color: var(--bad); }
tbody tr.row-bad { background: #fdf3f2; }
.chip.bad { border-color: #f4b8bd; background: #fdf3f2; }
.chip.bad b { color: var(--bad); }
/* picker: ช่องค้นหาผู้ใช้แล้วเลือกจากรายชื่อ */
.field.picker { position: relative; }
.picker-list { position: absolute; left: 0; right: 0; z-index: 20; margin-top: 2px; background: #fff; border: 1px solid var(--line); border-radius: var(--r2); max-height: 280px; overflow: auto; box-shadow: 0 8px 16px rgba(0,0,0,.14); }
.picker-item { display: block; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--row); background: #fff; padding: 7px 10px; font: inherit; cursor: pointer; }
.picker-item:last-child { border-bottom: 0; }
.picker-item small { display: block; color: var(--muted); font-size: 12px; }
.picker-item.on, .picker-item:hover { background: var(--red-ll); }
.picker-item:disabled { cursor: not-allowed; color: var(--muted); background: #f9f9f9; }
.picker-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.picker-picked { color: var(--ok); }
/* progress */
.progress { height: 4px; background: #e0e0e0; border-radius: 999px; overflow: hidden; width: 90px; display: inline-block; vertical-align: middle; margin-right: 6px; }
.progress i { display: block; height: 100%; background: var(--red); border-radius: 999px; }
/* steps */
.steps { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.steps div { padding: 4px 12px; border-radius: var(--r); background: #ebebeb; color: var(--muted); font-size: 12px; }
.steps div.on { background: var(--red); color: #fff; }
.steps div.done { background: var(--red-l); color: var(--red-d); }
td.wrap { white-space: normal; min-width: 240px; }
td select { width: 170px; min-height: 28px; padding: 2px 6px; }
td.row-actions { display: flex; gap: 4px; }
td.row-actions form { margin: 0; }
input[readonly] { background: #f5f5f5; color: var(--muted); }
.badge { display: inline-block; padding: 1px 8px; border-radius: var(--r); font-size: 12px; }
.badge.ok { background: #dff6dd; color: var(--ok); }
.badge.warn { background: #fff4ce; color: var(--warn); }
.badge.bad { background: #fde7e9; color: var(--bad); }
.badge.gray { background: #f0f0f0; color: var(--muted); }
.pager { display: flex; justify-content: space-between; padding: 8px 12px; font-size: 12px; color: var(--muted); }
.pager .pages a, .pager .pages b { margin-left: 8px; }
.pager .pages b { color: var(--red-d); }

/* home apps */
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; }
.app { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 16px; text-decoration: none; color: inherit; display: flex; gap: 12px; align-items: center; }
.app:hover { background: #fafafa; border-color: var(--line2); text-decoration: none; }
.app .aico { width: 40px; height: 40px; border-radius: var(--r2); background: var(--red-l); color: var(--red); display: grid; place-items: center; }
.app b { display: block; font-weight: 600; }
.app small { color: var(--muted); }

/* dialog — ContentDialog แบบ Windows (กล่องมีเงาได้ ปุ่มไม่มีเงา) */
dialog { border: 1px solid var(--line); border-radius: var(--r2); padding: 0; width: min(680px, calc(100% - 32px)); box-shadow: 0 32px 64px rgba(0,0,0,.19), 0 2px 21px rgba(0,0,0,.15); }
dialog::backdrop { background: rgba(0,0,0,.3); }
.dlg-h { padding: 18px 24px 6px; font-size: 18px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.dlg-h .icon-btn { color: var(--muted); }
.dlg-b { padding: 4px 24px 18px; max-height: 70vh; overflow: auto; }
.dlg-f { padding: 16px 24px; background: var(--mica); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }
.dlg-f .btn { min-width: 110px; justify-content: center; }
.secret { font-family: Consolas, monospace; background: #fff4ce; padding: 10px; border-radius: var(--r); word-break: break-all; font-size: 16px; letter-spacing: 1px; }

/* layout helpers */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid2 > *, .grid3 > *, .two-col > * { min-width: 0; }
.sec { font-weight: 600; font-size: 14px; color: var(--text); margin: 18px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.sec:first-child { margin-top: 4px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 10px; font-size: 13px; margin-top: 10px; }
.kv span { color: var(--muted); }

/* ฟอร์มระบบลูก: ตรวจหาค่าอัตโนมัติ + ค่าขั้นสูงแบบพับ */
.discover-box { background: var(--layer); border: 1px solid var(--line); border-radius: var(--r2); padding: 2px 14px 12px; margin-top: 12px; }
.discover-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.discover-actions select { width: auto; min-height: 26px; padding: 2px 8px; font-size: 13px; }
.discover-msg { margin: 0; }
.discover-msg:empty { display: none; }
details.adv { margin-top: 12px; border: 1px solid var(--line); border-radius: var(--r2); padding: 0 14px; }
details.adv > summary { cursor: pointer; padding: 10px 0; font-size: 13px; color: var(--muted); list-style-position: inside; }
details.adv[open] { padding-bottom: 12px; }
details.adv[open] > summary { color: var(--text); font-weight: 600; }

/* ปุ่มไอคอนในตาราง + ตัดข้อความยาว */
td.act, th.act { width: 1%; white-space: nowrap; text-align: right; }
td.act form { display: inline; margin: 0; }
.acts { display: inline-flex; gap: 4px; align-items: center; justify-content: flex-end; }
.acts form { margin: 0; }
.ibtn { width: 30px; height: 28px; display: inline-grid; place-items: center; border: 1px solid var(--line2); border-radius: var(--r); background: var(--card); color: var(--text); cursor: pointer; padding: 0; text-decoration: none; }
.ibtn .ico { width: 15px; height: 15px; }
.ibtn:hover { background: #f3f3f3; text-decoration: none; }
.ibtn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.ibtn.primary:hover { background: var(--red-d); border-color: var(--red-d); }
.ibtn.danger:hover { background: #fde7e9; border-color: #f4b8bd; color: var(--bad); }
.ibtn.on { background: var(--red-ll); border-color: var(--red); color: var(--red-d); }
.clip { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.clip.w160 { max-width: 160px; }
.clip.w280 { max-width: 280px; }
.clip.w180 { max-width: 180px; }
.clip.w190 { max-width: 190px; }
.tbl-roles td select { width: 150px; }
td small.wrap-sm { white-space: normal; max-width: 240px; }
th.wrap-h { white-space: normal; }
.two-col.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
td.wrap.org-name { min-width: 130px; }
td.wrap.narrow { min-width: 120px; }

/* app icon — ไอคอนตัวย่อของระบบ (โทนสีตาม id) */
.app-ico { width: 48px; height: 48px; border-radius: 10px; background: linear-gradient(135deg, var(--red), var(--red-dd)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; letter-spacing: .5px; flex-shrink: 0; }
.app-ico.tone-1 { background: linear-gradient(135deg, #f97316, #c2410c); }
.app-ico.tone-2 { background: linear-gradient(135deg, #e11d48, #9f1239); }
.app-ico.tone-3 { background: linear-gradient(135deg, #d97706, #92400e); }
.app-ico.tone-4 { background: linear-gradient(135deg, #7f1d1d, #450a0a); }
.app-ico.gray { background: #bdbdbd; }
.app-ico.sm { width: 28px; height: 28px; border-radius: 6px; font-size: 11px; }
.app-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.app-title .note { margin: 2px 0 0; }
.app-cell { display: flex; gap: 10px; align-items: center; color: inherit; }
.app-cell:hover { text-decoration: none; }
.app-cell:hover b { color: var(--red-d); }
.app-cell b { font-weight: 600; }
.app-cell small { display: block; color: var(--muted); font-size: 12px; }

/* home app card */
.apps2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 12px; }
.app2 { position: relative; display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); color: inherit; text-decoration: none; overflow: hidden; transition: border-color .15s, transform .15s, box-shadow .15s; }
.app2::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--red), var(--red-dd)); }
a.app2:hover { border-color: var(--red); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(158,16,23,.12); text-decoration: none; }
.app2-top { display: flex; gap: 14px; align-items: flex-start; padding: 18px 16px 14px; flex: 1; }
.app2-t { flex: 1; min-width: 0; }
.app2-t b { display: block; font-size: 15px; font-weight: 600; line-height: 1.35; }
.app2-t small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app2-go { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); flex-shrink: 0; transition: background .15s, color .15s; }
a.app2:hover .app2-go { background: var(--red); color: #fff; }
.app2-foot { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; padding: 10px 16px; border-top: 1px solid var(--row); background: var(--zebra); font-size: 12px; color: var(--muted); }
.app2-foot .sp { flex: 1; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: var(--ok); margin-right: 4px; }
.app2.off { opacity: .8; }
.app2.off::before { background: #d1d1d1; }
@media (prefers-reduced-motion: reduce) { .app2, .app2-go { transition: none; } a.app2:hover { transform: none; } }

/* tabs แบบ Windows (Pivot) */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: thin; }
.tabs a { position: relative; padding: 10px 14px; color: var(--muted); white-space: nowrap; text-decoration: none; border-radius: var(--r) var(--r) 0 0; }
.tabs a:hover { color: var(--text); background: var(--hover); text-decoration: none; }
.tabs a.on { color: var(--text); font-weight: 600; }
.tabs a.on::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; border-radius: 3px; background: var(--red); }
.tabs a.tab-danger.on::after { background: var(--bad); }
.sub-head { margin-top: -4px; }
.sub-head h3 { margin: 0; font-size: 15px; font-weight: 600; }

/* stats ของระบบ */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r2); padding: 12px 14px; color: inherit; }
a.stat:hover { border-color: var(--line2); text-decoration: none; }
.stat span { display: block; font-size: 12px; color: var(--muted); }
.stat b { font-size: 20px; font-weight: 600; }
.stat small { color: var(--muted); font-size: 12px; margin-left: 4px; }
.card-h { padding: 12px 14px 8px; font-weight: 600; font-size: 14px; }
.check-res { margin-top: 6px; }
.check-res td { white-space: normal; }
.check-res td.lv { width: 24px; text-align: center; }
.lv-ok, .ok-t { color: var(--ok); }
.lv-warn, .warn-t { color: var(--warn); }
.lv-bad, .bad-t { color: var(--bad); }
.kv2 { display: grid; grid-template-columns: 190px minmax(0, 1fr) auto; font-size: 13px; }
.kv2 > * { padding: 8px 0; border-bottom: 1px solid var(--row); display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: wrap; }
.kv2 > span:first-child, .kv2 > span:nth-child(3n+1) { color: var(--muted); }
.kv2 > form { margin: 0; justify-content: flex-end; }
.kv2 > .btn { margin: 6px 0 6px 8px; align-self: center; }
.kv2 code, td code, small code { font-family: Consolas, monospace; font-size: 12.5px; background: #f5f5f5; padding: 2px 6px; border-radius: 3px; overflow-wrap: anywhere; }

/* danger zone */
.danger-zone { border: 1px solid #f4b8bd; border-radius: var(--r2); background: var(--card); max-width: 860px; }
.dz-row { display: flex; gap: 14px; align-items: center; padding: 14px 16px; border-bottom: 1px solid #fbe0e2; }
.dz-row:last-child { border-bottom: 0; }
.dz-row > div { flex: 1; min-width: 0; }
.dz-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.dz-row form { margin: 0; }
@media (max-width: 760px) {
  .kv2 { grid-template-columns: minmax(0, 1fr) auto; }
  .kv2 > span:nth-child(3n+1) { grid-column: 1 / -1; padding-bottom: 0; border-bottom: 0; }
  .dz-row { flex-direction: column; align-items: stretch; }
  .app-ico { width: 40px; height: 40px; font-size: 14px; }
}

/* responsive — ปุ่มเมนู ☰ + drawer บนมือถือ */
.nav-btn { display: none; background: none; border: 0; color: #fff; width: 36px; height: 36px; border-radius: var(--r); cursor: pointer; place-items: center; flex-shrink: 0; }
.nav-btn:hover { background: rgba(255,255,255,.12); }
.nav-btn .ico { width: 20px; height: 20px; }
.nav-backdrop { display: none; }
@media (max-width: 1100px) {
  .side { width: 220px; }
  .main { padding: 20px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .titlebar { gap: 8px; padding: 0 8px; }
  .titlebar .tt { display: none; }
  .titlebar .search { width: auto; flex: 1; margin: 0; min-width: 0; }
  .nav-btn { display: grid; }
  .shell { display: block; background: var(--layer); min-height: calc(100vh - 48px); }
  .side { position: fixed; top: 0; left: 0; z-index: 60; width: min(290px, 85vw); height: 100vh; height: 100dvh; transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.3); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.4); }
  body.nav-open { overflow: hidden; }
  .main { padding: 14px 12px; border-radius: 0; }
  .head h2 { font-size: 20px; }
  .head .actions { width: 100%; }
  .filters input, .filters select, .filters input.q { flex: 1 1 140px; min-width: 0; }
  .grid2, .grid3, .two-col { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 100px 1fr; }
  .pager { flex-wrap: wrap; gap: 6px; }
  dialog { width: calc(100% - 16px); }
  .dlg-h, .dlg-b, .dlg-f { padding-left: 16px; padding-right: 16px; }
  .login-box { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
