/* screens-grants.css · การให้บทบาท (M9 lane R · G-03 · /settings/role-grants · ประวัติในหน้าผู้ใช้ · ช่องเหตุผลของการให้/ถอนบทบาท)
   กติกาเดียวกับ screens-ops.css: สีจากตัวแปรใน themes.css เท่านั้น · ตัวอักษร ≥ 12px · ไทยไม่ถ่างตัวอักษร · บรรทัด ≥ 1.45 ·
   เป้ากด ≥ 24px · สถานะใช้ข้อความเสมอ (สีเป็นตัวเสริม) · ระยะ 4/8 */

.grant-reason { display: grid; gap: 4px; margin: 12px 0; max-width: 40rem; }
.grant-reason label { font-weight: 500; line-height: 1.45; }
.grant-reason textarea { width: 100%; min-height: 3.2em; box-sizing: border-box; line-height: 1.5; resize: vertical; }
.grant-reason small { line-height: 1.5; }

/* ให้ = ป้ายพื้นเขียวอมฟ้า · ถอน = ป้ายพื้นแดงอ่อน (ข้อความ "ให้"/"ถอน" อยู่ในป้ายเสมอ) */
.grant-log .chip.grant-grant { background: var(--teal-bg); color: var(--teal-fg); }
.grant-log .chip.grant-revoke { background: var(--p1-bg); color: var(--p1-fg); }
.grant-log td { vertical-align: top; line-height: 1.5; text-align: left; }
.grant-log td.grant-at { white-space: nowrap; }
.grant-h { margin: 24px 0 8px; }
.grant-log td.grant-why { max-width: 28rem; overflow-wrap: anywhere; white-space: pre-line; }
.grant-log code { font-size: 12px; }

/* กลุ่ม AD/SSO → บทบาท: เหตุผลอยู่ในแถวลบ (ช่องเล็ก) และฟอร์มเพิ่ม */
.map-revoke { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.map-revoke input[name="reason"] { min-width: 12rem; flex: 1 1 12rem; min-height: 32px; }
.map-add { display: flex; flex-wrap: wrap; align-items: end; gap: 8px 12px; }
.map-add label { display: grid; gap: 4px; }
.map-add .grant-reason { margin: 0; flex: 1 1 18rem; }

@media (max-width: 640px) {
  /* ตารางกลายเป็นรายการซ้อน: หัวคอลัมน์ซ่อนแบบยังอ่านได้ด้วยโปรแกรมอ่านหน้าจอ · ชื่อช่องมาจาก data-label */
  .grant-log, .grant-log tbody, .grant-log tr, .grant-log td { display: block; width: auto; }
  .grant-log thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .grant-log tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .grant-log td { padding: 2px 0; border: 0; }
  .grant-log td[data-label]::before { content: attr(data-label); display: block; font-size: 12px; color: var(--muted); line-height: 1.45; }
  .grant-log td.grant-at { white-space: normal; }
  .grant-log td.grant-why { max-width: none; }
  .map-revoke input[name="reason"] { min-width: 0; flex-basis: 100%; }
}
