/* ============================================================
   แจ้งซ่อม / งานช่าง + ไฟล์แนบ (ภาพย่อ และหน้าดูเต็มจอ)
   ============================================================ */

/* ---------- รายการแจ้งซ่อม ---------- */
.rp-list{display:flex;flex-direction:column;gap:10px;margin-bottom:26px}
.rp-card{display:flex;gap:14px;align-items:flex-start;width:100%;text-align:left;background:var(--surface);border:1px solid var(--line-soft);
  border-left:4px solid var(--accent);border-radius:14px;padding:14px 16px;cursor:pointer;box-shadow:var(--shadow);font:inherit;color:inherit;
  transition:border-color .15s,transform .2s}
.rp-card:hover{border-color:var(--accent);transform:translateY(-1px)}
.rp-card.st-new{border-left-color:var(--gold)}
.rp-card.st-waiting{border-left-color:var(--gold)}
.rp-card.st-done{border-left-color:var(--ok)}
.rp-card.st-cancelled{border-left-color:var(--line);opacity:.75}
.rp-card.urgent{border-left-color:#C0392B}
.rp-ic{flex:0 0 auto;width:42px;height:42px;border-radius:12px;display:grid;place-items:center;background:var(--accent-soft);color:var(--accent-ink)}
.rp-ic svg{width:22px;height:22px;stroke-width:1.8}
.rp-ic.big{width:52px;height:52px;border-radius:14px}
.rp-ic.big svg{width:26px;height:26px}
.rp-main{flex:1;min-width:0;display:flex;flex-direction:column;gap:4px}
.rp-top{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.rp-top b{font-size:14.5px;color:var(--ink)}
.rp-loc{display:flex;align-items:center;gap:5px;font-size:13px;color:var(--ink-2)}
.rp-loc svg{width:13px;height:13px;flex:0 0 auto;color:var(--ink-3)}
.rp-det{font-size:13px;color:var(--ink-2);overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.rp-meta{font-size:12px;color:var(--ink-3)}
.rp-hist{margin-top:10px}
.rq-row{display:flex;gap:10px;align-items:center}
.rq-row .rp-card{flex:1}
.rq-take{flex:0 0 auto}
.rq-tiles{margin-bottom:16px}
.st-tile.hot{border-color:var(--gold);background:color-mix(in srgb,var(--gold) 8%,var(--surface))}
.st-tile.hot b{color:var(--gold)}
.rq-tabs{margin-bottom:16px}
@media (max-width:640px){.rq-row{flex-direction:column;align-items:stretch}}

/* ---------- ขั้นตอนงาน ---------- */
.rp-steps{display:flex;gap:4px;margin:6px 0 2px}
.rp-steps span{flex:1;display:flex;flex-direction:column;gap:5px;font-size:11px;color:var(--ink-3);text-align:center}
.rp-steps i{display:block;height:5px;border-radius:999px;background:var(--surface-2)}
.rp-steps .past i{background:color-mix(in srgb,var(--accent) 45%,var(--surface-2))}
.rp-steps .on{color:var(--accent-ink);font-weight:600}
.rp-steps .on i{background:var(--accent)}
.rp-steps.cx span{color:var(--ink-3)}
.rp-steps.cx i{background:var(--line)}

/* ---------- ฟอร์มแจ้งซ่อม ---------- */
.rp-cats{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}
.rp-cats button{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 6px;border:1px solid var(--line);border-radius:12px;
  background:var(--surface);color:var(--ink-2);font:inherit;font-size:12.5px;cursor:pointer;text-align:center;line-height:1.35}
.rp-cats button svg{width:24px;height:24px;stroke-width:1.7;color:var(--ink-3)}
.rp-cats button:hover{border-color:var(--accent)}
.rp-cats button[aria-pressed="true"]{border-color:var(--accent);background:var(--accent-soft);color:var(--accent-ink);font-weight:600}
.rp-cats button[aria-pressed="true"] svg{color:var(--accent-ink)}
@media (max-width:520px){.rp-cats{grid-template-columns:repeat(2,1fr)}}
.rp-pics,.rp-pics-in{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.rp-pic{position:relative;width:84px;height:84px;border-radius:10px;overflow:hidden;background:var(--surface-2)}
.rp-pic img{width:100%;height:100%;object-fit:cover;display:block}
.rp-pic button{position:absolute;top:3px;right:3px;width:22px;height:22px;border-radius:50%;border:0;background:rgba(0,0,0,.6);color:#fff;cursor:pointer;line-height:1;font-size:15px}
.rp-addpic{width:84px;height:84px;border:1.5px dashed var(--line);border-radius:10px;background:none;color:var(--ink-3);cursor:pointer;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font:inherit;font-size:11px}
.rp-addpic:hover{border-color:var(--accent);color:var(--accent-ink)}
.rp-addpic svg{width:24px;height:24px;stroke-width:1.7}
.rp-addpic[hidden]{display:none}

/* ---------- รายละเอียดงาน ---------- */
.rp-head{display:flex;gap:12px;align-items:center;margin-bottom:10px}
.rp-head b{display:block;font-size:16px;margin-bottom:3px}
.rp-infos{display:flex;flex-direction:column;border:1px solid var(--line-soft);border-radius:12px;margin:14px 0}
.rp-info{display:grid;grid-template-columns:150px 1fr;gap:10px;padding:9px 12px;border-bottom:1px solid var(--line-soft);font-size:13.5px}
.rp-info:last-child{border-bottom:0}
.rp-info span{display:flex;align-items:center;gap:6px;color:var(--ink-3)}
.rp-info span svg{width:14px;height:14px;flex:0 0 auto}
.rp-info b{font-weight:500;color:var(--ink);white-space:pre-wrap;overflow-wrap:anywhere}
@media (max-width:520px){.rp-info{grid-template-columns:1fr;gap:2px}}
.rp-h{font-size:14px;font-weight:600;margin:18px 0 8px}
.rp-acts{margin-top:18px;padding:14px;border:1px solid var(--line);border-radius:14px;background:var(--surface-2)}
.rp-acts h4{margin:0 0 10px;font-size:14px}
.rp-btns{display:flex;gap:8px;flex-wrap:wrap}
.rp-done{margin-top:14px;padding-top:14px;border-top:1px dashed var(--line)}
.rp-done h5{margin:0 0 8px;font-size:13.5px;font-weight:600}
.rp-finish{margin-top:10px}
.rp-note{margin-top:16px;display:flex;flex-direction:column;gap:6px}
.rp-note label{font-size:13px;color:var(--ink-2);font-weight:500}
.rp-note textarea{width:100%;border:1px solid var(--line);background:var(--surface-2);border-radius:10px;padding:9px 12px;font:inherit;font-size:14px;color:var(--ink);resize:vertical}
.rp-note .btn{align-self:flex-start}
.rp-log{list-style:none;margin:0;padding:0 0 0 14px;border-left:2px solid var(--line-soft);display:flex;flex-direction:column;gap:10px}
.rp-log li{font-size:13px;color:var(--ink-2);position:relative}
.rp-log li::before{content:"";position:absolute;left:-20px;top:6px;width:10px;height:10px;border-radius:50%;background:var(--accent);box-shadow:0 0 0 3px var(--surface)}
.rp-log b{color:var(--ink)}
.rp-log em{font-style:normal;color:var(--ink-3);margin-left:6px;font-size:12px}
.rp-log p{margin:3px 0 0;white-space:pre-wrap}

/* ---------- ไฟล์แนบ: ภาพย่อ ---------- */
.att-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:8px;margin-top:10px}
.att-th{display:flex;flex-direction:column;border:1px solid var(--line-soft);border-radius:10px;overflow:hidden;background:var(--surface);
  cursor:zoom-in;padding:0;font:inherit;color:inherit;text-align:left;transition:border-color .15s,transform .2s}
.att-th:hover{border-color:var(--accent);transform:translateY(-1px)}
.att-th > img,.att-pdf{display:block;width:100%;aspect-ratio:4/3;object-fit:cover;background:var(--surface-2)}
.att-pdf{display:flex;align-items:flex-start;justify-content:center;overflow:hidden}
.att-pdf canvas{width:100%;height:auto;display:block}
.att-pdf i{align-self:center;color:var(--ink-3)}
.att-pdf i svg{width:30px;height:30px;stroke-width:1.5}
.att-cap{display:flex;flex-direction:column;gap:1px;padding:6px 8px 7px;position:relative}
.att-cap svg{display:none}
.att-cap b{font-size:11.5px;font-weight:500;color:var(--ink);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.att-cap em{font-style:normal;font-size:10.5px;color:var(--ink-3)}
/* ในฟอร์ม */
.att-list{display:flex;flex-direction:column;gap:6px;margin-bottom:8px}
.att-row{display:flex;align-items:center;gap:10px;border:1px solid var(--line);border-radius:10px;padding:7px 8px 7px 12px;background:var(--surface-2)}
.att-row > svg{width:20px;height:20px;flex:0 0 auto;color:var(--accent-ink);stroke-width:1.7}
.att-row span{flex:1;min-width:0;display:flex;flex-direction:column}
.att-row b{font-size:13px;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.att-row em{font-style:normal;font-size:11.5px;color:var(--ink-3)}
.att-none{font-size:12.5px;color:var(--ink-3);padding:4px 0}

/* ---------- ดูเต็มจอ ---------- */
dialog.lb{width:calc(100vw / var(--zoom));height:var(--screen-h);max-width:none;max-height:none;margin:0;border-radius:0;
  background:rgba(6,10,9,.96);color:#fff;padding:0;overflow:hidden}
dialog.lb::backdrop{background:rgba(0,0,0,.7)}
dialog.lb:fullscreen{width:100%;height:100%}
.lb-top{position:absolute;inset:0 0 auto 0;display:flex;align-items:center;gap:6px;padding:10px 12px;z-index:3;
  background:linear-gradient(180deg,rgba(0,0,0,.55),transparent)}
.lb-title{flex:1;min-width:0;display:flex;flex-direction:column}
.lb-title b{font-size:14px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.lb-title span{font-size:12px;color:rgba(255,255,255,.7)}
.lb-btn{width:40px;height:40px;border-radius:50%;border:0;background:rgba(255,255,255,.12);color:#fff;display:grid;place-items:center;cursor:pointer}
.lb-btn:hover{background:rgba(255,255,255,.22)}
.lb-btn svg{width:19px;height:19px;stroke-width:1.9}
.lb-stage{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;overflow:hidden;touch-action:none;cursor:zoom-in}
.lb-stage.zoomed{cursor:grab}
.lb-stage.zoomed:active{cursor:grabbing}
.lb-item{display:flex;align-items:center;justify-content:center;width:100%;height:100%;padding:64px 64px 70px;transform-origin:center center;will-change:transform}
.lb-item > img,.lb-item > canvas{max-width:100%;max-height:100%;width:auto;height:auto;object-fit:contain;box-shadow:0 10px 40px rgba(0,0,0,.5);background:#fff;user-select:none;-webkit-user-drag:none}
.lb-err{color:rgba(255,255,255,.8);font-size:14px}
.lb-load{position:absolute;color:rgba(255,255,255,.7);font-size:13px}
.lb-load[hidden]{display:none}
.lb-nav{position:absolute;top:50%;transform:translateY(-50%);z-index:3;width:48px;height:48px;border-radius:50%;border:0;
  background:rgba(255,255,255,.14);color:#fff;display:grid;place-items:center;cursor:pointer}
.lb-nav:hover{background:rgba(255,255,255,.26)}
.lb-nav svg{width:24px;height:24px;stroke-width:2}
.lb-nav.prev{left:12px}
.lb-nav.next{right:12px}
.lb-nav[hidden]{display:none}
.lb-zoom{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);z-index:3;display:flex;align-items:center;gap:4px;
  background:rgba(0,0,0,.55);border-radius:999px;padding:4px}
.lb-zoom button{border:0;background:none;color:#fff;min-width:36px;height:32px;border-radius:999px;font:inherit;font-size:18px;cursor:pointer}
.lb-zoom button:hover{background:rgba(255,255,255,.14)}
.lb-zoom button.fit{font-size:12.5px;padding:0 10px}
.lb-zoom span{font-size:12px;min-width:46px;text-align:center;color:rgba(255,255,255,.85)}
@media (max-width:640px){.lb-item{padding:58px 6px 64px}.lb-nav{width:40px;height:40px}.lb-nav.prev{left:4px}.lb-nav.next{right:4px}}

/* ---------- แบบใหม่: 2 ขั้นตอน กดจบงานได้จากรายการ ---------- */
.rp-big{display:flex;align-items:center;gap:12px;width:100%;text-align:left;margin-bottom:22px;padding:16px 18px;cursor:pointer;
  border:1.5px dashed var(--accent);border-radius:16px;background:var(--accent-soft);color:var(--accent-ink);font:inherit}
.rp-big:hover{background:color-mix(in srgb,var(--accent) 16%,var(--surface))}
.rp-big svg{width:24px;height:24px;stroke-width:2;flex:0 0 auto}
.rp-big span{display:flex;flex-direction:column;gap:2px;font-size:12.5px;color:var(--ink-2)}
.rp-big b{font-size:15.5px;color:var(--ink)}
.rp-item{display:flex;align-items:center;gap:10px;background:var(--surface);border:1px solid var(--line-soft);border-left:4px solid var(--line);
  border-radius:14px;padding:10px 14px 10px 12px;box-shadow:var(--shadow)}
.rp-item.st-new{border-left-color:var(--gold)}
.rp-item.st-accepted,.rp-item.st-in_progress,.rp-item.st-waiting{border-left-color:var(--accent)}
.rp-item.st-done{border-left-color:var(--ok)}
.rp-item.st-cancelled{opacity:.7}
.rp-item.urgent{border-left-color:#C0392B}
.rp-open{flex:1;display:flex;align-items:center;gap:12px;min-width:0;background:none;border:0;padding:6px 0;font:inherit;color:inherit;text-align:left;cursor:pointer}
.rp-title{font-size:15px;font-weight:600;color:var(--ink);display:flex;align-items:center;gap:6px;flex-wrap:wrap}
.rp-quick{flex:0 0 auto;white-space:nowrap}
.rp-quick svg{width:15px;height:15px;stroke-width:2.4}
.rp-meta{display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:12px;color:var(--ink-3)}
.rp-meta svg{width:12px;height:12px;vertical-align:-2px;margin-right:2px}
.rq-sum{font-size:13px;color:var(--ink-2);margin-bottom:14px}
.rq-sum b{font-size:18px;color:var(--accent-ink);font-family:"Prompt",sans-serif}
.rp-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:6px}
.rp-head > div{flex:1;min-width:0}
.rp-head b{display:block;font-size:17px}
.rp-head span{font-size:13px;color:var(--ink-3)}
.rp-acts{display:flex;flex-wrap:wrap;gap:10px;margin-top:18px;padding:14px;border-radius:14px;background:var(--surface-2);border:1px solid var(--line)}
.rp-extra{flex:1 0 100%;display:flex;justify-content:space-between;gap:10px;flex-wrap:wrap}
.rp-logbox{margin-top:18px}
.rp-logbox summary{cursor:pointer;font-size:13px;color:var(--accent-ink)}
.rp-logbox .rp-log{margin-top:12px}
@media (max-width:640px){.rp-item{flex-wrap:wrap}.rp-quick{width:100%;justify-content:center}}

/* ---------- ฟอร์มตามแบบเดิม (Google Form) ---------- */
.rp-form .req{color:#C0392B;font-weight:600}
.rp-intro{margin:6px 0 -4px;padding:12px 14px;border-radius:10px;background:var(--surface-2);font-size:14px;color:var(--ink);font-weight:500}
.rp-intro.sub{background:none;padding:8px 0 0;border-top:1px solid var(--line-soft);border-radius:0;font-size:13px;color:var(--ink-3);font-weight:400}
.rp-radios{display:flex;flex-direction:column;gap:4px}
.rp-radio{display:flex !important;align-items:center;gap:12px;padding:9px 12px;margin:0 !important;border-radius:10px;cursor:pointer;font-weight:400 !important;font-size:14.5px !important;color:var(--ink) !important}
.rp-radio:hover{background:var(--surface-2)}
.rp-radio input{width:20px;height:20px;margin:0;accent-color:var(--accent);flex:0 0 auto}
.rp-radio:has(input:checked){background:var(--accent-soft)}
.rx-presets{flex-wrap:wrap}

/* ---------- ตารางประวัติการซ่อม (ใช้คลาส lt-* ร่วมกับตารางยืม-คืน ใน lend.css) ---------- */
.rpt-tools{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin:22px 0 14px}
.rpt-tools .rq-tabs{margin:0}
.rpt-q{flex:1 1 240px;min-width:0;border:1px solid var(--line);background:var(--surface);border-radius:12px;padding:10px 14px;font:inherit;font-size:14px;color:var(--ink)}
.rpt-q:focus{outline:none;border-color:var(--accent)}
.rpt .lt-items{min-width:220px}
.rpt .lt-items em{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.rpt .lt-items .pill{vertical-align:1px}
.rpt-note{color:var(--ok) !important}
.rpt-note svg{width:11px;height:11px;stroke-width:3;vertical-align:-1px;margin-right:3px}
.rpt-pics{display:flex;align-items:center;gap:4px}
.rpt-after{display:flex;gap:4px;padding-left:6px;margin-left:2px;border-left:2px solid var(--ok)}
.rpt-th{position:relative;width:46px;height:46px;padding:0;border:1px solid var(--line-soft);border-radius:8px;overflow:hidden;cursor:zoom-in;background:var(--surface-2);flex:0 0 auto;
  transition:transform .2s cubic-bezier(.34,1.56,.64,1),box-shadow .2s}
.rpt-th:hover{transform:scale(1.12);box-shadow:var(--shadow-lift);z-index:1}
.rpt-th img{width:100%;height:100%;object-fit:cover;display:block}
.rpt-th em{position:absolute;inset:0;display:grid;place-items:center;background:rgba(0,0,0,.5);color:#fff;font-style:normal;font-size:12px;font-weight:600}
.rpt-none{color:var(--ink-3)}
.rpt-done{white-space:nowrap}
.rpt-done svg{width:14px;height:14px;stroke-width:2.6}
.rpt .rp-state{white-space:nowrap}

/* ===== รุ่น 2: สถานะ 3 ขั้น · รับงาน · รายงานผลพร้อมรูป · แผงสรุป ===== */
.rp-state.fix{background:rgba(47,99,214,.12);color:#2F63D6}
.rp-state.hold{background:var(--gold-soft);color:var(--gold)}
.rpt-accept{border-color:#E0892B;color:#B8650F;font-weight:600;gap:6px}
.rpt-accept:hover{background:#FDF0E3}
.rpt-accept svg,.rpt-done svg{width:16px;height:16px}
.rp-acth{flex:1 0 100%;margin:0 0 2px;font-size:14px;color:var(--ink-2)}
.rp-donebox{border-color:var(--accent)}
.rp-donebox textarea{flex:1 0 100%;border:1px solid var(--line);border-radius:10px;padding:9px 11px;font:inherit;font-size:14px;background:var(--surface);color:var(--ink);resize:vertical}
.rp-shot{flex:1 0 100%;display:flex;align-items:center;gap:14px;padding:16px;border:2px dashed var(--accent);border-radius:14px;background:var(--accent-soft);color:var(--accent-ink);cursor:pointer;text-align:left;font:inherit}
.rp-shot svg{width:34px;height:34px;flex:none;stroke-width:1.8}
.rp-shot span{display:flex;flex-direction:column;font-size:12.5px;color:var(--ink-2)}
.rp-shot b{font-size:16px;color:var(--ink)}
.rp-donebox .rp-pics{flex:1 0 100%}
.rp-yr{flex-direction:row;flex-wrap:wrap}
.rp-yr .rp-radio{flex:1 1 40%}
/* แผงสรุปสถานะ — การ์ดตัวเลข (ไม่ใช่กราฟแท่ง) */
.rq-dash{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:0 0 12px}
.rq-tile{position:relative;display:grid;grid-template-columns:auto 1fr;grid-template-rows:auto auto auto;column-gap:12px;align-items:center;text-align:left;
  padding:16px 16px 14px 20px;border-radius:16px;border:1px solid var(--line);background:var(--surface);cursor:pointer;font:inherit;color:var(--ink);overflow:hidden;
  transition:border-color .15s,box-shadow .15s,transform .15s}
.rq-tile::before{content:"";position:absolute;left:0;top:0;bottom:0;width:5px;background:var(--tc)}
.rq-tile:hover{transform:translateY(-2px);box-shadow:0 8px 20px -10px rgba(0,0,0,.25)}
.rq-tile.on{border-color:var(--tc);box-shadow:0 0 0 2px var(--tc) inset}
.rq-ti{grid-row:1 / span 2;width:44px;height:44px;border-radius:12px;display:grid;place-items:center;background:var(--tc);color:#fff}
.rq-ti svg{width:24px;height:24px;stroke-width:2}
.rq-tn{font-family:"Prompt",sans-serif;font-size:34px;font-weight:600;line-height:1}
.rq-tl{font-size:14px;font-weight:600}
.rq-ts{grid-column:1 / span 2;font-size:12px;color:var(--ink-3);margin-top:6px}
.rq-tile.t-new{--tc:#E0892B}
.rq-tile.t-fixing{--tc:#2F63D6}
.rq-tile.t-waiting{--tc:#A87A1F}
.rq-tile.t-done{--tc:#1D7A4C}
.rq-facts{display:flex;flex-wrap:wrap;gap:8px 18px;align-items:center;font-size:13px;color:var(--ink-2);margin:0 0 10px}
.rq-facts b{font-family:"Prompt",sans-serif;font-size:16px;color:var(--ink);margin-right:3px}
.rq-urgent{border:1px solid rgba(192,57,43,.4);background:rgba(192,57,43,.08);color:#C0392B;border-radius:99px;padding:3px 12px;font:inherit;font-size:13px;cursor:pointer}
.rq-urgent b{color:#C0392B}
.rq-techs{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 16px}
.rq-tech{display:flex;flex-direction:column;padding:8px 12px;border-radius:12px;background:var(--surface-2);border:1px solid var(--line);font-size:13px}
.rq-tech em{font-style:normal;font-size:12px;color:var(--ink-3)}
@media (max-width:760px){.rq-dash{grid-template-columns:1fr 1fr}.rq-tn{font-size:28px}}
.rp-state.wait{background:rgba(224,137,43,.14);color:#B8650F}
