@font-face {
  font-family: Sarabun;
  src: url("dist/fonts/Sarabun-Regular.ttf");
}
* {
  box-sizing: border-box;
}
:root {
  --canvas: #eef6fa;
  --surface: #fff;
  --soft: #f5f9fb;
  --ink: #0b3154;
  --muted: #5f7488;
  --navy: #064c78;
  --teal: #008f91;
  --teal-dark: #00797d;
  --blue: #1876d2;
  --line: #dce9f0;
  --success: #079b78;
  --warning: #ed932d;
  --shadow: 0 8px 24px rgba(20, 63, 86, 0.11);
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font:
    16px/1.55 Sarabun,
    system-ui,
    sans-serif;
}
.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 100;
  background: #fff;
  padding: 0.7rem 1rem;
}
.skip-link:focus {
  top: 1rem;
}
.topbar {
  height: 66px;
  padding: 0 max(4%, calc((100% - 1450px) / 2));
  display: flex;
  align-items: center;
  gap: 30px;
  background: #fff;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.brand img {
  width: 48px;
  height: 48px;
}
.brand span {
  display: grid;
  line-height: 1.15;
}
.brand strong {
  font-size: 20px;
}
.brand small {
  font-size: 11px;
  color: var(--muted);
}
.topbar nav {
  display: flex;
  justify-content: center;
  gap: 25px;
  flex: 1;
}
.topbar nav a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
  padding: 20px 3px;
}
.topbar nav a.active {
  color: var(--teal);
  border-bottom: 3px solid var(--teal);
}
.login,
.primary-button {
  border: 0;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  font: 600 15px Sarabun;
  padding: 11px 18px;
  cursor: pointer;
}
.hero {
  height: 260px;
  color: #fff;
  background-image:
    linear-gradient(90deg, rgba(0, 47, 77, 0.76), rgba(0, 56, 80, 0.12)),
    url("admin/assets/nong-khai-river-header.png");
  background-position: center;
  background-size: cover;
}
.hero-content {
  width: min(1450px, 90%);
  margin: auto;
  padding-top: 35px;
}
.hero h1 {
  font-size: 40px;
  line-height: 1.2;
  margin: 0 0 8px;
  text-shadow: 0 2px 14px #052a43;
}
.hero p {
  font-size: 18px;
  margin: 0 0 20px;
}
.principles {
  display: flex;
  gap: 28px;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  padding-top: 12px;
  width: max-content;
}
.principles span {
  display: flex;
  align-items: center;
  gap: 7px;
}
.principles i {
  font-size: 22px;
  color: #8de2e1;
}
main {
  width: min(1450px, 94%);
  margin: -28px auto 36px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}
.stats article {
  min-height: 90px;
  padding: 17px 20px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 16px;
}
.stats article > i {
  width: 54px;
  height: 54px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #e4f2ff;
  color: #2788e7;
  font-size: 29px;
}
.stats article:nth-child(2) > i {
  background: #e1f8ef;
  color: #079b78;
}
.stats article:nth-child(3) > i {
  background: #ececff;
  color: #6469e7;
}
.stats article:nth-child(4) > i {
  background: #ffebf4;
  color: #d8477e;
}
.stats strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}
.stats span {
  font-size: 14px;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr) 250px;
  gap: 16px;
  align-items: start;
}
.panel,
.year-filter {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(20, 63, 86, 0.07);
}
.panel {
  padding: 18px;
}
.panel-title,
.meeting-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.panel h2,
.panel h3 {
  margin: 0;
}
.panel h2 {
  font-size: 22px;
}
.panel h3 {
  font-size: 18px;
}
.timeline {
  border-left: 3px solid #55a7ef;
  margin: 17px 0 17px 12px;
  padding-left: 17px;
}
.timeline-item {
  position: relative;
  padding: 10px 10px 10px 12px;
  border-radius: 9px;
  margin-bottom: 6px;
  cursor: pointer;
}
.timeline-item:before {
  content: "";
  position: absolute;
  left: -27px;
  top: 19px;
  width: 11px;
  height: 11px;
  border: 4px solid #2889e3;
  background: #fff;
  border-radius: 50%;
}
.timeline-item.active {
  background: #e8f7fa;
}
.timeline-item button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  width: 100%;
  cursor: pointer;
}
.timeline-item strong {
  display: block;
}
.timeline-item small {
  color: var(--muted);
}
.timeline-item .mini-status {
  float: right;
  background: #dff7ef;
  color: #087a65;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
}
.soft-button {
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #e4f3fb;
  color: #11679c;
  font: 600 15px Sarabun;
  padding: 11px;
  cursor: pointer;
}
.province-card {
  height: 118px;
  border-radius: 12px;
  margin-top: 14px;
  padding: 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: end;
  background:
    linear-gradient(90deg, rgba(0, 53, 83, 0.8), transparent),
    url("admin/assets/nong-khai-river-header.png") center/cover;
}
.province-card strong {
  font-size: 21px;
  line-height: 1.25;
}
.province-card span {
  font-size: 12px;
}
.public-card {
  margin-top: 12px;
  padding: 17px;
  background: linear-gradient(120deg, #07557d, #00a187);
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 12px;
}
.public-card > i:first-child {
  font-size: 34px;
}
.public-card span {
  display: grid;
  flex: 1;
}
.public-card small {
  opacity: 0.85;
}
.search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.search-box {
  height: 46px;
  flex: 1;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  display: flex;
  align-items: center;
  padding: 0 13px;
  gap: 9px;
}
.search-box i {
  color: #6d8ba1;
  font-size: 21px;
}
.search-box input {
  border: 0;
  outline: 0;
  width: 100%;
  font: 15px Sarabun;
  color: var(--ink);
}
.primary-button {
  min-width: 100px;
}
.meeting-heading {
  border-bottom: 1px solid var(--line);
  padding-bottom: 13px;
  margin-bottom: 14px;
}
.meeting-heading p,
.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
}
.status-pill,
.count-pill {
  border-radius: 16px;
  padding: 6px 10px;
  font-size: 12px;
  background: #e4f8f2;
  color: var(--success);
  white-space: nowrap;
}
.document-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 10px 0 22px;
}
.document-card {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
}
.document-card i,
.reference-item > i {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #ddecff;
  color: var(--blue);
  font-size: 18px;
}
.document-card span {
  display: grid;
  min-width: 0;
}
.document-card strong {
  line-height: 1.25;
}
.document-card small {
  color: var(--muted);
}
.section-heading {
  margin-top: 4px;
}
.project-list {
  display: grid;
  gap: 9px;
  margin-top: 12px;
}
.project-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.project-summary {
  width: 100%;
  padding: 13px;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(180px, 0.8fr) 100px;
  align-items: center;
  gap: 13px;
  border: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.project-name {
  display: flex;
  gap: 12px;
  align-items: center;
}
.project-name > i {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #e4f2ff;
  color: #2788e7;
  border-radius: 11px;
  font-size: 25px;
}
.project-name span {
  display: grid;
}
.project-name small,
.budget small {
  color: var(--muted);
}
.budget {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 13px;
}
.budget strong {
  display: block;
}
.project-count {
  text-align: center;
  font-weight: 700;
  color: var(--blue);
}
.project-detail {
  padding: 0 13px 13px;
  background: #f8fbfd;
}
.category-group {
  padding: 10px;
  border-top: 1px solid var(--line);
}
.category-group h4 {
  margin: 0 0 7px;
}
.category-documents {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.category-documents a {
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  text-decoration: none;
}
.year-filter {
  display: grid;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(145deg, #fff 45%, #f0f8fb);
}
.year-filter-label {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
}
.year-filter-label i {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #e4f5f4;
  color: var(--teal-dark);
  font-size: 18px;
}
.year-filter-control {
  position: relative;
}
.year-filter-control select {
  appearance: none;
  width: 100%;
  min-height: 46px;
  padding: 9px 40px 9px 13px;
  border: 1px solid #c8dce8;
  border-radius: 9px;
  color: var(--ink);
  font: 600 16px Sarabun, system-ui, sans-serif;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.year-filter-control select:hover {
  border-color: var(--teal);
}
.year-filter-control select:focus-visible {
  border-color: var(--teal);
  outline: 3px solid #9de1df;
  outline-offset: 2px;
}
.year-filter-control > i {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  color: var(--teal-dark);
  font-size: 23px;
  pointer-events: none;
}
.year-filter-period {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.share-panel {
  margin-top: 12px;
}
.share-panel p {
  font-weight: 600;
}
.share-panel img {
  display: block;
  width: 135px;
  height: 135px;
  margin: 10px auto;
}
.share-url {
  font-size: 11px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 9px;
}
.lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 16px;
  margin-top: 16px;
}
.preview-panel {
  min-height: 350px;
}
.preview-empty {
  height: 285px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
  gap: 6px;
}
.preview-empty i {
  font-size: 48px;
}
.preview-empty strong {
  color: var(--ink);
}
.preview-frame {
  width: 100%;
  height: 500px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.reference-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
.reference-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}
.reference-item span {
  display: grid;
  flex: 1;
}
.reference-item small {
  color: var(--muted);
}
.empty-message:empty,
.empty-message {
  color: var(--muted);
}
footer {
  min-height: 85px;
  padding: 14px max(4%, calc((100% - 1450px) / 2));
  background: #064c78;
  color: #fff;
  display: grid;
  grid-template-columns: 1.1fr 1.4fr 1fr 1fr;
  align-items: center;
  gap: 20px;
  font-size: 14px;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}
.footer-brand img {
  width: 45px;
}
.motto {
  text-align: right;
  font-style: italic;
}
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 3px solid #f0ad2d;
  outline-offset: 2px;
}
@media (max-width: 1180px) {
  .topbar nav {
    display: none;
  }
  .dashboard-grid {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .right-column {
    grid-column: 2;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .share-panel {
    margin: 0;
  }
  .lower-grid {
    grid-template-columns: 1fr 320px;
  }
  .project-summary {
    grid-template-columns: 1fr 230px 80px;
  }
}
@media (max-width: 800px) {
  .hero {
    height: 230px;
  }
  .hero h1 {
    font-size: 30px;
  }
  .principles {
    gap: 14px;
    font-size: 13px;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
  .dashboard-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }
  .right-column {
    grid-column: auto;
  }
  .left-column {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .meetings-panel {
    grid-row: span 2;
  }
  .province-card,
  .public-card {
    margin-top: 0;
  }
  .document-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  footer {
    grid-template-columns: 1fr 1fr;
  }
  .motto {
    text-align: left;
  }
}
@media (max-width: 560px) {
  .topbar {
    height: 58px;
    padding: 0 4%;
  }
  .brand img {
    width: 40px;
    height: 40px;
  }
  .brand strong {
    font-size: 17px;
  }
  .brand small,
  .login {
    font-size: 0;
  }
  .login i {
    font-size: 20px;
  }
  .hero {
    height: 240px;
  }
  .hero-content {
    padding-top: 25px;
  }
  .hero h1 {
    font-size: 25px;
  }
  .hero p {
    font-size: 15px;
  }
  .principles {
    width: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .stats {
    gap: 8px;
    margin-top: 8px;
  }
  .stats article {
    min-height: 75px;
    padding: 11px;
  }
  .stats article > i {
    width: 42px;
    height: 42px;
    font-size: 23px;
  }
  .stats strong {
    font-size: 22px;
  }
  .dashboard-grid {
    display: block;
  }
  .left-column {
    display: block;
  }
  .left-column > * {
    margin-bottom: 12px;
  }
  .search-row {
    position: sticky;
    top: 4px;
    z-index: 5;
  }
  .primary-button {
    min-width: 48px;
    font-size: 0;
  }
  .primary-button i {
    font-size: 20px;
  }
  .panel {
    padding: 14px;
  }
  .document-grid {
    grid-template-columns: 1fr;
  }
  .project-summary {
    grid-template-columns: 1fr;
  }
  .budget {
    padding-left: 60px;
  }
  .project-count {
    text-align: left;
    padding-left: 60px;
  }
  .right-column {
    display: block;
  }
  .right-column > * {
    margin-bottom: 12px;
  }
  .lower-grid {
    display: block;
  }
  .lower-grid > * {
    margin-bottom: 12px;
  }
  footer {
    grid-template-columns: 1fr;
  }
  .motto {
    text-align: left;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
.document-label {
  flex: 1;
  display: grid;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
@media (max-width: 1180px) {
  .right-column {
    grid-column: 2;
  }
}
@media (max-width: 800px) {
  .right-column {
    grid-column: auto;
  }
}

.reference-group {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}
.reference-group-toggle {
  width: 100%;
  border: 0;
  background: #f5f9fb;
  color: var(--ink);
  padding: 10px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.reference-group-toggle > i:first-child {
  color: var(--blue);
  font-size: 21px;
}
.reference-group-toggle > span {
  font-size: 12px;
  color: var(--muted);
}
.reference-group-toggle[aria-expanded="true"] > i:last-child {
  transform: rotate(180deg);
}
.reference-group-content {
  padding: 0 8px;
}
.reference-group-content .reference-item strong {
  flex: 1;
}
.reference-group-content .reference-item:last-child {
  border-bottom: 0;
}
.document-preview-loading {
  position: relative;
}
.document-preview-loading:before {
  content: "กำลังโหลดตัวอย่างเอกสาร…";
  display: block;
  padding: 9px;
  color: var(--muted);
}
.preview-help {
  margin: 8px 0 0;
  padding: 9px;
  border-radius: 7px;
  background: #fff8e7;
  color: #795a12;
  font-size: 13px;
}
.reference-group-content .reference-item strong {
  font-size: 12px;
  font-weight: 400;
}

.reference-group-toggle strong {
  font-size: 14px;
}
