:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #14202e; --muted: #5b6878; --line: #e2e6eb;
  --brand: #16365c; --brand-strong: #102a48; --brand-ink: #ffffff; --chip: #eef1f4; --accent: #d9771e; --accent-soft: #fdf0e3;
  --ok: #1f7a4d; --ok-soft: #e5f4ec; --warn: #a15c00; --warn-soft: #fff4e0;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 32, 48, .06), 0 4px 16px rgba(16, 32, 48, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f151c; --surface: #17202a; --ink: #e7ecf1; --muted: #9aa7b5; --line: #26323f;
    --brand: #1d4a7a; --brand-strong: #e7ecf1; --chip: #222d39; --accent: #f0974a; --accent-soft: #3a2614;
    --ok: #5cc994; --ok-soft: #12301f; --warn: #f2b45a; --warn-soft: #3a2a10;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.65 "IBM Plex Sans Thai", system-ui, sans-serif; }
a { color: var(--brand); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: #8cc0f5; } }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 .5em; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }

/* header */
.top { background: var(--brand); color: var(--brand-ink); }
.top .wrap { display: flex; align-items: center; gap: 24px; min-height: 64px; flex-wrap: wrap; }
.logo { color: #fff; font-weight: 600; line-height: 1.2; }
.logo small { display: block; font-weight: 400; opacity: .75; font-size: .78rem; }
.logo:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.nav a { color: #dbe6f2; padding: 8px 10px; border-radius: 8px; white-space: nowrap; font-size: .95rem; }
.nav a:hover, .nav a.on { background: rgba(255, 255, 255, .12); color: #fff; text-decoration: none; }
.nav .staff { margin-left: auto; color: #ffd3a8; }

/* layout */
main { padding: 40px 0 72px; }
.section { margin-top: 56px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 16px; }

/* hero: ภาพจริงจากงานวิจัยของอาจารย์ เป็นกราฟิกหลัก */
.hero { background: var(--surface); border-bottom: 1px solid var(--line); padding: 48px 0; }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 40px; align-items: center; }
.kicker { color: var(--accent); font-weight: 600; margin: 0 0 8px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); letter-spacing: -.01em; color: var(--brand-strong); }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 520px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.mosaic { display: grid; grid-template-columns: 1.2fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; height: 420px; }
.mosaic figure { margin: 0; position: relative; overflow: hidden; border-radius: 12px; background: var(--line); }
.mosaic figure:first-child { grid-row: span 2; }
.mosaic figure:nth-child(4) { display: none; }
.mosaic img { width: 100%; height: 100%; object-fit: cover; }
.mosaic figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 12px 8px; font-size: .78rem; color: #fff; background: linear-gradient(transparent, rgba(10, 20, 32, .78)); }
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .mosaic { height: 280px; }
}

/* งาน 5 เรื่องของอาจารย์ */
.tasks { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.tasks a { display: flex; gap: 12px; align-items: center; height: 100%; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); }
.tasks a:hover { border-color: var(--accent); text-decoration: none; }
.tasks b { display: block; line-height: 1.35; }
.task-icon { flex: none; width: 44px; height: 44px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }

/* แถบข้อมูลผลงาน: ส่วนเดียวที่ใช้พื้นเข้ม */
.band { margin: 56px -16px 0; padding: 36px 16px; background: var(--brand); color: #fff; border-radius: 16px; }
@media (min-width: 1192px) { .band { margin-left: 0; margin-right: 0; padding: 40px; } }
.band h2 { color: #fff; }
.band-grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: end; }
@media (max-width: 860px) { .band-grid { grid-template-columns: 1fr; } }
.figures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 24px; margin: 20px 0 12px; }
.figures div { margin: 0; }
.figures dd { margin: 0; font-size: 2rem; font-weight: 600; line-height: 1.1; }
.figures dt { color: #b9cbe0; font-size: .875rem; }
.source { color: #9fb3ca; font-size: .78rem; margin: 0; }
.bars { margin: 0; display: flex; align-items: flex-end; gap: 10px; height: 220px; }
.bar { flex: 1; height: 100%; display: flex; flex-direction: column; gap: 6px; text-align: center; }
.bar .track { flex: 1; display: flex; align-items: flex-end; padding-top: 24px; }
.bar .b { position: relative; width: 100%; background: #f0a35e; border-radius: 6px 6px 2px 2px; min-height: 4px; }
.bar .v { position: absolute; bottom: 100%; left: 0; right: 0; padding-bottom: 4px; }
.bar:last-child .b { background: #ffd2a6; }
.bar .v { font-weight: 600; font-size: .9rem; }
.bar .y { font-size: .78rem; color: #b9cbe0; }

/* กลุ่มวิจัย */
.groups { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.groups a { display: grid; grid-template-columns: 64px 1fr minmax(160px, 260px); gap: 16px; align-items: start; padding: 18px 4px; border-bottom: 1px solid var(--line); color: var(--ink); }
.groups a:hover { background: var(--surface); text-decoration: none; }
.groups .g-body { display: flex; flex-direction: column; gap: 2px; }
.groups b { font-size: 1.1rem; }
.num { font-size: 2.2rem; font-weight: 600; color: var(--accent); line-height: 1; }
@media (max-width: 700px) { .groups a { grid-template-columns: 48px 1fr; } .groups .g-people { grid-column: 2; } .num { font-size: 1.6rem; } }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chips span { font-size: .78rem; padding: 2px 10px; border-radius: 6px; background: var(--chip); color: var(--muted); }
.group-detail { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 28px 0; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.meta-list { display: grid; gap: 8px; margin: 12px 0 0; }
.meta-list dt { font-weight: 600; font-size: .875rem; }
.meta-list dd { margin: 0; color: var(--muted); }

/* งานวิจัยเด่น */
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr)); gap: 20px; }
.hl { display: grid; grid-template-columns: 180px 1fr; gap: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.hl img { width: 100%; height: 100%; max-height: 240px; object-fit: cover; border-radius: 10px; }
.hl h3 { margin-top: 8px; }
@media (max-width: 560px) { .hl { grid-template-columns: 1fr; } .hl img { max-height: 200px; } }
.card.empty { border-style: dashed; box-shadow: none; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-2 { display: grid; gap: 24px; grid-template-columns: 2fr 1fr; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
a.card { display: block; color: inherit; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); text-decoration: none; }
.card h3 { margin-bottom: 4px; }
.card .meta { color: var(--muted); font-size: .875rem; }
.card img.cover { border-radius: 10px; margin: -4px 0 12px; aspect-ratio: 16/9; object-fit: cover; width: 100%; }

.tag { display: inline-block; font-size: .78rem; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 12px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

/* process guide */
.guide-cards .icon { color: var(--accent); margin-bottom: 6px; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { position: relative; padding: 0 0 22px 52px; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; left: 0; top: 0; width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; }
.steps li::after { content: ""; position: absolute; left: 16px; top: 38px; bottom: 4px; width: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.mistake { margin-top: 8px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .92rem; }
.check label { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; align-items: flex-start; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--ok); flex: none; }
.check input:checked + span { color: var(--muted); text-decoration: line-through; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.progress div { height: 100%; background: var(--ok); width: 0; transition: width .2s; }
.dl { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.btn { display: inline-block; padding: 8px 14px; border-radius: 10px; background: var(--brand); color: #fff; font-size: .9rem; border: 0; cursor: pointer; font: inherit; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.accent { background: var(--accent); color: #fff; font-weight: 500; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .btn.ghost { color: var(--ink); } }

/* forms */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filters input, .filters select { font: inherit; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); min-width: 0; }
.filters input[type=search] { flex: 1 1 240px; }
.pills a { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line); color: var(--ink); font-size: .9rem; }
.pills a.on { background: var(--brand); color: #fff; border-color: var(--brand); }

/* people */
.person { display: flex; gap: 14px; align-items: center; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; flex: none; }
.avatar.lg { width: 112px; height: 112px; font-size: 2rem; }

/* dashboard */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .9rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; white-space: normal; min-width: 260px; }
td.auto { color: var(--ok); }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.kpi b { display: block; font-size: 1.6rem; }
.chart-box { position: relative; height: 240px; }

.footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--muted); font-size: .875rem; }
.prose { max-width: 760px; }
.prose p { white-space: pre-line; }

@media (max-width: 700px) {
  .top .wrap { gap: 4px 16px; padding-top: 10px; padding-bottom: 6px; }
  .nav { flex-basis: 100%; flex-wrap: wrap; margin: 0 -10px; }
  .nav .staff { margin-left: 0; }
}

.lang { margin-left: auto; }
.lang button { font: inherit; font-size: .85rem; padding: 4px 10px; border-radius: 6px; border: 1px solid rgba(255, 255, 255, .5); background: transparent; color: #fff; cursor: pointer; }
.lang button:hover { background: rgba(255, 255, 255, .12); }
