/* ============================================================
   ระบบบันทึกการตรวจวัดอุณหภูมิห้อง — สไตล์หลัก (responsive)
   มือถือ → แท็บเล็ต → เดสก์ท็อป / จอใหญ่
   ============================================================ */

:root {
    --primary: #1d6f42;
    --primary-600: #185c37;
    --primary-dark: #14502f;
    --primary-50: #f3faf6;
    --primary-light: #e3f5e9;
    --accent: #2f9e6c;
    --danger: #c0392b;
    --danger-dark: #9c2b1f;
    --danger-light: #fdeceb;
    --warn: #a15c07;
    --warn-light: #fff4de;
    --info: #1f5fa8;
    --info-light: #e8f1fb;

    --bg: #f1f5f3;
    --surface: #ffffff;
    --surface-2: #f7faf8;
    --border: #dde5e1;
    --border-strong: #c5d1cb;
    --text: #22302b;
    --text-muted: #5f716a;

    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px rgba(20, 50, 35, 0.06);
    --shadow: 0 1px 2px rgba(20, 50, 35, 0.05), 0 6px 20px rgba(20, 50, 35, 0.07);
    --shadow-lg: 0 24px 60px rgba(10, 30, 20, 0.28);
    --ring: 0 0 0 3px rgba(47, 158, 108, 0.28);

    --container: 1240px;
    --gutter: clamp(12px, 3vw, 28px);
    --topbar-h: 60px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Sarabun", "Segoe UI", "Tahoma", system-ui, sans-serif;
    font-size: clamp(15px, 0.88rem + 0.18vw, 16.5px);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body.modal-open, body.nav-lock { overflow: hidden; }

img, svg, canvas { max-width: 100%; }

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

.skip-link {
    position: absolute;
    left: 12px;
    top: -60px;
    z-index: 2000;
    background: var(--primary-dark);
    color: #fff;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: top 0.15s ease;
}
.skip-link:focus { top: 10px; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------------- แถบบน / เมนู ---------------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 500;
    color: #fff;
    background: linear-gradient(120deg, var(--primary-dark) 0%, var(--primary) 55%, #2a8a58 100%);
    box-shadow: 0 2px 12px rgba(10, 40, 25, 0.22);
}

.topbar-inner {
    max-width: var(--container);
    margin: 0 auto;
    min-height: var(--topbar-h);
    padding: 0 var(--gutter);
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    flex-shrink: 0;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.16);
    display: grid; place-items: center;
}
.brand-mark svg { width: 22px; height: 22px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 1.02rem; letter-spacing: 0.2px; }
.brand-text small { font-size: 0.72rem; opacity: 0.8; letter-spacing: 0.6px; }

.site-nav {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.nav-link {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 0.95rem;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, 0.22); color: #fff; font-weight: 600; }
.nav-link .badge { padding: 0 7px; font-size: 0.72rem; line-height: 1.5; }

.nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-left: 14px;
    border-left: 1px solid rgba(255, 255, 255, 0.25);
}
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: #fff; color: var(--primary-dark);
    display: grid; place-items: center;
    font-weight: 700; font-size: 0.95rem;
}
.nav-user-name { display: flex; flex-direction: column; line-height: 1.2; font-size: 0.88rem; }
.nav-user-name small { opacity: 0.8; font-size: 0.72rem; }
.nav-logout {
    color: #fff; text-decoration: none; font-size: 0.88rem;
    padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.4);
    white-space: nowrap;
}
.nav-logout:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.nav-toggle {
    display: none;
    margin-left: auto;
    width: 44px; height: 44px;
    border: 0; border-radius: 10px;
    background: rgba(255, 255, 255, 0.14);
    cursor: pointer;
    padding: 0;
    flex-direction: column; align-items: center; justify-content: center; gap: 5px;
}
.nav-toggle span {
    display: block; width: 22px; height: 2px; background: #fff; border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.topbar.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topbar.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.topbar.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------------- โครงหน้า ---------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: clamp(16px, 3vw, 30px) var(--gutter) 40px;
    flex: 1 0 auto;
}

.site-footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.8rem;
    padding: 18px var(--gutter) 26px;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 8px;
}
.page-head h1 { margin: 0; }

h1, h2, h3 { color: var(--primary-dark); line-height: 1.3; }
h1 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.85rem); margin: 0 0 12px; }
h2 { font-size: clamp(1.05rem, 1rem + 0.35vw, 1.3rem); margin: 0 0 14px; }
h3 { font-size: 1.05rem; }

.hint { color: var(--text-muted); font-size: 0.92rem; margin: 0 0 16px; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: clamp(16px, 2.4vw, 26px);
    margin-bottom: clamp(14px, 2.4vw, 24px);
    box-shadow: var(--shadow);
}

details.card summary { cursor: pointer; }

/* ---------------- ตาราง ---------------- */
.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.table-scroll > table { margin: 0; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.93rem;
    background: var(--surface);
}

th, td {
    border-bottom: 1px solid var(--border);
    padding: 11px 12px;
    text-align: center;
    vertical-align: middle;
}

th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    white-space: nowrap;
    border-bottom: 2px solid #c9e4d3;
}

tbody tr:nth-child(even) { background: var(--surface-2); }
tbody tr:hover { background: var(--primary-50); }
tbody tr:last-child td { border-bottom: 0; }

/* ตารางแบบฟอร์ม (รายงาน FM-STO-009): เส้นตารางครบทุกช่อง */
table.table-grid th, table.table-grid td { border: 1px solid var(--border-strong); padding: 7px 8px; }
table.table-grid tbody tr:last-child td { border-bottom: 1px solid var(--border-strong); }

.text-left { text-align: left; }
.actions-cell { white-space: normal; }
.actions-cell form { display: inline-block; vertical-align: middle; }
.actions-cell .btn { margin: 2px 2px 2px 0; }

/* ---------------- ปุ่ม ---------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
    border: 0;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 600;
    font-family: inherit;
    line-height: 1.2;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { box-shadow: var(--ring); border-radius: var(--radius-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary { background: #66766f; }
.btn-secondary:hover { background: #4f5e58; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: var(--danger-dark); }
.btn-outline { background: transparent; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.btn-outline:hover { background: var(--primary-light); color: var(--primary-dark); }
.btn-sm { min-height: 34px; padding: 5px 12px; font-size: 0.85rem; }
.btn-lg { min-height: 50px; padding: 12px 28px; font-size: 1.05rem; }
.btn-block { display: flex; width: 100%; }

/* ---------------- ฟอร์ม ---------------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.92rem; }

.form-row input, .form-row select, .form-row textarea,
.input {
    width: 100%;
    min-height: 42px;
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-row textarea { min-height: 84px; resize: vertical; }
.form-row input::placeholder, .form-row textarea::placeholder { color: #94a39d; }

.form-row input:focus, .form-row select:focus, .form-row textarea:focus, .input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: var(--ring);
}
.form-row input:disabled { background: var(--surface-2); color: var(--text-muted); }

.inline-fields { display: flex; gap: 14px; flex-wrap: wrap; }
.inline-fields .form-row { flex: 1 1 180px; min-width: 0; }

/* ---------------- ปุ่มไอคอน / แถวปุ่มจัดการ ---------------- */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.row-actions form { display: inline-flex; margin: 0; }
.icon-btn {
    width: 36px;
    height: 36px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.icon-btn.danger { color: var(--danger); }
.icon-btn.danger:hover { background: var(--danger-light); border-color: var(--danger); color: var(--danger-dark); }
.icon-btn.success { color: var(--primary); }
.icon-btn:focus-visible { box-shadow: var(--ring); }
@media (pointer: coarse) { .icon-btn { width: 42px; height: 42px; } }

/* ค่าที่วัดได้: ค่าที่ผิดปกติเป็นสีแดง */
.reading { display: inline-flex; flex-direction: column; gap: 2px; text-align: left; white-space: nowrap; }
.val-bad { color: var(--danger); font-weight: 700; }
.val-bad small { font-weight: 600; }

/* ---------------- ป้าย / แจ้งเตือน ---------------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
}
.badge-ok { background: var(--primary-light); color: var(--primary-dark); }
.badge-bad { background: var(--danger-light); color: var(--danger); }
.badge-muted { background: #edf0ee; color: #6a7a73; }
td.badge-bad { border-radius: 0; font-weight: 600; }

.alert {
    position: relative;
    padding: 12px 16px 12px 46px;
    border-radius: var(--radius);
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.alert::before {
    position: absolute; left: 14px; top: 11px;
    width: 22px; height: 22px; border-radius: 50%;
    display: grid; place-items: center;
    font-size: 0.8rem; font-weight: 700; color: #fff;
}
.alert-error { background: var(--danger-light); color: #8e2a1f; border-color: #f3c6c1; }
.alert-error::before { content: "!"; background: var(--danger); }
.alert-success { background: var(--primary-light); color: var(--primary-dark); border-color: #b9e3c6; }
.alert-success::before { content: "\2713"; background: var(--primary); }
.alert a { font-weight: 600; }

.point-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }

.qr-box { text-align: center; }
.qr-box img { border: 1px solid var(--border); padding: 8px; background: #fff; border-radius: var(--radius-sm); }

/* ---------------- หน้าเข้าสู่ระบบ ---------------- */
.auth-wrap { min-height: 60vh; display: grid; place-items: center; padding: 12px 0; }
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: clamp(22px, 5vw, 36px);
    box-shadow: var(--shadow-lg);
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 58px; height: 58px; margin: 0 auto 12px; background: var(--primary-light); }
.auth-brand .brand-mark svg { width: 32px; height: 32px; color: var(--primary); }
.auth-brand h1 { margin: 0 0 4px; font-size: 1.4rem; }
.auth-brand p { margin: 0; color: var(--text-muted); font-size: 0.9rem; }

/* ---------------- Modal ---------------- */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(12, 28, 20, 0.55);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    z-index: 1000;
    align-items: flex-start;
    justify-content: center;
    padding: clamp(16px, 6vh, 60px) 16px;
    overflow-y: auto;
}

.modal {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 580px;
    box-shadow: var(--shadow-lg);
    animation: modal-pop 0.18s ease;
}

@keyframes modal-pop {
    from { transform: translateY(10px) scale(0.98); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; }

.modal-close {
    flex-shrink: 0;
    width: 38px; height: 38px;
    display: grid; place-items: center;
    background: var(--surface-2);
    border: 0;
    border-radius: 50%;
    font-size: 1.5rem;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: none;
}
.modal-close:hover { color: var(--danger); background: var(--danger-light); }

.modal-body { padding: 22px; }

.modal-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 8px; flex-wrap: wrap; }

.autocomplete-results {
    position: absolute;
    z-index: 10;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    max-height: 240px;
    overflow: auto;
    display: none;
    box-shadow: var(--shadow);
}
.autocomplete-item { padding: 10px 14px; cursor: pointer; font-size: 0.95rem; }
.autocomplete-item:hover { background: var(--primary-light); }

/* ============================================================
   Responsive
   ============================================================ */

/* จอใหญ่ */
@media (min-width: 1500px) {
    :root { --container: 1360px; }
}

/* แท็บเล็ต / จอเล็ก: เมนูยุบเป็นปุ่มแฮมเบอร์เกอร์ */
@media (max-width: 1140px) {
    .nav-toggle { display: inline-flex; }

    .site-nav {
        position: absolute;
        left: 0; right: 0; top: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 2px;
        padding: 10px var(--gutter) 16px;
        background: var(--primary-dark);
        box-shadow: 0 14px 24px rgba(0, 0, 0, 0.25);
        max-height: calc(100vh - var(--topbar-h));
        overflow-y: auto;
        visibility: hidden;
        opacity: 0;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    }
    .topbar.nav-open .site-nav { visibility: visible; opacity: 1; transform: none; pointer-events: auto; }

    .nav-link { padding: 13px 14px; border-radius: 10px; font-size: 1rem; }
    .nav-user {
        margin: 8px 0 0;
        padding: 14px 4px 0;
        border-left: 0;
        border-top: 1px solid rgba(255, 255, 255, 0.2);
    }
    .nav-logout { margin-left: auto; padding: 9px 16px; }
}

/* จอกลาง: ซ่อนชื่อผู้ใช้เพื่อให้เมนูพอดีแถวเดียว */
@media (min-width: 1141px) and (max-width: 1400px) {
    .nav-user-name { display: none; }
}

/* มือถือ */
@media (max-width: 720px) {
    .brand-text small { display: none; }
    .page-head .btn { width: 100%; }
    .head-actions { width: 100%; }
    .head-actions .btn { flex: 1 1 140px; }

    /* ตารางที่มี class="responsive" กลายเป็นการ์ดต่อแถว */
    table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
    table.responsive { background: transparent; }
    table.responsive thead { display: none; }
    table.responsive tr {
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        box-shadow: var(--shadow-sm);
        padding: 6px 14px;
        margin-bottom: 12px;
    }
    table.responsive tbody tr:nth-child(even), table.responsive tbody tr:hover { background: var(--surface); }
    table.responsive td {
        position: relative;
        border: 0;
        border-bottom: 1px dashed var(--border);
        padding: 9px 0 9px 40%;
        min-height: 40px;
        text-align: left;
        overflow-wrap: anywhere;
    }
    table.responsive td:last-child { border-bottom: 0; }
    table.responsive td[data-label]:not([data-label=""])::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 10px;
        width: 36%;
        font-size: 0.78rem;
        font-weight: 600;
        color: var(--text-muted);
        line-height: 1.5;
    }
    table.responsive td.actions-cell,
    table.responsive td[data-label=""] { padding-left: 0; }
    table.responsive td.actions-cell::before { display: none; }
    table.responsive td.td-full { text-align: center; color: var(--text-muted); padding-left: 0; }
    table.responsive .actions-cell form { display: inline-block; }

    .alert { font-size: 0.92rem; }
    .inline-fields .form-row { flex-basis: 100%; }
    .table-scroll:has(> table.responsive) { border: 0; overflow: visible; border-radius: 0; }

    /* Modal เป็นแผ่นเลื่อนขึ้นจากด้านล่าง */
    .modal-backdrop { padding: 0; align-items: flex-end; }
    .modal {
        max-width: none;
        border-radius: 18px 18px 0 0;
        max-height: 94vh;
        overflow-y: auto;
        animation: sheet-up 0.22s ease;
    }
    .modal-body { padding: 18px; }
    .modal-header { padding: 14px 18px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
    .modal-footer { flex-direction: column-reverse; }
    .modal-footer .btn { width: 100%; min-height: 46px; }

    .actions-cell .btn { margin-bottom: 6px; }
}

@keyframes sheet-up {
    from { transform: translateY(40px); opacity: 0.4; }
    to { transform: none; opacity: 1; }
}

/* จอสัมผัส: ปุ่มและช่องกรอกใหญ่ขึ้น กดง่าย (และกันไม่ให้ iOS ซูมเข้า) */
@media (pointer: coarse) {
    .btn { min-height: 44px; }
    .btn-sm { min-height: 40px; }
    .form-row input, .form-row select, .form-row textarea, .input { min-height: 48px; font-size: 16px; }
    .nav-link { min-height: 46px; }
}

@media (max-width: 480px) {
    :root { --topbar-h: 56px; }
    .brand-text strong { font-size: 0.95rem; }
    .card { padding: 14px; }
    .btn-lg { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---------------- พิมพ์ ---------------- */
@media print {
    .topbar, .no-print, .site-footer, .skip-link { display: none !important; }
    .container { max-width: 100%; padding: 0; }
    body { background: #fff; display: block; font-size: 12px; }
    .card { box-shadow: none; border-color: #999; break-inside: avoid; }
    table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: revert; }
    table.responsive thead { display: table-header-group; }
}

/* ---------------- ตั้งเวลารอบ ---------------- */
.round-settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.round-box {
    margin: 0;
    padding: 14px 18px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-2);
}
.round-box legend { font-weight: 700; color: var(--primary-dark); padding: 0 8px; }
.round-box:disabled { opacity: 0.6; }
.settings-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.note-list { margin: 0; padding-left: 20px; color: var(--text-muted); line-height: 1.8; }

/* ค่ามาตรฐานใต้ช่องกรอก (หน้าบันทึกผล) */
.field-std { margin-top: 6px; font-size: 0.88rem; color: var(--text-muted); }
.field-std strong { color: var(--primary-dark); }
.field-std.bad, .field-std.bad strong { color: var(--danger); }
.form-row input.is-bad { border-color: var(--danger); background: var(--danger-light); }
.form-row input.is-bad:focus { box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.22); }

.input-sm { min-height: 36px; padding: 4px 10px; font-size: 0.9rem; width: auto; min-width: 130px; }

/* เลือกอาคาร (ผู้ดูข้อมูล) */
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; max-height: 260px; overflow-y: auto; padding: 4px 2px; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 0.95rem; cursor: pointer; padding: 6px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
.check-item:hover { background: var(--primary-50); }
.check-item input { accent-color: var(--primary); width: 18px; height: 18px; }
.bld-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left; }
