/* =========================================================
   KBS WebForms Template Theme
   CSS กลางของระบบ
   Stack หลัก: ASP.NET Web Forms + VB.NET + Bootstrap 5
   ========================================================= */

:root {
    --kbs-primary: #2563eb;
    --kbs-primary-dark: #1d4ed8;
    --kbs-primary-soft: #eff6ff;
    --kbs-success: #16a34a;
    --kbs-warning: #f59e0b;
    --kbs-danger: #dc2626;
    --kbs-info: #0891b2;
    --kbs-bg: #f5f7fb;
    --kbs-surface: #ffffff;
    --kbs-border: #e5e7eb;
    --kbs-text: #111827;
    --kbs-muted: #6b7280;
    --kbs-sidebar: #eef2f7;
    --kbs-radius: 16px;
    --kbs-shadow: 0 10px 28px rgba(15, 23, 42, .08);
    --kbs-font-th: 'Prompt', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --kbs-font-num: 'Public Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--kbs-bg);
    color: var(--kbs-text);
    font-family: var(--kbs-font-th);
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.font-num,
.num,
.kbs-num {
    font-family: var(--kbs-font-num);
    font-variant-numeric: tabular-nums;
}

.kbs-app {
    min-height: 100vh;
    display: flex;
}

.kbs-sidebar {
    width: 270px;
    min-height: 100vh;
    background: var(--kbs-sidebar);
    border-right: 1px solid var(--kbs-border);
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1040;
    transition: transform .2s ease;
}

.kbs-brand {
    height: 66px;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    border-bottom: 1px solid rgba(148, 163, 184, .35);
}

.kbs-brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--kbs-primary);
    color: #fff;
    font-weight: 700;
    font-family: var(--kbs-font-num);
}

.kbs-brand-title { font-weight: 700; line-height: 1.1; }
.kbs-brand-subtitle { color: var(--kbs-muted); font-size: 12px; }

.kbs-menu { padding: 14px 12px; }
.kbs-menu-label {
    color: #8994a5;
    font-size: 12px;
    font-weight: 600;
    padding: 10px 12px 8px;
    text-transform: uppercase;
    letter-spacing: .03em;
}

.kbs-menu-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    color: #1f2937;
    margin-bottom: 4px;
    transition: background .15s ease, color .15s ease;
}

.kbs-menu-link:hover,
.kbs-menu-link.active {
    background: #e9efff;
    color: var(--kbs-primary-dark);
}

.kbs-menu-link i { width: 20px; text-align: center; }

.kbs-main {
    flex: 1;
    margin-left: 270px;
    min-width: 0;
}

.kbs-topbar {
    height: 66px;
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(245, 247, 251, .86);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--kbs-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.kbs-toggle {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: #334155;
    display: none;
    align-items: center;
    justify-content: center;
}

.kbs-toggle:hover { background: rgba(148, 163, 184, .16); }

.kbs-topbar-title { font-weight: 700; }

.kbs-update-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    border-radius: 999px;
    background: #fff;
    color: var(--kbs-muted);
    border: 1px solid var(--kbs-border);
    box-shadow: 0 6px 18px rgba(15, 23, 42, .05);
    font-size: 12px;
}

.kbs-content {
    padding: 24px;
}

.kbs-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 18px;
}

.kbs-page-title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.kbs-page-subtitle {
    margin: 5px 0 0;
    color: var(--kbs-muted);
}

.kbs-card {
    background: var(--kbs-surface);
    border: 1px solid var(--kbs-border);
    border-radius: var(--kbs-radius);
    box-shadow: var(--kbs-shadow);
    padding: 18px;
}

.kbs-card-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 12px;
}

.kbs-filter-bar {
    background: #fff;
    border: 1px solid var(--kbs-border);
    border-radius: var(--kbs-radius);
    padding: 14px;
    margin-bottom: 18px;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: end;
}

.kbs-btn {
    border: 0;
    border-radius: 12px;
    min-height: 40px;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
}

.kbs-btn-primary { background: var(--kbs-primary); color: #fff; }
.kbs-btn-primary:hover { background: var(--kbs-primary-dark); color: #fff; }
.kbs-btn-light { background: #f1f5f9; color: #334155; }
.kbs-btn-danger { background: var(--kbs-danger); color: #fff; }

.kbs-table-wrap {
    overflow: auto;
    border: 1px solid var(--kbs-border);
    border-radius: var(--kbs-radius);
    background: #fff;
}

.kbs-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 0;
}

.kbs-table th {
    background: #f8fafc;
    color: #334155;
    font-weight: 700;
    white-space: nowrap;
}

.kbs-table th,
.kbs-table td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--kbs-border);
    vertical-align: middle;
}

.kbs-table tr:last-child td { border-bottom: 0; }

.kbs-empty {
    padding: 34px 18px;
    text-align: center;
    color: var(--kbs-muted);
}

.kbs-loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    background: rgba(15, 23, 42, .32);
}

.kbs-loading-box {
    background: #fff;
    border-radius: 18px;
    padding: 18px 22px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--kbs-shadow);
    font-weight: 600;
}

.kbs-toast-container {
    position: fixed;
    right: 18px;
    top: 82px;
    z-index: 3100;
    width: min(360px, calc(100vw - 36px));
}

.kbs-toast {
    background: #fff;
    border: 1px solid var(--kbs-border);
    border-left: 5px solid var(--kbs-primary);
    border-radius: 14px;
    padding: 12px 14px;
    margin-bottom: 10px;
    box-shadow: var(--kbs-shadow);
    animation: kbsSlideIn .18s ease;
}

.kbs-toast.success { border-left-color: var(--kbs-success); }
.kbs-toast.warning { border-left-color: var(--kbs-warning); }
.kbs-toast.error { border-left-color: var(--kbs-danger); }
.kbs-toast.info { border-left-color: var(--kbs-info); }
.kbs-toast-title { font-weight: 700; margin-bottom: 2px; }
.kbs-toast-message { color: var(--kbs-muted); font-size: 13px; }

.kbs-debug-panel {
    position: fixed;
    right: 16px;
    bottom: 16px;
    width: min(520px, calc(100vw - 32px));
    max-height: 280px;
    display: none;
    z-index: 3200;
    background: #0f172a;
    color: #dbeafe;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(15, 23, 42, .35);
    overflow: hidden;
    font-family: Consolas, 'Courier New', monospace;
    font-size: 12px;
}

.kbs-debug-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #111827;
    color: #fff;
    font-family: var(--kbs-font-th);
}

.kbs-debug-body {
    padding: 10px 12px;
    overflow: auto;
    max-height: 230px;
    white-space: pre-wrap;
}

.kbs-debug-line { margin-bottom: 6px; }
.kbs-debug-line.error { color: #fecaca; }
.kbs-debug-line.warn { color: #fde68a; }
.kbs-debug-close {
    border: 0;
    background: transparent;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
}

@keyframes kbsSlideIn {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 991.98px) {
    .kbs-sidebar { transform: translateX(-100%); }
    body.kbs-sidebar-open .kbs-sidebar { transform: translateX(0); }
    .kbs-main { margin-left: 0; }
    .kbs-toggle { display: inline-flex; }
    .kbs-content { padding: 18px; }
    .kbs-page-header { align-items: flex-start; flex-direction: column; }
}
/* assets/kbs/css/kbs-theme.css */

.kbs-app {
    min-height: 100vh;
}

.kbs-sidebar {
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.kbs-brand {
    flex: 0 0 auto;
}

.kbs-menu {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 24px;
}

    /* scrollbar แบบสุภาพ */
    .kbs-menu::-webkit-scrollbar {
        width: 6px;
    }

    .kbs-menu::-webkit-scrollbar-thumb {
        background: rgba(100, 116, 139, 0.35);
        border-radius: 999px;
    }

    .kbs-menu::-webkit-scrollbar-track {
        background: transparent;
    }
.kbs-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    backdrop-filter: blur(2px);
}

    .kbs-loading-overlay.show {
        display: flex;
    }

.kbs-loading-box {
    width: min(360px, calc(100vw - 40px));
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.25);
    text-align: center;
}

.kbs-loading-spinner {
    width: 46px;
    height: 46px;
    margin: 0 auto 14px auto;
    border: 4px solid #e5e7eb;
    border-top-color: var(--kbs-primary, #0d6efd);
    border-radius: 50%;
    animation: kbs-spin 0.8s linear infinite;
}

.kbs-loading-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.kbs-loading-text {
    font-size: .9rem;
    color: #6b7280;
}

@keyframes kbs-spin {
    to {
        transform: rotate(360deg);
    }
}
.kbs-kpi-card {
    position: relative;
    overflow: hidden;
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 4px 18px rgba(0,0,0,.06);
    border-left: 6px solid #64748b;
}

    .kbs-kpi-card::after {
        content: "";
        position: absolute;
        right: -24px;
        top: -24px;
        width: 86px;
        height: 86px;
        border-radius: 50%;
        background: rgba(100,116,139,.12);
    }

.kbs-kpi-label {
    position: relative;
    z-index: 1;
    font-size: .9rem;
    color: #64748b;
    font-weight: 600;
}

.kbs-kpi-value {
    position: relative;
    z-index: 1;
    font-size: 1.65rem;
    font-weight: 800;
    color: #111827;
}

/* Risk Color Standard */
.kbs-kpi-red {
    border-left-color: #dc3545;
}

    .kbs-kpi-red::after {
        background: rgba(220, 53, 69, .12);
    }

    .kbs-kpi-red .kbs-kpi-value {
        color: #dc3545;
    }

.kbs-kpi-orange {
    border-left-color: #fd7e14;
}

    .kbs-kpi-orange::after {
        background: rgba(253, 126, 20, .14);
    }

    .kbs-kpi-orange .kbs-kpi-value {
        color: #fd7e14;
    }

.kbs-kpi-yellow {
    border-left-color: #ffc107;
}

    .kbs-kpi-yellow::after {
        background: rgba(255, 193, 7, .18);
    }

    .kbs-kpi-yellow .kbs-kpi-value {
        color: #b58100;
    }

.kbs-kpi-green {
    border-left-color: #198754;
}

    .kbs-kpi-green::after {
        background: rgba(25, 135, 84, .12);
    }

    .kbs-kpi-green .kbs-kpi-value {
        color: #198754;
    }

.kbs-kpi-norisk {
    border-left-color: #adb5bd;
}

    .kbs-kpi-norisk::after {
        background: rgba(173, 181, 189, .18);
    }

    .kbs-kpi-norisk .kbs-kpi-value {
        color: #495057;
    }

.kbs-kpi-total {
    border-left-color: #0d6efd;
}

    .kbs-kpi-total::after {
        background: rgba(13, 110, 253, .12);
    }

    .kbs-kpi-total .kbs-kpi-value {
        color: #0d6efd;
    }
.kbs-table-risk thead th {
    font-weight: 800;
    white-space: nowrap;
    vertical-align: middle;
    border-bottom: 2px solid #e5e7eb;
}

    .kbs-table-risk thead th.kbs-th-red {
        color: #dc3545;
    }

    .kbs-table-risk thead th.kbs-th-orange {
        color: #fd7e14;
    }

    .kbs-table-risk thead th.kbs-th-yellow {
        color: #b58100;
    }

    .kbs-table-risk thead th.kbs-th-green {
        color: #198754;
    }

    .kbs-table-risk thead th.kbs-th-norisk {
        color: #495057;
    }

    .kbs-table-risk thead th.kbs-th-total {
        color: #0d6efd;
    }

.kbs-table-risk tbody td {
    vertical-align: middle;
}

    .kbs-table-risk tbody td.kbs-td-total {
        font-weight: 800;
    }
.kbs-table-risk th.kbs-th-red,
.kbs-table-risk td.kbs-td-red {
    background: rgba(220, 53, 69, .06);
}

.kbs-table-risk th.kbs-th-orange,
.kbs-table-risk td.kbs-td-orange {
    background: rgba(253, 126, 20, .07);
}

.kbs-table-risk th.kbs-th-yellow,
.kbs-table-risk td.kbs-td-yellow {
    background: rgba(255, 193, 7, .10);
}

.kbs-table-risk th.kbs-th-green,
.kbs-table-risk td.kbs-td-green {
    background: rgba(25, 135, 84, .06);
}

.kbs-table-risk th.kbs-th-norisk,
.kbs-table-risk td.kbs-td-norisk {
    background: rgba(173, 181, 189, .12);
}

.kbs-table-risk th.kbs-th-total,
.kbs-table-risk td.kbs-td-total {
    background: rgba(13, 110, 253, .07);
}
.kbs-filter-card .form-label {
    font-size: .95rem;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.kbs-filter-card .form-select,
.kbs-filter-card .form-control {
    min-height: 48px;
    border-radius: 10px;
    border: 1.5px solid #cbd5e1;
    background-color: #ffffff;
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

    .kbs-filter-card .form-select:focus,
    .kbs-filter-card .form-control:focus {
        border-color: #0d6efd;
        box-shadow: 0 0 0 .18rem rgba(13, 110, 253, .15);
    }

.kbs-filter-card .form-check-label {
    font-weight: 700;
    color: #0f172a;
}

.kbs-filter-card .form-check-input {
    width: 1.05rem;
    height: 1.05rem;
}
/* =========================================================
   JVK-MIS additions (kbs_ui.js)
   ========================================================= */

/* ปุ่มย่อ/ขยายเมนู : แสดงทุกขนาดจอ (เดิมแสดงเฉพาะจอเล็ก) */
.kbs-toggle { display: inline-flex; }

/* ---------- เมนูย่อเป็นไอคอน (html.kbs-sidebar-mini) ---------- */
@media (min-width: 992px) {
    .kbs-sidebar, .kbs-main { transition: width .18s ease, margin-left .18s ease; }

    html.kbs-sidebar-mini .kbs-sidebar { width: 72px; }
    html.kbs-sidebar-mini .kbs-main { margin-left: 72px; }

    html.kbs-sidebar-mini .kbs-brand { padding: 0; justify-content: center; }
    html.kbs-sidebar-mini .kbs-brand > div:not(.kbs-brand-mark) { display: none; }

    html.kbs-sidebar-mini .kbs-menu { padding: 14px 10px; }
    html.kbs-sidebar-mini .kbs-menu-label {
        font-size: 0;
        padding: 0;
        margin: 10px 8px;
        border-top: 1px solid rgba(148, 163, 184, .45);
    }

    html.kbs-sidebar-mini .kbs-menu-link {
        justify-content: center;
        padding: 11px 0;
        gap: 0;
    }
    html.kbs-sidebar-mini .kbs-menu-link i { font-size: 1.2rem; }
    html.kbs-sidebar-mini .kbs-menu-link span,
    html.kbs-sidebar-mini .kbs-menu-link .kbs-badge-new { display: none; }
}

/* ---------- ไอคอนอธิบายศัพท์ ---------- */
.kbs-info {
    font-size: .85em;
    color: #94a3b8;
    cursor: help;
    vertical-align: middle;
}
.kbs-info:hover { color: var(--kbs-primary); }
th .kbs-info { font-weight: normal; }

/* ---------- แถบไม่พบข้อมูล ---------- */
.kbs-empty-state {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
    padding: .7rem 1rem;
    border-radius: .75rem;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: .92rem;
}
.kbs-empty-state i { font-size: 1.2rem; }

/* ---------- เส้นทางระดับพื้นที่ของตารางเจาะลึก ---------- */
.kbs-drill-path {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .4rem;
    font-size: .9rem;
}
.kbs-drill-step {
    border: 0;
    background: transparent;
    padding: .1rem .3rem;
    border-radius: .4rem;
    color: var(--kbs-primary);
    text-decoration: underline dotted;
    cursor: pointer;
    font: inherit;
}
.kbs-drill-step:hover { background: rgba(37, 99, 235, .08); }
.kbs-drill-sep { color: #94a3b8; }
.kbs-drill-current { font-weight: 600; color: var(--kbs-text); }
.kbs-drill-hint { color: var(--kbs-muted); font-size: .8rem; margin-top: .15rem; }

/* ชื่อพื้นที่ในตารางที่คลิกเจาะลึกได้ */
a.jvk-drill-link {
    color: var(--kbs-primary);
    text-decoration: underline dotted;
}
a.jvk-drill-link:hover { text-decoration: underline; }

/* ---------- ตัวเลือกแบบค้นหาได้ (kbs_select.js) ---------- */
.kbs-ss { position: relative; }
.kbs-ss .kbs-ss-native { display: none !important; }
.kbs-ss-toggle {
    text-align: left;
    cursor: pointer;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.kbs-ss-toggle.kbs-ss-has-value { font-weight: 600; }
.kbs-ss-panel {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 1050;
    background: #fff;
    border: 1px solid var(--kbs-border);
    border-radius: .6rem;
    box-shadow: var(--kbs-shadow);
    min-width: 220px;
}
.kbs-ss.open .kbs-ss-panel { display: block; }
.kbs-ss-search {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem;
    border-bottom: 1px solid var(--kbs-border);
}
.kbs-ss-search i { color: var(--kbs-muted); }
.kbs-ss-list {
    list-style: none;
    margin: 0;
    padding: .25rem 0;
    max-height: 260px;
    overflow-y: auto;
}
.kbs-ss-item {
    padding: .45rem .9rem;
    cursor: pointer;
    font-size: .95rem;
}
.kbs-ss-item:hover, .kbs-ss-item.active { background: var(--kbs-primary-soft); }
.kbs-ss-item.selected { color: var(--kbs-primary); font-weight: 600; }
.kbs-ss-empty { padding: .6rem .9rem; color: var(--kbs-muted); font-size: .9rem; }
@media (max-width: 575.98px) {
    .kbs-ss-item { padding: .6rem .9rem; }   /* นิ้วแตะง่ายขึ้น */
}

/* ---------- ประโยคสรุป + ป้ายเทียบเป้าหมาย ---------- */
.kbs-summary {
    display: flex;
    gap: .7rem;
    align-items: flex-start;
    margin-bottom: 14px;
    padding: .8rem 1rem;
    border-radius: 12px;
    background: #fff;
    border-left: 4px solid var(--kbs-primary);
    box-shadow: 0 4px 18px rgba(0,0,0,.05);
    font-size: 1rem;
    line-height: 1.6;
}
.kbs-summary > i { color: var(--kbs-primary); font-size: 1.2rem; margin-top: .1rem; }
.kbs-summary strong { color: var(--kbs-text); }
.kbs-summary .num { font-family: var(--kbs-font-num); font-weight: 700; }
.kbs-summary-muted { color: var(--kbs-muted); font-size: .85rem; }
.kbs-target-badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .1rem .55rem;
    border-radius: 999px;
    font-size: .85rem;
    font-weight: 600;
    white-space: nowrap;
}
.kbs-target-badge.ok { background: #dcfce7; color: #166534; }
.kbs-target-badge.low { background: #fee2e2; color: #991b1b; }

/* ---------- คำบรรยายบนรูปที่ดาวน์โหลด ---------- */
.kbs-export-caption { padding: 0 0 10px; margin-bottom: 10px; border-bottom: 1px dashed var(--kbs-border); }
.kbs-export-caption-title { font-weight: 700; font-size: 1.05rem; }
.kbs-export-caption-meta { color: var(--kbs-muted); font-size: .85rem; }

/* ---------- คำแนะนำครั้งแรก ---------- */
.kbs-guide {
    margin-bottom: 1rem;
    padding: .9rem 1rem;
    border-radius: .75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #14532d;
}
.kbs-guide-head { font-weight: 700; margin-bottom: .35rem; }
.kbs-guide-steps { margin: 0 0 .6rem; padding-left: 1.3rem; }
.kbs-guide-steps li { margin-bottom: .2rem; }

/* ---------- ตารางเลื่อนแนวนอนบนจอเล็ก ---------- */
@media (max-width: 767.98px) {
    .kbs-scrollable { position: relative; }
    .kbs-scrollable::before {
        content: '\2190 เลื่อนซ้าย-ขวาเพื่อดูคอลัมน์ทั้งหมด \2192';
        display: block;
        font-size: .78rem;
        color: var(--kbs-muted);
        padding: 0 0 .3rem;
    }
}

/* ---------- จอเล็ก : หัวบน ตัวกรอง การ์ด ---------- */
@media (max-width: 575.98px) {
    .kbs-topbar { padding: 0 10px; gap: 6px; }
    .kbs-topbar-title { font-size: .95rem; line-height: 1.2; }
    .kbs-topbar-title .kbs-topbar-title-long { display: none; }
    .kbs-update-badge { padding: 5px 9px; font-size: .78rem; white-space: nowrap; }
    .kbs-update-badge > span:not(.font-num) { display: none; }
    .kbs-content { padding: 12px; }
    .kbs-page-title { font-size: 1.35rem; }
    .kbs-kpi-value { font-size: 1.5rem !important; }
    .kbs-summary { font-size: .95rem; }
    .kbs-drill-path { font-size: .85rem; }
    .kbs-area-bar { font-size: .85rem; }
}

/* ---------- ความยินยอมคุกกี้ (kbs_consent.js) ---------- */
.kbs-consent-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem 1.2rem;
    background: #fff;
    border: 1px solid var(--kbs-border);
    border-radius: 14px;
    box-shadow: 0 12px 36px rgba(15, 23, 42, .18);
    font-size: .92rem;
    line-height: 1.55;
}
.kbs-consent-text { flex: 1 1 420px; }
.kbs-consent-title { font-weight: 700; margin-bottom: .2rem; }
.kbs-consent-title i { color: var(--kbs-primary); }
.kbs-consent-more { color: var(--kbs-primary); text-decoration: underline; white-space: nowrap; }
.kbs-consent-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.kbs-consent-cat { padding: .75rem 0; border-top: 1px solid var(--kbs-border); }
.kbs-consent-cat:first-of-type { border-top: 0; }
.kbs-consent-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 260px;
    padding: 1.5rem;
    border-radius: 12px;
    background: #f1f5f9;
}
.kbs-consent-placeholder > i { font-size: 2.6rem; color: var(--kbs-primary); margin-bottom: .4rem; }
@media (max-width: 575.98px) {
    .kbs-consent-banner { left: 8px; right: 8px; bottom: 8px; padding: .85rem; font-size: .85rem; }
    .kbs-consent-actions { width: 100%; }
    .kbs-consent-actions .btn { flex: 1 1 auto; }
}
/* ตัวแทนวิดีโอในกรอบสัดส่วน 16:9 (เช่น หน้าคู่มือ) ให้เต็มกรอบ */
.jvk-video-frame .kbs-consent-placeholder {
    position: absolute;
    inset: 0;
    min-height: 0;
    border-radius: 0;
    background: #0f172a;
    color: #e2e8f0;
}
.jvk-video-frame .kbs-consent-placeholder .text-muted { color: #94a3b8 !important; }
.jvk-video-frame .kbs-consent-placeholder > i { color: #fff; }

/* ---------- ป้าย "ใหม่" ของเมนู/หน้า (KBSUI.newFeature) ---------- */
.kbs-menu-label .kbs-new-badge { font-size: .62rem; padding: .15rem .4rem; vertical-align: middle; letter-spacing: 0; text-transform: none; }
.kbs-new-notice {
    display: flex;
    align-items: center;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    padding: .7rem 1rem;
    border-radius: .75rem;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #14532d;
    font-size: .92rem;
}
.kbs-new-notice-text { flex: 1 1 280px; }
/* เมนูย่อ : แสดงจุดสีเขียวที่ไอคอนแทนป้ายข้อความ */
@media (min-width: 992px) {
    html.kbs-sidebar-mini .kbs-menu-link.kbs-has-new i { position: relative; }
    html.kbs-sidebar-mini .kbs-menu-link.kbs-has-new i::after {
        content: '';
        position: absolute;
        top: -2px;
        right: -5px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: #198754;
        box-shadow: 0 0 0 2px var(--kbs-sidebar);
    }
}

/* ---------- tooltip ลอย (แผนที่ / ตารางสี / KBSUI.floatTip) ---------- */
.kbs-map-tooltip {
    position: fixed;
    z-index: 1090;
    display: none;
    min-width: 210px;
    max-width: 280px;
    padding: .6rem .75rem;
    background: #fff;
    color: #0b0b0b;
    border: 1px solid rgba(11,11,11,.10);
    border-radius: .6rem;
    box-shadow: 0 10px 28px rgba(15,23,42,.16);
    font-size: .85rem;
    pointer-events: none;
}
.kbs-map-tooltip .tt-title { font-weight: 700; margin-bottom: .2rem; }
.kbs-map-tooltip .tt-sub { color: #898781; font-size: .78rem; margin-bottom: .35rem; }
.kbs-map-tooltip table { width: 100%; }
.kbs-map-tooltip td { padding: .1rem 0; }
.kbs-map-tooltip td.v { text-align: right; font-family: var(--kbs-font-num); font-variant-numeric: tabular-nums; font-weight: 600; }
.kbs-map-tooltip tr.hl td { color: #1c5cab; }

/* ---------- footer ชื่อหน่วยงานเจ้าของระบบ ---------- */
.kbs-footer {
    margin: 8px 28px 0;
    padding: 18px 0 24px;
    border-top: 1px solid var(--kbs-border);
    color: var(--kbs-muted);
    font-size: .82rem;
    line-height: 1.7;
    text-align: center;
}
.kbs-footer-dev { color: #374151; }
.kbs-footer-en { color: var(--kbs-muted); margin-left: .25rem; font-size: .78rem; letter-spacing: .02em; }
.kbs-footer-link { color: var(--kbs-primary); font-weight: 600; }
.kbs-footer-link:hover { text-decoration: underline; }
.kbs-footer-meta { display: flex; flex-wrap: wrap; justify-content: center; gap: .1rem .45rem; }
.kbs-footer-sep { color: #c3c2b7; }
.kbs-footer-copy { margin-top: .2rem; font-size: .76rem; }
.kbs-footer-owner { display: flex; align-items: center; justify-content: center; gap: .45rem; font-weight: 600; font-size: .86rem; }
.kbs-footer-logo { width: 26px; height: 26px; object-fit: contain; }
@media (max-width: 991.98px) {
    .kbs-footer { margin: 8px 18px 0; }
}
@media (max-width: 575.98px) {
    .kbs-footer { margin: 4px 12px 0; padding-bottom: 88px; }   /* เว้นที่ให้แถบยินยอมคุกกี้ด้านล่างจอ */
    .kbs-footer-en { display: block; margin-left: 0; }
}
@media print {
    .kbs-footer { margin-top: 12px; padding-bottom: 0; }
}

/* =========================================================
   หน้าคุณภาพข้อมูล (kbs_dq.js) : ใช้ร่วมกัน 4 หน้า
   ========================================================= */
.dq-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 14px; }
.dq-nav-link {
    display: inline-flex; align-items: center; gap: .35rem;
    padding: .4rem .85rem; border-radius: 999px;
    background: #fff; border: 1px solid var(--kbs-border); color: #374151;
    font-size: .88rem; font-weight: 500;
}
.dq-nav-link:hover { background: var(--kbs-primary-soft); }
.dq-nav-link.active { background: var(--kbs-primary); border-color: var(--kbs-primary); color: #fff; }

.dq-statusbar {
    display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem 1rem;
    background: #fff; border: 1px solid var(--kbs-border); border-radius: 12px;
    padding: .65rem 1rem; margin-bottom: 14px; font-size: .9rem;
}
.dq-statusbar-text { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.dq-criteria { color: var(--kbs-muted); font-size: .85rem; }

/* ป้ายสถานะ : ไอคอน + ข้อความ เสมอ */
.dq-status {
    flex: 0 0 auto; display: inline-flex; align-items: center; gap: .3rem;
    padding: 3px 10px; border-radius: 20px; font-size: .8rem; font-weight: 600; white-space: nowrap;
}
.dq-status.ok { background: #dcfce7; color: #166534; }
.dq-status.warn { background: #fef3c7; color: #92400e; }
.dq-status.critical { background: #fee2e2; color: #991b1b; }

.dq-group-title { display: flex; align-items: center; gap: .5rem; margin: 1rem 0 .25rem; font-weight: 700; color: #111827; }
.dq-group-title:first-child { margin-top: 0; }
.dq-group-count { font-weight: 400; color: var(--kbs-muted); font-size: .85rem; }
.dq-rule { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid #f1f5f9; }
.dq-rule:last-child { border-bottom: 0; }
.dq-rule-title { font-weight: 600; font-size: .9rem; color: #111827; }
.dq-rule-hint { font-size: .8rem; color: #52514e; margin-top: .15rem; }
.dq-rule-hint .bi { color: #898781; }
.dq-rule-note {
    margin-top: .4rem; padding: .45rem .6rem; border-radius: .5rem;
    background: #eff6ff; border: 1px solid #bfdbfe; color: #1e3a8a; font-size: .8rem;
}
.dq-rule-actions { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }
.dq-rule-link { font-size: .8rem; color: var(--kbs-primary); white-space: nowrap; }
.dq-rule-link:hover { text-decoration: underline; }

/* รายการกลุ่มปัญหาที่คลิกกรองตารางได้ */
.dq-filter-item {
    display: flex; align-items: center; justify-content: space-between; gap: .6rem;
    width: 100%; padding: .6rem .7rem; margin-bottom: .35rem;
    background: #fff; border: 1px solid var(--kbs-border); border-radius: .6rem;
    text-align: left; font: inherit; cursor: pointer;
}
.dq-filter-item:hover { background: #f8fafc; }
.dq-filter-item.active { border-color: var(--kbs-primary); background: var(--kbs-primary-soft); }
.dq-filter-title { font-weight: 600; font-size: .88rem; color: #111827; }
.dq-filter-sub { font-size: .76rem; color: var(--kbs-muted); }
.dq-count-pill { flex: 0 0 auto; padding: 2px 9px; border-radius: 999px; background: #f1f5f9; font-weight: 700; font-size: .8rem; font-family: var(--kbs-font-num); }

.dq-table { font-size: .84rem; }
.dq-table th { white-space: nowrap; color: #52514e; font-weight: 600; }
.dq-table td.num, .dq-table th.num { text-align: right; font-family: var(--kbs-font-num); font-variant-numeric: tabular-nums; }
.dq-unit-name { font-weight: 600; color: #111827; }
.dq-unit-code { font-size: .76rem; color: var(--kbs-muted); font-family: var(--kbs-font-num); }
.dq-table-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .6rem; }
.dq-table-tools .form-control { max-width: 260px; }
.dq-admin-note summary { cursor: pointer; color: var(--kbs-muted); font-size: .82rem; }
.dq-admin-note div { font-size: .8rem; color: #52514e; margin-top: .3rem; }

@media print {
    .dq-nav, .dq-statusbar .btn, .dq-table-tools { display: none !important; }
}

/* ---------- หมายเหตุวิธีคำนวณและแบ่งช่วงสี (หน้าแผนที่ / ตารางความร้อน) ---------- */
.kbs-calc-note { margin-top: .6rem; font-size: .8rem; color: #52514e; }
.kbs-calc-note > summary { cursor: pointer; color: var(--kbs-muted); width: fit-content; list-style: none; display: inline-flex; align-items: center; gap: .35rem; }
.kbs-calc-note > summary::-webkit-details-marker { display: none; }
.kbs-calc-note > summary::before { content: "\25B8"; font-size: .7rem; transition: transform .15s; }
.kbs-calc-note[open] > summary::before { transform: rotate(90deg); }
.kbs-calc-note > summary:hover { color: #1c5cab; }
.kbs-calc-note dl { margin: .45rem 0 0; padding: .55rem .75rem; background: #f6f6f3; border-radius: .5rem; display: grid; grid-template-columns: max-content 1fr; gap: .3rem .75rem; }
.kbs-calc-note dt { font-weight: 600; color: #0b0b0b; }
.kbs-calc-note dd { margin: 0; line-height: 1.55; }
@media (max-width: 575.98px) {
    .kbs-calc-note dl { grid-template-columns: 1fr; gap: .1rem; }
    .kbs-calc-note dd { margin-bottom: .35rem; }
}
@media print {
    .kbs-calc-note > summary { display: none; }
    .kbs-calc-note dl { background: none; padding: 0; }
}
.kbs-calc-list { margin: 0; padding-left: 1.1rem; }
.kbs-calc-list li { margin: .1rem 0; }
.kbs-calc-list b { color: #0b0b0b; }
.kbs-calc-swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .35rem; vertical-align: -1px; border: 1px solid rgba(0,0,0,.08); }
.kbs-calc-list:has(.kbs-calc-swatch) { list-style: none; padding-left: 0; }

/* ---------- จำลองเกณฑ์แบ่งช่วงสี (kbs_breaks.js) ---------- */
.kbs-brk { margin-top: .6rem; }
.kbs-brk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .8rem; }
.kbs-brk-toggle.active { background: #1c5cab; color: #fff; border-color: #1c5cab; }
.kbs-brk-badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; background: #fff4d6; color: #7a5200; border: 1px solid #f0d58a; font-weight: 600; }
.kbs-brk-reset { font-size: .8rem; padding: 0 .25rem; }
.kbs-brk-panel { margin-top: .5rem; padding: .65rem .75rem; border: 1px solid #e1e0d9; border-radius: .6rem; background: #fbfbf9; }
.kbs-brk-modes { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .6rem; }
.kbs-brk-strip { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; }
.kbs-brk-slot { display: flex; flex-direction: column; align-items: center; gap: .2rem; min-width: 0; }
.kbs-brk-swatch { width: 100%; height: .9rem; border-radius: 3px; border: 1px solid rgba(0,0,0,.08); }
.kbs-brk-count { font-size: .72rem; color: #52514e; white-space: nowrap; }
.kbs-brk-count.is-empty { color: #b0aea6; }
.kbs-brk-cuts { display: grid; grid-template-columns: .5fr repeat(5, 1fr) .5fr; gap: .3rem; margin-top: .3rem; }
.kbs-brk-field { min-width: 0; }
.kbs-brk-field input { width: 100%; text-align: right; font-variant-numeric: tabular-nums; padding-left: .3rem; padding-right: .3rem; }
.kbs-brk-caption { margin-top: .25rem; font-size: .72rem; color: #898781; text-align: center; }
.kbs-brk-hint { margin-top: .5rem; font-size: .78rem; color: #52514e; line-height: 1.5; }
.kbs-legend-sim { display: inline-block; margin-left: .4rem; padding: 0 .45rem; border-radius: 999px; background: #fff4d6; color: #7a5200; border: 1px solid #f0d58a; font-size: .72rem; font-weight: 600; vertical-align: 1px; }
@media (max-width: 575.98px) {
    .kbs-brk-cuts { grid-template-columns: repeat(5, 1fr); gap: .2rem; }
    .kbs-brk-cuts > span { display: none; }
    .kbs-brk-field input { font-size: .75rem; }
    .kbs-brk-count { font-size: .66rem; }
}
@media print { .kbs-brk { display: none; } }
.kbs-brk-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-bottom: .5rem; }
.kbs-brk-label { font-size: .8rem; font-weight: 600; color: #0b0b0b; min-width: 7.5rem; }
.kbs-brk-inline { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: #52514e; }
.kbs-brk-inline input { width: 8rem; text-align: right; font-variant-numeric: tabular-nums; }
.kbs-calc-note > summary:focus:not(:focus-visible) { outline: none; }
.kbs-brk-modes .btn { white-space: nowrap; flex: 0 0 auto; }

/* ---------- กลุ่มเมนูยุบ/ขยายได้ (KBSUI.menuGroups) ---------- */
.kbs-menu-toggle { display: flex; align-items: center; gap: .35rem; cursor: pointer; user-select: none; border-radius: 8px; }
.kbs-menu-toggle:hover { color: #52514e; background: rgba(148, 163, 184, .12); }
.kbs-menu-toggle:focus-visible { outline: 2px solid #3987e5; outline-offset: 1px; }
.kbs-menu-toggle::after {
    content: ""; margin-left: auto; flex: 0 0 auto; width: .45rem; height: .45rem;
    border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
    transform: rotate(45deg) translate(-2px, -2px); opacity: .7;
}
.kbs-menu-toggle[aria-expanded="false"]::after { transform: rotate(-45deg); }
.kbs-menu-group { display: grid; grid-template-rows: 1fr; }
.kbs-menu-group.is-collapsed { grid-template-rows: 0fr; }
.kbs-menu-group-inner { overflow: hidden; min-height: 0; }
.kbs-menu-ready .kbs-menu-group { transition: grid-template-rows .2s ease; }
.kbs-menu-ready .kbs-menu-toggle::after { transition: transform .2s ease; }
@media (prefers-reduced-motion: reduce) {
    .kbs-menu-ready .kbs-menu-group, .kbs-menu-ready .kbs-menu-toggle::after { transition: none; }
}
@media (min-width: 992px) {
    /* เมนูย่อ (ไอคอนอย่างเดียว) : ไม่มีหัวข้อให้กด จึงแสดงทุกกลุ่ม */
    html.kbs-sidebar-mini .kbs-menu-group.is-collapsed { grid-template-rows: 1fr; }
    html.kbs-sidebar-mini .kbs-menu-toggle { pointer-events: none; }
    html.kbs-sidebar-mini .kbs-menu-toggle::after { display: none; }
}
/* กลุ่มที่ยุบ : ซ่อนจากการกด Tab และโปรแกรมอ่านหน้าจอด้วย (หน่วงให้ภาพยุบเสร็จก่อน) */
.kbs-menu-group.is-collapsed .kbs-menu-group-inner { visibility: hidden; }
.kbs-menu-ready .kbs-menu-group-inner { transition: visibility 0s linear .2s; }
.kbs-menu-ready .kbs-menu-group:not(.is-collapsed) .kbs-menu-group-inner { transition-delay: 0s; }
@media (min-width: 992px) {
    html.kbs-sidebar-mini .kbs-menu-group.is-collapsed .kbs-menu-group-inner { visibility: visible; }
}

/* ---------- ประกาศของใหม่ (popup #kbsWhatsNew) ---------- */
.kbs-whatsnew .modal-content { border-radius: 16px; }
.kbs-whatsnew .modal-body { background: #f6f6f3; }
.kbs-wn-card {
    display: flex; flex-direction: column; height: 100%;
    background: #fff; border: 1px solid #e1e0d9; border-radius: 12px; overflow: hidden;
    color: inherit; text-decoration: none; transition: box-shadow .15s, transform .15s, border-color .15s;
}
.kbs-wn-card:hover, .kbs-wn-card:focus-visible { border-color: #9ec5f4; box-shadow: 0 6px 20px rgba(28, 92, 171, .14); transform: translateY(-2px); color: inherit; }
.kbs-wn-card:focus-visible { outline: 2px solid #3987e5; outline-offset: 2px; }
.kbs-wn-img { display: block; height: 190px; background: #fff; border-bottom: 1px solid #ecebe6; overflow: hidden; }
.kbs-wn-img img { width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.kbs-wn-body { display: flex; flex-direction: column; gap: .35rem; padding: .8rem .95rem .9rem; flex: 1; }
.kbs-wn-title { font-weight: 700; color: #0b0b0b; display: flex; align-items: center; gap: .4rem; }
.kbs-wn-title .bi { color: #1c5cab; }
.kbs-wn-text { font-size: .88rem; color: #52514e; line-height: 1.55; }
.kbs-wn-go { margin-top: auto; padding-top: .25rem; font-size: .86rem; font-weight: 600; color: #1c5cab; }
.kbs-wn-card:hover .kbs-wn-go .bi { transform: translateX(3px); }
.kbs-wn-go .bi { display: inline-block; transition: transform .15s; }
@media (max-width: 575.98px) {
    .kbs-wn-img { height: 150px; }
}
@media (prefers-reduced-motion: reduce) {
    .kbs-wn-card, .kbs-wn-go .bi { transition: none; }
    .kbs-wn-card:hover { transform: none; }
}
