/* ==========================================================================
   ชมรมจริยธรรม (Anticorruption) - สไตล์เฉพาะหน้า (ชุดเดียวกับหน้า HS4 / ITA)
   ทุก class ขึ้นต้นด้วย ac- เพื่อไม่ชนกับ header_footer/assets/css/style.css
   ต่างจาก HS4: ชื่อหัวข้อเป็นประโยคยาว จึงขึ้นบรรทัดใหม่แทนการตัดเป็น …, มีหัวข้อแบบเอกสารเดี่ยว (.ac-doc)
   ========================================================================== */

.ac-main,
.ac-login-body {
  --ac-green-900: #1b5e20;
  --ac-green-700: #2e7d32;
  --ac-green-400: #66bb6a;
  --ac-green-100: #e8f5e9;
  --ac-green-50: #f5faf6;
  --ac-border: #e3ebe5;
  --ac-border-strong: #cfe0d3;
  --ac-text: #24423a;
  --ac-text-soft: #334e45;
  --ac-muted: #5a6f64;
  --ac-faint: #8f9c97;
  --ac-red: #c62828;
  --ac-red-bg: #ffebee;
  --ac-red-border: #ffcdd2;
  --ac-radius: 14px;
  --ac-font: 'Sarabun', 'Prompt', Tahoma, sans-serif;
}

.ac-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 20px 48px;
  color: var(--ac-text);
  font-family: var(--ac-font);
}

.ac-main [hidden] {
  display: none !important;
}

/* ---------- กรอบหัวเรื่อง (เหมือน HS4) ---------- */
.ac-hero {
  position: relative;
  overflow: hidden;
  padding: 42px 30px;
  border-radius: 18px 18px 0 0;
  background: linear-gradient(135deg, var(--ac-green-900) 0%, var(--ac-green-700) 60%, var(--ac-green-400) 100%);
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 15px rgba(27, 94, 32, 0.18);
}

.ac-hero::before {
  content: "";
  position: absolute;
  top: -55px;
  right: -55px;
  width: 210px;
  height: 210px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
}

.ac-hero::after {
  content: "";
  position: absolute;
  bottom: -70px;
  left: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
}

.ac-hero-title {
  position: relative;
  z-index: 1;
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1.4;
  text-shadow: 1px 1px 4px rgba(0, 0, 0, 0.22);
}

.ac-hero-sub {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  font-size: 1.05rem;
  line-height: 1.6;
  opacity: 0.95;
}

.ac-hero-org {
  position: relative;
  z-index: 1;
  display: inline-block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.28);
  font-size: 1.35rem;
}

.ac-panel {
  padding: 26px 28px 32px;
  border: 1px solid #e7ece8;
  border-top: none;
  border-radius: 0 0 18px 18px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

/* ---------- แถบปีงบประมาณ + ปุ่มเข้าสู่ระบบ ---------- */
.ac-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.ac-years {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ac-years-label {
  margin-right: 4px;
  color: var(--ac-muted);
  font-weight: 700;
}

/* ทุกปีเป็นสีเขียวเข้มเหมือนกัน ปีที่เปิดอยู่มีวงแหวนรอบปุ่ม */
.ac-year {
  padding: 9px 18px;
  border: 1px solid var(--ac-green-700);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ac-green-900) 0%, var(--ac-green-700) 100%);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(46, 125, 50, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ac-year:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(46, 125, 50, 0.26);
}

.ac-year.is-active {
  box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--ac-green-400), 0 4px 10px rgba(46, 125, 50, 0.18);
}

.ac-login-link {
  flex: none;
  display: inline-flex;
  margin-left: auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--ac-green-700), #43a047);
  box-shadow: 0 3px 8px rgba(46, 125, 50, 0.25);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.ac-login-link:hover {
  background: linear-gradient(135deg, var(--ac-green-900), var(--ac-green-700));
  box-shadow: 0 5px 14px rgba(46, 125, 50, 0.35);
  color: #fff;
  transform: translateY(-1px);
}

.ac-login-link svg {
  width: 16px;
  height: 16px;
}

/* ---------- ปุ่ม ---------- */
.ac-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

.ac-btn:hover {
  transform: translateY(-1px);
}

.ac-btn:focus-visible,
.ac-link-btn:focus-visible,
.ac-handle:focus-visible,
.ac-group-head:focus-visible {
  outline: 3px solid rgba(46, 125, 50, 0.35);
  outline-offset: 2px;
}

.ac-btn[disabled] {
  opacity: 0.65;
  cursor: progress;
  transform: none;
}

.ac-btn-primary {
  background: linear-gradient(135deg, var(--ac-green-900) 0%, var(--ac-green-700) 100%);
  color: #fff;
  box-shadow: 0 4px 10px rgba(46, 125, 50, 0.18);
}

.ac-btn-primary:hover {
  box-shadow: 0 6px 14px rgba(46, 125, 50, 0.24);
}

.ac-btn-light {
  border-color: var(--ac-border-strong);
  background: #f2f6f3;
  color: var(--ac-green-900);
}

.ac-btn-light:hover {
  background: #e5efe7;
}

.ac-btn-danger {
  border-color: var(--ac-red-border);
  background: var(--ac-red-bg);
  color: var(--ac-red);
}

.ac-btn-danger:hover {
  background: #ffdde2;
}

.ac-btn-sm {
  padding: 5px 12px;
  font-size: 0.84rem;
}

.ac-btn-lg {
  padding: 11px 26px;
  border-radius: 10px;
  font-size: 0.98rem;
}

.ac-btn-block {
  width: 100%;
}

.ac-link-btn {
  padding: 4px 6px;
  border: none;
  background: none;
  color: var(--ac-green-700);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.ac-link-btn:hover {
  text-decoration: underline;
}

.ac-inline-form {
  display: inline-flex;
  margin: 0;
}

/* ---------- ข้อความแจ้งผล ---------- */
.ac-flash {
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 12px;
  font-weight: 700;
  transition: opacity 0.6s ease;
}

.ac-flash-ok {
  border-color: #cfe6d2;
  background: linear-gradient(180deg, #edf8ef 0%, #e7f4e9 100%);
  color: var(--ac-green-900);
}

.ac-flash-error {
  border-color: #ffcccc;
  background: linear-gradient(180deg, #fff0f0 0%, #ffe5e5 100%);
  color: var(--ac-red);
}

/* ---------- ส่วนเจ้าหน้าที่ ---------- */
.ac-staff {
  margin-bottom: 24px;
  padding: 20px 22px;
  border: 1px solid var(--ac-border);
  border-left: 6px solid var(--ac-green-700);
  border-radius: var(--ac-radius);
  background: var(--ac-green-50);
}

.ac-staff-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ac-staff-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--ac-green-900);
  font-size: 1.1rem;
}

.ac-staff-badge {
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ac-green-100);
  color: var(--ac-green-700);
  font-size: 0.78rem;
  font-weight: 700;
}

.ac-staff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ac-add-form {
  display: grid;
  grid-template-columns: minmax(200px, 340px) 1fr auto;
  align-items: end;
  gap: 14px;
}

.ac-add-form .ac-field-title {
  grid-column: 2 / 4;
}

.ac-add-form .ac-field-file {
  grid-column: 1 / 3;
}

.ac-staff > .ac-field-help {
  margin: 10px 0 0;
}

.ac-field-help {
  margin: -4px 0 0;
  color: var(--ac-muted);
  font-size: 0.85rem;
}

.ac-dialog [data-file-fields] {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ac-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.ac-field > span {
  color: #234438;
  font-size: 0.94rem;
  font-weight: 700;
}

.ac-field input[type="text"],
.ac-field input[type="url"],
.ac-field input[type="number"],
.ac-field input[type="password"],
.ac-field input[type="file"],
.ac-field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--ac-border-strong);
  border-radius: 10px;
  background: #fbfdfb;
  color: var(--ac-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.ac-field input:focus,
.ac-field select:focus {
  outline: none;
  border-color: var(--ac-green-700);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.ac-drop input[type="file"] {
  padding: 12px;
  border-style: dashed;
  border-width: 2px;
  background: #fff;
  cursor: pointer;
}

.ac-drop.is-dragover input[type="file"] {
  border-color: var(--ac-green-700);
  background: var(--ac-green-100);
}

.ac-check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.93rem;
  cursor: pointer;
}

.ac-check input {
  margin-top: 5px;
  accent-color: var(--ac-green-700);
}

/* ---------- แถบค้นหา (เหมือน HS4 / ITA) ---------- */
.ac-listbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ac-search {
  position: relative;
  display: flex;
  flex: 1 1 280px;
  align-items: center;
  max-width: 460px;
  padding: 4px 4px 4px 14px;
  border: 1px solid var(--ac-border-strong);
  border-radius: 999px;
  background: #fbfdfb;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.ac-search:focus-within {
  border-color: var(--ac-green-700);
  box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.12);
}

.ac-search-btn {
  flex: none;
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: var(--ac-green-700);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.ac-search-btn:hover {
  background: var(--ac-green-900);
}

.ac-search svg {
  flex: none;
  margin-right: 10px;
  width: 18px;
  height: 18px;
  color: var(--ac-green-700);
}

.ac-search input {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  border: none;
  background: transparent;
  color: var(--ac-text);
  font-family: inherit;
  font-size: 0.95rem;
}

.ac-search input:focus {
  outline: none;
}

.ac-search input::-webkit-search-cancel-button {
  display: none;
}

/* ---------- หัวข้อ (พับ/ขยาย) และหัวข้อแบบเอกสารเดี่ยว ---------- */
.ac-groups {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ac-group,
.ac-doc {
  border: 1px solid var(--ac-border);
  border-radius: var(--ac-radius);
  background: #fff;
  box-shadow: 0 2px 8px rgba(27, 94, 32, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.ac-group[open] {
  border-color: var(--ac-border-strong);
  box-shadow: 0 6px 18px rgba(27, 94, 32, 0.07);
}

.ac-group-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--ac-radius);
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.ac-group-head::-webkit-details-marker {
  display: none;
}

.ac-group-head:hover {
  background: var(--ac-green-50);
}

.ac-group[open] > .ac-group-head {
  border-bottom: 1px solid #edf2ee;
  border-radius: var(--ac-radius) var(--ac-radius) 0 0;
  background: #f8fbf8;
}

.ac-group-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--ac-green-700);
  color: #fff;
}

.ac-group-icon svg {
  width: 17px;
  height: 17px;
}

/* ชื่อหัวข้อเป็นประโยคยาว: ขึ้นบรรทัดใหม่ได้ (HS4 ตัดเป็น … เพราะชื่อด้านสั้น) */
.ac-group-name {
  flex: 1;
  min-width: 0;
  color: var(--ac-text);
  font-size: 1.02rem;
  line-height: 1.55;
  word-break: break-word;
}

.ac-group-name strong {
  margin-right: 2px;
  color: var(--ac-green-900);
}

.ac-count {
  flex: none;
  min-width: 32px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--ac-green-100);
  color: var(--ac-green-900);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
}

.ac-count.is-zero {
  background: #f0f2f1;
  color: var(--ac-faint);
}

/* ครบทุกข้อในหัวข้อ */
.ac-count.is-full {
  background: var(--ac-green-700);
  color: #fff;
}

.ac-chevron {
  display: inline-flex;
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--ac-faint);
  transition: transform 0.25s ease;
}

.ac-group[open] .ac-chevron {
  transform: rotate(180deg);
}

.ac-group-body {
  padding: 12px 20px 18px;
}

.ac-group-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px dashed #dfeae1;
}

/* หัวข้อแบบเอกสารเดี่ยว: แถวเดียว ไอคอน PDF แทนไอคอนโฟลเดอร์ กดชื่อเพื่อเปิดไฟล์ */
.ac-doc {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
}

.ac-doc:hover {
  border-color: var(--ac-border-strong);
  background: var(--ac-green-50);
}

.ac-doc-icon {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}

.ac-doc-icon .ac-pdf {
  width: 30px;
  height: 30px;
  margin: 0;
}

.ac-doc .ac-item-main {
  align-items: center;
}

.ac-doc .ac-item-title {
  flex: 1;
  color: var(--ac-text);
  font-size: 1.02rem;
  line-height: 1.55;
}

.ac-doc .ac-item-title strong {
  color: var(--ac-green-900);
}

.ac-doc.is-empty .ac-pdf {
  opacity: 0.35;
  filter: grayscale(1);
}

/* ---------- รายการเอกสาร ---------- */
.ac-items {
  margin: 0 0 0 17px;
  padding: 0 0 0 12px;
  border-left: 2px solid #e1ece2;
  list-style: none;
}

.ac-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  transition: background-color 0.15s ease;
}

.ac-item:hover {
  background: var(--ac-green-50);
}

/* ข้อใต้หัวข้อย่อย (เช่น ภาพกิจกรรม… ใต้ 8.1) เยื้องเข้าไป */
.ac-item.is-sub {
  margin-left: 26px;
}

.ac-pdf {
  flex: none;
  width: 24px;
  height: 24px;
  margin-top: 2px;
}

/* เอกสารที่เป็นลิงก์ (ไม่ใช่ไฟล์ PDF) เช่น คลิปวิดีโอ */
.ac-weblink {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-radius: 6px;
  background: var(--ac-green-700);
  color: #fff;
}

.ac-weblink svg {
  width: 14px;
  height: 14px;
}

.ac-doc-icon .ac-weblink {
  width: 30px;
  height: 30px;
  margin: 0;
}

.ac-doc-icon .ac-weblink svg {
  width: 17px;
  height: 17px;
}

.ac-item-main {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

/* ชื่อเอกสารเป็นประโยคยาว ให้ขึ้นบรรทัดใหม่ได้แทนการตัดเป็น … */
.ac-item-title {
  flex: 1;
  min-width: 0;
  color: var(--ac-text-soft);
  line-height: 1.65;
  word-break: break-word;
}

/* หัวข้อย่อย เช่น "8.1 เข้าร่วมโครงการสัมมนาตลาดนัดคุณธรรม…" */
.ac-item.ac-heading {
  margin-top: 8px;
  padding-top: 9px;
  padding-bottom: 5px;
}

.ac-item.ac-heading:first-child {
  margin-top: 0;
}

.ac-item.ac-heading:hover {
  background: none;
}

.ac-heading-title {
  color: var(--ac-green-900);
  font-weight: 700;
  line-height: 1.5;
}

/* ปุ่มคัดลอกลิงก์ */
.ac-copy {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--ac-border);
  border-radius: 8px;
  background: #fff;
  color: var(--ac-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.ac-copy:hover,
.ac-copy:focus-visible {
  border-color: var(--ac-green-700);
  color: var(--ac-green-700);
  outline: none;
}

.ac-copy svg {
  width: 15px;
  height: 15px;
}

.ac-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 1000;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ac-green-900);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
}

a.ac-item-title:hover {
  color: var(--ac-green-700);
  text-decoration: underline;
}

/* ข้อที่ยังไม่มีไฟล์: ไอคอนเป็นสีเทา */
.ac-item.is-empty .ac-pdf {
  opacity: 0.35;
  filter: grayscale(1);
}

.ac-item-title.is-missing {
  color: var(--ac-muted);
}

.ac-item-meta {
  flex: none;
  color: var(--ac-faint);
  font-size: 0.8rem;
  white-space: nowrap;
}

.ac-item-meta.is-missing {
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff4e5;
  color: #a15c00;
}

.ac-item-actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 6px;
}

.ac-empty-group {
  margin: 4px 0 0;
  color: var(--ac-faint);
  font-size: 0.92rem;
}

.ac-empty {
  padding: 40px 16px;
  color: var(--ac-muted);
  text-align: center;
}

.ac-empty svg {
  width: 44px;
  height: 44px;
  margin-bottom: 8px;
  color: var(--ac-border-strong);
}

.ac-item.is-highlight,
.ac-group.is-highlight,
.ac-doc.is-highlight {
  animation: acGlow 2.6s ease;
}

@keyframes acGlow {
  0% { box-shadow: inset 0 0 0 9999px rgba(46, 125, 50, 0.16); }
  100% { box-shadow: inset 0 0 0 9999px rgba(46, 125, 50, 0); }
}

/* ---------- ลากจัดลำดับ ---------- */
.ac-handle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--ac-faint);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.ac-handle:hover {
  background: var(--ac-green-100);
  color: var(--ac-green-700);
}

.ac-handle svg {
  width: 16px;
  height: 16px;
}

.is-dragging {
  position: relative;
  z-index: 2;
  background: #fff !important;
  box-shadow: 0 8px 24px rgba(27, 94, 32, 0.18);
}

.is-sorting,
.is-sorting * {
  cursor: grabbing !important;
  user-select: none;
}

.ac-order-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0;
  padding: 10px 14px;
  border: 1px solid #ffe08a;
  border-radius: 12px;
  background: #fffbea;
  color: #7a5b00;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
}

.ac-order-actions {
  display: flex;
  gap: 8px;
}

/* ---------- กล่องแก้ไข (dialog) ---------- */
.ac-dialog {
  width: min(580px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: auto; /* style.css กลางตั้ง * { margin: 0 } ทำให้ dialog ไม่อยู่กลางจอ */
  padding: 0;
  border: none;
  border-radius: 16px;
  color: var(--ac-text);
  font-family: var(--ac-font);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
}

.ac-dialog::backdrop {
  background: rgba(15, 35, 25, 0.45);
}

.ac-dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 24px;
}

.ac-dialog h3 {
  margin: 0;
  color: var(--ac-green-900);
  font-size: 1.15rem;
}

.ac-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}

/* ---------- หน้า login ---------- */
.ac-login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  padding: 20px;
  background: #f4f6f5;
  color: var(--ac-text);
  font-family: var(--ac-font);
}

.ac-login-body *,
.ac-login-body *::before,
.ac-login-body *::after {
  box-sizing: border-box;
}

.ac-login {
  width: 100%;
  max-width: 400px;
  overflow: hidden;
  border: 1px solid var(--ac-border);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}

.ac-login-head {
  padding: 26px 24px 22px;
  background: linear-gradient(135deg, var(--ac-green-900) 0%, var(--ac-green-700) 60%, var(--ac-green-400) 100%);
  color: #fff;
  text-align: center;
}

.ac-login-head .ac-login-badge {
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
}

.ac-login-head h1 {
  margin: 6px 0 0;
  font-size: 1.08rem;
  font-weight: 600;
}

.ac-login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.ac-login-note {
  margin: 0;
  color: var(--ac-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.ac-login-error {
  padding: 10px 12px;
  border: 1px solid var(--ac-red-border);
  border-radius: 10px;
  background: var(--ac-red-bg);
  color: var(--ac-red);
  font-weight: 700;
}

.ac-pwd {
  position: relative;
}

.ac-pwd input {
  padding-right: 64px !important;
}

.ac-pwd button {
  position: absolute;
  top: 50%;
  right: 6px;
  padding: 4px 10px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ac-muted);
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transform: translateY(-50%);
}

.ac-pwd button:hover {
  background: var(--ac-green-100);
}

.ac-caps {
  margin: -6px 0 0;
  color: var(--ac-red);
  font-size: 0.85rem;
  font-weight: 700;
}

.ac-login-back {
  display: block;
  padding: 0 24px 22px;
  color: var(--ac-muted);
  font-size: 0.9rem;
  text-align: center;
  text-decoration: none;
}

.ac-login-back:hover {
  color: var(--ac-green-900);
}

/* ---------- มือถือ / แท็บเล็ต ---------- */
@media (max-width: 768px) {
  .ac-main {
    padding: 12px 12px 110px; /* เผื่อแถบเมนูล่างของ footer กลาง */
  }

  .ac-hero {
    padding: 30px 18px;
  }

  .ac-hero-title {
    font-size: 2rem;
  }

  .ac-hero-sub {
    font-size: 0.92rem;
  }

  .ac-hero-org {
    font-size: 1.05rem;
  }

  .ac-panel {
    padding: 16px;
  }

  .ac-staff {
    padding: 16px;
  }

  .ac-add-form {
    grid-template-columns: 1fr;
  }

  .ac-add-form .ac-field-title,
  .ac-add-form .ac-field-file {
    grid-column: auto;
  }

  .ac-group-head {
    gap: 10px;
    padding: 14px;
  }

  .ac-group-icon {
    width: 32px;
    height: 32px;
  }

  .ac-group-name,
  .ac-doc .ac-item-title {
    font-size: 0.97rem;
  }

  .ac-group-body {
    padding: 10px 10px 14px;
  }

  .ac-doc {
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
  }

  .ac-doc-icon {
    width: 32px;
    height: 32px;
  }

  .ac-doc .ac-item-main {
    flex-basis: calc(100% - 46px);
    flex-wrap: wrap;
    gap: 2px 10px;
  }

  .ac-items {
    margin-left: 4px;
    padding-left: 6px;
  }

  .ac-item.is-sub {
    margin-left: 14px;
  }

  .ac-item-main {
    flex-wrap: wrap;
    gap: 2px 10px;
  }

  .ac-item {
    flex-wrap: wrap;
    padding: 8px 6px;
  }

  .ac-item-actions {
    justify-content: flex-end;
    width: 100%;
  }

  .ac-search input {
    font-size: 16px; /* iOS ไม่ซูมเข้าเองตอนแตะช่องค้นหา */
  }

  .ac-order-bar {
    bottom: 90px;
  }

  .ac-toast {
    bottom: 100px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ac-chevron,
  .ac-btn,
  .ac-year,
  .ac-login-link {
    transition: none;
  }
}

/* กรอบเขียวหัวเรื่อง: ความสูงเท่ากันทุกหน้า (ใช้ของชมรมจริยธรรมซึ่งหัวเรื่องยาวที่สุดเป็นมาตรฐาน) หัวเรื่องอยู่กลางกรอบ */
.ac-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 257px;
}

@media (max-width: 768px) {
  .ac-hero {
    min-height: 225px;
  }
}

/* มือถือ: ปุ่มปีงบประมาณ เป็นแถวเดียว เลื่อนซ้าย-ขวาด้วยนิ้ว (จอคอมคงเดิม) เว้นขอบให้วงแหวนปุ่มที่เลือกไม่ถูกตัด */
@media (max-width: 768px) {
  .ac-years {
    flex: 1 1 100%;
    min-width: 0;
  }

  .ac-years {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 8px 6px;
    margin: -8px -6px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .ac-years::-webkit-scrollbar {
    display: none;
  }

  .ac-years > * {
    flex: none;
    white-space: nowrap;
  }
}
