/* หน้า ผู้ดูแลระบบ */
.adm-grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; }
.adm-card { display: flex; flex-direction: column; gap: 14px; }
.adm-head { display: flex; gap: 12px; align-items: flex-start; margin-top: 6px; }
.adm-head h3 { margin: 0; font-size: 16px; }
.adm-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.adm-ico { width: 36px; height: 36px; flex: none; border-radius: 12px; display: grid; place-items: center; color: var(--primary); box-shadow: var(--in); }
.adm-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border: 0; border-radius: 14px; background: var(--bg); color: var(--text); font: inherit; cursor: pointer; box-shadow: var(--out-sm); }
.tgl-btn[aria-checked="true"] .tgl::after { transform: translateX(16px); background: var(--primary); }
.adm-actions { display: flex; justify-content: flex-end; margin-top: 4px; }
.adm-menu { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 8px; border-radius: 14px; }
.adm-seg { order: 3; width: 100%; display: flex; }
.adm-seg button { flex: 1; }
.adm-menu + .adm-menu { border-top: 1px solid var(--line, rgba(128, 128, 160, .14)); }
.adm-menu.off .adm-mname b, .adm-menu.off .adm-mico { opacity: .45; }
.adm-mico { display: grid; color: var(--primary); }
.adm-mname { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.adm-mname small { font-size: 11.5px; color: var(--muted); }
.adm-seg button:disabled { cursor: default; opacity: .6; }
.adm-move { display: flex; }
.adm-move .btn-flat { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 8px; display: grid; place-items: center; background: none; color: var(--muted); cursor: pointer; }
.adm-move .btn-flat:disabled { opacity: .25; cursor: default; }

/* แท็บ */
.adm-tabs { display: flex; width: 100%; max-width: 640px; margin-bottom: 16px; }
.adm-tabs button { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 10px; position: relative; }
.adm-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--expense); color: #fff; font-size: 11px; line-height: 18px; font-weight: 600; }
/* ทุกแท็บกว้างเต็มพื้นที่เท่ากัน; จอกว้าง: ช่องข้อความ 2 คอลัมน์ต่อแถว, เมนู = ชื่อซ้าย ตัวเลือกขวา */
@media (min-width: 721px) {
  .adm-seg { order: 0; width: min(420px, 45%); margin-left: auto; }
  .adm-menu .adm-mname { flex: 1 1 160px; }
}

/* เครื่องมือค้นหา/กรอง */
.adm-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.adm-search { flex: 1 1 240px; max-width: 360px; display: flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 14px; box-shadow: var(--in); color: var(--muted); }
.adm-search input { flex: 1; min-width: 0; border: 0; background: none; box-shadow: none; padding: 10px 0; color: var(--text); font: inherit; outline: none; }

/* ตารางผู้ใช้ */
.adm-table-wrap { overflow-x: auto; margin: 0 -4px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.adm-table th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 8px 10px; white-space: nowrap; }
.adm-table td { padding: 10px; border-top: 1px solid var(--line, rgba(128, 128, 160, .14)); vertical-align: middle; white-space: nowrap; }
.adm-table .num { text-align: right; }
.adm-user { display: flex; align-items: center; gap: 10px; min-width: 0; }
.adm-user .adm-mname { white-space: normal; }
.adm-user .adm-mname b { overflow-wrap: anywhere; }
.adm-avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 14px; color: #fff; background: linear-gradient(135deg, var(--primary), var(--primary-2)); }
.adm-you { font-weight: 500; font-size: 11px; color: var(--primary); }
.adm-acts { text-align: right; }
.adm-acts .btn + .btn { margin-left: 6px; }
.btn.sm { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 32px; min-width: 32px; padding: 0 10px; vertical-align: middle; border-radius: 10px; font-size: 12.5px; color: var(--text); }
.btn.sm.danger { color: var(--expense); }
.adm-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; color: var(--muted); box-shadow: var(--in); white-space: nowrap; }
.adm-pill.pri { color: var(--primary); }
.adm-pill.ok { color: var(--income); }
.adm-pill.warn { color: var(--loan); }
.adm-pill.danger { color: var(--expense); }
.adm-empty { margin: 0; padding: 18px 8px; text-align: center; font-size: 13px; color: var(--muted); }

/* แบ่งหน้า */
.adm-pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.adm-pager:empty { display: none; }
.adm-count { font-size: 12.5px; color: var(--muted); }
.adm-pages { display: flex; gap: 4px; align-items: center; }
.adm-pages button { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 10px; background: var(--bg); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; display: grid; place-items: center; }
.adm-pages button.active { color: var(--primary); font-weight: 600; box-shadow: var(--out-sm); }
.adm-pages button:disabled { opacity: .3; cursor: default; }
.adm-gap { color: var(--muted); padding: 0 2px; }

/* ความคิดเห็น */
.adm-fb { padding: 14px 4px; border-top: 1px solid var(--line, rgba(128, 128, 160, .14)); display: flex; flex-direction: column; gap: 8px; }
.adm-fb:first-child { border-top: 0; }
.adm-fb-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 12.5px; }
.adm-fb-who { font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.adm-fb-date { margin-left: auto; color: var(--muted); }
.adm-fb-msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; }
.adm-fb.done .adm-fb-msg { color: var(--muted); }
.adm-fb-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.adm-fb-acts .spacer { flex: 1; }

/* มือถือ: ตาราง → การ์ดทีละคน */
@media (max-width: 720px) {
  .adm-tabs button span { font-size: 13px; }
  .adm-tabs { gap: 2px; }
  .adm-tabs button { padding: 8px 4px; }
  .adm-tabs button svg { display: none; }
  .adm-table thead { display: none; }
  .adm-table, .adm-table tbody, .adm-table tr, .adm-table td { display: block; }
  .adm-table tr { padding: 12px 4px; border-top: 1px solid var(--line, rgba(128, 128, 160, .14)); display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
  .adm-table tr:first-child { border-top: 0; }
  .adm-table td { border: 0; padding: 0; white-space: normal; font-size: 13px; }
  .adm-table td[data-l]:not(:first-child)::before { content: attr(data-l); display: block; font-size: 11px; color: var(--muted); }
  .adm-table td:first-child, .adm-table .adm-acts { grid-column: 1 / -1; }
  .adm-table .num { text-align: left; }
  .adm-acts { text-align: left; }
  .adm-acts:empty { display: none; }
  .adm-table-wrap { overflow: visible; }
  .adm-search { max-width: none; }
}
.adm-table tr.off .adm-user { opacity: .5; }
