/* ============================================================
   PSF Helpdesk — หลังบ้าน
   ภาษาภาพเดียวกับใบแจ้งงาน แต่แน่นกว่า อ่านเร็วกว่า
   ============================================================ */

:root {
  --ink:        #16202b;
  --ink-soft:   #55636f;
  --ink-faint:  #8c98a2;
  --board:      #dde2dd;
  --paper:      #fbfbf9;
  --rule:       #c4ccc6;
  --amber:      #e0a92a;
  --signal:     #c0392b;
  --go:         #12796c;
  --radius:     3px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--board);
  color: var(--ink);
  font-family: "Sarabun", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.mono   { font-family: "IBM Plex Mono", monospace; }
.stencil {
  font-family: "Bai Jamjuree", sans-serif;
  font-weight: 600; font-size: 10.5px;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--amber);
}

a { color: var(--ink); }
.lnk { color: var(--ink-soft); text-decoration: none; font-size: 14px; }
.lnk:hover { color: var(--ink); text-decoration: underline; }

/* ---------- แถบบน ---------- */

.topbar { background: var(--ink); color: var(--paper); border-bottom: 4px solid var(--amber); }
.topbar__in {
  max-width: 1180px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand {
  font-family: "Bai Jamjuree", sans-serif; font-weight: 700; font-size: 18px;
  color: var(--paper); text-decoration: none;
  display: flex; align-items: baseline; gap: 9px;
}
.topbar__right { display: flex; align-items: center; gap: 16px; }
.topbar__right .lnk { color: #a9b4bd; }
.topbar__right .lnk:hover { color: var(--paper); }
.who { font-weight: 600; font-size: 14px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px; }
.wrap--detail { max-width: 1100px; }

/* ---------- ตัวเลขสรุป ---------- */

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }

.tile {
  background: var(--paper); border: 1px solid var(--rule);
  border-top: 3px solid var(--ink);
  border-radius: var(--radius); padding: 12px 14px;
  text-decoration: none; display: block;
}
.tile:hover { background: #fff; border-top-color: var(--amber); }
.tile--alert { border-top-color: var(--signal); background: #fbeceb; }
.tile--flat  { border-top-color: var(--rule); }
.tile__n {
  display: block; font-family: "IBM Plex Mono", monospace;
  font-weight: 600; font-size: 26px; line-height: 1.1;
}
.tile--alert .tile__n { color: var(--signal); }
.tile__l { display: block; font-size: 12.5px; color: var(--ink-soft); }

/* ---------- ตัวกรอง ---------- */

.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px;
}
.filters__q { flex: 1 1 240px; }

input[type=text], input[type=search], input[type=password], input[type=number], select, textarea {
  font: inherit; font-size: 14.5px; color: var(--ink);
  padding: 7px 10px; background: #fff;
  border: 1px solid var(--rule); border-bottom-width: 2px;
  border-radius: var(--radius);
}
textarea { width: 100%; resize: vertical; line-height: 1.6; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: none; border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(224,169,42,.35);
}

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.chk input { accent-color: var(--ink); }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.inline input { width: 90px; }

.btn {
  font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 15px;
  color: var(--paper); background: var(--ink);
  border: none; border-radius: var(--radius);
  padding: 9px 18px; cursor: pointer;
}
.btn:hover { background: #22303f; }
.btn:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.btn--sm { padding: 7px 14px; font-size: 14px; }
.btn--full { width: 100%; margin-top: 8px; }

/* ---------- ตารางคิวงาน ---------- */

.grid {
  width: 100%; border-collapse: collapse;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.grid th {
  text-align: left; font-family: "Bai Jamjuree", sans-serif;
  font-weight: 600; font-size: 12px; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-soft);
  padding: 9px 12px; background: #eef1ee; border-bottom: 1px solid var(--rule);
}
.grid td { padding: 10px 12px; border-bottom: 1px solid #e6eae6; vertical-align: top; }
.grid tbody tr:hover { background: #f4f6f4; }
.grid tbody tr:last-child td { border-bottom: none; }

.row--line_down td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.row--dept_blocked td:first-child { box-shadow: inset 3px 0 0 var(--amber); }

.subj { font-weight: 600; text-decoration: none; }
.subj:hover { text-decoration: underline; }
.sub { display: block; font-size: 12.5px; color: var(--ink-soft); }
.none { color: var(--ink-faint); font-size: 13.5px; }

.chip {
  display: inline-block; font-size: 11px; padding: 1px 6px;
  background: #e6eae6; border-radius: 2px; color: var(--ink-soft);
}
.chip--warn { background: #f7ecd2; color: #7a5c10; }

.imp, .st {
  display: inline-block; font-size: 12.5px; padding: 2px 8px;
  border-radius: 2px; white-space: nowrap;
}
.imp--line_down      { background: #f7dedb; color: #8c231b; font-weight: 600; }
.imp--dept_blocked   { background: #faedcd; color: #7a5c10; }
.imp--person_blocked { background: #e6eae6; color: var(--ink-soft); }
.imp--request        { background: #eef1ee; color: var(--ink-faint); }

.st--new          { background: #dbe6f5; color: #1c4a80; font-weight: 600; }
.st--acknowledged { background: #e6eae6; color: var(--ink-soft); }
.st--in_progress  { background: #faedcd; color: #7a5c10; }
.st--waiting      { background: #ede4f0; color: #5c3a66; }
.st--resolved     { background: #d9ece7; color: #0d5a50; }
.st--cancelled    { background: #eef1ee; color: var(--ink-faint); }

.age--over { color: var(--signal); font-weight: 600; }
.age--near { color: #a37a10; }

.count { font-size: 13px; color: var(--ink-soft); margin: 10px 2px; }
.empty {
  background: var(--paper); border: 1px dashed var(--rule);
  border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-soft);
}
.empty--sm { padding: 14px; text-align: left; font-size: 14px; }

.flash-err {
  background: #fbeceb; border-left: 5px solid var(--signal);
  padding: 12px 16px; margin: 0 0 14px; border-radius: var(--radius);
}

/* ---------- หน้ารายละเอียดงาน ---------- */

.tk { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }

.tk__main, .card {
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); padding: 18px 20px;
}
.tk__main { padding-bottom: 22px; }

.tk__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 12px; }
.tk__no {
  font-weight: 600; font-size: 20px; color: var(--paper);
  background: var(--ink); padding: 4px 10px; border-radius: 2px; flex: none;
}
.tk__head h1 {
  margin: 0 0 6px; font-family: "Bai Jamjuree", sans-serif;
  font-weight: 700; font-size: 21px; line-height: 1.3;
}
.tk__meta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }

.tk__detail {
  background: #f4f6f4; border-left: 3px solid var(--rule);
  padding: 12px 14px; border-radius: 2px; margin-bottom: 16px;
}

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 16px; margin: 0 0 20px; }
.facts--tight { grid-template-columns: 1fr; gap: 6px; margin-bottom: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: 12px; color: var(--ink-soft); }
.facts dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }

.h2 {
  font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 16px;
  margin: 0 0 10px; padding-top: 6px; border-top: 1px solid var(--rule);
}

.notes { list-style: none; margin: 0 0 16px; padding: 0; }
.note {
  border-left: 3px solid var(--rule); padding: 8px 0 8px 12px; margin-bottom: 10px;
}
.note--internal { border-left-color: var(--amber); background: #fdfaf2; }
.note__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; font-size: 12.5px; }
.note__who { font-weight: 600; font-size: 14px; }
.note__at  { color: var(--ink-faint); }
.note__min { color: var(--ink-soft); }
.note__body { margin-top: 2px; }

.noteform { border-top: 1px solid var(--rule); padding-top: 14px; }
.noteform__row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 8px; }

/* ---------- แถบข้าง ---------- */

.tk__side { display: grid; gap: 12px; }
.card { padding: 14px 16px; }
.card h3 {
  margin: 0 0 10px; font-family: "Bai Jamjuree", sans-serif;
  font-weight: 600; font-size: 14px; letter-spacing: .03em;
  text-transform: uppercase; color: var(--ink-soft);
}

.people { list-style: none; margin: 0 0 4px; padding: 0; }
.people li {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid #e6eae6; font-size: 14.5px;
}
.people li:last-child { border-bottom: none; }
.inlineform { display: inline; }
.x {
  background: none; border: none; cursor: pointer;
  color: var(--ink-faint); font-size: 18px; line-height: 1; padding: 0 4px;
}
.x:hover { color: var(--signal); }

.addperson { display: flex; gap: 6px; margin-top: 10px; }
.addperson select { flex: 1; min-width: 0; }

.statusbtns { display: grid; gap: 6px; }
.sbtn {
  width: 100%; text-align: left; font: inherit; font-size: 14.5px;
  padding: 8px 12px; cursor: pointer;
  background: #fff; border: 1px solid var(--rule); border-left-width: 4px;
  border-radius: var(--radius);
}
.sbtn:hover { background: #f4f6f4; border-color: var(--ink); }
.sbtn--in_progress { border-left-color: var(--amber); }
.sbtn--waiting     { border-left-color: #8e6ba0; }
.sbtn--resolved    { border-left-color: var(--go); }
.sbtn--cancelled   { border-left-color: var(--ink-faint); }
.sbtn--new, .sbtn--acknowledged { border-left-color: #4a7fbf; }

.log { list-style: none; margin: 0; padding: 0; font-size: 13.5px; }
.log li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.log__at { color: var(--ink-faint); font-size: 12px; }

.hint { font-size: 12.5px; color: var(--ink-soft); margin: 8px 0 0; }
.back { margin: 16px 2px; }
.gohome {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 11px 16px;
  border-radius: var(--radius); text-decoration: none; font-size: 14.5px; font-weight: 500;
  color: var(--paper); background: var(--ink); border: 1px solid var(--ink);
  transition: background .15s, border-color .15s;
}
.gohome:hover { background: #22303f; border-color: var(--amber); }
.gohome:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.gohome svg { width: 16px; height: 16px; fill: var(--amber); }

/* ---------- หน้า login ---------- */

.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login {
  width: 100%; max-width: 380px;
  background: var(--paper); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.login__head {
  background: var(--ink); color: var(--paper);
  padding: 20px; border-bottom: 4px solid var(--amber);
}
.login__head h1 {
  margin: 4px 0 0; font-family: "Bai Jamjuree", sans-serif;
  font-weight: 700; font-size: 21px;
}
.login__form { padding: 20px; }
.login__form label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 5px; }
.login__form input { width: 100%; margin-bottom: 14px; }
.login__form .btn { width: 100%; }
.login__err {
  margin: 0; padding: 12px 20px;
  background: #fbeceb; border-left: 5px solid var(--signal); font-size: 14px;
}
.login__note {
  margin: 0; padding: 12px 20px; border-top: 1px solid var(--rule);
  background: #f2f4f2; font-size: 13px; color: var(--ink-soft);
}

/* ---------- จอเล็ก ---------- */

@media (max-width: 900px) {
  .tk { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .facts { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .grid { font-size: 14px; }
  .grid th:nth-child(3), .grid td:nth-child(3),
  .grid th:nth-child(6), .grid td:nth-child(6) { display: none; }
  .facts { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* ============================================================
   ส่วนเพิ่ม: ต่อท้าย admin.css บน Server (ของเดิมยังเป็นเวอร์ชันแรก)
   ============================================================ */

/* ---------- หน้าจัดการผู้ใช้ ---------- */

.wrap--detail > .card { margin-bottom: 14px; }

.stack { display: grid; gap: 12px; justify-items: start; }
.stack .grid { width: 100%; }

.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
.row3 label, .wide {
  display: grid; gap: 4px;
  font-weight: 600; font-size: 13.5px;
}
.row3 input, .row3 select, .wide select { width: 100%; font-weight: 400; }
.wide { max-width: 420px; }

.acts { display: flex; flex-wrap: wrap; gap: 5px; }
.mini {
  font: inherit; font-size: 12.5px; padding: 3px 9px; cursor: pointer;
  background: #fff; color: var(--ink);
  border: 1px solid var(--rule); border-radius: 2px; white-space: nowrap;
}
.mini:hover { background: #f4f6f4; border-color: var(--ink); }
.mini--danger { color: var(--signal); border-color: #e2b6b1; }
.mini--danger:hover { background: #fbeceb; border-color: var(--signal); }

.flash-ok {
  background: #e9f4f1; border-left: 5px solid var(--go);
  padding: 12px 16px; margin: 0 0 14px; border-radius: var(--radius);
}

@media (max-width: 700px) {
  .row3 { grid-template-columns: 1fr; }
}

/* ---------- แถวแก้ไขข้อมูลผู้ใช้ ---------- */

.rowedit td { background: #fdfaf2; border-left: 4px solid var(--amber); padding: 14px 12px; }
.editform { display: grid; gap: 10px; }
.editform .row3 { max-width: 760px; }
.editform .acts { align-items: center; gap: 12px; }
.editform .hint { margin: 0; }

a.mini { text-decoration: none; display: inline-block; line-height: 1.5; }

/* ---------- รอ IT ยืนยัน ---------- */

.tiles--6 { grid-template-columns: repeat(6, 1fr); }
.tiles--7 { grid-template-columns: repeat(7, 1fr); }
.tile--done { border-top-color: var(--go); }
.tile--done .tile__n { color: var(--go); }
.tile--confirm { border-top-color: var(--amber); background: #fdf6e6; }
.tile--confirm .tile__n { color: #a37a10; }

.st--pending_confirm  { background: #faedcd; color: #7a5c10; font-weight: 600; }
.sbtn--pending_confirm { border-left-color: var(--amber); }

.claim {
  background: #fdf6e6; border: 1px solid #e6cf94; border-left: 5px solid var(--amber);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px;
}
.claim__head {
  margin: 0 0 2px;
  font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 15.5px;
}
.claim__body { margin: 0 0 10px; font-size: 14.5px; }
.claim__form textarea { background: #fff; }
.claim .hint { margin-top: 8px; }

@media (max-width: 1000px) { .tiles--6 { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 900px)  { .tiles--6 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- สถานะที่เพิ่มใหม่ ---------- */

.st--updated          { background: #dbe6f5; color: #1c4a80; }
.st--waiting_purchase { background: #ede4f0; color: #5c3a66; }
.sbtn--updated          { border-left-color: #4a7fbf; }
.sbtn--waiting_purchase { border-left-color: #8e6ba0; }

/* ---------- ลำดับความสำคัญ ---------- */

.prio {
  display: inline-block; font-size: 11.5px; padding: 1px 7px;
  border-radius: 2px; margin-top: 3px; white-space: nowrap;
}
.prio--important_urgent       { background: #f7dedb; color: #8c231b; font-weight: 600; }
.prio--important_noturgent    { background: #faedcd; color: #7a5c10; }
.prio--urgent_notimportant    { background: #e4eaf5; color: #2a4a75; }
.prio--notimportant_noturgent { background: #eef1ee; color: var(--ink-soft); }

.classify { display: grid; gap: 10px; }
.classify .lbl { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
.classify select { width: 100%; font-weight: 400; }
@media (max-width: 1100px) { .tiles--7 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px)  { .tiles--7 { grid-template-columns: repeat(2, 1fr); } }

/* ---------- ลายเซ็นส่งมอบงาน ---------- */
.sigcard .sigblock { padding: 10px 0; border-bottom: 1px solid #e6eae6; }
.sigcard .sigblock:last-child { border-bottom: none; }
.sigblock__head { font-weight: 600; font-size: 13.5px; margin-bottom: 8px; color: var(--ink-soft); }
.sig-done { display: grid; gap: 6px; }
.sig-img { width: 100%; max-width: 280px; height: auto; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); }
.sig-meta { display: flex; flex-direction: column; gap: 1px; }
.sig-name { font-weight: 600; font-size: 14px; }
.sig-at { font-size: 11.5px; color: var(--ink-faint); }
.sig-del { margin-top: 4px; }
.sig-modal { position: fixed; inset: 0; z-index: 2000; background: rgba(22,32,43,.55); display: grid; place-items: center; padding: 16px; }
.sig-modal[hidden] { display: none; }
.sig-panel { background: var(--paper); border-radius: var(--radius); border-top: 5px solid var(--amber); width: 100%; max-width: 640px; box-shadow: 0 20px 50px -20px rgba(22,32,43,.6); overflow: hidden; }
.sig-panel__head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; background: var(--ink); color: var(--paper); font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 16px; }
.sig-x { background: none; border: none; color: var(--paper); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.sig-pad { display: block; width: calc(100% - 36px); height: 240px; margin: 18px; background: #fff; border: 2px dashed var(--rule); border-radius: var(--radius); touch-action: none; cursor: crosshair; }
.sig-hint { margin: -8px 18px 0; font-size: 12.5px; color: var(--ink-soft); }
.sig-form { padding: 14px 18px 18px; display: grid; gap: 12px; }
.sig-namefield { display: grid; gap: 4px; font-weight: 600; font-size: 13.5px; }
.sig-namefield input { width: 100%; font-weight: 400; }
.sig-actions { display: flex; justify-content: flex-end; gap: 10px; align-items: center; }

/* ---------- ticket.php บนมือถือ ---------- */
@media (max-width: 600px) {
  .tk { gap: 12px; }
  .tk__main, .card { padding: 14px; }
  .tk__head { gap: 10px; }
  .tk__no { font-size: 16px; padding: 3px 8px; }
  .tk__head h1 { font-size: 18px; }
  .facts { gap: 8px; }

  /* ฟอร์มเรียงแนวตั้ง ปุ่ม/ช่องใหญ่พอสำหรับนิ้ว */
  .noteform__row, .addperson { flex-direction: column; align-items: stretch; }
  .noteform__row .inline { justify-content: space-between; }
  .noteform__row .inline input { width: 120px; }
  .btn, .sbtn, .mini { min-height: 44px; }

  /* 16px กัน iOS ซูมเองตอนแตะช่องกรอก */
  textarea, select, input[type=text], input[type=number], input[type=search] { font-size: 16px; }

  /* แผ่นเซ็นเต็มจอ */
  .sig-modal { padding: 0; align-items: end; }
  .sig-panel { max-width: none; border-radius: 0; }
  .sig-pad { height: 200px; margin: 12px; width: calc(100% - 24px); }
  .sig-hint { margin: -4px 12px 0; }
  .sig-form { padding: 12px; }
  .sig-actions { flex-direction: column-reverse; align-items: stretch; }
}
.log--full{max-height:420px;overflow:auto;margin-top:6px}
.log--full li{display:grid;grid-template-columns:auto 1fr;gap:0 8px;padding:6px 0;border-bottom:1px solid var(--rule)}
.log--full .log__txt{grid-column:1/-1;overflow-wrap:anywhere}
.log__who{font-weight:600;font-size:12.5px}
.log--full .is-view{color:var(--ink-faint)}
.log__cb:not(:checked) ~ .log .is-view{display:none}
.log__tg{font-size:12px;color:var(--ink-soft);cursor:pointer}
/* ---------- ticket.php: หัวงานแถวบน · รายละเอียดคู่ผู้แจ้ง · ลายเซ็นแนวนอน ---------- */
.tk__top { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 20px; margin-bottom: 16px; }
.tk__top .tk__head { margin-bottom: 0; }
.tk__pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; margin-bottom: 20px; }
.tk__pair > div { min-width: 0; }
.tk__pair .tk__detail, .tk__pair .rqbox { margin-bottom: 0; }
.tk__pr { background: #f4f6f4; border-radius: var(--radius); padding: 12px 14px; }
.tk__pr .h2 { border-top: 0; padding-top: 0; }
.tk__pr .facts { grid-template-columns: 1fr 1fr; margin: 0; }
.sig-h2 { margin-top: 22px; }
.siggrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.siggrid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sigbox { border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; padding: 12px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sigbox__head { font-weight: 600; font-size: 13.5px; color: var(--ink); }
.sigbox .sig-img { max-width: 100%; }
.sig-empty { flex: 1; min-height: 70px; border: 1px dashed var(--rule); border-radius: var(--radius); display: grid; place-items: center; color: var(--ink-faint); font-size: 12.5px; }
.sig-dec { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--ink-faint); }
.sig-dec .on { color: var(--go); font-weight: 600; }
.sig-dec .on--no { color: #c0392b; }
.sig-kv { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; margin: 0; font-size: 13px; }
.sig-kv dt { color: var(--ink-soft); }
.sig-kv dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.sig-decision { display: flex; gap: 18px; font-weight: 600; }
.sig-decision[hidden] { display: none; }
@media (max-width: 1100px) { .siggrid--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 820px)  { .tk__pair { grid-template-columns: 1fr; } }
@media (max-width: 520px)  { .siggrid, .siggrid--4, .tk__pr .facts { grid-template-columns: 1fr; } }
.sigsub { border-top: 1px dashed var(--rule); padding-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.sigsub__head { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.sigsub .sig-empty { min-height: 56px; }
/* ส่วนที่ 5 เป็นแถวเต็มใต้ 3 กล่องแรก */
.siggrid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sigbox--handover { grid-column: 1 / -1; }
.sigbox__row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.sigbox__row .sigsub { border-top: 0; padding-top: 0; }
@media (max-width: 1100px) { .siggrid--4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) {
  .siggrid--4, .sigbox__row { grid-template-columns: 1fr; }
  .sigbox__row .sigsub { border-top: 1px dashed var(--rule); padding-top: 8px; }
}

/* ---------- สต็อกหมึก ---------- */
.inktabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 14px; border-bottom: 2px solid var(--rule); }
.inktabs a { padding: 8px 14px; text-decoration: none; color: var(--ink-soft); font-family: "Bai Jamjuree", sans-serif; font-weight: 600; font-size: 14px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.inktabs a:hover { color: var(--ink); }
.inktabs a.on { color: var(--ink); border-bottom-color: var(--amber); }
.inktabs--sm { border-bottom: 0; margin: 0; }
.inktabs--sm a { padding: 4px 10px; font-size: 13px; }
.tiles--3 { grid-template-columns: repeat(3, 1fr); }

.inkgrid td { vertical-align: middle; }
.ink-row--empty td:first-child { box-shadow: inset 3px 0 0 var(--signal); }
.ink-row--low   td:first-child { box-shadow: inset 3px 0 0 var(--amber); }
.inkgrid tr.is-off { opacity: .55; }
.inkbar { width: 70px; height: 6px; background: #e6eae6; border-radius: 3px; overflow: hidden; margin-bottom: 3px; }
.inkbar__fill { height: 100%; background: var(--go); }
.ink-row--low .inkbar__fill { background: var(--amber); }
.inkst { display: inline-block; font-size: 11.5px; padding: 0 7px; border-radius: 2px; margin-left: 4px; background: #eef1ee; color: var(--ink-soft); }
.inkst--empty { background: #f7dedb; color: #8c231b; font-weight: 600; }
.inkst--low   { background: #faedcd; color: #7a5c10; font-weight: 600; }
.inkst--over  { background: #dbe6f5; color: #1c4a80; }
.inkst--uin   { background: #d9ece7; color: #0d5a50; }
.inkst--uvoid { background: #f7dedb; color: #8c231b; }
.need { color: var(--signal); }
.inkdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; vertical-align: 0; border: 1px solid rgba(0,0,0,.2); background: #2b2b2b; }
.inkdot--C { background: #00a7c8; } .inkdot--M { background: #cf2a8c; } .inkdot--Y { background: #f2c200; }
.inkdot--COLOR { background: conic-gradient(#00a7c8 0 33%, #cf2a8c 0 66%, #f2c200 0); } .inkdot--NA { background: #cfd5cf; }
.inkact { white-space: nowrap; text-align: right; }
.inkact form { display: inline; }
.inkact .mini { font-size: 13px; font-weight: 600; padding: 5px 14px; margin-left: 4px; }
.inkact .mini:first-child { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.inkact .mini:first-child:hover { background: #22303f; }
.inkact .mini:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }

/* dropdown % หมึกในเครื่องถ่าย (ใต้ชื่อรุ่น) */
.inkdev { margin-top: 6px; font-size: 12.5px; }
.inkdev summary {
  display: inline-flex; align-items: center; gap: 5px; list-style: none; cursor: pointer;
  padding: 2px 10px; border: 1px solid var(--rule); border-radius: 12px; background: #fff; color: var(--ink-soft);
  transition: border-color .15s, color .15s;
}
.inkdev summary::-webkit-details-marker { display: none; }
.inkdev summary::after { content: "▾"; font-size: 11px; transition: transform .15s; }
.inkdev[open] summary::after { transform: rotate(180deg); }
.inkdev summary:hover, .inkdev[open] summary { border-color: var(--ink); color: var(--ink); }
.inkdev summary:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.inkdev__low { color: var(--signal); font-weight: 700; }
.inkdev__list { display: grid; gap: 2px; margin-top: 6px; padding: 6px 10px; min-width: 250px; background: #eef1ee; border-radius: var(--radius); }

.inkform { max-width: 820px; display: grid; gap: 10px; }
.inkform .lbl { display: grid; gap: 4px; font-size: 13px; font-weight: 600; flex: 1 1 180px; min-width: 0; }
.inkform .lbl input, .inkform .lbl select { width: 100%; font-weight: 400; }
.inkform__row { display: flex; flex-wrap: wrap; gap: 12px; }
.inkform__act { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; }
.inkform .hint, .hint { margin: 0; font-size: 12.5px; color: var(--ink-soft); }

.inkcount input[type=number] { width: 90px; }
.inkcount input[type=text] { width: 100%; }
.diff.bad, td.bad { color: var(--signal); font-weight: 700; }
.diff.good { color: var(--go); }
.inkscroll { overflow-x: auto; }

.inkcols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hbar { display: grid; grid-template-columns: minmax(0, 1.4fr) 1fr 36px; gap: 8px; align-items: center; font-size: 13.5px; padding: 3px 0; }
.hbar__l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__b { height: 10px; background: #e6eae6; border-radius: 2px; overflow: hidden; }
.hbar__b i { display: block; height: 100%; background: var(--ink); }
.hbar__n { text-align: right; font-weight: 600; }

@media (max-width: 820px) {
  .inkcols { grid-template-columns: 1fr; }
  .tiles--3 { grid-template-columns: repeat(3, 1fr); }

  /* แท็บแถวเดียว เลื่อนแนวนอน */
  .inktabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .inktabs::-webkit-scrollbar { display: none; }
  .inktabs a { flex: none; white-space: nowrap; padding: 10px 14px; }

  /* ตัวเลขสรุป 3 คอลัมน์ กะทัดรัด */
  .inktabs ~ .tiles--6 { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .inktabs ~ .tiles--6 .tile { padding: 8px 10px; }
  .inktabs ~ .tiles--6 .tile__n { font-size: 20px; }
  .inktabs ~ .tiles--6 .tile__l { font-size: 11.5px; line-height: 1.35; }

  /* ตัวกรองหน้าสต็อก: ค้นหาเต็มแถว · สถานะ/แบรนด์คู่กัน */
  .filters:has(select[name=brand]) { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .filters:has(select[name=brand]) > * { min-width: 0; }
  .filters:has(select[name=brand]) > span:empty { display: none; }
  .filters:has(select[name=brand]) .filters__q,
  .filters:has(select[name=brand]) .chk,
  .filters:has(select[name=brand]) .mini { grid-column: 1 / -1; }
  .filters:has(select[name=brand]) input[type=search],
  .filters:has(select[name=brand]) select { width: 100%; min-height: 44px; font-size: 16px; }
  .filters:has(select[name=brand]) .btn,
  .filters:has(select[name=brand]) .lnk,
  .filters:has(select[name=brand]) .mini { min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 14.5px; }
  .filters:has(select[name=brand]) .lnk { background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); text-decoration: none; }

  /* ตารางหมึกหน้าอื่น: เรียงเป็นบล็อกแบบเดิม */
  .inkgrid thead { display: none; }
  .inkgrid, .inkgrid tbody, .inkgrid tr, .inkgrid td { display: block; width: 100%; }
  .inkgrid tr { border-bottom: 1px solid var(--rule); padding: 8px 4px; }
  .inkgrid td { border: 0; padding: 3px 8px; }
  .grid.inkgrid td:nth-child(n) { display: block; }
  .inkgrid td[data-l]::before { content: attr(data-l); display: inline-block; min-width: 90px; font-size: 12px; color: var(--ink-faint); }
  .inkact { text-align: left; }

  /* หน้าสต็อก: ตาราง → การ์ด
     คอลัมน์ 1 รุ่น · 2 รหัส · 3 คงคลัง · 4 MIN/MAX · 5 ควรสั่ง · 6 เบิกเดือนนี้ · 7 แผนก · 8 ปุ่ม */
  .inkgrid--stock, .inkgrid--stock tbody { background: none; border: 0; }
  .inkgrid--stock tr {
    display: flex; flex-wrap: wrap; align-items: flex-start; gap: 6px 14px; width: auto;
    background: var(--paper); border: 1px solid var(--rule); border-left: 4px solid var(--go);
    border-radius: var(--radius); padding: 12px 14px; margin-bottom: 10px;
  }
  .inkgrid--stock tr.ink-row--empty { border-left-color: var(--signal); background: #fdf3f2; }
  .inkgrid--stock tr.ink-row--low   { border-left-color: var(--amber); }
  .inkgrid--stock tr.ink-row--over  { border-left-color: #4a7fbf; }
  .grid.inkgrid--stock td:nth-child(n) { display: block; width: auto; padding: 0; border: 0; box-shadow: none; font-size: 13px; }
  .inkgrid--stock td[data-l]::before { content: attr(data-l) " "; display: inline; min-width: 0; }

  /* แถวบน: ชื่อรุ่น | ยอดคงคลัง */
  /* ช่องรุ่นแตกลูกออกเป็นไอเท็มของการ์ด เพื่อให้ dropdown กว้างเต็มการ์ด */
  .grid.inkgrid--stock td:nth-child(1) { display: contents; }
  .inkgrid--stock td:nth-child(1)::before, .inkgrid--stock td:nth-child(3)::before { content: none; }
  .inkgrid--stock .inkname { order: 1; flex: 1 1 0; min-width: 0; font-size: 15px; }
  .inkgrid--stock .inkname .subj { display: block; font-size: 16px; line-height: 1.4; overflow-wrap: anywhere; }
  .grid.inkgrid--stock td:nth-child(3) { order: 2; display: flex; flex-direction: column; align-items: flex-end; }
  .inkgrid--stock td:nth-child(3) strong { font-size: 26px; line-height: 1.05; }
  .inkgrid--stock td:nth-child(3) .inkst { margin: 3px 0 0; font-size: 12px; padding: 1px 8px; }
  .inkgrid--stock td:nth-child(3) .inkbar { order: 3; width: 72px; margin: 6px 0 0; }

  /* รายละเอียดย่อยเรียงเป็นแถวเล็ก */
  .grid.inkgrid--stock td:nth-child(2), .grid.inkgrid--stock td:nth-child(4),
  .grid.inkgrid--stock td:nth-child(5), .grid.inkgrid--stock td:nth-child(6) { order: 4; flex: none; }
  .grid.inkgrid--stock td:nth-child(5):not(:has(.need)) { display: none; }
  .grid.inkgrid--stock td:nth-child(7) { order: 5; flex: 1 0 100%; }
  .grid.inkgrid--stock td:nth-child(7):has(.sub:empty) { display: none; }
  .inkgrid--stock td:nth-child(7) .sub { display: inline; font-size: 13px; }

  /* ปุ่มเต็มกว้าง แตะง่าย */
  .grid.inkgrid--stock td.inkact { order: 6; flex: 1 0 100%; display: flex; gap: 8px; padding-top: 4px; }
  .inkgrid--stock td.inkact .mini { flex: 1; min-height: 44px; display: flex; align-items: center; justify-content: center; font-size: 14.5px; margin: 0; }
  .inkgrid--stock tr.is-off { opacity: .6; }

  /* dropdown เครื่องถ่าย: แถวเต็มกว้างการ์ด แตะง่าย */
  .inkgrid--stock .inkdev { order: 3; flex: 1 0 100%; margin: 2px 0 0; font-size: 13.5px; }
  .inkdev summary { display: flex; width: 100%; min-height: 44px; padding: 6px 14px; border-radius: var(--radius); }
  .inkdev summary::after { margin-left: auto; font-size: 13px; }
  .inkdev[open] summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .inkdev__list { min-width: 0; margin-top: 0; padding: 8px 14px; border: 1px solid var(--ink); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); gap: 6px; }
  .inkdev .lvlrow { justify-content: space-between; }
  .inkdev .lvlrow__n { min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .inkdev .lvl__b { width: 90px; }
}

/* ---------- % หมึกในเครื่องพิมพ์ ---------- */
.lvl { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.lvl__b { width: 64px; height: 8px; background: #e6eae6; border-radius: 4px; overflow: hidden; display: inline-block; }
.lvl__b i { display: block; height: 100%; background: #2b2b2b; }
.lvl__b i.lvl--C { background: #00a7c8; } .lvl__b i.lvl--M { background: #cf2a8c; } .lvl__b i.lvl--Y { background: #f2c200; }
.lvl--low .lvl__n { color: var(--signal); font-weight: 700; }
.lvl--low .lvl__b { outline: 1px solid var(--signal); }
.lvl--na { color: var(--ink-faint); }
.lvl--ok { color: var(--go); font-weight: 600; }
.lvlrow { display: flex; align-items: center; gap: 8px; }
.lvlrow__n { font-size: 11.5px; color: var(--ink-soft); min-width: 92px; }
.stockpill { display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; margin: 0 4px 2px 0; border: 1px solid var(--rule); border-radius: 10px; font-size: 12.5px; text-decoration: none; font-family: "IBM Plex Mono", monospace; }
.stockpill--0 { border-color: #e2b6b1; color: var(--signal); background: #fbeceb; }

/* ---------- ink_printers: หลอดหมึกเต็มช่อง ---------- */
.prgrid th:nth-child(n+3):nth-child(-n+6) { width: 14%; }
.prgrid td:nth-child(n+3):nth-child(-n+6) { vertical-align: middle; }
.prgrid .lvl { display: flex; width: 100%; gap: 8px; }
.prgrid .lvl__b { flex: 1; width: auto; min-width: 48px; height: 12px; border-radius: 6px; }
.prgrid .lvl__n { min-width: 3.2em; text-align: right; }

@media (max-width: 820px) {
  .grid.prgrid td:nth-child(n+3):nth-child(-n+6) { display: flex; align-items: center; }
  .prgrid td:nth-child(n+3):nth-child(-n+6)::before { flex: none; }
  .prgrid td .lvl { flex: 1; min-width: 0; }
  .prgrid .lvl__b { height: 14px; border-radius: 7px; }
  /* เครื่องขาวดำ: ซ่อนช่อง C/M/Y ที่ว่าง */
  .grid.prgrid td:nth-child(n+3):nth-child(-n+6):has(> .lvl--na:empty) { display: none; }
}
