@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;600;700&display=swap');
:root {
    --line:#9aa3ad; --head:#0f5d33; --head2:#17784a; --gold:#c9a227; --hl:#fff7d6;
    --low:#d6f5d6; --mid:#fff2cc; --high:#ffd6d6;
    --vlow:#eaf8ea; --vhigh:#ffc2c2;
}
* { box-sizing: border-box; }
body { font-family:"Kanit","TH Sarabun New","Sarabun","Segoe UI",Tahoma,sans-serif; font-weight:300; font-size:17px; margin:0; background:linear-gradient(180deg,#eef4f0 0,#eef1f5 320px); color:#1a1a1a; }
.wrap { padding:18px; max-width:1500px; margin:0 auto; }
.banner { display:block; width:100%; max-width:1500px; margin:0 auto 14px; border-radius:0 0 8px 8px; box-shadow:0 4px 14px rgba(0,0,0,.18); }
h1 { font-size:26px; font-weight:600; margin:0 0 10px; color:var(--head); }
.status { display:inline-block; padding:6px 13px; border-radius:20px; font-size:14px; font-weight:bold; }
.status.draft { background:#e9ecef; color:#495057; }
.status.pending { background:#fff3cd; color:#856404; }
.status.rejected { background:#f8d7da; color:#842029; }
.status.approved { background:#d1e7dd; color:#0f5132; }
h2 { font-size:21px; font-weight:500; margin:18px 0 8px; color:var(--head); padding-left:10px; border-left:5px solid var(--gold); }
a { color:var(--head2); }

.landing-topbar .zoom { margin-left:auto; display:flex; align-items:center; gap:6px; color:#cdd8e8; font-size:14px; }
.landing-topbar .zoom .zlbl { opacity:.8; }
.landing-topbar .zoom button { background:#ffffff22; color:#fff; border:1px solid #ffffff44; border-radius:6px; padding:4px 10px; font:inherit; cursor:pointer; line-height:1; }
.landing-topbar .zoom button:hover { background:#fff; color:var(--head); }
.landing-topbar .zoom #zoomPct { min-width:46px; text-align:center; font-weight:bold; }
.landing-topbar .userbox { display:flex; align-items:center; gap:10px; padding-left:14px; margin-left:auto; border-left:1px solid #ffffff33; }
.landing-topbar .userbox .uname { color:#fff; font-size:13.5px; max-width:200px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.landing-topbar .userbox .logout { background:#b3261e; color:#fff; text-decoration:none; padding:4.5px 10.8px; border-radius:6px; font-size:12.6px; }
.landing-topbar .userbox .logout:hover { background:#8a1c16; color:#fff; }

.card { background:#fff; border:1px solid var(--line); border-radius:10px; padding:16px; margin-bottom:16px; }
.row { display:flex; gap:12px; flex-wrap:wrap; align-items:flex-end; }
label { font-size:15px; color:#555; display:block; margin-bottom:3px; }
input[type=text], input[type=number], select {
    padding:7px 9px; border:1px solid var(--line); border-radius:6px; font:inherit;
}
select.year-jump { min-width:110px; cursor:pointer; }
.btn { background:var(--head); color:#fff; border:0; padding:9px 18px; border-radius:6px; font:inherit; cursor:pointer; text-decoration:none; display:inline-block; }
.btn:hover { background:var(--head2); }
.btn.sec { background:#5a6b7d; }
.btn.danger { background:#b3261e; }
.btn.sm { padding:5px 11px; font-size:13px; }

.msg { padding:10px 14px; border-radius:8px; margin-bottom:14px; font-weight:bold; }
.msg.ok { background:#d6f5d6; color:#176b1c; }
.msg.err { background:#ffd6d6; color:#b3261e; }

table { border-collapse:collapse; width:100%; font-size:16px; background:#fff; }
th, td { border:1px solid var(--line); padding:6px 8px; text-align:left; }
.li-criteria-compact { font-size:12.5px; }
.li-criteria-compact th, .li-criteria-compact td { padding:4px 6px; }
thead th { background:var(--head); color:#fff; }
tbody tr:nth-child(even) { background:#f4f6f9; }
tbody tr:hover { background:#fdf6e3; }
td.c, th.c { text-align:center; }

.risk { font-weight:bold; padding:2px 8px; border-radius:5px; display:inline-block; min-width:60px; text-align:center; }
.risk.low { background:var(--low); color:#176b1c; }
.risk.mid { background:var(--mid); color:#8a6d00; }
.risk.high { background:var(--high); color:#b3261e; }
.risk.vlow { background:var(--vlow); color:#176b1c; }
.risk.vhigh { background:var(--vhigh); color:#7a140f; }


/* ปุ่มติ๊ก ⭐/✓ หน้าหน่วยรับตรวจประจำปี */
.plan-toggle {
    background:none; border:1px solid var(--line); border-radius:6px;
    width:36px; height:32px; font-size:17px; line-height:1;
    cursor:pointer; color:#aab0b8;
}
.plan-toggle:hover { background:#f4f6f9; border-color:#8a94a3; }
.plan-toggle.on { border-color:var(--gold); background:var(--hl); color:inherit; }
.plan-toggle.check.on { border-color:#176b1c; background:var(--low); color:#176b1c; font-weight:bold; font-size:19px; }

.legend { font-size:15px; line-height:1.8; }
.legend b { color:var(--head); }
.legend span { display:inline-block; margin-right:14px; }

/* ฟอร์มเล็กที่ครอบช่อง L/I ในตาราง (หน้าประเมินภารกิจ) ไม่ให้ดันเลย์เอาต์ */
form.lform { display:inline-block; margin:0; }

/* ตารางรวมหน้าประเมินภารกิจ: ช่องซ้ายรวมแถว (rowspan) ต่อด้าน — กระชับบรรทัดเดียวแบบเดียวกับตาราง Audit Universe */
table.mission-table td, table.mission-table th { vertical-align:middle; padding:10px 10px; }
table.mission-table td.mission-area-cell { background:#f4f6f9; white-space:normal; vertical-align:top; text-align:left; }

/* ตารางกรอกคะแนน */
.grid-scroll { overflow:auto; border:1px solid var(--line); border-radius:8px; }
table.grid { white-space:nowrap; font-size:15px; }
table.grid th, table.grid td { padding:4px 6px; text-align:center; }
table.grid thead th { position:sticky; top:0; z-index:2; }
table.grid td.unit, table.grid th.unit { text-align:left; position:sticky; left:0; background:#f4f6f9; z-index:1; min-width:250px; }
table.grid thead th.unit { z-index:3; background:var(--head); }
input.cell { width:52px; padding:5px 3px; text-align:center; border:1px solid #cfd6de; border-radius:4px; font:inherit; }
input.cell:focus { outline:2px solid #ffb400; border-color:#ffb400; background:var(--hl); }

/* ช่องที่มีคนอื่น (คนละ user) กำลังกรอกอยู่ตอนนี้ */
input.cell.cell-occupied { border-color:#e67e22; background:#fff4e6; box-shadow:0 0 0 2px rgba(230,126,34,.35); }
input.cell.cell-occupied::placeholder { color:#e67e22; }
td.occupied-cell { position:relative; }
td.occupied-cell .presence-tag {
    position:absolute; left:2px; bottom:-9px; z-index:2;
    background:#e67e22; color:#fff; font-size:10px; line-height:1.3; font-weight:bold;
    padding:1px 5px; border-radius:8px; white-space:nowrap; pointer-events:none;
    box-shadow:0 1px 3px rgba(0,0,0,.25);
}
table.grid tfoot td { font-weight:bold; background:#eaf0f7; }
.muted { color:#888; font-size:14px; }

/* รายการเกณฑ์แบบมีลำดับ (หน้าหน่วยรับตรวจประจำปี) */
.criteria-list { font-size:16px; line-height:1.9; padding-left:26px; margin:0; }
.criteria-list li { margin-bottom:14px; text-align:justify; }
/*--------------ช่องเลือกปี-------------*/
.year-filter {
    display: flex;
    align-items: center;
    gap: 10px;
}

.year-filter label {
    font-weight: bold;
    color: #333;
}

.year-filter select {
    min-width: 150px;
    padding: 10px 14px;
    border: 1px solid #ccc;
    border-radius: 8px;
    background: #fff;
    font-size: 15px;
    cursor: pointer;
}

.year-filter select:focus {
    outline: none;
    border-color: #15703f;
    box-shadow: 0 0 0 3px rgba(21, 112, 63, 0.1);
}

@media(max-width:600px) {

    .year-filter {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }

    .year-filter select {
        width: 100%;
    }

}
/*-----------------------------------*/

/* =========================================
   Highlight หัวข้อที่รอตรวจสอบ
========================================= */

.review-grid .pending-topic {
    background-color: #fff3cd !important;
}

.review-grid thead .pending-topic {
    background-color: #d99b00 !important;
    color: #fff !important;
}

.review-grid tbody td.pending-topic {
    background-color: #fff9e6 !important;
}

.review-grid tbody tr:hover td.pending-topic {
    background-color: #ffefb8 !important;
}

/* ขอบด้านซ้ายของกลุ่มหัวข้อที่รอตรวจ */
.review-grid .pending-topic-start {
    border-left: 4px solid #f0ad00 !important;
}

/* ป้ายรอตรวจ */
.pending-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 7px;
    border-radius: 12px;
    background: #fff3cd;
    color: #856404;
    font-size: 11px;
    font-weight: bold;
}

/* =========================================
   หน้า Landing (index.php)
========================================= */
.landing-topbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    background: var(--head);
    color: #fff;
    text-align: left;
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    border-bottom: 3px solid var(--gold);
    font-size: 17px;
    font-weight: 400;
    letter-spacing: .5px;
}

.landing-topbar .brand {
    display: inline-block;
    padding: 7px 13px;
    font-size: 14px;
    color: #fff;
    text-decoration: none;
}

/* =========================================
   แถบแท็บเฉพาะหน้า Audit Universe (topics.php)
========================================= */
.tabbar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 8px;
    background: var(--head);
    padding: 8px 16px;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
    border-bottom: 3px solid var(--gold);
}
.tabbar-tabs { display: flex; flex:1 1 auto; min-width:0; flex-wrap: nowrap; gap: 4px; overflow-x: auto; scrollbar-width: thin; }
.tabbar-tabs a { flex:0 0 auto; color: #cdd8e8; text-decoration: none; padding: 7px 10px; border-radius: 6px; font-size: 13px; white-space: nowrap; }
.tabbar-tabs a:hover { background: #ffffff22; color: #fff; }
.tabbar-tabs a.on { background: #fff; color: var(--head); font-weight: bold; }
.tabbar .userbox { flex:0 0 auto; margin-left: 8px; display: flex; align-items: center; gap: 10px; padding-left: 14px; border-left: 1px solid #ffffff33; }
.tabbar .userbox .uname { color: #fff; font-size: 13.5px; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .userbox .logout { background: #b3261e; color: #fff; text-decoration: none; padding: 4.5px 10.8px; border-radius: 6px; font-size: 12.6px; }
.tabbar .userbox .logout:hover { background: #8a1c16; color: #fff; }

.landing-topbar .userbox a.uname,
.tabbar .userbox a.uname { display:inline-block; padding:7px 7px; border:0; border-radius:4px; background:transparent; color:#cdd8e8; text-decoration:none; }
.landing-topbar .userbox a.uname:hover,
.tabbar .userbox a.uname:hover { background:#ffffff22; color:#fff; }
.landing-topbar .userbox a.uname:focus-visible,
.tabbar .userbox a.uname:focus-visible { outline:none; background:#ffffff22; color:#fff; }
.landing-topbar .userbox a.uname.on,
.tabbar .userbox a.uname.on { background:#fff; color:var(--head); font-weight:bold; }

@media (max-width: 900px) {
    .tabbar { gap:6px; padding:7px 10px; }
    .tabbar .userbox { margin-left: 4px; padding-left: 8px; gap:6px; }
    .tabbar .userbox .uname { max-width:120px; font-size:12px; }
    .tabbar .userbox .logout { padding:4.5px 7.2px; font-size:12px; }
}

.landing-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin: 24px 0;
}

.landing-card {
    background: linear-gradient(180deg, #ffffff 0%, #f5f9f7 100%);
    border: 1px solid #e1e8e4;
    border-top: 4px solid var(--gold);
    border-radius: 14px;
    padding: 26px 18px 22px;
    min-height: 130px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    color: var(--head);
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    box-shadow: 0 3px 10px rgba(15,93,51,.08);
    transition: .2s ease;
    position: relative;
}

.landing-card .icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--head);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
    box-shadow: 0 3px 8px rgba(15,93,51,.25);
    transition: .2s ease;
}

.landing-card:hover {
    color: var(--head);
    border-top-color: var(--head);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(15,93,51,.18);
}

.landing-card:hover .icon {
    background: var(--gold);
    transform: scale(1.08);
}

.landing-card.soon {
    background: linear-gradient(180deg, #fbfbfc 0%, #f2f3f5 100%);
    border-top-color: #c7ccd3;
    color: #8a94a3;
}

.landing-card.soon .icon { background: #b7bfc9; box-shadow: none; }
.landing-card.soon:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,.1); border-top-color:#a8afb8; color:#6b7480; }

.landing-card .soon-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: var(--mid);
    color: #8a6d00;
    font-size: 11px;
    font-weight: bold;
    padding: 2px 9px;
    border-radius: 10px;
}

@media (max-width: 900px) {
    .landing-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
    .landing-cards { grid-template-columns: 1fr; }
    .landing-topbar { font-size: 16px; }
}

/* =========================================
   ตารางเกณฑ์การประเมินความเสี่ยง (Risk Evaluation matrix)
========================================= */
.risk-matrix table { table-layout: fixed; min-width: 1200px; }
.risk-matrix th, .risk-matrix td { vertical-align: top; font-size: 13.5px; line-height: 1.6; text-align: left; }
.risk-matrix th { text-align: center; }
.risk-matrix th .en { display: block; font-weight: normal; font-size: 12px; opacity: .85; }
.risk-matrix .factor-name { color: var(--head); font-weight: bold; }
.risk-matrix .factor-en { color: #666; font-size: 12px; }

.risk-matrix th.lv-vlow  { background: #3f8a52; }
.risk-matrix th.lv-low   { background: #5a9e5a; }
.risk-matrix th.lv-mid   { background: #c9a227; }
.risk-matrix th.lv-high  { background: #d98a2b; }
.risk-matrix th.lv-vhigh { background: #b3261e; }

.risk-matrix td.lv-vlow  { background: var(--vlow); }
.risk-matrix td.lv-low   { background: var(--low); }
.risk-matrix td.lv-mid   { background: var(--mid); }
.risk-matrix td.lv-high  { background: #ffe2b8; }
.risk-matrix td.lv-vhigh { background: var(--vhigh); }

.consider-list { font-size: 15px; line-height: 1.9; margin: 0; padding-left: 22px; color: #333; }
.consider-list li { margin-bottom: 2px; }

/* หน้าเกณฑ์การประเมิน: ปิดเอฟเฟกต์ไฮไลต์แถวตอนเอาเมาส์ชี้ (hover) ทุกตารางในหน้านี้ */
#eval-page tbody tr:hover { background-color: transparent; }

/* Workload design tokens shared with workload.css and the task modal. */
:root {
    --wl-green: #0f5d33;
    --wl-green2: #17784a;
    --wl-gold: #c9a227;
    --wl-muted: #687789;
}
