/* ==========================================================================
   Open Government Data API Portal — UI layer
   โหลดหลัง bootstrap.css/default.css เพื่อทับสไตล์เดิมเฉพาะส่วนที่ออกแบบใหม่
   คลาสทั้งหมดขึ้นต้นด้วย .op- เพื่อไม่ให้ชนกับ bootstrap/sbsStyle เดิม
   ========================================================================== */

:root {
  --op-bg: #f7f9fc;
  --op-surface: #ffffff;
  --op-ink: #1e2939;
  --op-ink-soft: #5a6b82;
  --op-ink-faint: #8b9ab0;
  --op-line: #e3e9f2;
  --op-line-strong: #cfd9e8;
  --op-field: #f8fafc;
  --op-primary: #2563eb;
  --op-primary-dark: #1d4ed8;
  --op-accent: #4f46e5;
  --op-accent-dark: #4338ca;
  --op-danger: #dc2626;
  --op-danger-soft: #fdecec;
  --op-success: #15803d;
  --op-success-soft: #e8f6ed;
  --op-warning: #b45309;
  --op-warning-soft: #fdf3e3;
  --op-info: #1d4ed8;
  --op-info-soft: #e8effd;
  --op-radius: 12px;
  --op-radius-sm: 8px;
  --op-shadow: 0 1px 2px rgba(16, 30, 54, .04), 0 8px 24px rgba(16, 30, 54, .06);
  --op-shadow-lg: 0 12px 48px rgba(16, 30, 54, .18);
  --op-font: "Prompt", "Noto Sans Thai", "Sukhumvit Set", -apple-system, "Segoe UI", sans-serif;
}

body {
  background-color: var(--op-bg);
  font-family: var(--op-font);
  color: var(--op-ink);
}

/* ไม่พึ่ง border-box จาก bootstrap — คำนวณความกว้างเองให้ครบทุกคอมโพเนนต์ */
[class^="op-"],
[class*=" op-"] { box-sizing: border-box; }

/* --------------------------------------------------------------- navbar -- */

.op-nav {
  position: sticky;
  top: 0;
  z-index: 900;
  background: var(--op-surface);
  border-bottom: 1px solid var(--op-line);
}

.op-nav__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.op-nav__brand { display: inline-flex; align-items: center; }
.op-nav__brand img { height: 44px; width: auto; display: block; }

.op-nav__links {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.op-nav__link {
  color: var(--op-ink);
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
}
.op-nav__link:hover,
.op-nav__link:focus { color: var(--op-primary); text-decoration: none; }
.op-nav__link--me { color: var(--op-primary); font-weight: 500; }

.op-nav__cta {
  display: inline-block;
  background: var(--op-accent);
  color: #fff !important;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border: 0;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
.op-nav__cta:hover,
.op-nav__cta:focus { background: var(--op-accent-dark); color: #fff; text-decoration: none; }

.op-nav__toggle {
  display: none;
  background: none;
  border: 1px solid var(--op-line-strong);
  border-radius: var(--op-radius-sm);
  padding: 8px 10px;
  color: var(--op-ink);
}

@media (max-width: 860px) {
  .op-nav__toggle { display: inline-flex; }
  .op-nav__links {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--op-surface);
    border-bottom: 1px solid var(--op-line);
    padding: 8px 24px 16px;
  }
  .op-nav__links.is-open { display: flex; }
  .op-nav__links > li { padding: 10px 0; }
  .op-nav__cta { text-align: center; }
}

/* ------------------------------------------------------------ page shell -- */

.op-page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}
.op-page--auth {
  max-width: 520px;
  padding-top: 64px;
}
.op-page--mid { max-width: 760px; }
.op-page--wide { max-width: 1400px; }

.op-card {
  background: var(--op-surface);
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius);
  box-shadow: var(--op-shadow);
  padding: 36px 40px 40px;
}

.op-title {
  font-family: var(--op-font);
  font-size: 26px;
  font-weight: 600;
  text-align: center;
  color: var(--op-ink);
  margin: 0 0 26px;
}
.op-title--page { margin-bottom: 8px; }
.op-subtitle {
  text-align: center;
  color: var(--op-ink-soft);
  font-size: 15px;
  margin: 0 0 28px;
}

/* ----------------------------------------------------------------- form -- */

.op-field { margin-bottom: 20px; }

.op-label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--op-ink);
  margin-bottom: 8px;
}
.op-label .op-req { color: var(--op-danger); margin-left: 2px; }

.op-input {
  display: block;
  width: 100%;
  height: auto;
  background: var(--op-field);
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
  padding: 12px 14px;
  font-family: var(--op-font);
  font-size: 15px;
  color: var(--op-ink);
  box-shadow: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.op-input::placeholder { color: var(--op-ink-faint); font-style: italic; }
.op-input:focus {
  outline: none;
  background: var(--op-surface);
  border-color: var(--op-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
.op-input[readonly],
.op-input:disabled {
  background: #eef2f7;
  color: var(--op-ink-soft);
  cursor: not-allowed;
}
.op-input.is-invalid { border-color: var(--op-danger); }

.op-help { font-size: 13px; color: var(--op-ink-soft); margin: 6px 0 0; }
.op-help--error { color: var(--op-danger); }

.op-field__aside { text-align: right; margin-top: 8px; }

.op-link { color: var(--op-primary); font-size: 14px; text-decoration: none; }
.op-link:hover, .op-link:focus { color: var(--op-primary-dark); text-decoration: underline; }
.op-link--muted { color: var(--op-ink-soft); }

/* --------------------------------------------------------------- button -- */

.op-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: var(--op-font);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.2;
  padding: 13px 22px;
  border-radius: var(--op-radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.op-btn:focus-visible { outline: 3px solid rgba(37, 99, 235, .35); outline-offset: 2px; }
.op-btn--block { width: 100%; }

.op-btn--primary { background: var(--op-primary); color: #fff; }
.op-btn--primary:hover, .op-btn--primary:focus { background: var(--op-primary-dark); color: #fff; text-decoration: none; }

.op-btn--secondary { background: var(--op-surface); color: var(--op-ink); border-color: var(--op-line-strong); }
.op-btn--secondary:hover, .op-btn--secondary:focus { background: #f4f7fc; color: var(--op-ink); text-decoration: none; }

.op-btn--accent { background: var(--op-surface); color: var(--op-accent); border-color: var(--op-line-strong); font-weight: 600; }
.op-btn--accent:hover, .op-btn--accent:focus { background: #f3f2ff; color: var(--op-accent-dark); text-decoration: none; }

.op-btn--danger { background: var(--op-danger); color: #fff; }
.op-btn--danger:hover, .op-btn--danger:focus { background: #b91c1c; color: #fff; text-decoration: none; }

.op-btn--ghost { background: transparent; color: var(--op-ink-soft); border-color: transparent; padding: 8px 12px; font-size: 14px; }
.op-btn--ghost:hover { color: var(--op-ink); text-decoration: underline; }

.op-btn--sm { padding: 8px 14px; font-size: 13px; }

/* -------------------------------------------------------------- divider -- */

.op-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 26px 0;
  color: var(--op-ink-faint);
  font-size: 14px;
}
.op-divider::before,
.op-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--op-line);
}

/* ------------------------------------------------------------------ otp -- */

.op-otp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 18px 0 24px;
}
.op-otp__box {
  width: 52px;
  height: 60px;
  text-align: center;
  font-size: 24px;
  font-weight: 600;
  color: var(--op-ink);
  background: var(--op-surface);
  border: 1px solid var(--op-line-strong);
  border-radius: var(--op-radius-sm);
  padding: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.op-otp__box:focus {
  outline: none;
  border-color: var(--op-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .15);
}
.op-otp__dash { color: var(--op-ink-faint); font-size: 20px; }

@media (max-width: 480px) {
  .op-otp { gap: 6px; }
  .op-otp__box { width: 40px; height: 50px; font-size: 20px; }
}

/* ------------------------------------------------------------------ qr --- */

.op-qr {
  display: block;
  width: 220px;
  height: 220px;
  margin: 24px auto 14px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
}
.op-secret {
  text-align: center;
  font-size: 13px;
  color: var(--op-ink-soft);
  margin: 0 0 26px;
  word-break: break-all;
}
.op-secret strong {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: var(--op-ink);
  letter-spacing: .5px;
}

/* ----------------------------------------------------------------- note -- */

.op-note {
  background: #f2f6fc;
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
  padding: 16px 18px;
  font-size: 14px;
  color: var(--op-ink-soft);
  margin-top: 28px;
}
.op-note__title { font-weight: 600; color: var(--op-ink); margin: 0 0 8px; }
.op-note ul { margin: 0; padding-left: 20px; }
.op-note li { margin-bottom: 4px; }
.op-note--warning { background: var(--op-warning-soft); border-color: #f0dcbb; color: #7c4a10; }
.op-note--warning .op-note__title { color: #7c4a10; }

/* -------------------------------------------------------------- profile -- */

.op-profile__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.op-profile__id { display: flex; align-items: center; gap: 14px; }
.op-profile__avatar {
  width: 54px; height: 54px; border-radius: 50%;
  background: #e6ebf4; object-fit: cover;
}
.op-profile__name { font-size: 17px; font-weight: 600; color: var(--op-ink); }

.op-kv { display: grid; grid-template-columns: 190px 1fr; gap: 14px 20px; align-items: center; }
.op-kv__key { font-weight: 600; font-size: 15px; color: var(--op-ink); text-align: right; }
.op-kv__val {
  background: var(--op-surface);
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
  padding: 12px 16px;
  font-size: 15px;
  color: var(--op-ink);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
@media (max-width: 700px) {
  .op-kv { grid-template-columns: 1fr; gap: 6px; }
  .op-kv__key { text-align: left; }
}

.op-status { font-weight: 600; font-size: 14px; }
.op-status--on { color: var(--op-success); }
.op-status--off { color: var(--op-ink-faint); }

/* ---------------------------------------------------------------- admin -- */

.op-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.op-toolbar__search { flex: 1 1 320px; min-width: 220px; }
.op-toolbar__select { flex: 0 0 auto; width: auto; min-width: 170px; }

/* แถบสรุปจำนวนผู้ใช้แยกตามสถานะ — ใต้ช่องค้นหา เหนือตาราง */
.op-stat {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 16px 0 4px;
  font-size: 14px;
}
.op-stat__total { color: var(--op-ink-soft); }
.op-stat__total strong { color: var(--op-ink); font-size: 16px; }

.op-stat__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--op-ink-soft);
  text-decoration: none;
  white-space: nowrap;
}
.op-stat__item:hover,
.op-stat__item:focus { color: var(--op-ink); text-decoration: none; }
.op-stat__item b { color: var(--op-ink); font-weight: 600; }
.op-stat__item.is-current { color: var(--op-ink); font-weight: 500; }

.op-stat__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.op-stat__dot--success { background: #22a559; }
.op-stat__dot--danger  { background: var(--op-danger); }
.op-stat__dot--warning { background: #e0921f; }
.op-stat__dot--info    { background: var(--op-primary); }

@media (max-width: 620px) {
  .op-stat { gap: 8px 16px; font-size: 13.5px; }
}

.op-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.op-badge--success { background: var(--op-success-soft); color: var(--op-success); }
.op-badge--danger  { background: var(--op-danger-soft);  color: var(--op-danger); }
.op-badge--warning { background: var(--op-warning-soft); color: var(--op-warning); }
.op-badge--info    { background: var(--op-info-soft);    color: var(--op-info); }

.op-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.op-actions form { margin: 0; }

.op-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
}

.op-table--admin { font-size: 14px; }
.op-table--admin thead th,
.op-table--admin tbody td {
  padding: 12px 14px;
  vertical-align: top;
  white-space: nowrap;
}
.op-table--admin .op-btn { white-space: nowrap; }
.op-table--admin .op-badge + .op-badge { margin-top: 4px; }

/* --- ตารางผู้ใช้: ต้องพอดีความกว้างจอ ห้ามเลื่อนแนวนอน ---
   table-layout: fixed ทำให้คอลัมน์กว้างตาม <colgroup> ที่กำหนด ไม่ใช่ตามความยาวข้อความ
   ข้อความที่ยาวเกินจะถูกตัดด้วย ... แทนที่จะดันตารางให้กว้างออกไป (ดูค่าเต็มได้จาก title
   เมื่อชี้เมาส์ และจากหน้ารายละเอียดผู้ใช้) */
.op-table--users { table-layout: fixed; width: 100%; }
.op-table--users .op-col-user { width: 33%; }
.op-table--users .op-col-org  { width: 23%; }
.op-table--users .op-col-sec  { width: 14%; }
.op-table--users .op-col-date { width: 13%; }
.op-table--users .op-col-act  { width: 17%; }

/* จุดสถานะหน้าชื่อผู้ใช้ (แทนคอลัมน์สถานะเดิม)
   สีอย่างเดียวไม่พอสำหรับคนตาบอดสี — จึงมี title ให้ชี้ดู
   และสถานะที่ผิดปกติจะมีคำกำกับใต้อีเมลเสมอ ส่วนสีเขียว (ปกติ) ไม่ต้องมีคำ */
.op-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  flex: none;
  margin-right: 8px;
  vertical-align: 1px;
}
.op-dot--success { background: #22a559; }
.op-dot--danger  { background: var(--op-danger); }
.op-dot--warning { background: #e0921f; }
.op-cell__sub--indent { padding-left: 17px; }
.op-cell__sub--danger { color: var(--op-danger); }
.op-cell__sub--warn   { color: #b06d0d; }

.op-table--users tbody td { white-space: normal; }
.op-cell__main,
.op-cell__sub {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.op-cell__sub { font-size: 12.5px; color: var(--op-ink-soft); margin-top: 3px; }

/* ป้ายสถานะ 2FA / Digital ID — ใช้เครื่องหมายนำหน้าคู่กับสี ไม่พึ่งสีอย่างเดียว
   เพื่อให้คนตาบอดสีอ่านออก และสั้นพอจะไม่ดันคอลัมน์ */
.op-flag {
  display: block;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--op-ink-soft);
}
.op-flag--on { color: #1b7a43; font-weight: 500; }
.op-flag__mark { font-weight: 600; margin-right: 3px; }
.op-table--users .op-badge { display: inline-block; margin-bottom: 3px; }
.op-table--users .op-badge + .op-badge { margin-top: 0; }
.op-table--users .op-actions { flex-direction: column; align-items: stretch; gap: 6px; }
.op-table--users .op-actions .op-btn { width: 100%; text-align: center; }

/* แท็บเล็ตและโน้ตบุ๊กจอเล็ก: ยังเป็นตาราง แต่ลด padding และฟอนต์ลง
   เพื่อคืนพื้นที่ให้คอลัมน์วันที่กับความปลอดภัยแสดงค่าได้เต็มโดยไม่ต้องเลื่อนแนวนอน */
@media (max-width: 1023px) {
  .op-table--users { font-size: 13px; }
  .op-table--users thead th,
  .op-table--users tbody td { padding: 10px 8px; }
  .op-table--users .op-cell__sub,
  .op-table--users .op-flag { font-size: 11.5px; }
  .op-table--users .op-col-user { width: 31%; }
  .op-table--users .op-col-org  { width: 19%; }
  .op-table--users .op-col-sec  { width: 15%; }
  .op-table--users .op-col-date { width: 16%; }
  .op-table--users .op-col-act  { width: 19%; }
  .op-table--users .op-btn--sm { padding: 5px 8px; font-size: 12px; }
  .op-dot { margin-right: 6px; }
  .op-cell__sub--indent { padding-left: 15px; }
}

/* เฉพาะจอมือถือเท่านั้นที่เปลี่ยนเป็นการ์ด
   แท็บเล็ต (768px ขึ้นไป) ยังคงเป็นตารางตามที่ผู้ใช้งานต้องการ */
@media (max-width: 700px) {
  .op-table--users,
  .op-table--users tbody,
  .op-table--users tr,
  .op-table--users td { display: block; width: auto; }
  .op-table--users thead { display: none; }
  .op-table--users colgroup { display: none; }
  .op-table--users tr {
    border-top: 1px solid var(--op-line);
    padding: 12px 14px;
  }
  .op-table--users tr:first-child { border-top: 0; }
  .op-table--users tbody td { border: 0; padding: 5px 0; }
  .op-table--users tbody td::before {
    content: attr(data-label);
    display: block;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--op-ink-soft);
    margin-bottom: 2px;
  }
  .op-cell__main, .op-cell__sub { white-space: normal; overflow: visible; }
  .op-cell__sub--indent { padding-left: 0; }
  /* ในมุมมองการ์ดมีที่ว่างพอ จึงเติมคำกำกับวันที่กลับมา ไม่งั้นเห็นสองวันที่แล้วแยกไม่ออก */
  .op-cell--dates .op-cell__sub:nth-of-type(1)::before { content: "สมัคร "; }
  .op-cell--dates .op-cell__sub:nth-of-type(2)::before { content: "ล่าสุด "; }
  .op-table--users .op-actions { flex-direction: row; flex-wrap: wrap; }
  .op-table--users .op-actions .op-btn { width: auto; }
}

.op-adminaction__row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--op-line);
}
.op-adminaction__row:last-child { border-bottom: 0; padding-bottom: 0; }
.op-adminaction__row:first-child { padding-top: 0; }
.op-adminaction__row strong { font-size: 15px; }
.op-adminaction__row .op-help { margin: 4px 0 0; max-width: 52ch; }
.op-adminaction__row form { margin: 0; flex: none; }

@media (max-width: 620px) {
  .op-adminaction__row { flex-direction: column; gap: 10px; }
}

/* -------------------------------------------------------------- api key -- */

.op-key {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.op-key__value {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--op-ink);
  background: var(--op-field);
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
  padding: 7px 12px;
  word-break: break-all;
}
.op-key.is-revealed .op-key__value {
  background: var(--op-info-soft);
  border-color: var(--op-primary);
  color: var(--op-ink);
}

/* ---------------------------------------------------------------- table -- */

.op-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--op-surface);
  border: 1px solid var(--op-line);
  border-radius: var(--op-radius-sm);
  overflow: hidden;
  font-size: 15px;
}
.op-table thead th {
  background: var(--op-primary);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
  padding: 14px 18px;
  text-align: left;
}
.op-table tbody td {
  padding: 16px 18px;
  border-top: 1px solid var(--op-line);
  color: var(--op-ink);
}
.op-table-wrap { overflow-x: auto; }

/* --------------------------------------------------------------- footer -- */
/* เดิมสไตล์ footer ถูกประกาศซ้ำในแต่ละหน้า (block <style> ท้ายไฟล์)
   ย้ายมารวมที่เดียวเพื่อให้ทุกหน้าแสดงผลเหมือนกันเหมือนก่อนหน้านี้ */

.bgFooter {
  background-color: #113355;
  position: relative;
  bottom: 0;
  left: 0;
  right: 0;
}

footer .container {
  background-color: transparent;
  padding-top: 0;
  padding-bottom: 0;
}

.page-header + section .container,
header .container { background-color: transparent; }

/* ---------------------------------------------------------------- popup -- */

.op-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.op-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .5);
  animation: op-fade .16s ease-out;
}
.op-modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--op-surface);
  border-radius: 16px;
  box-shadow: var(--op-shadow-lg);
  padding: 32px 32px 28px;
  text-align: center;
  animation: op-pop .18s ease-out;
}
.op-modal__icon {
  width: 62px;
  height: 62px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.op-modal__icon svg { width: 30px; height: 30px; }
.op-modal__icon--error { background: var(--op-danger-soft); color: var(--op-danger); }
.op-modal__icon--success { background: var(--op-success-soft); color: var(--op-success); }
.op-modal__icon--warning { background: var(--op-warning-soft); color: var(--op-warning); }
.op-modal__icon--info { background: var(--op-info-soft); color: var(--op-info); }

.op-modal__title {
  font-size: 19px;
  font-weight: 600;
  color: var(--op-ink);
  margin: 0 0 10px;
}
.op-modal__text {
  font-size: 15px;
  line-height: 1.6;
  color: var(--op-ink-soft);
  margin: 0 0 24px;
}
.op-modal__count { font-weight: 600; color: var(--op-ink); }

/* ประกาศระบบ — กว้างกว่า modal ปกติ รองรับทั้งโปสเตอร์และข้อความ */
.op-modal--announce .op-modal__dialog {
  max-width: 620px;
  padding: 30px 34px 26px;
  text-align: center;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.op-announce__image {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: var(--op-radius-sm);
  margin: 0 auto 20px;
}
.op-announce__logo {
  display: block;
  width: auto;
  max-width: 70%;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  object-fit: contain;
}
.op-announce__logo--top {
  max-height: 84px;
  margin-bottom: 20px;
}
.op-announce__logo--bottom {
  max-height: 78px;
  max-width: 55%;
  margin-top: 18px;
}

.op-announce__body {
  font-size: 15px;
  line-height: 1.75;
  color: var(--op-ink);
  margin-bottom: 4px;
}
.op-announce__body p { margin: 0 0 12px; }
.op-announce__note {
  border-top: 1px dashed var(--op-line-strong);
  margin-top: 18px;
  padding-top: 16px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--op-ink-soft);
}
.op-announce__note p { margin: 0; }
.op-announce__dismiss {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 400;
  color: var(--op-ink-soft);
  margin: 20px 0 16px;
  cursor: pointer;
}
.op-announce__dismiss input { margin: 0; cursor: pointer; }

@media (max-width: 560px) {
  .op-modal--announce .op-modal__dialog { padding: 22px 20px 20px; }
  .op-announce__body { font-size: 14px; }
}

.op-toasts {
  position: fixed;
  top: 88px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1900;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(560px, calc(100vw - 32px));
}
.op-toast {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--op-surface);
  border: 1px solid var(--op-line);
  border-left: 4px solid var(--op-info);
  border-radius: var(--op-radius-sm);
  box-shadow: var(--op-shadow);
  padding: 14px 16px;
  font-size: 15px;
  color: var(--op-ink);
  animation: op-slide .18s ease-out;
}
.op-toast--success { border-left-color: var(--op-success); }
.op-toast--error { border-left-color: var(--op-danger); }
.op-toast--warning { border-left-color: var(--op-warning); }
.op-toast__icon { flex: none; width: 22px; height: 22px; margin-top: 1px; }
.op-toast--success .op-toast__icon { color: var(--op-success); }
.op-toast--error .op-toast__icon { color: var(--op-danger); }
.op-toast--warning .op-toast__icon { color: var(--op-warning); }
.op-toast--info .op-toast__icon { color: var(--op-info); }
.op-toast__body { flex: 1; line-height: 1.5; }
.op-toast__close {
  flex: none;
  background: none;
  border: 0;
  color: var(--op-ink-faint);
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.op-toast__close:hover { color: var(--op-ink); }
.op-toast.is-leaving { animation: op-fade-out .18s ease-in forwards; }

body.op-modal-open { overflow: hidden; }

@keyframes op-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes op-fade-out { from { opacity: 1; } to { opacity: 0; transform: translateY(-6px); } }
@keyframes op-pop { from { opacity: 0; transform: translateY(10px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes op-slide { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .op-modal__overlay,
  .op-modal__dialog,
  .op-toast,
  .op-toast.is-leaving { animation: none; }
}

/* ---- สิทธิ์ผู้ดูแลระบบ (เฉพาะผู้ดูแลสูงสุด) ---- */
.op-badge--muted { background: var(--op-line); color: var(--op-ink-soft); }

/* เส้นขอบซ้ายสีแดงบางๆ ให้กล่องนี้ดูต่างจากกล่องคำสั่งทั่วไป
   เพราะเป็นคำสั่งที่ให้อำนาจถาวร ไม่ควรกลมกลืนกับปุ่มอื่น */
.op-card--role { border-left: 3px solid var(--op-danger); }
.op-rolegrant { margin: 0; max-width: 460px; }
.op-rolegrant .op-field { margin-bottom: 16px; }
.op-rolegrant code {
  background: var(--op-line); padding: 1px 6px; border-radius: 4px;
  font-size: 13px; color: var(--op-ink);
}
.op-stat__dot--admin { background: #7c3aed; }

/* ตารางเลือกหลายรายการในหน้าล้างบัญชี */
.op-table--admin input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.op-pager { display: flex; align-items: center; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
