/* PICO Finance — picodoc
   Design tokens จาก Design System "PICO Finance" (อ้างอิงสีและขนาดจาก mof.go.th)
   แก้สีหรือฟอนต์ทั้งเว็บได้ที่ :root ที่เดียว */

:root {
  --surface: #FFFFFF;
  --surface-muted: #E6E6E6;
  --brand-soft: #E8EEF7;
  --ink: #232428;
  --ink-muted: #71767F;
  --brand: #02449B;
  --brand-alt: #3256A9;
  --on-brand: #FFFFFF;
  --line: #999999;
  --danger: #B42318;

  --font-heading: "Prompt", sans-serif;
  --font-body: "Sarabun", sans-serif;

  --space-2: 8px;
  --space-4: 16px;
  --space-6: 24px;
  --space-10: 40px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-pill: 40px;

  --container: 1200px;
  --shadow-card: 0 2px 8px rgba(35, 36, 40, .06);
  --shadow-header: 0 2px 12px rgba(35, 36, 40, .08);
  --shadow-panel: 0 8px 24px rgba(2, 68, 155, .12);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--brand); }
a:hover { color: var(--brand-alt); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-heading); font-weight: 500; margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }

.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 var(--space-4); }
@media (min-width: 768px) { .container { padding: 0 var(--space-6); } }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: var(--space-4); top: -60px; z-index: 100;
  padding: 10px 16px; background: var(--brand); color: var(--on-brand);
  border-radius: var(--radius-sm); font-family: var(--font-heading);
}
.skip-link:focus { top: var(--space-2); color: var(--on-brand); }

.icon { width: 24px; height: 24px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 48px; padding: 0 20px; border-radius: var(--radius-sm);
  font-family: var(--font-heading); font-size: 17px; font-weight: 500;
  text-decoration: none; cursor: pointer; border: 1px solid var(--brand);
}
.btn--primary { background: var(--brand); color: var(--on-brand); }
.btn--primary:hover { background: var(--brand-alt); border-color: var(--brand-alt); color: var(--on-brand); }
.btn--secondary { background: var(--surface); color: var(--brand); }
.btn--secondary:hover { background: var(--brand-soft); }

/* ---------- top bar + header ---------- */
.topbar { background: var(--brand); color: var(--on-brand); font-size: 14px; }
.topbar .container { display: flex; justify-content: space-between; align-items: center; min-height: 36px; gap: var(--space-4); }
.topbar a { color: var(--on-brand); text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.topbar__org { display: none; }
@media (min-width: 768px) { .topbar__org { display: block; } }

.site-header { position: sticky; top: 0; z-index: 50; background: var(--surface); box-shadow: var(--shadow-header); }
.site-header .container { display: flex; align-items: center; gap: var(--space-4); min-height: 64px; }
@media (min-width: 1024px) { .site-header .container { min-height: 88px; gap: 32px; } }

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; margin-right: auto; }
.brand img { width: 40px; height: 40px; }
.brand__name { display: block; white-space: nowrap; font-family: var(--font-heading); font-weight: 600; font-size: 18px; line-height: 24px; color: var(--brand); }
.brand__org { display: block; white-space: nowrap; font-size: 12px; line-height: 16px; color: var(--ink-muted); }
@media (min-width: 1024px) {
  .brand img { width: 52px; height: 52px; }
  .brand__name { font-size: 22px; line-height: 28px; }
  .brand__org { font-size: 14px; line-height: 20px; }
}

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 0; border-radius: var(--radius-sm);
  background: var(--brand); color: var(--on-brand); cursor: pointer;
}
.main-nav { display: none; }
.main-nav.is-open {
  display: block; position: absolute; left: 0; right: 0; top: 100%;
  background: var(--surface); box-shadow: var(--shadow-header); padding: var(--space-2) var(--space-4) var(--space-4);
}
.main-nav ul { display: flex; flex-direction: column; }
.main-nav a {
  display: flex; align-items: center; min-height: 48px;
  font-family: var(--font-heading); font-size: 17px; font-weight: 500; text-decoration: none;
  border-bottom: 1px dashed var(--line);
}
@media (min-width: 1280px) {
  .nav-toggle { display: none; }
  .main-nav, .main-nav.is-open { display: block; position: static; box-shadow: none; padding: 0; }
  .main-nav ul { flex-direction: row; gap: 20px; }
  .main-nav a { border-bottom: 0; min-height: 44px; white-space: nowrap; }
}

/* ---------- hero ---------- */
.hero { background: var(--brand-soft); padding: 28px 0 32px; }
.hero .container { display: grid; gap: var(--space-6); }
@media (min-width: 1024px) { .hero { padding: 56px 0; } .hero .container { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; align-items: center; } }
.hero__intro { display: flex; flex-direction: column; gap: 14px; }
.hero__eyebrow { font-family: var(--font-heading); font-weight: 500; font-size: 15px; color: var(--brand); }
.hero h1 { font-weight: 600; font-size: 30px; line-height: 42px; color: var(--ink); }
.hero__lead { font-size: 16px; line-height: 27px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: var(--space-2); }
@media (min-width: 1024px) {
  .hero__eyebrow { font-size: 17px; }
  .hero h1 { font-size: 40px; line-height: 54px; }
  .hero__lead { font-size: 18px; line-height: 30px; }
}

.check-panel {
  display: flex; flex-direction: column; gap: 12px;
  padding: 20px; border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-panel);
}
@media (min-width: 768px) { .check-panel { padding: 32px; gap: 16px; } }
.check-panel h2 { font-size: 20px; line-height: 30px; color: var(--brand); }
@media (min-width: 768px) { .check-panel h2 { font-size: 26px; line-height: 38px; } }
.check-panel__hint { font-size: 15px; line-height: 24px; color: var(--ink-muted); }
.check-panel label { font-size: 15px; font-weight: 700; }
.search-row { display: flex; flex-direction: column; gap: var(--space-2); }
@media (min-width: 560px) { .search-row { flex-direction: row; } }
.search-row input {
  flex-grow: 1; min-height: 48px; padding: 0 14px; border: 1px solid var(--ink-muted);
  border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 16px; color: var(--ink); background: var(--surface);
}
.status-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.status-chip {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; padding: 0 14px;
  border-radius: var(--radius-pill); border: 1px solid currentColor; background: var(--surface);
  font-size: 15px; font-weight: 700; text-decoration: none; color: var(--brand);
}
.status-chip::before { content: ""; width: 8px; height: 8px; border-radius: 8px; background: currentColor; }
.status-chip--danger { color: var(--danger); }
.status-chip--muted { color: var(--ink-muted); }
.status-chip:hover { background: var(--brand-soft); }

/* ---------- sections ---------- */
.section { padding: var(--space-10) 0 0; }
@media (min-width: 1024px) { .section { padding-top: 64px; } }
.section:last-of-type { padding-bottom: var(--space-10); }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); margin-bottom: var(--space-4); }
.section h2 { display: flex; align-items: center; gap: 10px; font-size: 24px; line-height: 36px; color: var(--brand); }
@media (min-width: 1024px) { .section h2 { font-size: 26px; line-height: 38px; } }
.section__lead { color: var(--ink-muted); margin: 0 0 var(--space-4); font-size: 15px; }
.more-link { font-family: var(--font-heading); font-weight: 500; font-size: 16px; text-decoration: none; white-space: nowrap; }

/* audience cards */
.audience-grid { display: grid; gap: var(--space-4); }
@media (min-width: 640px) { .audience-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .audience-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-6); } }
.audience-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px;
  border: 1px solid var(--surface-muted); border-radius: var(--radius-md); background: var(--surface); box-shadow: var(--shadow-card);
}
@media (min-width: 1024px) { .audience-card { padding: var(--space-6); } }
.audience-card__icon { width: 48px; height: 48px; border-radius: var(--radius-md); background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.audience-card__icon .icon { width: 28px; height: 28px; }
.audience-card h3 { font-size: 20px; line-height: 30px; color: var(--brand); }
.audience-card p { font-size: 15px; line-height: 24px; color: var(--ink-muted); }
.link-list li { border-top: 1px dashed var(--line); }
.link-list a { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); min-height: 44px; text-decoration: none; }

/* news + reports */
.news-reports { display: grid; gap: var(--space-10); }
@media (min-width: 1024px) { .news-reports { grid-template-columns: 2fr 1fr; gap: 48px; } }
.news-list { display: flex; flex-direction: column; gap: 18px; }
.news-item { display: flex; gap: 14px; align-items: flex-start; }
.news-item a { color: var(--ink); text-decoration: none; line-height: 26px; }
.news-item a:hover { color: var(--brand); text-decoration: underline; }
.date-tile { width: 64px; flex-shrink: 0; border-radius: var(--radius-sm); overflow: hidden; box-shadow: 0 2px 6px rgba(35, 36, 40, .12); text-align: center; }
@media (min-width: 1024px) { .date-tile { width: 72px; } }
.date-tile__year, .date-tile__body, .date-tile__day, .date-tile__month { display: block; }
.date-tile__year { background: var(--brand); color: var(--on-brand); font-size: 12px; line-height: 20px; font-weight: 700; }
.date-tile__body { background: var(--surface-muted); padding: 4px 0 6px; }
.date-tile__day { font-family: var(--font-heading); font-weight: 600; font-size: 28px; line-height: 32px; }
.date-tile__month { font-size: 12px; line-height: 16px; color: var(--ink); } /* ใช้ ink แทน ink-muted เพื่อให้ผ่าน contrast 4.5:1 บนพื้นเทา */

.report-list { display: flex; flex-direction: column; gap: 12px; }
.report-card { display: block; padding: 18px 20px; border-radius: var(--radius-md); text-decoration: none; background: var(--brand-soft); color: var(--ink); }
.report-card strong { display: block; font-family: var(--font-heading); font-weight: 500; font-size: 19px; line-height: 28px; color: var(--brand); }
.report-card span { font-size: 15px; line-height: 24px; }
.report-card--primary { background: var(--brand); color: var(--on-brand); }
.report-card--primary strong { color: var(--on-brand); }
.report-card:hover { outline: 2px solid var(--brand-alt); color: inherit; }
.report-card--primary:hover { background: var(--brand-alt); color: var(--on-brand); }

/* documents: tabs */
.tablist { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
@media (min-width: 1024px) { .tablist { flex-wrap: wrap; overflow: visible; } }
.tab {
  flex-shrink: 0; min-height: 44px; padding: 0 16px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--ink-muted); border-radius: var(--radius-sm); background: var(--surface); color: var(--brand);
  font-family: var(--font-heading); font-size: 16px; font-weight: 500;
}
.tab[aria-selected="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.tab__count { font-weight: 400; opacity: .8; }
.tabpanel { margin-top: var(--space-2); }
.tabpanel[hidden] { display: none; }
.notice { margin-top: var(--space-4); padding: 12px 16px; border-radius: var(--radius-sm); background: var(--surface-muted); font-size: 15px; line-height: 24px; }

.doc-list li { display: flex; align-items: flex-start; gap: var(--space-4); padding: var(--space-4) 0; border-bottom: 1px dashed var(--line); }
@media (min-width: 768px) { .doc-list li { align-items: center; padding: var(--space-4) var(--space-2); } }
.doc-list__icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; }
.doc-list__body { flex-grow: 1; min-width: 0; }
.doc-list__title { color: var(--ink); text-decoration: none; line-height: 24px; }
.doc-list__title:hover { color: var(--brand); text-decoration: underline; }
.doc-list__meta { margin-top: 4px; display: flex; gap: var(--space-2); align-items: center; font-size: 14px; line-height: 22px; color: var(--ink-muted); }
.badge { padding: 0 6px; border: 1px solid var(--ink-muted); border-radius: var(--radius-sm); font-size: 12px; line-height: 18px; font-weight: 700; color: var(--ink); }
.doc-list__dl {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; justify-content: center;
  padding: 0 10px; border: 1px solid var(--brand); border-radius: var(--radius-sm);
  font-family: var(--font-heading); font-size: 16px; font-weight: 500; text-decoration: none;
}
.doc-list__dl:hover { background: var(--brand-soft); }
.doc-list__dl-label { display: none; }
@media (min-width: 768px) { .doc-list__dl { padding: 0 14px; } .doc-list__dl-label { display: inline; } }

/* ---------- footer ---------- */
.site-footer { margin-top: var(--space-10); background: var(--brand); color: var(--on-brand); }
.site-footer .container { display: flex; flex-direction: column; gap: 12px; padding-top: 32px; padding-bottom: 32px; }
@media (min-width: 1024px) { .site-footer .container { flex-direction: row; align-items: center; gap: 32px; padding-top: 40px; padding-bottom: 40px; } }
.site-footer img { width: 64px; height: 64px; }
@media (min-width: 1024px) { .site-footer img { width: 88px; height: 88px; } }
.site-footer__org { flex-grow: 1; display: flex; flex-direction: column; gap: 4px; }
.site-footer__org strong { font-family: var(--font-heading); font-weight: 500; font-size: 18px; line-height: 27px; }
.site-footer__org span, .site-footer__org a { font-size: 15px; line-height: 24px; color: var(--on-brand); }
.hotline {
  display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 20px;
  border-radius: var(--radius-sm); background: var(--surface); color: var(--brand);
  font-family: var(--font-heading); font-size: 20px; font-weight: 600; text-decoration: none;
}
.hotline:hover { color: var(--brand-alt); }
@media (min-width: 1024px) {
  .hotline { flex-direction: column; gap: 0; background: none; color: var(--on-brand); padding: 0; align-items: flex-end; }
  .hotline small { font-family: var(--font-body); font-size: 15px; font-weight: 400; }
  .hotline b { font-size: 44px; line-height: 48px; }
  .hotline:hover { color: var(--on-brand); text-decoration: underline; }
  .hotline .icon { display: none; }
}

/* ---------- language switch ---------- */
.lang-switch {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--brand); border-radius: var(--radius-sm);
  font-family: var(--font-heading); font-size: 16px; font-weight: 600; text-decoration: none; white-space: nowrap;
}
.lang-switch:hover { background: var(--brand-soft); }
.main-nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--brand); text-decoration-thickness: 2px; text-underline-offset: 8px; }
.lang-note { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-2); font-size: 15px; color: var(--ink); }
.lang-note .icon { color: var(--brand); }
.badge--soft { border-color: var(--brand-soft); background: var(--brand-soft); color: var(--brand); font-weight: 400; }

/* ---------- sub-page hero ---------- */
.page-hero { background: var(--brand-soft); padding: 24px 0 32px; }
@media (min-width: 1024px) { .page-hero { padding: 32px 0 48px; } }
.page-hero h1 { font-weight: 600; font-size: 28px; line-height: 40px; color: var(--ink); max-width: 820px; }
@media (min-width: 1024px) { .page-hero h1 { font-size: 36px; line-height: 50px; } }
.page-hero__lead { margin-top: var(--space-2); font-size: 16px; line-height: 27px; max-width: 760px; }
.crumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; margin-bottom: 12px; font-size: 15px; color: var(--ink); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ---------- latest / callout panel ---------- */
.latest-panel {
  display: flex; flex-direction: column; gap: var(--space-4); padding: 20px;
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--surface-muted); box-shadow: var(--shadow-panel);
}
@media (min-width: 768px) { .latest-panel { flex-direction: row; align-items: center; justify-content: space-between; padding: 28px 32px; } }
.latest-panel__label { font-size: 14px; font-weight: 700; color: var(--brand); }
.latest-panel h2 { font-size: 24px; line-height: 36px; color: var(--ink); }
.latest-panel p { margin-top: 4px; color: var(--ink-muted); font-size: 15px; }
.latest-panel__links { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- small buttons ---------- */
.btn-sm {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 12px;
  border: 1px solid var(--brand); border-radius: var(--radius-sm); background: var(--surface);
  font-family: var(--font-heading); font-size: 15px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.btn-sm:hover { background: var(--brand-soft); }

/* ---------- report month grid ---------- */
.year-heading { font-size: 22px; line-height: 34px; color: var(--brand); margin: var(--space-6) 0 var(--space-4); }
.month-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .month-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 900px) { .month-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .month-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); } }
.month-card { padding: var(--space-4); border: 1px solid var(--surface-muted); border-radius: var(--radius-md); box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 12px; }
.month-card h3 { font-size: 19px; line-height: 28px; color: var(--ink); }
.month-card__links { display: flex; flex-wrap: wrap; gap: var(--space-2); }

/* ---------- news ---------- */
.filter-bar { display: flex; gap: var(--space-2); overflow-x: auto; padding-bottom: 4px; }
.filter-bar .tab[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.year-group[hidden] { display: none; }
.press-list { display: flex; flex-direction: column; }
.press-item { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4) 0; border-bottom: 1px dashed var(--line); }
.press-item[hidden] { display: none; }
.press-item__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.press-item__label { font-size: 14px; font-weight: 700; color: var(--brand); }
.press-item__label--fpo { color: var(--ink); }
.press-item__title { color: var(--ink); text-decoration: none; line-height: 26px; }
.press-item__title:hover { color: var(--brand); text-decoration: underline; }
.press-item__links { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: 4px; }

@media (max-width: 767px) { .crumbs [aria-current="page"], .crumbs span[aria-hidden] { display: none; } }
