/* =====================================================================
   app.css — คลาสกลางของแอป kku_mobile (prefix ma-) ใช้ร่วมทุก module
   โหลดต่อจาก tokens.css, components.css, mobile.css ของ CI kku-dent-ci-mobile
   ทุกค่าอ้างจาก CI: สี มุมโค้ง เงา ขนาดตัวอักษร
   คลาสเฉพาะ module ให้เขียนใน module นั้นด้วย prefix ของตัวเอง
   ===================================================================== */
[hidden] { display: none !important; }
.ic { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.scr { flex: 1; display: flex; flex-direction: column; }
.m-top__avatar { display: inline-flex; align-items: center; justify-content: center; }
/* ปุ่มย้อนกลับบนหัวแอป ใช้แทนโลโก้ในหน้าจอย่อยของ module */
.ma-back { width: 36px; height: 36px; margin-left: -6px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.18); color: #fff; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; }

/* ปุ่มหลักนอก bottom sheet: สูง 44px มุม 12px เท่าปุ่มใน sheet */
.m-app .ma-btn { height: 44px; border-radius: 12px; font-weight: 700; font-size: 0.92rem; width: 100%; }
.m-app .ma-btn--p { box-shadow: 0 4px 14px rgba(134, 69, 170, 0.3); }
.m-app .ma-btn--out { background: #fee2e2; color: #b91c1c; border-color: transparent; }

/* ---------- ช่องกรอก (ใช้ทั้งหน้า login และใน sheet) ---------- */
.ma-field { display: flex; flex-direction: column; }
.ma-inp { position: relative; display: flex; align-items: center; }
.ma-inp .inp { width: 100%; height: 44px; border-radius: 12px; font-size: 0.9rem; padding: 0 12px 0 40px; }
.ma-inp--plain .inp { padding-left: 12px; }
.ma-inp--eye .inp { padding-right: 46px; }
.ma-inp select.inp { appearance: none; -webkit-appearance: none; padding-right: 38px; }
.ma-inp__ico { position: absolute; left: 12px; color: var(--muted); display: inline-flex; pointer-events: none; }
.ma-inp__chev { position: absolute; right: 12px; color: var(--muted); display: inline-flex; pointer-events: none; }
.ma-inp__eye { position: absolute; right: 0; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; border-radius: 12px; }
.ma-field--err .inp { border-color: var(--danger); }
.ma-err { font-size: 0.7rem; color: var(--danger-text); margin-top: 4px; line-height: 1.4; }
.ma-hint { font-size: 0.7rem; color: var(--muted); margin-top: 4px; line-height: 1.4; }

/* ---------- Login ---------- */
.ma-login__brand { background: #8645aa; color: #fff; border-radius: 0 0 24px 24px; padding: 36px 20px 58px; text-align: center; box-shadow: 0 2px 8px rgba(15, 23, 42, 0.25); }
.ma-login__logo { height: 30px; width: auto; }
.ma-login__name { font-size: 1.15rem; font-weight: 800; margin-top: 16px; line-height: 1.2; }
.ma-login__sub { font-size: 0.72rem; opacity: 0.92; margin-top: 3px; }
.ma-login__card { margin: -34px 12px 0; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px 16px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 2px 10px rgba(70, 25, 100, 0.07); position: relative; }
.ma-login__h { font-weight: 700; font-size: 1rem; }
.ma-login__hs { font-size: 0.74rem; color: var(--muted); margin-top: 2px; }
.ma-login__foot { margin-top: auto; padding: 18px 12px calc(14px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 0.68rem; color: var(--muted); line-height: 1.6; }
.ma-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.45); border-top-color: #fff; animation: ma-spin 0.7s linear infinite; }
@keyframes ma-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .ma-spin { animation: none; } }

/* ---------- หน้าแรก: เมนูเลือกระบบงาน ---------- */
.ma-hero--stack { display: block; }
.ma-hero__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ma-hero__hi { font-size: 0.8rem; opacity: 0.9; }
.ma-hero__name { font-size: 1.15rem; font-weight: 700; margin-top: 4px; }
.ma-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ma-tile { text-align: left; font-family: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px; min-height: 118px; display: flex; flex-direction: column; gap: 10px; cursor: pointer; box-shadow: 0 2px 10px rgba(70, 25, 100, 0.07); }
.ma-tile:active { background: var(--primary-subtle); }
.ma-tile__ico { width: 46px; height: 46px; border-radius: 14px; background: #f0e4f7; color: #8645aa; display: inline-flex; align-items: center; justify-content: center; }
.ma-tile__t { font-weight: 700; font-size: 0.92rem; line-height: 1.25; }
.ma-tile__s { font-size: 0.7rem; color: var(--muted); line-height: 1.4; margin-top: 2px; }
.ma-tile--wide { grid-column: 1 / -1; flex-direction: row; align-items: center; min-height: 0; gap: 12px; }
.ma-tile--out .ma-tile__ico { background: #fee2e2; color: #b91c1c; }
.ma-tile--out .ma-tile__t { color: #b91c1c; }

/* ---------- หน้า "กำลังพัฒนา" ---------- */
.ma-soon { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 44px 16px; }
.ma-soon__ico { width: 64px; height: 64px; border-radius: 14px; background: #f0e4f7; color: #8645aa; display: inline-flex; align-items: center; justify-content: center; }
.ma-soon__t { font-weight: 700; font-size: 1rem; color: var(--ink); }
.ma-soon__s { font-size: 0.82rem; line-height: 1.5; }

/* ---------- Profile ---------- */
.ma-ava { position: relative; width: 64px; height: 64px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.6); background: rgba(255, 255, 255, 0.22); color: #fff; font-family: inherit; font-weight: 700; font-size: 1.5rem; padding: 0; cursor: pointer; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; }
.ma-ava img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; display: block; }
.ma-ava__cam { position: absolute; right: -4px; bottom: -4px; width: 26px; height: 26px; border-radius: 50%; background: #fff; color: #8645aa; display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(70, 25, 100, 0.3); }
.ma-hero__pillrow { margin-top: 6px; }
.ma-kv .kv { font-size: 0.86rem; padding: 9px 0; align-items: baseline; }
.ma-kv .kv > span:first-child { color: var(--muted); flex-shrink: 0; }
.ma-kv .kv > span:last-child { font-weight: 600; text-align: right; overflow-wrap: anywhere; }
.m-app .ma-rows { padding: 0; overflow: hidden; }
.ma-row { width: 100%; min-height: 60px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 0; background: transparent; font-family: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.ma-row + .ma-row { border-top: 1px solid var(--border); }
.ma-row:active { background: var(--primary-subtle); }
.ma-row__ico { width: 38px; height: 38px; border-radius: 12px; background: #f0e4f7; color: #8645aa; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ma-row__main { flex: 1; min-width: 0; }
.ma-row__t { font-weight: 700; font-size: 0.88rem; }
.ma-row__s { font-size: 0.7rem; color: var(--muted); margin-top: 1px; }
.ma-row__chev { color: var(--muted); display: inline-flex; }

/* ---------- Bottom sheet ของ module นี้ ---------- */
.m-sheet { border-radius: 20px 20px 0 0; padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.ma-sheet__t { font-weight: 700; font-size: 1rem; }
.ma-sheet__x { width: 42px; height: 42px; margin: -8px -8px -8px 0; border: 0; background: transparent; color: var(--muted); border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.ma-form { display: flex; flex-direction: column; gap: 12px; }
.ma-rules { list-style: none; margin: 0; padding: 10px 12px; background: var(--bg); border-radius: 12px; display: flex; flex-direction: column; gap: 6px; }
.ma-rule { display: flex; align-items: center; gap: 8px; font-size: 0.76rem; color: var(--muted); line-height: 1.4; }
.ma-rule__m { width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; color: transparent; flex-shrink: 0; }
.ma-rule--ok { color: var(--success-text); font-weight: 600; }
.ma-rule--ok .ma-rule__m { background: var(--success); border-color: var(--success); color: #fff; }
.ma-rule__st { margin-left: auto; font-size: 0.68rem; font-weight: 600; white-space: nowrap; }
.ma-photo { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0 2px; }
.ma-photo__pv { width: 104px; height: 104px; border-radius: 50%; background: #f0e4f7; color: #8645aa; border: 2px solid #e6d5f2; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 2.4rem; overflow: hidden; }
.ma-photo__pv img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ma-row--danger .ma-row__ico { background: #fee2e2; color: #b91c1c; }
.ma-row--danger .ma-row__t { color: #b91c1c; }
.ma-confirm { font-size: 0.86rem; color: var(--ink-soft); line-height: 1.6; }

/* =====================================================================
   ตัวช่วยดู mock — ไม่ใช่ส่วนของแอป แสดงเฉพาะจอกว้าง
   ===================================================================== */
body { background: #e2e4e9; }
.mock-nav { display: none; }
@media (min-width: 1000px) {
  .mock-nav { display: flex; flex-direction: column; gap: 4px; position: fixed; left: 16px; top: 16px; width: 208px; padding: 12px; background: #fff; border: 1px dashed #9aa0aa; border-radius: 12px; font-size: 0.74rem; z-index: 100; max-height: calc(100vh - 32px); overflow: auto; }
  .mock-nav b { font-size: 0.76rem; }
  .mock-nav p { margin: 0 0 6px; color: #535559; line-height: 1.45; }
  .mock-nav span { margin-top: 8px; font-weight: 700; color: #535559; font-size: 0.68rem; }
  .mock-nav button { text-align: left; font: inherit; padding: 6px 8px; border: 1px solid #dbdee2; background: #f7f8fa; border-radius: 8px; cursor: pointer; }
  .mock-nav button:hover { background: #eceef2; }
}
