/* PROPFINN Admin Panel Styles */
:root {
  --navy: #0C2240; --navy-2: #102E54; --navy-3: #163A68;
  --blue: #2A6BE0; --blue-light: #DDE9FC;
  --gold: #C79A3D; --gold-light: #F4EAD0;
  --green: #15976A; --green-light: #DBF1E7;
  --red: #D8567A; --red-light: #FBE4EC;
  --yellow: #F59E0B; --yellow-light: #FEF3C7;
  --purple: #7C3AED; --purple-light: #EDE9FE;
  --gray: #6B7280; --gray-light: #F3F4F6;
  --bg: #F5F7FB; --white: #fff;
  --border: #E8ECF3; --border-soft: #EEF1F6; --text: #111827; --text-2: #6B7280;
  --shadow-sm: 0 1px 2px rgba(16,32,64,.04), 0 4px 16px rgba(16,32,64,.05);
  --shadow-md: 0 2px 6px rgba(16,32,64,.06), 0 14px 34px rgba(16,32,64,.10);
  --sidebar-w: 240px; --font: 'IBM Plex Sans Thai', 'Sukhumvit Set', system-ui, sans-serif; --font-num: 'Plus Jakarta Sans', 'IBM Plex Sans Thai', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
h2, h3 { font-size: 15px; font-weight: 600; line-height: 1.4; }
h4 { font-size: 13.5px; font-weight: 600; }

/* Layout */
.admin-layout { display: flex; min-height: 100vh; }
.admin-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; }
.admin-main { flex: 1; padding: 28px; overflow-y: auto; position: relative; z-index: 1; }
.admin-page-wrap { max-width: 1280px; margin: 0 auto; width: 100%; }
.admin-topbar { display: flex; align-items: center; justify-content: flex-end; gap: 14px; height: 58px; padding: 0 28px; background: var(--white); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 50; }
/* ปุ่ม hamburger เปิดเมนู (โชว์เฉพาะมือถือ) + ฉากหลังคลิกปิด */
.admin-menu-btn { display: none; margin-right: auto; width: 38px; height: 38px; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 10px; background: var(--white); cursor: pointer; font-size: 20px; color: var(--navy); padding: 0; }
.admin-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9998; }
.admin-user-wrap { position: relative; flex-shrink: 0; }
.admin-avatar-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--gold); color: #fff; font-weight: 700; font-size: 15px; border: none; cursor: pointer; display: grid; place-items: center; font-family: var(--font); transition: filter .15s; }
.admin-avatar-btn:hover { filter: brightness(1.06); }
.admin-user-dropdown { position: absolute; right: 0; top: calc(100% + 10px); width: 230px; background: #fff; border-radius: 14px; box-shadow: 0 14px 38px rgba(0,0,0,.16); border: 1px solid var(--border); overflow: hidden; z-index: 60; }
.admin-user-head { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; }
.admin-user-head b { font-size: 14px; color: var(--navy); }
.admin-user-head span { font-size: 12px; color: var(--text-2); }
.admin-role-badge { display: inline-block; width: fit-content; margin-top: 3px; background: var(--blue-light); color: var(--blue); font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px; }
.admin-user-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; text-align: left; font-size: 14px; color: var(--text); background: none; border: none; border-bottom: 1px solid var(--border); cursor: pointer; font-family: var(--font); }
.admin-user-item:hover { background: var(--gray-light); color: var(--navy); }
.admin-user-logout { display: flex; align-items: center; gap: 8px; width: 100%; padding: 12px 16px; text-align: left; font-size: 14px; color: var(--text); background: none; border: none; cursor: pointer; font-family: var(--font); }
.admin-user-logout:hover { background: var(--red-light); color: var(--red); }
.splash, .loading { display: grid; place-items: center; min-height: 200px; color: var(--text-2); font-size: 16px; }

/* Sidebar */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-w); background: var(--navy); display: flex; flex-direction: column; z-index: 9999; transition: transform .25s ease; }
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-logo-img { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0; }
.login-logo-img { width: 48px; height: 48px; object-fit: contain; flex-shrink: 0; }
.sidebar-brand { font-family: var(--font-num); font-weight: 800; font-size: 17px; color: #fff; }
.sidebar-sub { font-size: 10px; color: var(--gold); letter-spacing: .12em; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 99px; }
.sidebar-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.3); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.7); font-size: 14px; font-weight: 500; cursor: pointer; transition: all .15s; background: none; border: none; width: 100%; text-align: left; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(42,107,224,.25); color: #fff; }
.nav-icon { font-size: 18px; width: 20px; text-align: center; display: inline-flex; align-items: center; justify-content: center; }
.nav-subitem { display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 30px; border-radius: 10px; color: rgba(255,255,255,.55); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s; background: none; border: none; width: 100%; text-align: left; }
.nav-subitem:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-subitem.active { background: rgba(42,107,224,.2); color: #fff; }
.nav-subitem-dot { color: rgba(255,255,255,.35); font-size: 12px; width: 12px; }
.nav-group-label { display: flex; align-items: center; gap: 10px; padding: 11px 12px 5px; color: rgba(255,255,255,.9); font-size: 14px; font-weight: 700; letter-spacing: .2px; cursor: default; }
/* หัวข้อกลุ่มใหญ่ (section) ในเมนูซ้าย — ตัวเล็ก สีจาง เว้นบนให้แยกกลุ่มชัด */
.nav-section { padding: 15px 12px 5px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.4); cursor: default; }
.nav-section:first-child { padding-top: 2px; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.1); }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--gold); text-transform: uppercase; letter-spacing: .08em; }

/* compact flag language dropdown */
.lang-picker { position: relative; flex-shrink: 0; }
.lang-flag { width: 22px; height: 16px; border-radius: 3px; object-fit: cover; display: block; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.lang-btn { display: flex; align-items: center; gap: 6px; height: 34px; padding: 0 11px; border-radius: 99px;
  background: var(--gray-light); color: var(--navy); cursor: pointer;
  border: 1px solid var(--border); font-family: var(--font); }
.lang-btn:hover { background: #EAEFF6; }
.lang-label { font-size: 13px; font-weight: 600; }
.lang-menu { position: absolute; top: calc(100% + 8px); right: 0; z-index: 60; min-width: 130px;
  background: #fff; border-radius: 10px; padding: 6px; box-shadow: 0 12px 28px rgba(0,0,0,.18); border: 1px solid var(--border); }
.lang-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border: 0;
  background: transparent; border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600;
  color: #15233a; font-family: var(--font); text-align: left; }
.lang-item:hover { background: #eef3fb; }
.lang-item.active { background: #e3edfc; color: #1f58c4; }
.btn-logout { width: 100%; padding: 8px; border-radius: 8px; background: rgba(255,255,255,.08); color: rgba(255,255,255,.7); border: none; cursor: pointer; font-size: 13px; font-family: var(--font); }
.btn-logout:hover { background: rgba(255,255,255,.15); color: #fff; }

/* Page */
.page { max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 19px; font-weight: 600; color: var(--navy); }
.page-sub { color: var(--text-2); font-size: 14px; }

/* Stats Grid */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat-card { position: relative; background: var(--white); border-radius: 16px; padding: 20px 22px; border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(16,32,64,.04), 0 4px 14px rgba(16,32,64,.05); transition: transform .16s ease, box-shadow .16s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(16,32,64,.05), 0 10px 26px rgba(16,32,64,.09); }
/* accent bar ซ้าย (ลอยตัว มน) */
.stat-card::before { content: ''; position: absolute; left: 0; top: 16px; bottom: 16px; width: 4px; border-radius: 0 4px 4px 0; background: #C9D2E0; }
.stat-card.blue::before   { background: #2A6BE0; }
.stat-card.yellow::before { background: #E8A12C; }
.stat-card.purple::before { background: #7C5CE0; }
.stat-card.green::before  { background: #17A36C; }
/* แถวบน: label ซ้าย + ไอคอนกล่องมนขวา */
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.stat-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.stat-ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 20px; flex-shrink: 0;
  background: #EEF2F8; color: #5A6B85; }
.stat-card.blue   .stat-ic { background: #E7F0FE; color: #2A6BE0; }
.stat-card.yellow .stat-ic { background: #FBF1D8; color: #C7901F; }
.stat-card.purple .stat-ic { background: #EDE9FB; color: #6B4FD0; }
.stat-card.green  .stat-ic { background: #E0F4EC; color: #17A36C; }
.stat-value { font-size: 29px; font-weight: 700; color: var(--navy); font-family: var(--font-num); line-height: 1.1; letter-spacing: -.01em; }
.stat-sub { font-size: 12.5px; color: var(--text-2); margin-top: 7px; }

/* Filter cards — การ์ดกรองสถานะ (กดได้ + โชว์จำนวน) · ใช้ซ้ำได้ผ่าน window.FilterCards */
/* การ์ดกรอง — เลย์เอาต์แนวนอน กะทัดรัด (ไอคอนซ้าย · ป้าย+ตัวเลขขวา) ไม่กินพื้นที่ */
.filter-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; }
.filter-card { position: relative; text-align: left; font-family: inherit; cursor: pointer; background: var(--white);
  border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; overflow: hidden;
  display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic label" "ic value"; column-gap: 10px; align-items: center;
  box-shadow: 0 1px 2px rgba(16,32,64,.05); transition: transform .16s ease, box-shadow .16s ease, border-color .15s ease; }
.filter-card:hover { transform: translateY(-2px); box-shadow: 0 8px 18px rgba(16,32,64,.12); }
.filter-card.active { box-shadow: 0 6px 16px rgba(16,32,64,.12); }
.filter-card .fc-accent { position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 0 4px 4px 0; transition: opacity .15s; }
.filter-card .fc-top { grid-area: ic; display: flex; align-items: center; margin-bottom: 0; }
.filter-card .fc-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-size: 17px; flex-shrink: 0; }
.filter-card .fc-dot { position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%; margin-top: 0; box-shadow: 0 0 0 3px rgba(255,255,255,.9), 0 0 0 4px rgba(0,0,0,.05); animation: fc-pulse 1.8s ease-in-out infinite; }
@keyframes fc-pulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }
.filter-card .fc-label { grid-area: label; align-self: end; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-card .fc-value { grid-area: value; align-self: start; font-size: 21px; font-weight: 800; line-height: 1.15; color: var(--navy); font-family: var(--font-num); letter-spacing: -.01em; margin-top: 1px; }

/* Card */
.card { background: var(--white); border-radius: 16px; border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow: hidden; }
.card-header { padding: 16px 20px; font-weight: 600; font-size: 15px; color: var(--navy); border-bottom: 1px solid var(--border-soft); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* Table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { padding: 13px 16px; text-align: left; font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: #1E293B; background: #EEF2F8; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 14px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: #F7F9FC; }
/* หัวคอลัมน์ที่จัดลำดับได้ — ให้เห็นชัดว่าคลิกได้ */
.table th.th-sort { cursor: pointer; user-select: none; transition: background .12s, color .12s; }
.table th.th-sort:hover { background: #EAF2FF; color: #2A6BE0; }
.table th.th-sort.active { background: #EAF2FF; color: #2A6BE0; border-bottom: 2px solid #2A6BE0; }
.text-bold { font-weight: 600; }
.text-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 200px; }
.empty-state { padding: 44px 24px; text-align: center; color: var(--text-2); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty-ic { width: 60px; height: 60px; border-radius: 50%; display: grid; place-items: center; font-size: 30px; color: #9AA9BE;
  background: linear-gradient(150deg, #F1F5FA, #E6EDF6); box-shadow: inset 0 0 0 1px rgba(16,32,64,.04); }
.empty-msg { font-size: 14px; font-weight: 500; color: var(--text-2); max-width: 320px; line-height: 1.5; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2.5px solid var(--border); border-top-color: var(--blue); border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -3px; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Tabs */
/* แท็บย่อยแบบ segmented control (โมเดิร์น เบา ไม่ทึบ) */
.tabs { display: inline-flex; gap: 2px; background: var(--gray-light); padding: 4px; border-radius: 10px; width: fit-content; }
.tab { padding: 6px 15px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--text-2); border: none; background: none; cursor: pointer; transition: all .14s; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--white); color: var(--navy); font-weight: 600; box-shadow: 0 1px 3px rgba(16,32,64,.14); }

/* Badges */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: #92400E; }
.badge-blue { background: var(--blue-light); color: var(--blue); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: var(--gray-light); color: var(--gray); }

/* Buttons */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 16px; border-radius: 10px; font-weight: 600; font-size: 13px; cursor: pointer; border: none; transition: all .15s; }
.btn-primary { background: var(--blue); color: #fff; box-shadow: 0 2px 8px rgba(42,107,224,.25); }
.btn-primary:hover { background: #1F58C4; }
.btn:active { transform: translateY(.5px); }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { filter: brightness(1.1); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--white); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: #F7F9FC; border-color: #CBD5E6; color: var(--blue); }
.btn-google { background: var(--white); color: var(--text); border: 1.5px solid var(--border); width: 100%; justify-content: center; height: 48px; font-size: 15px; border-radius: 12px; }
.btn-google:hover { border-color: var(--blue); background: var(--blue-light); }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; border-radius: 8px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.row { display: flex; align-items: center; }
.row.between, .between { justify-content: space-between; width: 100%; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-16 { gap: 16px; }

/* Form */
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 3px; color: var(--navy-3); }
.input { width: 100%; padding: 7px 11px; border: 1.5px solid var(--border); border-radius: 8px; font-family: var(--font); font-size: 13.5px; color: var(--text); background: var(--white); }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-light); }
.input-sm { width: auto; height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
select.input { cursor: pointer; }
textarea.input { height: auto; resize: vertical; line-height: 1.5; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: grid; place-items: center; }
.modal { background: var(--white); border-radius: 16px; width: 100%; max-width: 480px; max-height: 90vh; padding: 0; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,.2); display: flex; flex-direction: column; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-2); width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; }
.modal-close:hover { background: var(--gray-light); }
.modal-body { padding: 24px; overflow-y: auto; min-height: 0; }

/* Customer drawer (CRM Phase 2) — แผงเลื่อนจากขวา รวมทุกลีดของลูกค้า 1 คน */
.cust-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 210; display: flex; justify-content: flex-end; }
.cust-drawer { background: var(--white); width: 100%; max-width: 560px; height: 100%; display: flex; flex-direction: column; box-shadow: -12px 0 40px rgba(0,0,0,.18); animation: custSlide .22s ease; }
@keyframes custSlide { from { transform: translateX(30px); opacity: .4; } to { transform: translateX(0); opacity: 1; } }
.cust-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.cust-body { padding: 20px 22px; overflow-y: auto; min-height: 0; flex: 1; }
.cust-idcard { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding-bottom: 16px; border-bottom: 1px dashed var(--border); margin-bottom: 16px; }
.cust-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-1); background: var(--gray-light); border-radius: 999px; padding: 6px 12px; text-decoration: none; }
.cust-chip i { color: var(--text-2); }
.cust-sec-title { font-size: 12.5px; font-weight: 700; color: var(--text-2); letter-spacing: .02em; margin: 6px 0 10px; text-transform: none; }
.cust-lead { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 9px; }
.cust-lead-link { cursor: pointer; }
.cust-lead-link:hover { border-color: var(--blue); box-shadow: 0 2px 10px rgba(42,107,224,.08); }

/* การ์ดทรัพย์ในตารางลีด — รูป + ชื่อลิงก์ + เมทา + ราคา (คลิกไปหน้าจัดการทรัพย์) */
.lead-prop { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; min-width: 180px; }
.lead-prop-thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; flex-shrink: 0; background: var(--gray-light); }
.lead-prop-noimg { display: grid; place-items: center; color: var(--text-2); font-size: 20px; }
.lead-prop-title { font-weight: 600; font-size: 13.5px; color: var(--blue); line-height: 1.3; display: flex; align-items: center; gap: 4px; }
.lead-prop-title i { font-size: 12px; opacity: .65; }
.lead-prop:hover .lead-prop-title { text-decoration: underline; }
.lead-prop-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 2px; }
.lead-prop-price { font-size: 13px; font-weight: 700; color: var(--navy); font-family: var(--font-num); margin-top: 2px; }
.cust-lead-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; font-size: 19px; flex-shrink: 0; }
.cust-timeline { position: relative; padding-left: 6px; }
.cust-tl-item { display: flex; gap: 12px; position: relative; padding-bottom: 16px; }
.cust-tl-item:not(:last-child)::before { content: ''; position: absolute; left: 13px; top: 26px; bottom: 0; width: 2px; background: var(--border); }
.cust-tl-dot { width: 28px; height: 28px; border-radius: 50%; background: var(--white); border: 2px solid currentColor; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; z-index: 1; }
.cust-clickable { cursor: pointer; color: var(--blue); }
.cust-clickable:hover { text-decoration: underline; }
@media (max-width: 640px) { .cust-drawer { max-width: 100%; } }

/* Alert */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; }
.alert-error { background: var(--red-light); color: var(--red); }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-3) 100%); }
.login-card { background: var(--white); border-radius: 20px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand { font-family: var(--font-num); font-weight: 800; font-size: 22px; color: var(--navy); }
.login-sub { font-size: 12px; color: var(--text-2); letter-spacing: .1em; text-transform: uppercase; }
.login-desc { font-size: 14px; color: var(--text-2); margin-bottom: 24px; line-height: 1.5; }

@media (max-width: 1080px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}
/* Infrastructure Diagram */
.infra-diagram { padding: 32px; }
.infra-diagram-inner { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.infra-row { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.infra-node { background: var(--white); border: 2.5px solid var(--border); border-radius: 14px; padding: 16px 24px; text-align: center; min-width: 140px; transition: transform .15s, box-shadow .15s; }
.infra-node:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(0,0,0,.1); }
.infra-node-icon { font-size: 28px; margin-bottom: 6px; }
.infra-node-name { font-weight: 700; font-size: 15px; color: var(--navy); }
.infra-node-sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.infra-user { background: linear-gradient(135deg, var(--navy), var(--navy-3)); color: #fff; border: none; }
.infra-user .infra-node-name { color: #fff; }
.infra-backend { min-width: 200px; }
.infra-small { min-width: 110px; padding: 12px 18px; }
.infra-small .infra-node-icon { font-size: 22px; }
.infra-arrow { font-size: 20px; color: var(--text-2); }
.infra-arrow-split { display: flex; gap: 80px; color: var(--text-2); font-size: 20px; }
.infra-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--text-2); background: var(--gray-light); padding: 4px 14px; border-radius: 99px; margin-top: 4px; }
.infra-badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600; }
.infra-accounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.infra-account-card { display: flex; align-items: center; gap: 12px; padding: 16px; }
.infra-account-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* Rich Text Editor */
.ql-toolbar.ql-snow { border-radius: 10px 10px 0 0; border-color: var(--border); background: var(--gray-light); }
.ql-container.ql-snow { border-radius: 0 0 10px 10px; border-color: var(--border); font-family: var(--font); font-size: 15px; min-height: 300px; }
.ql-editor { min-height: 300px; line-height: 1.8; }
.ql-editor h1 { font-size: 28px; font-weight: 700; margin-bottom: 12px; }
.ql-editor h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.ql-editor h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.ql-editor p { margin-bottom: 12px; }
.ql-editor blockquote { border-left: 4px solid var(--gold); padding-left: 16px; color: var(--text-2); font-style: italic; }
.ql-editor img { max-width: 100%; border-radius: 8px; margin: 12px 0; }
.ql-editor a { color: var(--blue); }
.ql-editor table { width: 100%; border-collapse: collapse; margin: 14px 0; font-size: 14px; }
.ql-editor table th, .ql-editor table td { border: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.ql-editor table th { background: var(--gray-light); font-weight: 700; }
.ql-editor table.pf-table { cursor: pointer; }
.ql-editor table.pf-table:hover { outline: 2px solid #2A6BE0; outline-offset: 2px; }
.ql-snow .ql-tooltip { z-index: 10000; }

@media (max-width: 768px) {
  .admin-content { margin-left: 0; }
  .admin-main { padding: 16px; }
  .admin-topbar { padding: 0 16px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .admin-menu-btn { display: inline-flex; }
  .admin-overlay.show { display: block; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .infra-accounts { grid-template-columns: 1fr; }
}

/* ===== Executive report ===== */
.exec-section { margin: 28px 0 12px; font-size: 16px; color: var(--navy-2); font-weight: 700; }
.exec-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.exec-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.exec-stat { padding: 16px 18px; }
.exec-stat-label { font-size: 13px; color: var(--text-2); margin-bottom: 8px; }
.exec-stat-value { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.exec-stat-sub { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.exec-toptable { width: 100%; border-collapse: collapse; }
.exec-toptable td { padding: 9px 6px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text); }
.exec-toptable tr:last-child td { border-bottom: 0; }
@media (max-width: 1100px) { .exec-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) { .exec-grid { grid-template-columns: 1fr 1fr; } .exec-grid-2 { grid-template-columns: 1fr; } }

/* =====================================================
   MOBILE — ฟอร์ม/หน้าจัดการทรัพย์ (แอดมิน)  jul 2026
   editor ใช้ inline style → override grid ด้วย attribute selector + !important
   grid แบบ auto-fit/auto-fill ปล่อยตามเดิม (ยืดหดเองอยู่แล้ว)
   ===================================================== */
@media (max-width: 600px) {
  .page { padding-left: 8px; padding-right: 8px; }
  .btn { height: 40px; }

  /* ฟอร์มหลายคอลัมน์ + layout 2 คอลัมน์ (แผนที่/ฟอร์มคู่/รูปภาพ/ความเสี่ยง) → 1 คอลัมน์ */
  [style*="repeat(4,1fr)"], [style*="repeat(4, 1fr)"],
  [style*="1.3fr 1fr"],
  [style*="1.15fr 1fr"],
  [style*="1fr 1fr"],
  [style*="minmax(0px, 1.15fr)"] {
    grid-template-columns: 1fr !important;
  }
}
