/* =====================================================================
 * catalog.css — กลุ่มยุทธศาสตร์ / 9 ด้าน 9 ดี / นโยบาย 261+ (index + view)
 * views: astrategygroups/*, adimensions/*, apolicies261/* · ข้อมูล: frontend\components\PolicyCatalog
 * ใช้ร่วมกับ dataview.css (dv-table, dv-badge) และ js/viewswitch.js (สลับมุมมอง/ตัวกรอง)
 * สีประจำรายการส่งผ่านตัวแปร --c (color_hex ของมิติ/กลุ่ม)
 * ===================================================================== */
.ct { --c: var(--green); }
.ct-hero { margin: 22px 0 16px; padding: 22px 26px; background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--c); }
.ct-eyebrow { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--gold-deep); }
.pv2 .pv2-main h1.ct-title { margin: 4px 0 6px; font-size: 28px; line-height: 1.3; color: var(--green-deep); }
.ct-lede { margin: 0; max-width: 860px; font-size: 14.5px; color: var(--ink-soft); }
.ct-crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ct-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

/* ตัวเลขสรุป */
.ct-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; margin-bottom: 18px; background: var(--card); border: 1px solid var(--rule); }
.ct-stat { padding: 14px 18px; border-left: 1px solid var(--rule-soft); }
.ct-stat:first-child { border-left: 0; }
.ct-stat b { display: block; font-family: 'IBM Plex Mono', monospace; font-size: 24px; font-weight: 600; color: var(--ink); line-height: 1.2; }
.ct-stat span { font-size: 12px; color: var(--ink-soft); }

/* chip */
.ct-chip { display: inline-flex; align-items: center; gap: 6px; padding: 1px 9px; font-size: 12px; line-height: 1.6; color: var(--ink-soft); background: var(--card); border: 1px solid var(--rule); text-decoration: none; white-space: nowrap; }
.ct-chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
a.ct-chip:hover { border-color: var(--c); color: var(--ink); }
.ct-chip.is-urgent { color: #8a1f14; border-color: #c0392b; background: var(--red-tint); }
.ct-code { font-family: 'IBM Plex Mono', monospace; font-size: 12px; font-weight: 600; color: var(--gold-deep); background: var(--gold-tint); border: 1px solid var(--gold); padding: 0 7px; white-space: nowrap; }

/* แถบเครื่องมือ: สลับมุมมอง + ตัวกรอง */
.ct-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-bottom: 14px; padding: 10px 12px; background: var(--card); border: 1px solid var(--rule); }
.ct-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; flex: 1; }
.pv2 .ct .ct-filters input, .pv2 .ct .ct-filters select { width: auto; min-height: 36px; padding: 5px 10px; font-size: 13px; }
.pv2 .ct .ct-filters input[type=search] { min-width: 220px; flex: 1 1 220px; }
.pv2 .ct .ct-filters select { max-width: 220px; }
.ct-count { font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.ct-count b { font-family: 'IBM Plex Mono', monospace; color: var(--ink); }
.pv2 .ct .ct-reset { background: none; border: 0; padding: 0; font: inherit; font-size: 12.5px; color: var(--ink-soft); text-decoration: underline; cursor: pointer; }
.ct-empty { padding: 28px; text-align: center; color: var(--ink-faint); background: var(--card); border: 1px dashed var(--rule); }
.ct [hidden] { display: none !important; }

/* การ์ด */
.ct-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.ct-cards.lg { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.ct-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 18px 14px; background: var(--card); border: 1px solid var(--rule); border-top: 4px solid var(--c); min-width: 0; transition: box-shadow .15s, transform .15s; }
.ct-card:hover { box-shadow: 0 8px 22px rgba(18,59,39,.10); transform: translateY(-1px); }
.ct-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pv2 .pv2-main .ct-card h3 { margin: 0; font-family: 'Sarabun', sans-serif; font-size: 15.5px; font-weight: 700; line-height: 1.45; color: var(--ink); }
.pv2 .pv2-main .ct-card.lg h3 { font-size: 19px; }
.ct-card h3 a { color: inherit; text-decoration: none; }
.ct-card h3 a::after { content: ''; position: absolute; inset: 0; } /* ทั้งการ์ดคลิกได้ */
.ct-card .ct-mix a, .ct-card .ct-card-links, .ct-card .ct-card-top a { position: relative; z-index: 1; }
.ct-num { font-family: 'IBM Plex Mono', monospace; font-size: 30px; font-weight: 700; color: var(--c); line-height: 1; }
.ct-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 0; padding-top: 10px; border-top: 1px solid var(--rule-soft); }
.ct-meta div { min-width: 0; }
.ct-meta dt { font-size: 11px; font-weight: 400; color: var(--ink-faint); }
.ct-meta dd { margin: 0; font-family: 'IBM Plex Mono', monospace; font-size: 16px; font-weight: 600; color: var(--ink); }
.ct-ach .ach-label { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }
.ct-card-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--rule); }
.ct-mix { display: flex; flex-wrap: wrap; gap: 6px; }
.ct-desc { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ตาราง */
.ct-table td { vertical-align: top; }
.ct-table .ct-name { min-width: 260px; line-height: 1.5; }
.ct-table .ct-name a { color: var(--ink); text-decoration: none; font-weight: 600; }
.ct-table .ct-name a:hover { color: var(--green-deep); text-decoration: underline; }
.ct-table .mono { font-family: 'IBM Plex Mono', monospace; }
.ct-table .ct-achcell { min-width: 170px; }
.ct-table .ct-achcell .ach-label { font-size: 11.5px; }
.ct-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--c); vertical-align: -1px; margin-right: 6px; }

/* รายการ */
.ct-list { list-style: none; margin: 0; padding: 0; background: var(--card); border: 1px solid var(--rule); }
.ct-li { display: grid; grid-template-columns: 6px 1fr 240px; gap: 14px; align-items: center; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule-soft); }
.ct-li:last-child { border-bottom: 0; }
.ct-li:hover { background: #fbfaf3; }
.ct-li::before { content: ''; align-self: stretch; background: var(--c); }
.ct-li-title { font-weight: 600; line-height: 1.5; }
.ct-li-title a { color: var(--ink); text-decoration: none; }
.ct-li-title a:hover { color: var(--green-deep); text-decoration: underline; }
.ct-li-sub { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; color: var(--ink-soft); }
.ct-li-sub b { font-family: 'IBM Plex Mono', monospace; color: var(--ink); }
.ct-li-side .ach-label { font-size: 11.5px; margin-top: 3px; color: var(--ink-soft); }

/* ส่วนของหน้า view */
.ct-sec { margin: 26px 0 0; }
.ct-sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.pv2 .pv2-main .ct-sec-head h2 { margin: 0; font-size: 20px; color: var(--green-deep); }
.ct-sec-head small { font-size: 12.5px; color: var(--ink-soft); }
.ct-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 0; }
.ct-detail > div { padding: 12px 16px; background: var(--card); border: 1px solid var(--rule); }
.ct-detail dt { font-size: 12px; font-weight: 600; color: var(--gold-deep); margin-bottom: 4px; }
.ct-detail dd { margin: 0; font-size: 13.5px; line-height: 1.65; word-break: break-word; }
.ct-detail .wide { grid-column: 1 / -1; }

@media (max-width: 720px) {
    .ct-li { grid-template-columns: 6px 1fr; }
    .ct-li-side { grid-column: 2; }
    .ct-stat { border-left: 0; border-top: 1px solid var(--rule-soft); }
    .pv2 .ct .ct-filters select { max-width: 100%; flex: 1 1 140px; }
}
.vs-loading { padding: 28px; text-align: center; font-size: 13px; color: var(--ink-faint); background: var(--card); border: 1px dashed var(--rule); }

/* ไอคอนด้าน 9 ดี (images/bma9d/dim) */
.ct-icon { display: inline-block; flex: none; object-fit: cover; border-radius: 10px; vertical-align: middle; }
.ct-icon.card { width: 64px; height: 64px; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.ct-icon.sm { width: 28px; height: 28px; border-radius: 6px; margin-right: 8px; }
.ct-card-top:has(.ct-icon) { justify-content: space-between; }
.ct-hero:has(.ct-hero-icon) { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; }
.ct-hero:has(.ct-hero-icon) > :not(.ct-hero-icon) { grid-column: 1; }
.ct-hero-icon { grid-column: 2; grid-row: 1 / span 6; align-self: start; width: 112px; height: 112px; border-radius: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
@media (max-width: 600px) {
    .ct-hero-icon { width: 72px; height: 72px; border-radius: 10px; }
}
