/* ============================================================
   dis-list.css — หน้ารายการโครงการ/ตัวชี้วัดด้านคนพิการ (tbisdisabled, tbisdisabledokr)
   dashboard สรุป + มุมมอง card / list / table ในธีม pv2
   ============================================================ */

.dl-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.dl-head h1.pv2-title { margin: 0 0 4px; }
.dl-head-sub { font-size: 13.5px; color: var(--ink-faint); }
.dl-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- KPI strip ---------- */
.dl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); margin-bottom: 16px; }
.dl-kpi { background: var(--card); padding: 16px 18px; position: relative; }
.dl-kpi::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--kc, var(--green)); }
.dl-kpi-num { font-family: 'IBM Plex Mono', monospace; font-size: 24px; font-weight: 600; color: var(--kc, var(--green-deep)); line-height: 1.2; }
.dl-kpi-num small { font-size: 13px; color: var(--ink-faint); font-weight: 500; }
.dl-kpi-label { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }

/* ---------- dashboard panels ---------- */
.dl-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.dl-panel { background: var(--card); border: 1px solid var(--rule); padding: 16px 18px; min-width: 0; }
.dl-panel.wide { grid-column: 1 / -1; }
.dl-panel h3 { font-size: 13px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; margin: 0 0 12px; }

.dl-stack { display: flex; height: 14px; background: var(--rule-soft); overflow: hidden; gap: 2px; }
.dl-stack i { display: block; min-width: 3px; }
.dl-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 12.5px; color: var(--ink-soft); }
.dl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.dl-legend i { width: 10px; height: 10px; display: inline-block; }
.dl-legend b { color: var(--ink); font-family: 'IBM Plex Mono', monospace; }
.dl-legend small { color: var(--ink-faint); }

.dl-hbars { display: flex; flex-direction: column; gap: 7px; }
.dl-hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 12.5px; }
.dl-hbar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); }
.dl-hbar-track { height: 10px; background: var(--rule-soft); }
.dl-hbar-track i { display: block; height: 100%; }
.dl-hbar-val { color: var(--ink-faint); white-space: nowrap; font-size: 12px; }
.dl-hbar-val b { color: var(--ink); font-family: 'IBM Plex Mono', monospace; }
.dl-empty { color: var(--ink-faint); font-size: 13px; padding: 12px 0; text-align: center; }

/* ---------- filter bar ---------- */
.dl-filter { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; background: var(--card); border: 1px solid var(--rule); padding: 12px 14px; margin-bottom: 14px; }
.dl-filter .dl-field { display: flex; flex-direction: column; gap: 3px; flex: 1 1 160px; min-width: 140px; }
.dl-filter .dl-field.grow { flex: 3 1 260px; }
.pv2 .dl-filter label { font-size: 11.5px; margin: 0; }
.pv2 .dl-filter input, .pv2 .dl-filter select { width: 100%; padding: 7px 10px; font-size: 13.5px; border: 1px solid var(--rule); background: var(--paper); font-family: 'Sarabun', sans-serif; color: var(--ink); height: 36px; }
.dl-filter .dl-filter-actions { display: flex; gap: 6px; flex: 0 0 auto; }

/* ---------- toolbar ---------- */
.dl-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.dl-count { font-size: 13px; color: var(--ink-soft); }
.dl-count b { font-family: 'IBM Plex Mono', monospace; color: var(--ink); }
.dl-sort { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--ink-faint); flex-wrap: wrap; }
.dl-sort a { color: var(--ink-soft); text-decoration: none; border: 1px solid var(--rule); background: var(--card); padding: 2px 9px; }
.dl-sort a:hover { background: var(--green-tint); }
.dl-sort a.asc, .dl-sort a.desc { background: var(--green-deep); color: #fff; border-color: var(--green-deep); }
.dl-sort a.asc::after { content: ' ▲'; font-size: 9px; }
.dl-sort a.desc::after { content: ' ▼'; font-size: 9px; }
.dl-viewswitch { display: inline-flex; }
.pv2-viewswitch.dl-viewswitch a { text-decoration: none; }

/* ทั้ง pv2-viewswitch อาจไม่มีใน staff-v2 — กำหนดเอง */
.dl-viewswitch { border: 1px solid var(--rule); background: var(--card); }
.dl-viewswitch a { padding: 6px 14px; font-size: 13px; color: var(--ink-soft); border-right: 1px solid var(--rule); }
.dl-viewswitch a:last-child { border-right: none; }
.dl-viewswitch a:hover { background: var(--green-tint); color: var(--green-deep); }
.dl-viewswitch a.active { background: var(--green-deep); color: #fff; }

/* ---------- progress bar ---------- */
.dl-barwrap { display: flex; align-items: center; gap: 8px; }
.dl-bar { flex: 1; height: 8px; background: var(--rule-soft); overflow: hidden; min-width: 60px; }
.dl-bar i { display: block; height: 100%; }
.dl-pct { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600; color: var(--ink); min-width: 52px; text-align: right; }

.dl-chip { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border: 1px solid var(--c); color: var(--c); background: color-mix(in srgb, var(--c) 10%, white); white-space: nowrap; }
.dl-tag { display: inline-block; font-size: 11.5px; color: var(--ink-soft); background: var(--band); border: 1px solid var(--rule-soft); padding: 0 7px; }

/* ---------- card view ---------- */
.dl-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.dl-card { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--lc, var(--green)); padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; transition: transform .1s, box-shadow .1s; }
.dl-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(23,37,28,.08); color: inherit; text-decoration: none; }
.dl-card-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.dl-card h3 { font-family: 'Taviraj', serif; font-size: 15.5px; font-weight: 600; line-height: 1.45; margin: 0; color: var(--ink); }
.dl-card-meta { font-size: 12px; color: var(--ink-faint); }
.dl-card-figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; border-top: 1px dashed var(--rule); padding-top: 8px; margin-top: auto; }
.dl-fig-label { font-size: 11px; color: var(--ink-faint); }
.dl-fig-val { font-family: 'IBM Plex Mono', monospace; font-size: 14px; font-weight: 600; color: var(--ink); word-break: break-word; }

/* ---------- list view ---------- */
.dl-list { background: var(--card); border: 1px solid var(--rule); }
.dl-row { display: grid; grid-template-columns: 6px minmax(0, 1fr) 220px; gap: 14px; padding: 12px 16px 12px 0; border-bottom: 1px solid var(--rule-soft); color: inherit; text-decoration: none; align-items: center; }
.dl-row:last-child { border-bottom: none; }
.dl-row:hover { background: var(--paper); color: inherit; text-decoration: none; }
.dl-row-accent { align-self: stretch; background: var(--lc, var(--green)); }
.dl-row-title { font-weight: 600; font-size: 14px; color: var(--ink); line-height: 1.45; }
.dl-row-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; font-size: 12px; color: var(--ink-faint); margin-top: 3px; align-items: center; }
.dl-row-side { display: flex; flex-direction: column; gap: 4px; }
.dl-row-side small { font-size: 11.5px; color: var(--ink-faint); text-align: right; }

/* ---------- table view ---------- */
.dl-table-wrap { overflow-x: auto; border: 1px solid var(--rule); background: var(--card); }
.pv2 .dl-table-wrap .grid-view table { border: none; min-width: 900px; }
.pv2 .dl-table-wrap .grid-view .summary { padding: 10px 14px 0; }
.pv2 .dl-table-wrap .grid-view thead th { white-space: normal; }
.pv2 .dl-table-wrap .grid-view td { word-break: break-word; }
.pv2 .dl-table-wrap ul.pagination { padding: 0 14px; }

@media (max-width: 860px) {
  .dl-panels { grid-template-columns: 1fr; }
  .dl-row { grid-template-columns: 6px minmax(0, 1fr); }
  .dl-row-side { grid-column: 2; }
  .dl-row-side small { text-align: left; }
}

/* site.css เดิมวาดสามเหลี่ยมด้วย border บน a.asc/a.desc — ซ้อนกับลูกศรของ pv2 */
.pv2 a.asc::after, .pv2 a.desc::after { border: none !important; width: auto; height: auto; margin: 0 0 0 2px; background: none; }

/* ============================================================
   หน้าจับคู่ (tbisdisabled/create, tbisdisabledokr/create) — views/tbisdisabled/_matcher.php
   ============================================================ */
.dm-editor { font-size: 12.5px; color: var(--gold-deep); background: var(--gold-tint); border: 1px solid var(--gold); padding: 6px 12px; align-self: center; }
.dm-hint { font-size: 13px; color: var(--teal-deep); background: var(--teal-tint); border-left: 3px solid var(--teal); padding: 8px 14px; margin-bottom: 14px; }
.dm-show a { cursor: pointer; }
.dm .dl-viewswitch.dm-show { height: 36px; }
.dm .dl-viewswitch.dm-show a { display: inline-flex; align-items: center; }

.dm-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.dm-table thead th { background: var(--band); color: var(--ink-soft); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 1; }
.dm-table td { padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; font-size: 13.5px; }
.dm-table tbody tr { transition: background .15s; box-shadow: inset 3px 0 0 transparent; }
.dm-table tbody tr:hover td { background: var(--paper); }
.dm-table tbody tr.is-matched td { background: var(--green-tint); }
.dm-table tbody tr.is-matched { box-shadow: inset 3px 0 0 var(--green); }
.dm-id { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; color: var(--ink-soft); white-space: nowrap; }
.dm-title { font-weight: 600; color: var(--ink); line-height: 1.45; }
.dm-meta { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.dm-year { text-align: center; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.dm-act { text-align: center; }
.dm-empty { text-align: center; color: var(--ink-faint); padding: 34px 12px !important; }
.dm-empty.err { color: var(--red); }
.dm.is-loading #dm-body { opacity: .45; transition: opacity .15s; }
.dm-more { font-size: 12.5px; color: var(--gold-deep); background: var(--gold-tint); padding: 8px 14px; border: 1px solid var(--rule); border-top: none; }

/* toggle switch */
.dm-switch { display: inline-flex; align-items: center; gap: 8px; background: none; border: none; padding: 4px 6px; cursor: pointer; font-family: 'Sarabun', sans-serif; font-size: 12.5px; color: var(--ink-soft); min-width: 128px; }
.dm-switch:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }
.dm-sw-track { position: relative; width: 40px; height: 22px; background: #c9c8c0; border-radius: 11px; transition: background .15s; flex-shrink: 0; }
.dm-sw-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: left .15s; }
.dm-switch[aria-checked="true"] .dm-sw-track { background: var(--green); }
.dm-switch[aria-checked="true"] .dm-sw-knob { left: 21px; }
.dm-switch[aria-checked="true"] .dm-sw-label { color: var(--green-deep); font-weight: 600; }
.dm-switch.busy { opacity: .5; cursor: progress; }

/* toast */
.dm-toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.dm-toast { background: var(--green-deep); color: #fff; padding: 10px 16px; font-size: 13.5px; box-shadow: 0 4px 16px rgba(0,0,0,.18); max-width: 360px; transition: opacity .4s, transform .4s; }
.dm-toast.err { background: var(--red); }
.dm-toast.out { opacity: 0; transform: translateY(8px); }

/* หน้ารายละเอียด (view) */
.dv-card { background: var(--card); border: 1px solid var(--rule); border-top: 3px solid var(--green); padding: 20px 22px; max-width: 900px; }
.dv-grid { display: grid; grid-template-columns: 180px 1fr; gap: 10px 18px; font-size: 14px; }
.dv-grid dt { color: var(--ink-faint); font-size: 12.5px; font-weight: 600; }
.dv-grid dd { margin: 0; color: var(--ink); }
.dv-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--rule); }
.pv2 .pv2-btn.danger, .pv2 a.pv2-btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
@media (max-width: 640px) { .dv-grid { grid-template-columns: 1fr; gap: 2px; } .dv-grid dd { margin-bottom: 10px; } }

/* ============================================================
   หน้ารายละเอียด (tbproject/view, lutkeyresult/view)
   ============================================================ */
.dd-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.dd-readonly { font-size: 12.5px; color: var(--ink-soft); background: var(--band); border: 1px solid var(--rule); padding: 6px 12px; align-self: center; }
.dl-kpi .dl-bar { margin-top: 8px; }
.dd-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.dd-main, .dd-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.dd-side { position: sticky; top: 80px; }
.dd-box { background: var(--card); border: 1px solid var(--rule); padding: 16px 18px; }
.dd-box h3 { font-family: 'Taviraj', serif; font-size: 16.5px; font-weight: 600; color: var(--green-deep); margin: 0 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--rule-soft); }
.dd-text { font-size: 14px; line-height: 1.75; color: var(--ink); }
.dd-sub { font-size: 12px; color: var(--ink-faint); }
.dd-note { font-size: 12.5px; color: var(--gold-deep); background: var(--gold-tint); padding: 4px 8px; margin-top: 4px; }
.dd-isa { display: inline-block; font-size: 11px; background: #0b5cad; color: #fff; padding: 0 5px; margin-left: 4px; vertical-align: 1px; }

.dd-tablewrap { overflow-x: auto; }
.dd-table { width: 100%; border-collapse: collapse; min-width: 560px; }
.dd-table th { background: var(--band); color: var(--ink-soft); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--rule); }
.dd-table td { padding: 9px 12px; border-bottom: 1px solid var(--rule-soft); font-size: 13.5px; vertical-align: middle; }
.dd-table tr:last-child td { border-bottom: none; }
.dd-table tbody tr:hover td { background: var(--paper); }
.dd-table .r { text-align: right; }
.dd-table .mono, .dd-info .mono { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.dd-table a { color: var(--green-deep); font-weight: 600; }

.dd-steps { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--rule); display: flex; flex-direction: column; gap: 14px; }
.dd-steps li { position: relative; }
.dd-steps li::before { content: ''; position: absolute; left: -25px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--lc, var(--green)); border: 2px solid var(--card); box-shadow: 0 0 0 1px var(--rule); }
.dd-step-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 14px; }
.dd-step-bar { margin: 4px 0 2px; max-width: 420px; }

.dd-info { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; font-size: 13.5px; }
.dd-info dt { color: var(--ink-faint); font-size: 12px; font-weight: 600; }
.dd-info dd { margin: 0; color: var(--ink); word-break: break-word; }
.dd-info-all { grid-template-columns: 220px 1fr; margin-top: 12px; }
.dd-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13.5px; }
.dd-links a { color: var(--green-deep); }
.dd-all summary { cursor: pointer; font-weight: 600; color: var(--ink-soft); font-size: 14px; }
.dd-all[open] summary { color: var(--green-deep); }

.dd-scores { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.dd-score { border: 1px solid var(--rule); border-top: 3px solid var(--c); padding: 8px 10px; text-align: center; }
.dd-score small { display: block; font-size: 11px; color: var(--ink-faint); }
.dd-score b { font-family: 'IBM Plex Mono', monospace; font-size: 15px; }

@media (max-width: 960px) {
  .dd-layout { grid-template-columns: 1fr; }
  .dd-side { position: static; }
  .dd-info-all { grid-template-columns: 1fr; }
}
