/* ============================================================
   yearplan.css — หน้าสรุปผลแผนปฏิบัติราชการรายปี (site/index2567-2569, views/site/_yearplan.php)
   ต่อยอดตัวแปรสีของธีม pv2 (public-theme-v2.css)
   ============================================================ */

.yp {
  --st-done: var(--st5); --st-doing: var(--st3); --st-none: var(--st0); --st-hold: var(--teal); --st-stop: var(--st1);
  --shadow: 0 1px 2px rgba(23,37,28,.04), 0 6px 18px rgba(23,37,28,.06);
}
.yp a { text-decoration: none; }
.yp-section { margin: 48px 0; }
.yp-muted { color: var(--ink-faint); }

/* ---------- หัวเรื่อง + ปี ---------- */
.yp-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--rule); }
.yp-head h1.pv2-title { margin: 10px 0 8px; max-width: 820px; }
.yp-head .pv2-lede { margin: 0; max-width: 760px; }
.yp-years { display: inline-flex; border: 1px solid var(--rule); background: var(--card); }
.yp-years a { padding: 10px 18px; font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; font-weight: 600; color: var(--ink-soft); border-left: 1px solid var(--rule); white-space: nowrap; }
.yp-years a:first-child { border-left: 0; }
.yp-years a:hover { background: var(--band); color: var(--green-deep); }
.yp-years a.active { background: var(--green-deep); color: #fff; }

.yp-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.yp-links a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; font-size: 13.5px; font-weight: 600; color: var(--green-deep); background: var(--green-tint); border: 1px solid #C7DECF; }
.yp-links a:hover { background: var(--green-deep); color: #fff; }

/* ---------- 01 KPI ---------- */
.yp-kpis { display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.yp-kpi { background: var(--card); padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px; color: inherit; border-top: 4px solid var(--c, var(--rule)); transition: background .12s; }
.yp-kpi:hover { background: var(--band); color: inherit; }
.yp-kpi.total { --c: var(--green-deep); background: var(--green-deep); }
.yp-kpi.total:hover { background: #0E301F; }
.yp-kpi.total .yp-kpi-label, .yp-kpi.total .yp-kpi-sub { color: rgba(255,255,255,.78); }
.yp-kpi.total .yp-kpi-num { color: #fff; font-size: 34px; }
.yp-kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-soft); display: flex; align-items: center; gap: 7px; }
.yp-kpi-label .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.yp-kpi-num { font-family: 'IBM Plex Mono', monospace; font-size: 28px; font-weight: 600; line-height: 1.1; color: var(--ink); }
.yp-kpi-sub { font-size: 12px; color: var(--ink-faint); }
.yp-kpi.st-done { --c: var(--st-done); } .yp-kpi.st-done .yp-kpi-num { color: var(--green); }
.yp-kpi.st-doing { --c: var(--st-doing); } .yp-kpi.st-doing .yp-kpi-num { color: var(--gold-deep); }
.yp-kpi.st-none { --c: var(--st-none); }
.yp-kpi.st-hold { --c: var(--st-hold); }
.yp-kpi.st-stop { --c: var(--st-stop); } .yp-kpi.st-stop .yp-kpi-num { color: var(--red); }

/* แถบสถานะซ้อน */
.yp-stack { display: flex; width: 100%; height: 8px; background: var(--rule-soft); overflow: hidden; }
.yp-stack i { display: block; height: 100%; min-width: 2px; }
.yp-stack-lg { margin-top: 12px; }
.yp-stack-lg .yp-stack { height: 12px; }
.yp .st-done { --c: var(--st-done); } .yp-stack i.st-done, .yp-legend i.st-done { background: var(--st-done); }
.yp-stack i.st-doing, .yp-legend i.st-doing { background: var(--st-doing); }
.yp-stack i.st-none, .yp-legend i.st-none { background: var(--st-none); }
.yp-stack i.st-hold, .yp-legend i.st-hold { background: var(--st-hold); }
.yp-stack i.st-stop, .yp-legend i.st-stop { background: var(--st-stop); }

.yp-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }
.yp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.yp-legend i { width: 12px; height: 12px; display: inline-block; }

/* ---------- 02 ยุทธศาสตร์ ---------- */
.yp-pillars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.yp-pillar { background: var(--card); border: 1px solid var(--rule); padding: 18px; display: flex; flex-direction: column; gap: 16px; color: inherit; transition: transform .12s, box-shadow .12s, border-color .12s; }
.yp-pillar:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #B7C8B2; color: inherit; }
.yp-pillar-top { display: flex; align-items: center; gap: 14px; }
.yp-pillar-top img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.yp-pillar-name { font-family: 'Taviraj', serif; font-size: 18px; font-weight: 600; color: var(--green-deep); line-height: 1.3; }
.yp-pillar-en { font-size: 12px; color: var(--ink-faint); letter-spacing: .02em; }
.yp-pillar-figs { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rule-soft); padding-top: 12px; }
.yp-pillar-figs div { display: flex; flex-direction: column; gap: 2px; }
.yp-pillar-figs div + div { padding-left: 12px; border-left: 1px solid var(--rule-soft); }
.yp-pillar-figs b { font-family: 'IBM Plex Mono', monospace; font-size: 17px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.yp-pillar-figs span { font-size: 11.5px; color: var(--ink-faint); }

.yp-panel { background: var(--card); border: 1px solid var(--rule); padding: 16px 16px 8px; margin-top: 24px; }
.yp-panel-head { font-size: 14px; font-weight: 600; color: var(--ink-soft); margin-bottom: 6px; }

/* ---------- 03 เป้าหมาย KR ---------- */
.yp-kr-bar { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.yp-kr-summary { display: flex; flex-wrap: wrap; border: 1px solid var(--rule); background: var(--card); }
.yp-kr-summary div { padding: 10px 18px; display: flex; align-items: baseline; gap: 8px; }
.yp-kr-summary div + div { border-left: 1px solid var(--rule); }
.yp-kr-summary b { font-family: 'IBM Plex Mono', monospace; font-size: 20px; color: var(--green-deep); }
.yp-kr-summary span { font-size: 12.5px; color: var(--ink-soft); }

.yp-tabs { display: inline-flex; border: 1px solid var(--rule); background: var(--card); }
.yp-tabs button { border: 0; background: none; padding: 9px 18px; font-family: 'Sarabun', sans-serif; font-size: 14px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }
.yp-tabs button + button { border-left: 1px solid var(--rule); }
.yp-tabs button:hover { background: var(--band); }
.yp-tabs button.active { background: var(--green-deep); color: #fff; }
.yp-tabs button small { font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; opacity: .75; margin-left: 4px; }

.yp-krs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.yp-kr { --lv: var(--st0); background: var(--card); border: 1px solid var(--rule); display: flex; flex-direction: column; color: inherit; overflow: hidden; transition: transform .12s, box-shadow .12s; }
.yp-kr:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: inherit; }
.yp-kr.l5 { --lv: var(--st5); } .yp-kr.l4 { --lv: var(--st4); } .yp-kr.l3 { --lv: var(--st3); } .yp-kr.l2 { --lv: var(--st2); }
.yp-kr img { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-bottom: 1px solid var(--rule-soft); }
.yp-kr-body { padding: 14px 14px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; border-top: 3px solid var(--lv); }
.yp-kr-name { font-size: 14.5px; font-weight: 600; color: var(--ink); line-height: 1.45; flex: 1; }
.yp-kr-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-faint); }
.yp-kr-progress { display: flex; align-items: center; gap: 10px; }
.yp-kr-progress b { font-family: 'IBM Plex Mono', monospace; font-size: 14px; color: var(--ink); min-width: 70px; text-align: right; }
.yp-meter { flex: 1; height: 8px; background: var(--rule-soft); }
.yp-meter i { display: block; height: 100%; background: var(--lv); }
.yp-tag { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; background: var(--gold-tint); color: var(--gold-deep); border: 1px solid #E3D2AC; white-space: nowrap; }

/* ตาราง */
.yp-table { min-width: 820px; }
.yp-table th.r, .yp-table td.mono { text-align: right; white-space: nowrap; }
.yp-table td.mono, .yp-table td.mono-l { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; }
.yp-table td.mono-l { color: var(--ink-faint); }
.yp-table td a { color: var(--green-deep); font-weight: 600; }
.yp-table td a:hover { text-decoration: underline; }
.yp-table tfoot td { text-align: right; }
.yp-pct { display: inline-block; min-width: 64px; padding: 2px 8px; text-align: right; font-weight: 600; background: var(--st0-bg, #EEEDE7); }
.yp-pct.l5 { background: var(--st5-bg); color: #0F5A2B; } .yp-pct.l4 { background: var(--st4-bg); }
.yp-pct.l3 { background: var(--st3-bg); } .yp-pct.l2 { background: var(--st2-bg); } .yp-pct.l1 { background: #EEEDE7; color: var(--ink-faint); }

/* ---------- 04 หน่วยงาน ---------- */
.pv2 input[type=search].yp-search { width: 280px; max-width: 100%; flex: 0 0 auto; padding: 9px 12px; border: 1px solid var(--rule); background: var(--card); font-family: 'Sarabun', sans-serif; font-size: 14px; color: var(--ink); }
.pv2 .yp-search:focus { outline: 2px solid var(--green); outline-offset: -1px; }
.yp-dept { display: inline-flex; align-items: center; gap: 10px; }
.yp-dept img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: var(--band); }
.yp-deptgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.yp-dept.card { display: flex; flex-direction: row; padding: 10px 12px; border: 1px solid var(--rule); background: var(--card); color: var(--green-deep); font-size: 14px; font-weight: 600; line-height: 1.35; }
.yp-dept.card:hover { background: var(--green-tint); border-color: #B7C8B2; }
.yp-deptgrid [hidden], .yp-table tr[hidden] { display: none; }
.yp-empty { padding: 20px; text-align: center; color: var(--ink-faint); border: 1px dashed var(--rule); margin-top: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .yp-kpis { grid-template-columns: repeat(3, 1fr); }
  .yp-kpi.total { grid-column: 1 / -1; }
  .yp-kpi:last-child { grid-column: span 2; }
  .yp-krs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .yp-pillars { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .yp-krs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .yp-head { align-items: flex-start; }
}
@media (max-width: 560px) {
  .yp-kpis { grid-template-columns: repeat(2, 1fr); }
  .yp-kpi:last-child { grid-column: 1 / -1; }
  .yp-pillars, .yp-krs { grid-template-columns: 1fr; }
  .yp-kr-summary div + div { border-left: 0; }
  .yp-years { width: 100%; } .yp-years a { flex: 1; text-align: center; padding: 10px 6px; }
  .pv2 input[type=search].yp-search { width: 100%; }
}
