:root {
  --green-900: #143d2b;
  --green-700: #1e6b45;
  --green-600: #237a4f;
  --green-500: #2c9660;
  --green-100: #e6f3ea;
  --green-50:  #f3f9f5;
  --ink: #1c2621;
  --ink-soft: #4c5a53;
  --line: #d9e6dd;
  --paper: #ffffff;
  --shadow: 0 10px 30px rgba(20, 61, 43, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Sarabun', sans-serif;
  background: var(--green-50);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, var(--green-700), var(--green-900));
  color: #fff;
}
.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.header-icon {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255,255,255,0.14);
  display: flex;
  align-items: center;
  justify-content: center;
}
.header-text h1 {
  margin: 0 0 4px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.header-text p {
  margin: 0;
  font-size: 14px;
  color: rgba(255,255,255,0.82);
}

/* ---------- Page / toolbar ---------- */
.page {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  flex: 1;
  min-width: 240px;
  max-width: 420px;
  color: var(--green-700);
}
.search-box input {
  border: none;
  outline: none;
  font-family: 'Sarabun', sans-serif;
  font-size: 15px;
  width: 100%;
  color: var(--ink);
  background: transparent;
}
.result-count {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ---------- Table ---------- */
.table-wrap {
  background: var(--paper);
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--line);
}
.activity-table {
  width: 100%;
  border-collapse: collapse;
}
.activity-table thead th {
  background: var(--green-600);
  color: #fff;
  text-align: left;
  font-weight: 600;
  font-size: 14px;
  padding: 14px 16px;
  position: sticky;
  top: 0;
}
.col-index { width: 56px; text-align: center; }
.col-thumb { width: 96px; }
.col-count { width: 72px; text-align: center; }
.col-date  { width: 150px; }

.activity-table tbody tr {
  border-top: 1px solid var(--line);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.activity-table tbody tr:hover { background: var(--green-50); }
.activity-table tbody td {
  padding: 10px 16px;
  font-size: 14.5px;
  vertical-align: middle;
}
.row-index { text-align: center; color: var(--ink-soft); }
.row-thumb img {
  width: 76px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
  border: 1px solid var(--line);
}
.row-title {
  color: var(--green-700);
  font-weight: 500;
  line-height: 1.45;
}
.activity-table tbody tr:hover .row-title { color: var(--green-900); text-decoration: underline; }
.row-count {
  text-align: center;
}
.count-badge {
  display: inline-block;
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--green-100);
  color: var(--green-700);
  font-size: 13px;
  font-weight: 600;
}
.row-date { color: var(--ink-soft); white-space: nowrap; }

.no-results {
  text-align: center;
  padding: 40px 16px;
  color: var(--ink-soft);
}

/* ---------- Footer ---------- */
.site-footer {
  text-align: center;
  padding: 28px 16px 40px;
  color: var(--ink-soft);
  font-size: 13px;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 35, 25, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 60;
}
.modal-overlay[hidden] { display: none; }
.modal-card {
  background: var(--paper);
  border-radius: 16px;
  max-width: 880px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}
.modal-head {
  background: var(--green-700);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}
.icon-btn {
  flex: none;
  background: rgba(255,255,255,0.16);
  border: none;
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.icon-btn:hover { background: rgba(255,255,255,0.28); }
.modal-meta {
  padding: 14px 20px 0;
  font-size: 13.5px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 8px;
}
.meta-dot { color: var(--line); }
.modal-desc {
  padding: 8px 20px 4px;
  margin: 0;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink);
}
.modal-grid {
  padding: 14px 20px 20px;
  overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.modal-grid img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--line);
  transition: transform 0.12s ease;
}
.modal-grid img:hover { transform: scale(1.04); }

/* ---------- Lightbox ---------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 15, 11, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}
.lightbox-overlay[hidden] { display: none; }
.lightbox-img {
  max-width: 88vw;
  max-height: 84vh;
  border-radius: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.lightbox-close, .lightbox-nav {
  position: absolute;
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.lightbox-close:hover, .lightbox-nav:hover { background: rgba(255,255,255,0.22); }
.lightbox-close { top: 20px; right: 20px; }
.lightbox-prev { left: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-next { right: 20px; top: 50%; transform: translateY(-50%); }
.lightbox-count {
  position: absolute;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  background: rgba(0,0,0,0.35);
  padding: 4px 12px;
  border-radius: 999px;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .header-inner { padding: 20px 16px; }
  .header-text h1 { font-size: 18px; }
  .page { padding: 16px; }
  .col-date { display: none; }
  .activity-table thead th, .activity-table tbody td { padding: 10px; }
  .row-thumb img { width: 56px; height: 42px; }
  .modal-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }
  .lightbox-close { top: 10px; right: 10px; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
