/* ============================================================
   EQUIP CHECK — styles (มือถือแนวตั้ง + Dashboard แนวนอน)
   ============================================================ */
:root {
  --bg: #f3f5f8; --card: #ffffff; --ink: #0f172a; --ink2: #475569; --mute: #94a3b8; --line: #e2e8f0;
  --brand: #0f172a; --lime: #a3e635; --lime-d: #65a30d;
  --s1: #2563eb; --s1b: #eff6ff;   /* รับจากสำนักงาน */
  --s2: #d97706; --s2b: #fffbeb;   /* ส่งให้เจ้าหน้าที่ */
  --s3: #7c3aed; --s3b: #f5f3ff;   /* รับคืน */
  --s4: #059669; --s4b: #ecfdf5;   /* คืนสำนักงาน */
  --bad: #ef4444; --good: #16a34a; --warn: #f59e0b;
  --r: 16px; --r-s: 10px;
  --sh: 0 1px 2px rgba(15,23,42,.06), 0 4px 16px rgba(15,23,42,.06);
  --font: "IBM Plex Sans Thai", "Noto Sans Thai", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; }
body.noscroll { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { display: block; }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.muted { color: var(--ink2); }
.small { font-size: 13px; }

/* ---------- buttons / inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px;
  padding: 12px 18px; font-weight: 600; background: #e2e8f0; color: var(--ink); min-height: 46px; transition: transform .08s, filter .15s; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.lime { background: var(--lime); color: #1a2e05; }
.btn.ghost { background: transparent; color: var(--ink2); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 18px; border-radius: 16px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.accent { background: var(--acc, var(--ink)); color: #fff; }
.icon-btn { border: 0; background: transparent; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 18px; color: var(--ink2); }
.icon-btn:active { background: rgba(15,23,42,.06); }
label.f { display: block; margin: 0 0 14px; }
label.f > span { display: block; font-size: 13px; color: var(--ink2); margin-bottom: 6px; font-weight: 500; }
.in { width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 12px; padding: 12px 14px; min-height: 48px; outline: none; transition: border-color .15s, box-shadow .15s; }
.in:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,23,42,.08); }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 500; color: var(--ink2); white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.seg { display: inline-flex; background: #e9edf2; border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 7px 14px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: #eef2f6; color: var(--ink2); white-space: nowrap; }
.pill.bad { background: #fee2e2; color: #b91c1c; } .pill.good { background: #dcfce7; color: #15803d; }
.pill.warn { background: #fef3c7; color: #b45309; } .pill.mute { background: #eef2f6; color: #64748b; }
.pill.s1 { background: var(--s1b); color: var(--s1); } .pill.s2 { background: var(--s2b); color: var(--s2); }
.pill.s3 { background: var(--s3b); color: var(--s3); } .pill.s4 { background: var(--s4b); color: var(--s4); }

/* ---------- toast / modal ---------- */
#toasts { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sh); font-size: 14px; animation: tin .2s; transition: opacity .3s; }
.toast.bad { background: #b91c1c; } .toast.good { background: #15803d; }
.toast.out { opacity: 0; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.modal-wrap { position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 80; display: grid; place-items: end center; animation: fin .15s; }
@media (min-width: 640px) { .modal-wrap { place-items: center; } }
.modal-wrap.out { opacity: 0; transition: opacity .18s; }
@keyframes fin { from { opacity: 0; } }
.modal { background: #fff; width: min(100%, 460px); border-radius: 22px 22px 0 0; padding: 22px 20px calc(18px + var(--safe-b)); box-shadow: 0 -10px 40px rgba(0,0,0,.2); animation: mup .2s; }
@media (min-width: 640px) { .modal { border-radius: 20px; padding-bottom: 20px; } }
@keyframes mup { from { transform: translateY(30px); } }
.modal h3 { margin: 0 0 12px; font-size: 20px; }
.modal-body { color: var(--ink2); }
.modal-actions { display: flex; gap: 10px; margin-top: 18px; }
.modal-actions .btn { flex: 1; }

/* ============================================================
   STAFF (mobile, portrait)
   ============================================================ */
.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(243,245,248,.92); backdrop-filter: blur(10px); padding: 10px 16px 8px; display: flex; align-items: center; gap: 10px; }
.brand-dot { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); display: grid; place-items: center; color: var(--lime); font-weight: 800; font-size: 15px; flex: none; }
.topbar .ev { flex: 1; min-width: 0; border: 0; background: transparent; text-align: left; padding: 0; }
.topbar .ev b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ev span { font-size: 12px; color: var(--ink2); }
.sync { font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: #dcfce7; color: #15803d; white-space: nowrap; }
.sync.busy { background: #fef3c7; color: #b45309; } .sync.off { background: #fee2e2; color: #b91c1c; }

.view { flex: 1; padding: 4px 16px calc(96px + var(--safe-b)); }
.tabhead { display: flex; align-items: center; gap: 12px; margin: 8px 0 14px; }
.tabhead .num { width: 40px; height: 40px; border-radius: 12px; background: var(--acc); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none; }
.tabhead h2 { margin: 0; font-size: 20px; line-height: 1.2; }
.tabhead p { margin: 2px 0 0; font-size: 13px; color: var(--ink2); }
.toolbar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 12px; scrollbar-width: none; }
.toolbar::-webkit-scrollbar { display: none; }
.search { position: relative; margin-bottom: 10px; }
.search input { padding-left: 40px; }
.search::before { content: ""; position: absolute; left: 14px; top: 50%; width: 14px; height: 14px; border: 2px solid var(--mute); border-radius: 50%; transform: translateY(-60%); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.stat { background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: var(--sh); }
.stat b { display: block; font-size: 22px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink2); }

.list { display: grid; gap: 10px; }
.dcard { background: var(--card); border-radius: var(--r); box-shadow: var(--sh); padding: 12px; display: flex; gap: 12px; align-items: center; border: 2px solid transparent; transition: border-color .15s; position: relative; }
.dcard.sel { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 5%, #fff); }
.dcard .th { width: 64px; height: 64px; border-radius: 12px; background: #eef2f6 center/cover no-repeat; flex: none; display: grid; place-items: center; overflow: hidden; }
.dcard .th .pict { width: 44px; opacity: .5; }
.dcard .meta { flex: 1; min-width: 0; }
.dcard .meta b { font-size: 16px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard .meta .l2 { font-size: 13px; color: var(--ink2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcard .meta .l3 { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.dcard .chk { width: 28px; height: 28px; border-radius: 9px; border: 2px solid var(--line); flex: none; display: grid; place-items: center; color: #fff; font-size: 16px; font-weight: 800; }
.dcard.sel .chk { background: var(--acc); border-color: var(--acc); }
.dcard.done { opacity: .6; }
.prog { height: 4px; border-radius: 4px; background: #eef2f6; overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: var(--acc); }
.empty { text-align: center; color: var(--ink2); padding: 36px 20px; background: var(--card); border-radius: var(--r); border: 2px dashed var(--line); }
.empty .pict { width: 72px; margin: 0 auto 8px; opacity: .35; }
.sec-title { font-size: 13px; font-weight: 700; color: var(--ink2); margin: 18px 2px 8px; text-transform: uppercase; letter-spacing: .03em; }

.fab { position: fixed; right: max(16px, calc(50vw - 264px)); bottom: calc(86px + var(--safe-b)); z-index: 25; border: 0; background: var(--acc); color: #fff; border-radius: 18px; padding: 0 22px; height: 58px; font-weight: 700; font-size: 16px; box-shadow: 0 10px 28px color-mix(in srgb, var(--acc) 45%, transparent); display: flex; align-items: center; gap: 8px; }
.fab b { font-size: 26px; line-height: 0; font-weight: 400; }
.actionbar { position: fixed; left: 0; right: 0; bottom: calc(72px + var(--safe-b)); z-index: 25; padding: 10px 16px; display: flex; justify-content: center; pointer-events: none; }
.actionbar .btn { pointer-events: auto; width: min(100%, 528px); box-shadow: 0 10px 28px rgba(15,23,42,.25); }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding-bottom: var(--safe-b); }
.tabbar nav { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); }
.tabbar button { border: 0; background: transparent; padding: 8px 2px 9px; display: grid; justify-items: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--mute); position: relative; line-height: 1.2; }
.tabbar button .n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: #eef2f6; color: var(--mute); }
.tabbar button.on { color: var(--acc); }
.tabbar button.on .n { background: var(--acc); color: #fff; }
.tabbar button .badge { position: absolute; top: 4px; left: calc(50% + 10px); background: var(--bad); color: #fff; font-size: 10px; min-width: 17px; height: 17px; border-radius: 9px; display: grid; place-items: center; padding: 0 4px; }

/* setup screen */
.setup { min-height: 100dvh; display: flex; flex-direction: column; padding: 28px 20px calc(24px + var(--safe-b)); max-width: 520px; margin: 0 auto; }
.hero { background: var(--ink); color: #fff; border-radius: 24px; padding: 24px 22px; margin-bottom: 22px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, rgba(163,230,53,.45), transparent 70%); }
.hero small { color: var(--lime); font-weight: 700; letter-spacing: .08em; }
.hero h1 { margin: 6px 0 4px; font-size: 26px; line-height: 1.2; }
.hero p { margin: 0; color: #cbd5e1; font-size: 14px; }
.flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 16px; position: relative; z-index: 1; }
.flow div { background: rgba(255,255,255,.08); border-radius: 10px; padding: 8px 6px; font-size: 11px; text-align: center; color: #e2e8f0; }
.flow div b { display: block; width: 22px; height: 22px; border-radius: 7px; margin: 0 auto 4px; display: grid; place-items: center; color: #fff; font-size: 12px; }
.evlist { display: grid; gap: 8px; margin: 6px 0 12px; }
.evitem { display: flex; align-items: center; gap: 12px; background: #fff; border: 2px solid var(--line); border-radius: 14px; padding: 12px 14px; text-align: left; width: 100%; }
.evitem.on { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(15,23,42,.06); }
.evitem .radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.evitem.on .radio { border: 6px solid var(--ink); }
.evitem div { flex: 1; min-width: 0; }
.evitem b { display: block; }
.evitem span { font-size: 12px; color: var(--ink2); }

/* ---------- wizard ---------- */
.wiz { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; flex-direction: column; animation: wz .2s; }
@keyframes wz { from { transform: translateY(20px); opacity: 0; } }
.wiz-head { padding: 12px 16px 10px; background: #fff; border-bottom: 1px solid var(--line); }
.wiz-head .row { display: flex; align-items: center; gap: 8px; max-width: 560px; margin: 0 auto; }
.wiz-head .row b { flex: 1; font-size: 16px; }
.wiz-head .steps { max-width: 560px; margin: 10px auto 0; display: flex; gap: 4px; }
.wiz-head .steps i { flex: 1; height: 5px; border-radius: 3px; background: #e2e8f0; }
.wiz-head .steps i.done { background: var(--acc); }
.wiz-head .steps i.cur { background: color-mix(in srgb, var(--acc) 45%, #fff); }
.wiz-head .steps i.opt { background: repeating-linear-gradient(90deg, #e2e8f0 0 4px, transparent 4px 7px); }
.wiz-head .steps i.opt.done { background: var(--acc); }
.wiz-body { flex: 1; overflow-y: auto; padding: 18px 16px 24px; }
.wiz-body > div { max-width: 560px; margin: 0 auto; }
.wiz-foot { padding: 12px 16px calc(12px + var(--safe-b)); background: #fff; border-top: 1px solid var(--line); }
.wiz-foot .row { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.wiz-foot .btn { flex: 1; }
.types { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.types button { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 14px 10px 12px; display: grid; justify-items: center; gap: 4px; font-weight: 700; }
.types button .pict { width: 70px; }
.types button span { font-size: 12px; color: var(--ink2); font-weight: 500; }
.types button.on { border-color: var(--acc); background: color-mix(in srgb, var(--acc) 6%, #fff); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 15%, transparent); }
.shot-title { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.shot-title .pict { width: 64px; flex: none; background: #fff; border-radius: 14px; padding: 6px; box-shadow: var(--sh); }
.shot-title h3 { margin: 0; font-size: 22px; }
.shot-title p { margin: 2px 0 0; color: var(--ink2); font-size: 14px; }
.opt-tag { font-size: 11px; font-weight: 700; color: var(--ink2); background: #e9edf2; padding: 2px 8px; border-radius: 6px; vertical-align: middle; margin-left: 6px; }
.shot { position: relative; background: #0f172a; border-radius: 18px; overflow: hidden; aspect-ratio: 4/3; display: grid; place-items: center; }
.shot img { width: 100%; height: 100%; object-fit: contain; }
.shot .ph { color: #94a3b8; text-align: center; padding: 20px; }
.shot .ph .pict { width: 110px; margin: 0 auto 6px; }
.shot .ph .pict * { stroke: #475569; }
.shot .ref { position: absolute; right: 10px; top: 10px; width: 34%; border-radius: 10px; overflow: hidden; border: 2px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,.35); }
.shot .ref span { position: absolute; left: 0; right: 0; bottom: 0; background: rgba(15,23,42,.75); color: #fff; font-size: 10px; text-align: center; padding: 2px; }
.shot .meta { position: absolute; left: 10px; bottom: 10px; background: rgba(15,23,42,.72); color: #fff; font-size: 12px; padding: 4px 9px; border-radius: 8px; }
.cam-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 12px; }
.cam-row .btn.alt { background: #fff; border: 1.5px solid var(--line); padding: 12px 14px; }
.hint { background: #fff; border-radius: 14px; padding: 12px 14px; font-size: 13px; color: var(--ink2); margin-top: 12px; display: flex; gap: 10px; }
.hint b { color: var(--ink); }
.ocr-box { background: #fff; border-radius: 14px; padding: 14px; margin-top: 14px; box-shadow: var(--sh); }
.ocr-box .cands { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ocr-box .cands button { font-family: ui-monospace, Menlo, monospace; }
.ocr-status { font-size: 13px; color: var(--ink2); display: flex; align-items: center; gap: 8px; }
.spin { width: 16px; height: 16px; border: 2.5px solid #cbd5e1; border-top-color: var(--ink); border-radius: 50%; animation: sp .8s linear infinite; flex: none; }
@keyframes sp { to { transform: rotate(360deg); } }
.recap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.recap div { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: var(--sh); position: relative; }
.recap img, .recap .no { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #eef2f6; }
.recap .no { display: grid; place-items: center; color: var(--mute); font-size: 12px; }
.recap span { display: block; font-size: 11.5px; padding: 5px 7px; font-weight: 600; }

/* photo grid in device sheet */
.pgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.pcell { background: #fff; border-radius: 14px; overflow: hidden; box-shadow: var(--sh); }
.pcell .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: #e2e8f0; }
.pcell .pair.one { grid-template-columns: 1fr; }
.pcell .im { aspect-ratio: 4/3; background: #eef2f6 center/cover no-repeat; position: relative; border: 0; padding: 0; }
.pcell .im.none { display: grid; place-items: center; color: var(--mute); font-size: 11px; }
.pcell .im .flag, .vw-strip .flag, .sumgrid .flag { position: absolute; right: 5px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px #fff; }
.pcell .cap { padding: 7px 9px; font-size: 12px; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.pcell .cap b { font-size: 13px; }
.pcell .cap button { border: 0; background: #eef2f6; border-radius: 8px; font-size: 11px; padding: 4px 8px; font-weight: 600; }

/* sheet (device detail) */
.sheet { position: fixed; inset: 0; z-index: 45; background: var(--bg); overflow-y: auto; animation: wz .2s; }
.sheet-head { position: sticky; top: 0; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 12px; display: flex; align-items: center; gap: 8px; z-index: 2; }
.sheet-head b { flex: 1; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-body { padding: 16px; max-width: 560px; margin: 0 auto; padding-bottom: calc(40px + var(--safe-b)); }
.kv { background: #fff; border-radius: 14px; box-shadow: var(--sh); padding: 4px 14px; margin-bottom: 16px; }
.kv div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 14px; }
.kv div:last-child { border: 0; }
.kv span { color: var(--ink2); }
.kv b { text-align: right; font-weight: 600; word-break: break-all; }

/* summary cards (tab 4) */
.scard { background: #fff; border-radius: 18px; box-shadow: var(--sh); overflow: hidden; border: 2px solid transparent; }
.scard.sel { border-color: var(--s4); }
.scard .sh { display: flex; align-items: center; gap: 10px; padding: 12px 12px 10px; }
.scard .sh .meta { flex: 1; min-width: 0; }
.scard .sh b { display: block; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scard .sh span { font-size: 12px; color: var(--ink2); }
.sumgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2px; background: #e2e8f0; border-top: 1px solid #e2e8f0; border-bottom: 1px solid #e2e8f0; }
.sumgrid .cell { background: #fff; position: relative; border: 0; padding: 0; text-align: left; }
.sumgrid .ba { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; }
.sumgrid .ba > div { aspect-ratio: 4/3; background: #eef2f6 center/cover no-repeat; position: relative; }
.sumgrid .ba > div svg.bx { position: absolute; inset: 0; width: 100%; height: 100%; }
.sumgrid .lb { font-size: 11px; padding: 4px 7px; font-weight: 600; color: var(--ink2); display: flex; justify-content: space-between; }
.sumgrid .cell.flagged .lb { color: var(--bad); }
.scard .sf { display: flex; gap: 8px; padding: 10px 12px; align-items: center; }
.scard .sf .btn { min-height: 40px; padding: 8px 12px; font-size: 14px; }
.scard .sf .grow { flex: 1; }
.cmp-run { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--sh); font-size: 14px; }
.cmp-run .grow { flex: 1; }

/* ============================================================
   VIEWER
   ============================================================ */
.viewer { position: fixed; inset: 0; z-index: 100; background: #0b1120; color: #e2e8f0; display: flex; flex-direction: column; animation: fin .15s; user-select: none; }
.vw-top { display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.vw-title { flex: 1; min-width: 0; }
.vw-title b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; }
.vw-title span { font-size: 12px; color: #94a3b8; }
.viewer .seg { background: #1e293b; }
.viewer .seg button { color: #94a3b8; padding: 6px 11px; font-size: 13px; }
.viewer .seg button.on { background: #fff; color: var(--ink); }
.viewer .icon-btn { color: #fff; background: #1e293b; }
.vw-panes { flex: 1; display: flex; gap: 3px; min-height: 0; }
.vw-panes.two { flex-direction: row; }
@media (orientation: portrait) { .vw-panes.two { flex-direction: column; } }
.zp { flex: 1; position: relative; overflow: hidden; touch-action: none; background: #020617; cursor: grab; min-height: 0; }
.zl { position: absolute; transform-origin: center center; will-change: transform; }
.zl img, .zl canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.zl svg.bx { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
svg.bx rect { fill: rgba(239,68,68,.08); stroke: #ef4444; stroke-width: 2.5; vector-effect: non-scaling-stroke; }
svg.bx.off { display: none; }
.stage-tag { position: absolute; left: 8px; top: 8px; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 7px; background: var(--s1); color: #fff; transform: scale(var(--inv, 1)); transform-origin: top left; }
.stage-tag.after { background: var(--s3); }
.stage-tag.r { left: auto; right: 8px; transform-origin: top right; }
.vw-wipe { display: none; align-items: center; gap: 10px; padding: 8px 16px; font-size: 12px; color: #94a3b8; }
.viewer.is-wipe .vw-wipe { display: flex; }
.vw-wipe input { flex: 1; accent-color: var(--lime); }
.vw-bottom { padding: 8px 12px calc(10px + var(--safe-b)); display: grid; gap: 8px; }
.vw-info { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: #cbd5e1; }
.vw-info .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--s1); }
.vw-info .dot.after { background: var(--s3); }
.vw-info .bad { color: #fca5a5; font-weight: 700; } .vw-info .good { color: #86efac; font-weight: 700; } .vw-info .warn { color: #fcd34d; }
.vw-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.viewer .chip { background: #1e293b; border-color: #1e293b; color: #cbd5e1; }
.viewer .chip.on { background: #fee2e2; border-color: #fee2e2; color: #b91c1c; }
.vw-strip { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.vw-strip button { flex: none; width: 74px; border: 2px solid transparent; background: #1e293b; border-radius: 10px; padding: 0; overflow: hidden; position: relative; color: #cbd5e1; }
.vw-strip button.on { border-color: var(--lime); }
.vw-strip img { width: 100%; aspect-ratio: 4/3; object-fit: cover; }
.vw-strip span { display: block; font-size: 10.5px; padding: 2px 0; }

/* ============================================================
   DASHBOARD (landscape, responsive)
   ============================================================ */
.dash { min-height: 100vh; display: flex; flex-direction: column; }
.dbar { position: sticky; top: 0; z-index: 30; background: var(--ink); color: #fff; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.dbar .logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .04em; }
.dbar .logo i { width: 30px; height: 30px; border-radius: 9px; background: var(--lime); color: var(--ink); display: grid; place-items: center; font-style: normal; font-size: 14px; }
.dbar select { background: #1e293b; color: #fff; border: 0; border-radius: 10px; padding: 8px 12px; min-width: 220px; max-width: 360px; }
.dbar .grow { flex: 1; }
.dbar .who { font-size: 13px; color: #94a3b8; }
.dbar .btn { min-height: 36px; padding: 6px 12px; font-size: 13px; background: #1e293b; color: #e2e8f0; }
.dtools { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: sticky; top: 56px; z-index: 25; }
.dtools .search { margin: 0; width: 260px; }
.dtools .search .in { min-height: 38px; padding-top: 6px; padding-bottom: 6px; }
.dstats { display: flex; gap: 8px; flex-wrap: wrap; }
.dstat { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 5px 12px; font-size: 12px; color: var(--ink2); display: flex; align-items: baseline; gap: 6px; cursor: pointer; }
.dstat b { font-size: 18px; color: var(--ink); }
.dstat.on { border-color: var(--ink); background: var(--ink); color: #cbd5e1; }
.dstat.on b { color: #fff; }
.dwrap { flex: 1; overflow: auto; padding: 0 0 30px; }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; font-size: 13px; }
table.grid th { position: sticky; top: 0; z-index: 3; background: #f8fafc; color: var(--ink2); font-weight: 600; text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-size: 12px; }
table.grid td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; background: #fff; }
table.grid tr:hover td { background: #fbfdff; }
table.grid .sticky { position: sticky; left: 0; z-index: 2; box-shadow: 1px 0 0 var(--line); }
table.grid th.sticky { z-index: 4; }
.devcell { width: 230px; min-width: 230px; }
.devcell b { font-size: 15px; display: block; }
.devcell .l2 { color: var(--ink2); font-size: 12px; }
.devcell .l3 { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }
.devcell .sn { font-size: 11.5px; color: var(--ink2); margin-top: 4px; word-break: break-all; }
.pc { width: 150px; min-width: 150px; }
.pc .stk { display: grid; gap: 4px; }
.pc .ph { position: relative; border: 0; padding: 0; background: #eef2f6; border-radius: 9px; overflow: hidden; aspect-ratio: 4/3; width: 100%; display: block; }
.pc .ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.pc .ph:hover img { transform: scale(1.05); }
.pc .ph .tag { position: absolute; left: 4px; top: 4px; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; background: var(--s1); color: #fff; }
.pc .ph .tag.after { background: var(--s3); }
.pc .ph .flag { position: absolute; right: 5px; top: 5px; background: var(--bad); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; }
.pc .who { font-size: 10.5px; color: var(--ink2); line-height: 1.3; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc .none { aspect-ratio: 4/3; border-radius: 9px; border: 1.5px dashed var(--line); display: grid; place-items: center; color: #cbd5e1; font-size: 11px; }
.pc.na { background: #fafbfc !important; }
.statuscol { width: 170px; min-width: 150px; }
.statuscol .row { font-size: 12px; color: var(--ink2); margin-top: 4px; }
.dash-actions { display: flex; gap: 6px; margin-top: 8px; }
.dash-actions button { font-size: 11.5px; padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 600px at 80% -10%, rgba(163,230,53,.25), transparent), var(--ink); }
.login form { background: #fff; border-radius: 24px; padding: 30px 28px; width: min(100%, 380px); box-shadow: 0 30px 80px rgba(0,0,0,.4); }
.login h1 { margin: 10px 0 2px; font-size: 24px; }
.login p { margin: 0 0 20px; color: var(--ink2); font-size: 14px; }
.login .err { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0 8px; }
.dempty { padding: 60px 20px; text-align: center; color: var(--ink2); }
@media (max-width: 760px) {
  .dbar { padding: 10px 12px; } .dtools { padding: 8px 12px; top: 0; position: static; }
  .dbar select { min-width: 0; flex: 1; } .dtools .search { width: 100%; }
  .devcell { width: 170px; min-width: 170px; } .pc { width: 120px; min-width: 120px; }
}

/* pictograms */
.pict { display: block; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pict .f { fill: color-mix(in srgb, var(--acc, #2563eb) 18%, transparent); }
.pict .d { stroke-dasharray: 3 4; opacity: .5; }
.pict .hl { fill: rgba(239,68,68,.2); stroke: var(--bad); }
.pcell button.im { width: 100%; display: grid; place-items: center; color: var(--ink2); font-size: 12px; font-weight: 600; }
.pcell button.im.none { background: #f8fafc; border: 2px dashed var(--line); border-radius: 14px 14px 0 0; }
.pcell button.im .pict { margin: 0 auto; }
