﻿
body {
    font-family: "Kanit", "Open Sans", sans-serif;
    color: #555555;
}
a{
    color:#444;
    text-decoration:none;
}
    a:hover {
        color: #0d6efd;
        text-decoration: none;
    }
@media (max-width: 768px) {
    .km-container {
        max-width: 420px;
        margin: 0 auto;
    }
}

.km-item {
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    margin-bottom: 20px;
    /* เงาบน + ล่าง แบบไล่กลางออก */
    box-shadow: 0 -15px 30px -15px rgba(0, 0, 0, 0.15), /* เงาบน */
    0 0px 0px 0px rgba(0, 0, 0, 0.35); /* เงาล่าง */
    display: flex;
    gap: 14px;
    align-items: flex-start;
}


.km-thumb {
    width: 45px;
    height: 45px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 88px;
    border: 1px solid #eee;
}

.km-category {
    margin-top: 6px;
    font-size: 14px;
    color: #444;
}
.km-box-link {
    color: #0077cc;
    text-decoration: none;
    font-weight: 600;
}

.km-category-link {
    color: #0077cc;
    text-decoration: none;
    font-weight: 600;
}

    .km-category-link:hover {
        color: #0077cc;
        text-decoration: none;
    }

.km-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

.km-tags {
    margin-bottom: 8px;
}

.km-box-title {
    display: inline-block;
    font-size: 18px;
    font-weight: 600;
    color: #0077cc;
    margin-right: 8px;
}
    .km-box-title a {
        color: inherit;
        text-decoration: none;
    }
.km-title {
    font-size: 18px;
    font-weight: 700;
    color: #222;
    display: inline;
}

    .km-title a {
        color: inherit;
        text-decoration: none;
    }

.km-desc {
    margin-top: 8px;
    color: #444;
    font-size: 16px;
    line-height: 1.45;
}
    .km-desc a {
        color: inherit;
        text-decoration: none;
    }
.km-meta {
    margin-top: 10px;
    font-size: 14px;
    color: #086d78;
    display: flex;
    gap: 12px;
    align-items: center;
}
.km-meta-right {
    margin-left: auto;
}

.tag-badge {
    display: inline-block;
    margin-right: 6px;
    margin-bottom: 6px;
    background: #f0f8ff;
    color: #0066aa;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 13px;
    font-weight: 500;
}

.pagination-container {
    display: flex;
    justify-content: center;
    margin-top: 16px;
    gap: 6px;
}

.btn-default {
    padding: 6px 10px;
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 6px;
    cursor: pointer;
}

.btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}

mark {
    background: #ffea8a;
}

@media (max-width:768px) {
    .km-item {
        flex-direction: row;
        gap: 10px;
    }
    .km-list {
        padding:5px;
    }
    .km-thumb {
        width: 70px;
        height: 70px;
        flex: 0 0 70px;
    }

    .km-title {
        font-size: 16px;
    }

    .km-desc {
        font-size: 13px;
    }

    .km-meta {
        flex-direction: column; /* จาก row → column */
        align-items: flex-start; /* ชิดซ้าย */
        gap: 6px; /* ลดช่องว่าง */
    }
}
 
/* ─── Desktop default ─── */
.search-bar {
    padding: 5px;
    margin-bottom: 18px;
    display: flex;
    flex-direction: row; /* ช่องค้นหา + ปุ่ม + select เรียงในแถวเดียว */
    gap: 12px;
    align-items: center;
}

/* ช่องค้นหา + ปุ่มรีเซ็ต */
.search-row {
    display: flex;
    flex: 1; /* ขยายเต็มแถวเท่าที่ทำได้ */
    gap: 8px;
    align-items: center;
}

    .search-row input {
        flex: 1;
        padding: 8px;
        border-radius: 6px;
        border: 1px solid #ddd;
        box-shadow: 0px 0px 6px 3px rgba(15, 23, 42, 0.06), 0 8px 20px rgba #0f172a0a (15, 23, 42, 0.04);
        transition: box-shadow .2s ease, border-color .2s ease, transform .15s ease;
    }

/* ปุ่มรีเซ็ต */
#btnClearClient {
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid #bbb;
    background: #f4f4f4;
    cursor: pointer;
}

    #btnClearClient:hover {
        background: #e9e9e9;
    }

/* dropdown จำนวนหน้า */
.page-row {
    display: flex;
    justify-content: flex-end; /* อยู่ท้ายสุดฝั่งขวา */
    width: auto;
}

.page-size-select {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    min-width: 160px;
    text-align: center;
}
/* ปุ่มควบคุมฟอนต์ */
.font-controls {
    grid-area: font;
    display: flex;
    gap: 6px;
}

.font-btn {
    padding: 4px 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    background: #f8f8f8;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}

    .font-btn:hover {
        background: #eaeaea;
    }
.search-bar.is-hidden {
    display: none !important;
}
@media (max-width: 768px) {

    .search-bar {
        display: grid !important;
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "font page"
            "search search";
        gap: 10px;
        padding: 14px;
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(15,23,42,0.06);
    }

    .font-controls {
        grid-area: font;
        display: flex;
        gap: 6px;
    }

    .page-row {
        grid-area: page;
        display: flex;
        justify-content: flex-end;
    }

    .search-row {
        grid-area: search;
        display: flex;
        gap: 8px;
    }

    #txtSearchClient {
        flex: 1;
        padding: 14px 16px;
        border: 1px solid rgb(206 207 209);
        background: #ffffff;
        box-shadow: -3px 5px 2px 0px rgba(15, 23, 42, 0.06), 0 8px 20px rgba(15, 23, 42, 0.04);
        transition: box-shadow .2s ease, border-color .2s ease, transform .15s ease;
    }


    #btnClearClient {
        font-weight: 600;
        background: #e7e7e7;
    }

    .page-size-select {
        padding: 4px 12px;
        white-space: nowrap;
    }
}


.km-group-block {
    margin-bottom: 28px;
}

.km-group-title {
    border-bottom: 3px solid #6b0e6b;
    color: #4a0a4a;
    font-weight: 700;
    padding-bottom: 6px;
    margin-bottom: 12px;
    font-size: 18px;
}

.km-box-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
}

.km-box {
    flex: 1 1 45%;
    min-width: 260px;
    background: transparent;
}

.km-box-title {
    font-weight: 700;
    color: #0b6fa6;
    margin-bottom: 6px;
}



    .km-item .ico {
        width: 18px;
        color: #9aa;
        margin-top: 3px;
        text-align: center;
    }

@media (max-width:768px) {
    .km-box {
        flex-basis: 100%;
    }
}

 
 
/* category-groups.css - modern tidy style for category block */
.category-groups {
    color: #25303b;
    margin: 18px 0;
}

.category-group-block {
    margin-bottom: 22px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid rgba(10,20,30,0.03);
}

.category-group-title {
    margin: 0 0 10px 0;
    padding-bottom: 6px;
    font-size: 18px;
    font-weight: 700;
    color: #3c0051;
    border-bottom: 3px solid rgba(107,14,107,0.08);
}

.category-box-row {
    display: grid;
    grid-template-columns: repeat(2,1fr);
    gap: 12px;
}

.category-box {
    background: #fafafa;
    padding: 10px;
    border-radius: 8px;
    min-height: 84px;
    transition: transform .14s, box-shadow .14s;
    border: 1px solid rgba(10,20,30,0.04);
}

    .category-box:hover {
        transform: translateY(-4px);
    }

.category-box-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
}

.category-box-link {
    color: #0b6fa6;
    text-decoration: none;
}

    .category-box-link:hover {
        color: #064a64;
        text-decoration: none;
    }

.category-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    padding: 6px 0;
    border-radius: 6px;
}

.category-ico {
    width: 20px;
    color: #9aa5ae;
    flex: 0 0 20px;
    text-align: center;
    margin-top: 4px;
    font-size: 12px;
}

.category-item-title {
    flex: 1;
}

.category-item-link {
    color: #263238;
    text-decoration: none;
    font-size: 14px;
    display: block;
    line-height: 1.2;
}

    .category-item-link:hover {
        color: #0b6fa6;
        text-decoration: none;
    }

.category-more {
    display: inline-block;
    margin-top: 8px;
    font-size: 13px;
    color: #0077cc;
    text-decoration: none;
    font-weight: 600;
}

    .category-more:hover {
        color: #005fa3;
        text-decoration: none;
    }

.category-empty, .category-error {
    color: #666;
    padding: 12px;
}

.category-item-empty {
    padding: 6px 4px;
    font-size: 13.5px;
    color: #7a8699;
    font-style: italic;
    opacity: 0.9;
}

@media (max-width:880px) {
    .category-box-row {
        grid-template-columns: 1fr;
    }

    .category-group-title {
        font-size: 16px;
    }
}

 
 
/* ตัวแปรสเกลฟอนต์ทั้งเว็บ */
:root {
    --font-scale: 1;
}

/* ครอบทุก element ให้สเกลตาม font-size เดิม */
.font-scale .portfolio-details *,
.font-scale #detailArea.detail-wrap * {
    font-size: calc(var(--font-scale) * 1em);
}

 
.km-tabs {
    display: flex;
    gap: 18px;
    border-bottom: 2px solid #eee;
    margin-bottom: 15px;
    margin-top: 15px;

    position: sticky;
    top: 0;
    z-index: 100;

    background: #fff;
}

.km-tab {
    padding: 10px 14px;
    font-size: 16px;
    color: #444;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    text-decoration: none;
}

    .km-tab.active {
        font-weight: 700;
        background: #0f5132;
        border-bottom: 3px solid #198754;
        color: #fff !important;
        /*box-shadow: 0 4px 10px rgba(0,0,0,0.15);*/
    }

    .km-tab:hover {
        color: #0b6fa6;
    }

.km-tab-content {
    padding: 12px 0 12px 0;
}

/* ===== KM Tabs (Mobile First) ===== */
@media (max-width:768px) {
    .km-tabs {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        padding-bottom: 6px;
        border-bottom: 0;
        -webkit-overflow-scrolling: touch;
    }
    .km-tab-content {
        padding: 0px 0 0px 0;
    }
        .km-tabs::-webkit-scrollbar {
            display: none;
        }

    .km-tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 14px;
        border-radius: 999px;
        background: #f1f5f9;
        color: #334155;
        border-bottom: 0;
        flex-shrink: 0;
        font-weight: 600;
    }

        .km-tab.active {
            background: #0b6fa6;
            color: #fff;
            box-shadow: 0 4px 10px rgba(11,111,166,0.25);
        }
}
/* ===============================
   KM ENTERPRISE DASHBOARD STYLE
   =============================== */

.km-stats-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin: 16px 0;
    align-items: stretch;
}

/* ===============================
   CARD
   =============================== */

.km-stat-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.04);
    position: relative;
    overflow: hidden;
    transition: all .28s ease;
}

    .km-stat-card:hover {
        transform: translateY(-8px);
        box-shadow: 0 20px 48px rgba(0,0,0,0.12);
    }

/* ===============================
   GRADIENT HERO
   =============================== */

.gradient-card {
    background: linear-gradient(135deg,#065f46,#2563eb);
    color: white;
    border: none;
}

    .gradient-card:before {
        content: "";
        position: absolute;
        top: -80px;
        right: -80px;
        width: 200px;
        height: 200px;
        background: radial-gradient(circle,rgba(255,255,255,0.18),transparent);
    }

/* ===============================
   HEADER
   =============================== */

.km-stat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.km-stat-title {
    font-size: 18px;
    font-weight: 700;
}

.km-stat-sub {
    font-size: 13px;
    opacity: .8;
}

.km-stat-note {
    font-size: 13px;
    margin-bottom: 14px;
    opacity: .9;
}

/* ===============================
   LEADERBOARD
   =============================== */

.km-leader-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    background: #f9fafb;
    transition: all .2s ease;
}

.gradient-card .km-leader-row {
    background: rgba(255,255,255,0.12);
}

.km-leader-row:hover {
    transform: translateX(6px);
    background: #eef2ff;
}

.gradient-card .km-leader-row:hover {
    background: rgba(255,255,255,0.2);
}

.km-leader-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* ===============================
   RANK CIRCLE
   =============================== */

.km-medal {
    font-size: 22px;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 2px 6px rgba(0,0,0,.25));
}

.km-rank {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
    /* top ranks */

    .km-rank.rank-1 {
        background: #facc15;
        color: #000;
    }

    .km-rank.rank-2 {
        background: #cbd5f5;
    }

    .km-rank.rank-3 {
        background: #f59e0b;
        color: white;
    }

/* gradient card version */

.gradient-card .km-rank {
    background: rgba(255,255,255,0.25);
    color: white;
}

.km-name {
    font-size: 14px;
    /*font-weight: 600;*/
}

.km-leader-right {
    text-align: right;
    min-width: 90px;
}

.km-impact-score {
    font-size: 20px;
    font-weight: 800;
}

.km-impact-label {
    font-size: 12px;
    opacity: .75;
}

/* ===============================
   IMPACT BAR
   =============================== */

.km-impact-bar {
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 8px;
    margin-top: 4px;
    overflow: hidden;
}

    .km-impact-bar i {
        display: block;
        height: 100%;
        background: #facc15;
    }

/* ===============================
   CATEGORY TREND
   =============================== */

.km-cat-row {
    display: grid;
    grid-template-columns: 1.6fr 3fr 50px;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.km-cat-name {
    font-size: 14px;
    color: #111827;
}

.km-cat-bar {
    height: 14px;
    background: #eef2f7;
    border-radius: 10px;
    overflow: hidden;
}

    .km-cat-bar i {
        display: block;
        height: 100%;
        border-radius: 10px;
        background: linear-gradient(90deg,#06b6d4,#2563eb);
        transition: width .5s ease;
    }

.km-cat-count {
    font-weight: 700;
    text-align: center;
    color: #111827;
}

/* ===============================
   CTA
   =============================== */

.km-stat-cta {
    margin-top: 16px;
    padding: 14px;
    background: rgba(255,255,255,0.18);
    border-radius: 12px;
    font-size: 13px;
    text-align: center;
    backdrop-filter: blur(4px);
}

/* ===============================
   SCROLL
   =============================== */
.km-leader-scroll,
.km-category-scroll {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 10px;
    scrollbar-gutter: stable;
    scroll-behavior: smooth;
}

    .km-leader-scroll::-webkit-scrollbar,
    .km-category-scroll::-webkit-scrollbar {
        width: 6px;
    }

    .km-leader-scroll::-webkit-scrollbar-thumb,
    .km-category-scroll::-webkit-scrollbar-thumb {
        background: linear-gradient(#4f46e5,#06b6d4);
        border-radius: 8px;
    }

        .km-leader-scroll::-webkit-scrollbar-thumb:hover,
        .km-category-scroll::-webkit-scrollbar-thumb:hover {
            background: #4f46e5;
        }

/* ===============================
   RESPONSIVE
   =============================== */

@media(max-width:900px) {

    .km-stats-wrap {
        grid-template-columns: 1fr;
    }

    .km-stat-card {
        padding: 18px;
    }
}
/* ===== styles (Blogdetail) ===== */
.detail-wrap {
    background: #fff;
    padding: 18px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
    margin-bottom: 18px;
}

.detail-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #222;
}

.detail-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    color: #666;
    font-size: 14px;
    margin-bottom: 12px;
    border-bottom-style: ridge;
    padding: 10px;
}

.meta-left {
    display: flex;
    align-items: center;
}

.meta-right {
    display: flex;
    gap: 18px;
    align-items: center;
    flex-wrap: wrap;
    text-align: right;
}

@media (max-width:768px) {
    .detail-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .meta-right {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
        gap: 4px;
    }
}

.author-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.author-thumb {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #eee;
}

.content-html {
    color: #333;
    font-size: clamp(15px, 4vw, 17px);
    line-height: 1.8;
    margin-top: 12px;
}

    .content-html img {
        max-width: 100%;
        height: auto;
        border-radius: 8px;
        margin: 12px 0;
    }
@media (max-width:768px) {
    .detail-wrap {
        padding: 14px;
    }

    .content-html {
        margin-top: 10px;
    }
}

.attachment {
    margin-top: 12px;
    padding: 10px;
    border: 1px dashed #eee;
    border-radius: 6px;
    background: #fafafa;
}

.related-list {
    margin-top: 18px;
    border-top: 1px solid #eee;
    padding: 10px;
}

.related-item {
    display: flex;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f3f3f3;
}

    .related-item:last-child {
        border-bottom: 0;
    }

.related-thumb {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid #eee;
}
/* ===== Related Posts (Mobile) ===== */
@media (max-width:768px) {

    .related-list {
        margin-top: 22px;
        padding-top: 0;
        border-top: 0;
    }

    .related-item {
        display: flex;
        gap: 12px;
        padding: 12px;
        margin-bottom: 12px;
        background: #ffffff;
        border-radius: 12px;
        box-shadow: 0 6px 18px rgba(15,23,42,0.06);
        border: 1px solid rgba(15,23,42,0.04);
    }

    .related-thumb {
        width: 64px;
        height: 64px;
        border-radius: 10px;
        flex: 0 0 64px;
    }

    .related-item a {
        font-size: 15px;
        font-weight: 700;
        line-height: 1.3;
        color: #0f172a;
        text-decoration: none;
    }

        .related-item a:hover {
            color: #0b6fa6;
        }
}

.stat-box {
    margin-left: auto;
    color: #999;
    font-size: 13px;
}

.btn-like {
    border: 1px solid #ddd;
    padding: 6px 10px;
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
}

@media (max-width:768px) {
    .author-thumb {
        width: 48px;
        height: 48px;
    }
}

/* modal styles */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9998;
}

.modal-box {
    background: #fff;
    border-radius: 8px;
    padding: 18px;
    width: 420px;
    max-width: 94%;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.modal-title {
    font-weight: 700;
    font-size: 18px;
}

.modal-close {
    cursor: pointer;
    color: #999;
    font-size: 20px;
}

.input {
    width: 100%;
    padding: 8px;
    margin-bottom: 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.btn-primary {
    background: #086d78;
    color: #fff;
    border: 0;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
}

.small-muted {
    font-size: 13px;
    color: #666;
}

#loginFeedback {
    color: #c0392b;
    margin-bottom: 8px;
    display: none;
}
.login-input-group {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f2f4f7;
    margin-bottom: 10px;
}

    .login-input-group .icon-left {
        padding: 10px 12px;
        background: #e9ecef;
        color: #555;
        display: flex;
        align-items: center;
        font-size: 14px;
    }

    .login-input-group input {
        border: none;
        flex: 1;
        padding: 10px;
        background: #fff;
        outline: none;
        font-size: 14px;
    }

        .login-input-group input::placeholder {
            color: #999;
        }


    .login-input-group input.email-left {
        border: none;
        flex: 1;
        padding: 8px;
        background: #fff;
        outline: none;
    }

    .login-input-group .domain {
        padding: 8px 10px;
        background: #e9ecef;
        color: #555;
        font-size: 14px;
        display: flex;
        align-items: center;
    }


/* CSS: km-comments */
/* Comments professional style (add to KMStyle.css) */
.km-comments {
    margin-top: 32px;
    background: #fff;
    border-radius: 12px;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(2,6,23,0.06);
    color: #222;
    max-width: -webkit-fill-available;
    margin: 18px 0;
}

.km-comments-title {
    font-size: 1.25rem;
    margin: 0 0 12px;
    color: #0b5c6b;
    font-weight: 700;
}

.km-login-prompt {
    margin: 6px 0 12px;
}

.km-link {
    color: #086d78;
    font-weight: 600;
    text-decoration: none;
}

.km-comment-list {
    display: block;
    gap: 12px;
}

.km-comment-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: linear-gradient(180deg,#fff,#fbfbfb);
    border: 1px solid #f1f5f6;
    margin-bottom: 12px;
    align-items: flex-start;
}
@media (max-width:768px) {
    .km-comment-item {
        flex-direction: column;
    }
}

.km-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #f0f4f5;
    flex: 0 0 48px;
}

.km-comment-body {
    flex: 1;
}

.km-comment-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.km-comment-author {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: #1f2937;
}

.km-comment-medal {
    font-size: 18px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,.25));
}

.km-comment-time {
    color: #7a8b8f;
    font-size: 13px;
}

.km-comment-text {
    color: #1f2d2f;
    line-height: 1.45;
    white-space: pre-wrap;
}

.km-comment-actions {
    margin-top: 8px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.km-btn {
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
}

.km-btn-primary {
    background: #086d78;
    color: #fff;
    border-color: transparent;
}

.km-btn-link {
    background: transparent;
    color: #086d78;
    border: 1px solid transparent;
    padding: 6px 8px;
    border-radius: 6px;
}

.km-input, .km-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #e3ecec;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    background: #fff;
}

    .km-input:focus, .km-textarea:focus {
        border-color: #86c1c6;
        box-shadow: 0 4px 12px rgba(6,86,93,0.06);
    }

.km-guest-inputs {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

    .km-guest-inputs .km-input {
        flex: 1;
    }

.km-comment-msg {
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    display: none;
}

    .km-comment-msg.error {
        background: #fff5f5;
        color: #c0392b;
        border: 1px solid #f2c6c6;
    }

    .km-comment-msg.ok {
        background: #f3fffb;
        color: #086d78;
        border: 1px solid #bfeee3;
    }
/* responsiveness */
@media (max-width:720px) {
    .km-guest-inputs {
        flex-direction: column;
    }

    .km-avatar {
        width: 40px;
        height: 40px;
        flex: 0 0 40px;
    }
}


.km-comment-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* comment item (server should render each comment as .km-comment) */
.km-comment {
    display: flex;
    gap: 12px;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15,23,42,0.04);
    align-items: flex-start;
}

    .km-comment.child {
        margin-left: 56px;
        background: #fbfdfe;
    }
.km-comment-body {
    flex: 1;
    min-width: 0;
}

.km-comment-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 13px;
    color: #556;
    margin-bottom: 6px;
}

.km-comment-dot {
    color: #ccc;
}

.km-comment-time {
    color: #889;
    font-size: 12px;
}

.km-comment-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
    align-items: center;
}

.km-comment-content {
    font-size: 14px;
    line-height: 1.5;
    color: #233;
    white-space: pre-wrap;
    word-break: break-word;
}

.km-comment-footer {
    margin-top: 10px;
    display: flex;
    gap: 8px;
    align-items: center;
}

.km-comment-children {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.km-comment-form {
    margin-top: 18px;
    background: transparent;
}

.km-comment-msg {
    padding: 10px;
    border-radius: 8px;
    display: block;
    margin-bottom: 8px;
}

    .km-comment-msg.error {
        background: #fff2f2;
        color: #b32e2e;
        border: 1px solid #ffd6d6;
    }

    .km-comment-msg.ok {
        background: #eefaf7;
        color: #0b7068;
        border: 1px solid #dff3ef;
    }

.km-input, .km-textarea {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid #e5eef0;
    background: #fff;
    font-size: 14px;
    box-sizing: border-box;
}

.km-input {
    max-width: 280px;
    display: inline-block;
    vertical-align: middle;
}

.km-textarea {
    resize: vertical;
    min-height: 94px;
}

.km-form-row {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.km-btn {
    background: transparent;
    border: 0;
    padding: 6px 10px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}

    .km-btn:focus {
        outline: 2px solid rgba(11,92,107,0.12);
        outline-offset: 2px;
    }

.km-btn-link {
    color: #4b5563;
    background: transparent;
    padding: 6px;
    border-radius: 6px;
}

.km-btn-primary {
    background: #0b5560;
    color: #fff;
    padding: 8px 14px;
    box-shadow: 0 6px 16px rgba(11,85,96,0.12);
    font-weight: 600;
}

    .km-btn-primary[disabled] {
        opacity: 0.6;
        cursor: not-allowed;
        box-shadow: none;
    }

@media (max-width:720px) {
    .km-comment {
        padding: 12px;
        gap: 10px;
    }

    .km-comment.child {
        margin-left: 46px;
    }

    .km-input {
        max-width: 100%;
        display: block;
        width: 100%;
    }
}
.comment-reply {
    margin-left: 40px;
    padding: 8px 10px;
    border-left: 3px solid #e5e5e5;
}
.comment-item.reply {
    margin-left: 40px;
    border-left: 3px solid #e6e6e6;
    padding-left: 12px;
}
.comment-hot {
    background: #fff8e1;
    border-left: 4px solid orange;
}
    /* =====================================================
   FORCE SEARCH HIGHLIGHT (FINAL FIX)
   ===================================================== */
    #kmResultsContainer mark {
    background-color: #ffeb3b !important;
    color: #000 !important;
    padding: 0 3px;
    border-radius: 3px;
    line-height: 1.4;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* กรณี mark อยู่ในลิงก์ */
#kmResultsContainer a mark {
    color: #000 !important;
    background-color: #ffeb3b !important;
    text-decoration: none !important;
}

/* กัน global reset / theme ที่ชอบล้าง background */
#kmResultsContainer mark,
#kmResultsContainer mark * {
    background-clip: padding-box;
}

.detail-title {
    font-size: clamp(22px, 4vw, 32px);
    line-height: 1.3;
}

.detail-meta {
    border-bottom: 1px solid #eee;
    padding-bottom: 12px;
}

.attachment {
    margin-top: 20px;
    padding: 14px;
    background: #f9fafb;
    border-radius: 10px;
}
.km-manual {
    background: #ffffff;
    padding: 24px;
    border-radius: 10px;
    line-height: 1.8;
}

    .km-manual h1 {
        font-size: 26px;
        font-weight: 700;
        margin-bottom: 16px;
    }

    .km-manual h2 {
        font-size: 20px;
        font-weight: 600;
        margin-top: 24px;
        scroll-margin-top: 140px;
    }
@media (max-width:768px) {
    .km-manual h2 {
        scroll-margin-top: 160px;
    }
}

.manual-img {
    max-width: 100%;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin: 12px 0;
}

.km-sidebar-box {
    background: #ffffff;
    border-radius: 12px;
    padding: 18px 16px;
    border: 1px solid #e3e8ef;
    box-shadow: 0 6px 18px rgba(0,0,0,0.05);
    position: sticky;
    top: 120px; /* กัน header */
}

    .km-sidebar-box h5 {
        font-size: 17px;
        font-weight: 700;
        color: #0b5e3b;
        margin-bottom: 14px;
        border-bottom: 1px solid #e5e7eb;
        padding-bottom: 8px;
    }

.km-menu {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .km-menu li {
        margin-bottom: 6px;
    }

        .km-menu li a {
            display: block;
            padding: 8px 12px;
            border-radius: 8px;
            color: #374151;
            text-decoration: none;
            font-size: 14.5px;
            transition: all 0.2s ease;
        }

            .km-menu li a:hover {
                background: #eef7f3;
                color: #065f46;
                padding-left: 16px;
            }

        .km-menu li.active a {
            background: #d1fae5;
            color: #065f46;
            font-weight: 600;
        }

    .km-menu .divider {
        height: 1px;
        background: #e5e7eb;
        margin: 10px 0;
    }

    .km-menu li.active a {
        background: #d1fae5;
        color: #065f46;
        font-weight: 600;
    }
    /* Mobile */
/* ปุ่มเปิดเมนู */
.km-menu-btn {
    display: none;
    z-index: 1200;
    background: #065f46;
    color: #fff;
    border: none;
    padding: 10px 14px;
}

.km-manual-content {
    padding-top: 0 !important; /* ตัดผลของ section */
}

.km-manual-wrap {
    margin-top: 0px; /* ดึงขึ้นแทน */
}

/* ===== KM Sidebar Mobile (FINAL) ===== */
.km-sidebar-close {
    display: none;
}
@media (max-width: 768px) {
    .km-menu-btn {
        top: auto; /* ยกเลิก top */
        bottom: 24px; /* 🔥 ระยะจากด้านล่าง */
        right: 16px;
    }
}

@media (max-width: 768px) {
    .km-sidebar-close {
        position: absolute;
        top: 10px;
        right: 10px;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: #065f46;
        color: #fff;
        font-size: 18px;
        cursor: pointer;
        z-index: 1400;
    }
    .km-menu-btn {
        position: fixed;
       /* top: 150px;  ปรับระดับได้ */
        right: 12px; /* ชิดซ้าย */
        z-index: 9999;
        background: linear-gradient(135deg, #065f46, #0b7a5a);
        color: #fff;
        border: none;
        padding: 10px 14px;
        border-radius: 999px;
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 14px;
        font-weight: 600;
        box-shadow: 0 8px 20px rgba(0,0,0,.18);
        cursor: pointer;
    }

        .km-menu-btn .ico {
            font-size: 16px;
            line-height: 1;
        }
 
    .km-sidebar {
        position: fixed;
        top: 70px;
        left: -280px;
        width: 260px;
        height: auto !important;
        background: #ffffff;
        z-index: 1300;
        padding: 16px;
        overflow-y: visible !important;
        transition: left .25s ease;
        box-shadow: 2px 0 12px rgba(0,0,0,.12);
    }

        .km-sidebar.show {
            left: 0;
        }

    body.km-lock {
        overflow: hidden;
    }
}
@media (max-width: 768px) {
    .km-sidebar {
        top: auto; /* ไม่ยึดด้านบน */
        bottom: 0; /* 🔥 ชิดด้านล่าง */
        left: -280px;
        height: auto;
        max-height: 75vh; /* 🔥 ไม่สูงเกินจอ */
        overflow-y: auto;
        border-top-left-radius: 16px;
        border-top-right-radius: 16px;
    }

        .km-sidebar.show {
            left: 0;
        }
}

.km-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1200;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}

    .km-overlay.show {
        opacity: 1;
        pointer-events: auto;
    }

.km-acc-body {
    display: none; /* ✅ หุบค่าเริ่มต้น */
    padding: 8px 16px;
}

.km-acc-header {
    width: 100%;
    border: 1px solid #e5e7eb;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    background: linear-gradient(135deg, #1f4f46, #2d6a5e);
    color: #fff;
    border-radius: 16px;
}

.km-acc-item.active .km-acc-body {
    display: block;
}

.km-acc-icon {
    float: right;
}

.km-header {
    background: linear-gradient(135deg, #1f4f46, #2d6a5e);
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.km-header-badge {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
    letter-spacing: 1px;
    color: #fff;
}

.km-header-text h1 {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
}

@media (max-width: 576px) {
    .km-header-text h1 {
        font-size: 18px;
    }
}
/* ===== KM Footer (Professional) ===== */
.km-footer {
    background: linear-gradient(135deg, #1f4f46, #2d6a5e);
    color: #e5f3f1;
    margin-top: 48px;
}

.km-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 28px 20px 18px;
}

.km-footer-main {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
}

.km-footer-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.km-footer-badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    background: rgba(255,255,255,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
    color: #ffffff;
}

.km-footer-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
}

.km-footer-sub {
    font-size: 13px;
    opacity: 0.85;
}

.km-footer-meta {
    font-size: 14px;
    line-height: 1.6;
}

.km-footer-row {
    display: flex;
    gap: 8px;
    margin-bottom: 4px;
}

    .km-footer-row .label {
        font-weight: 600;
        opacity: 0.85;
        min-width: 70px;
    }

.km-footer-bottom {
    margin-top: 18px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.18);
    display: flex;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    opacity: 0.85;
    flex-wrap: wrap;
}

    .km-footer-bottom .sep {
        opacity: 0.6;
    }

@media (max-width: 768px) {
    .km-footer-main {
        flex-direction: column;
        gap: 18px;
    }
}
/* ===== KM Breadcrumb Base ===== */
.km-breadcrumb {
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

    .km-breadcrumb .container {
        display: flex;
        align-items: center;
    }

/* Desktop breadcrumb */
.km-breadcrumb-list {
    display: flex;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 10px 0;
    font-size: 14px;
}

.km-breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

    .km-breadcrumb-item::after {
        content: "/";
        color: #cbd5e1;
    }

    .km-breadcrumb-item:last-child::after {
        display: none;
    }

    .km-breadcrumb-item a {
        color: #0b6fa6;
        font-weight: 600;
        text-decoration: none;
    }

    .km-breadcrumb-item.active span {
        font-weight: 700;
        color: #334155;
    }

/* Toggle button (hidden on desktop) */
.km-breadcrumb-toggle {
    margin-left: auto;
    display: none;
    background: transparent;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 18px;
    cursor: pointer;
}

/* Mobile dropdown */
.km-breadcrumb-mobile {
    display: none;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 6px 18px rgba(15,23,42,0.08);
}

    .km-breadcrumb-mobile ol {
        list-style: none;
        margin: 0;
        padding: 10px 14px;
    }

    .km-breadcrumb-mobile li {
        padding: 6px 0;
        font-size: 14px;
    }

    .km-breadcrumb-mobile a {
        color: #0b6fa6;
        font-weight: 600;
        text-decoration: none;
    }

    .km-breadcrumb-mobile .active span {
        font-weight: 700;
        color: #334155;
    }

/* ===== Mobile behavior ===== */
@media (max-width: 768px) {

    .km-breadcrumb-list {
        /* display: none; 🔥 หุบ breadcrumb */
    }

    .km-breadcrumb-toggle {
        display: inline-flex; /* 🔥 แสดงปุ่มมุมขวา */
        align-items: center;
        justify-content: center;
    }

    .km-breadcrumb.open .km-breadcrumb-mobile {
        display: block;
    }
}
/* ===== Scroll To Top Button ===== */
.km-scroll-top {
    position: fixed;
    right: 10px;
    bottom: 50px; /* 🔥 อยู่เหนือปุ่มสารบัญ */
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #545b60;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease, transform .25s ease;
    z-index: 9998;
}

    .km-scroll-top.show {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

/* Mobile only 
@media (min-width: 769px) {
    .km-scroll-top {
        display: none;
    }
}*/
/* ===== Floating Action Button Stack ===== */
.km-fab-stack {
    position: fixed;
    left: 18px; /* 👈 เปลี่ยนจาก right */
    right: auto; /* 👈 สำคัญมาก */
    bottom: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px; /* ⭐ ระยะห่าง */
    z-index: 9999;
}

    /* ปุ่มใน stack ใช้ position ธรรมดา */
    .km-fab-stack .km-gpt-btn,
    .km-fab-stack .km-scroll-top {
        position: relative;
    }
@media (max-width: 768px) {
    .km-fab-stack {
        bottom: 0px;
        gap: 10px;
    }
}
/* ===== GPT KM Assistant Button ===== */
/* ปุ่มลอย */
.km-gpt-btn {
    position: fixed;
    left: 18px; /* 👈 ย้ายมาซ้าย */
    bottom: 50px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #0b7285;
    text-decoration: none;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0,0,0,.25);
}
/* ไอคอน */
.km-gpt-icon {
    font-size: 26px;
    line-height: 1;
}

/* popover */
.km-gpt-popover {
    position: absolute;
    left: 70px;
    right: auto;
    bottom: 50%;
    transform: translateY(50%);
    background: #1f2937;
    color: #fff;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    line-height: 1.4;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
}

    /* ลูกศร */
    .km-gpt-popover::after {
        content: "";
        position: absolute;
        left: -6px;
        right: auto;
        top: 50%;
        transform: translateY(-50%);
        border-width: 6px;
        border-style: solid;
        border-color: transparent transparent transparent #1f2937;
    }

/* show */
.km-gpt-btn.show-popover .km-gpt-popover {
    opacity: 1;
    transform: translate(0, 50%);
}


/* ===== GPT Panel ===== */
.km-gpt-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 340px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -8px 0 28px rgba(0,0,0,.18);
    z-index: 9998;
    display: flex;
    flex-direction: column;
    /* 🔥 จุดแก้จริง */
    transform: translateX(100%);
    visibility: hidden;
    transition: transform .3s ease, visibility .3s ease;
}

    .km-gpt-panel.show {
        transform: translateX(0);
        visibility: visible;
    }


/* Header */
.km-gpt-header {
    padding: 14px 16px;
    background: linear-gradient(135deg,#065f46,#0b7a5a);
    color: #fff;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

    .km-gpt-header button {
        background: transparent;
        border: none;
        color: #fff;
        font-size: 18px;
        cursor: pointer;
    }

/* Body */
.km-gpt-body {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    background: #f8fafc;
}

.km-gpt-message {
    background: #fff;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

    .km-gpt-message.system {
        background: #eefaf7;
    }

/* Footer */
.km-gpt-footer {
    display: flex;
    gap: 8px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

    .km-gpt-footer input {
        flex: 1;
        padding: 10px;
        border-radius: 8px;
        border: 1px solid #ccc;
    }

    .km-gpt-footer button {
        padding: 0 14px;
        border-radius: 8px;
        border: none;
        background: #086d78;
        color: #fff;
        font-weight: 600;
        cursor: pointer;
    }

/* Mobile */
@media (max-width: 768px) {
    .km-gpt-panel {
        width: 100%;
    }
}
.km-gpt-message.user {
    background: #e0f2fe;
    align-self: flex-end;
}

.km-gpt-message.system {
    background: #eefaf7;
}
.gradient-card {
    background: linear-gradient(135deg, #0f5132, #198754);
    color: #fff;
    border-radius: 16px;
    padding: 20px;
}

.km-contributor-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.km-rank {
    font-weight: 700;
    font-size: 14px;
}

.km-name {
    font-size: 15px;
}

.km-impact-score {
    font-size: 22px;
    font-weight: 700;
    text-align: right;
}

.km-impact-label {
    font-size: 11px;
    opacity: 0.8;
    text-align: right;
}

.km-stat-cta {
    margin-top: 16px;
    font-size: 13px;
    opacity: 0.95;
}
.attachment ul {
    list-style: none;
    padding-left: 0;
}
.km-contributor-scroll {
    max-height: 420px;
    overflow-y: auto;
    padding-right: 6px;
}
.km-badge {
    font-size: 12px;
    margin-left: 6px;
    color: #0a7c4a;
    font-weight: 600;
}
.km-box-link {
    position: relative;
}
/* Hover link */
.km-box-link {
    position: relative;
    color: #2563eb;
    font-weight: 500;
    text-decoration: none;
}

/* Hover card */
.km-box-card {
    display: none;
    position: absolute;
    top: 28px;
    left: 0;
    width: 320px;
    background: #fff;
    border-radius: 10px;
    padding: 14px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    z-index: 999;
    font-size: 14px;
    line-height: 1.6;
}

    /* Arrow */
    .km-box-card::before {
        content: "";
        position: absolute;
        top: -8px;
        left: 20px;
        border-width: 0 8px 8px 8px;
        border-style: solid;
        border-color: transparent transparent #fff transparent;
    }

/* Show */
.km-box-link:hover .km-box-card {
    display: block;
}

/* CKEditor content styling */
.km-box-card h1,
.km-box-card h2,
.km-box-card h3 {
    font-size: 16px;
    margin-bottom: 6px;
}

.km-box-card p {
    margin: 4px 0;
    color: #374151;
}