/* =========================================================
   Safety CYP — Design System
   ศูนย์พิทักษ์สิทธิเสรีภาพและความปลอดภัย
   โรงเรียนเชียงยืนพิทยาคม | Adapted from AntiBully CYP UI
   ========================================================= */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Thai:wght@300;400;500;600;700&family=Sarabun:wght@400;500;600;700&display=swap');

:root {
  /* Theme: แดงเลือดหมู · เหลือง · ขาว (โทนเดียวกับ BSSMS.CYP.AC.TH) */
  --ab-primary: #760807;
  --ab-primary-2: #e0ab06;
  --ab-accent: #fdc007;
  --ab-danger: #c1121f;
  --ab-success: #2a9d8f;
  --ab-bg: #fbf7f5;
  --ab-surface: #ffffff;
  --ab-text: #2a181a;
  --ab-muted: #7a5c60;
  --ab-border: #ead6d9;
  --ab-sidebar: #5a0606;
  --ab-sidebar-2: #760807;
  --ab-shadow: 0 10px 30px rgba(118, 8, 7, .10);
  --ab-radius: 14px;
  --ab-font: 'IBM Plex Sans Thai', 'Sarabun', sans-serif;
  --ab-sidebar-w: 270px;
  /* AdminLTE-style: brand + topbar share the same header height */
  --ab-header-h: 4.35rem;
  /* aliases */
  --cyp-teal: var(--ab-primary);
  --cyp-navy: var(--ab-sidebar-2);
  --cyp-gold: var(--ab-accent);
  --cyp-maroon: var(--ab-primary);
  --cyp-cream: #fff8f0;
}

[data-theme="dark"] {
  --ab-bg: #1a0f12;
  --ab-surface: #2a161a;
  --ab-text: #f5e9eb;
  --ab-muted: #c4a0a6;
  --ab-border: #4a2a30;
  --ab-primary: #a81818;
  --ab-primary-2: #fdc007;
  --ab-sidebar: #3d0404;
  --ab-sidebar-2: #5a0606;
  --ab-shadow: 0 10px 30px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--ab-font);
  color: var(--ab-text);
  background: var(--ab-bg);
  line-height: 1.6;
}
body.page-home,
body.page-inner {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.ab-main {
  flex: 1 0 auto;
  width: 100%;
}

a { color: var(--ab-primary); text-decoration: none; }
a:hover { color: var(--ab-primary-2); }

/* Public hero */
.ab-hero {
  position: relative;
  min-height: 92vh;
  display: grid;
  align-items: end;
  color: #fff;
  background:
    linear-gradient(120deg, rgba(90,6,6,.90), rgba(118,8,7,.58)),
    radial-gradient(circle at 20% 20%, rgba(253,192,7,.28), transparent 40%),
    url('../img/hero-pattern.svg'),
    #760807;
  background-size: cover, auto, 480px, auto;
  overflow: hidden;
}
.ab-hero::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 55vw;
  height: 55vw;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(247,179,43,.25), transparent 60%);
  animation: float 8s ease-in-out infinite;
}
.ab-hero-inner {
  position: relative;
  z-index: 2;
  padding: 7rem 1.5rem 4rem;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: 2rem 2.5rem;
  align-items: end;
}
.ab-hero-copy {
  min-width: 0;
}
.ab-brand-hero {
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
  line-height: 1.1;
  animation: fadeUp .8s ease both;
}
.ab-hero h1 {
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 500;
  margin: 0 0 1rem;
  max-width: 28ch;
  animation: fadeUp .9s ease .1s both;
}
.ab-hero p {
  font-size: 1.05rem;
  max-width: 42ch;
  opacity: .92;
  animation: fadeUp 1s ease .2s both;
}
.ab-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.75rem;
  animation: fadeUp 1.1s ease .3s both;
}

/* Hero news cover slider */
.ab-hero-slider {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 520px;
  margin-left: auto;
  animation: fadeUp 1s ease .25s both;
}
.ab-hero-slider__viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .28);
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.18);
}
.ab-hero-slider__track {
  position: relative;
  width: 100%;
  height: 100%;
}
.ab-hero-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity .55s ease, visibility .55s ease;
  display: block;
  color: inherit;
  text-decoration: none;
}
.ab-hero-slide.is-active {
  opacity: 1;
  visibility: visible;
  z-index: 1;
}
.ab-hero-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ab-hero-slide__caption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 2.4rem 1rem .9rem;
  background: linear-gradient(transparent, rgba(8, 28, 40, .82));
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.35;
}
.ab-hero-slider__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.35rem;
  height: 2.35rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255,255,255,.92);
  color: #5a0606;
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,.2);
  transition: transform .15s ease, background .15s ease;
}
.ab-hero-slider__nav:hover {
  background: #fff;
  transform: translateY(-50%) scale(1.05);
}
.ab-hero-slider__nav--prev { left: .65rem; }
.ab-hero-slider__nav--next { right: .65rem; }
.ab-hero-slider__dots {
  display: flex;
  justify-content: center;
  gap: .4rem;
  margin-top: .75rem;
}
.ab-hero-slider__dot {
  width: .55rem;
  height: .55rem;
  border-radius: 999px;
  border: 0;
  padding: 0;
  background: rgba(255,255,255,.35);
  cursor: pointer;
  transition: width .2s ease, background .2s ease;
}
.ab-hero-slide__fallback {
  width: 100%;
  height: 100%;
  background:
    linear-gradient(135deg, rgba(253,192,7,.35), rgba(247,179,43,.25)),
    #5a0606;
}

.btn-ab {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  border: 0;
  border-radius: 999px;
  padding: .85rem 1.4rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}
.btn-ab-primary { background: var(--ab-accent); color: #1b2838 !important; }
.btn-ab-primary:hover,
.btn-ab-primary:focus,
.btn-ab-primary.active {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(247,179,43,.35);
  background: #ffc94a;
  color: #1b2838 !important;
}
.btn-ab-ghost { background: rgba(255,255,255,.12); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.btn-ab-ghost:hover { background: rgba(255,255,255,.2); color: #fff; }
.btn-ab-solid { background: var(--ab-primary); color: #fff; }
.btn-ab-solid:hover { background: #5a0606; color: #fff; }
.btn-ab-outline {
  background: transparent;
  color: var(--ab-primary) !important;
  border: 2px solid var(--ab-primary);
}
.btn-ab-outline:hover,
.btn-ab-outline:focus {
  background: var(--ab-primary);
  color: #fff !important;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(118, 8, 7, .25);
}

/* Public nav — solid by default (inner pages) */
.ab-nav {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding: .85rem 1.5rem;
  background: linear-gradient(90deg, #5a0606, #760807);
  box-shadow: 0 6px 20px rgba(90, 6, 6, .18);
}
.ab-nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.ab-logo {
  color: #fff !important;
  font-weight: 700;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  opacity: 1 !important;
}
.ab-logo i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 8px;
  background: var(--ab-accent);
  color: #1b2838;
  font-size: .95rem;
}
.ab-logo:hover { color: #fff !important; opacity: 1 !important; }
.ab-logo span { color: var(--ab-accent); }
.ab-menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}
.ab-menu a {
  color: rgba(255,255,255,.92) !important;
  font-weight: 500;
  font-size: .95rem;
  opacity: 1 !important;
}
.ab-menu a:hover:not(.btn-ab),
.ab-menu a.active:not(.btn-ab) {
  color: var(--ab-accent) !important;
  opacity: 1 !important;
}
.ab-menu a.btn-ab-primary,
.ab-menu a.btn-ab-primary:hover,
.ab-menu a.btn-ab-primary:focus,
.ab-menu a.btn-ab-primary.active {
  background: var(--ab-accent);
  color: #1b2838 !important;
}
.ab-menu a.btn-ab-primary:hover,
.ab-menu a.btn-ab-primary.active {
  background: #ffc94a;
}
.ab-menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid rgba(255,255,255,.35);
  color: #fff;
  border-radius: 10px;
  width: 42px;
  height: 42px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

/* Homepage: transparent overlay on hero */
body.page-home .ab-nav {
  position: absolute;
  background: transparent;
  box-shadow: none;
}
body.page-home .ab-nav.is-scrolled {
  position: fixed;
  background: linear-gradient(90deg, rgba(90,6,6,.96), rgba(118,8,7,.96));
  box-shadow: 0 6px 20px rgba(90, 6, 6, .18);
  backdrop-filter: blur(8px);
}

.ab-section {
  padding: 4rem 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}
.ab-section h2 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 .5rem;
}
.ab-section .lead {
  color: var(--ab-muted);
  margin-bottom: 2rem;
  max-width: 50ch;
}
.pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}
.pillar {
  padding: 1.5rem 1.2rem;
  border-radius: var(--ab-radius);
  background: var(--ab-surface);
  box-shadow: var(--ab-shadow);
  border-top: 4px solid var(--ab-primary);
  transition: transform .25s ease;
}
.pillar:hover { transform: translateY(-4px); }
.pillar .num {
  width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(118, 8, 7, .12);
  color: var(--ab-primary);
  font-weight: 700;
  margin-bottom: .75rem;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  align-items: stretch;
}
.news-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.news-page-head .section-title { margin-bottom: .35rem; }
.news-page-head .section-sub { margin-bottom: 0; }
.news-page-head h2 { margin-bottom: .35rem; }
.news-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .85rem;
}
.news-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .25rem;
  border: 1px solid var(--ab-border);
  border-radius: 999px;
  background: var(--ab-surface);
  box-shadow: var(--ab-shadow);
  flex-shrink: 0;
}
.news-view-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ab-muted, #6c757d);
  border-radius: 999px;
  padding: .4rem .85rem;
  font-size: .9rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.news-view-btn:hover {
  color: var(--ab-primary);
  background: rgba(118, 8, 7, .08);
}
.news-view-btn.is-active {
  background: var(--ab-primary);
  color: #fff;
}
.news-view-btn.is-active:hover {
  background: var(--ab-primary);
  color: #fff;
  opacity: .95;
}
.news-grid.is-list {
  grid-template-columns: 1fr;
  gap: 1rem;
}
.news-grid.is-list .news-item {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  align-items: stretch;
}
.news-grid.is-list .news-item:hover {
  transform: none;
}
.news-grid.is-list .news-item .cover {
  aspect-ratio: auto;
  min-height: 140px;
  height: 100%;
}
.news-grid.is-list .news-item .body {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.news-grid.is-list .news-item h3 {
  font-size: 1.15rem;
}
.news-cover-fallback {
  width: 100%;
  height: 100%;
  min-height: 140px;
  display: grid;
  place-items: center;
  color: var(--ab-primary);
  font-size: 1.75rem;
  opacity: .55;
}
.news-pagination {
  margin-top: 1.75rem;
  padding-top: .5rem;
}
.news-item {
  background: var(--ab-surface);
  border-radius: var(--ab-radius);
  overflow: hidden;
  box-shadow: var(--ab-shadow);
  border: 1px solid var(--ab-border);
  transition: transform .2s ease, box-shadow .2s ease;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.news-item:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(118, 8, 7, .12);
}
.news-item .cover {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(118, 8, 7, .08), rgba(244, 180, 0, .12));
  flex-shrink: 0;
}
.news-item .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease;
}
.news-item .cover .cover-empty {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  color: rgba(118, 8, 7, .35);
  font-size: 2rem;
}
.news-item:hover .cover img {
  transform: scale(1.04);
}
.news-item .body {
  padding: 1.2rem 1.25rem 1.1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.news-item .body > p {
  flex: 1;
  margin-bottom: 0;
  color: var(--ab-muted);
  font-size: .95rem;
  line-height: 1.55;
}
.news-item .body .meta {
  font-size: .85rem;
  color: var(--ab-muted);
  margin-bottom: .45rem;
}
.news-item h3 {
  margin: 0 0 .5rem;
  font-size: 1.05rem;
  color: var(--ab-primary);
  line-height: 1.4;
}
/* เฉพาะหัวข้อข่าว — ใช้สีหลัก ไม่กระทบ navbar */
.news-item h3 a,
.news-item h3 a:link,
.news-item h3 a:visited,
.news-item h3 a:hover,
.news-item h3 a:focus {
  color: var(--ab-primary) !important;
  opacity: 1;
}
.news-item h3 a:hover {
  color: var(--ab-primary) !important;
  opacity: .85;
}
.news-show-cover {
  aspect-ratio: 16 / 9;
  border-radius: var(--ab-radius);
  overflow: hidden;
  margin: 0 0 1.25rem;
  background: linear-gradient(135deg, rgba(118, 8, 7, .08), rgba(244, 180, 0, .12));
  box-shadow: var(--ab-shadow);
  border: 1px solid var(--ab-border);
}
.news-show-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.news-show-body {
  line-height: 1.8;
  font-size: 1.02rem;
}
.news-show-body img {
  max-width: 100%;
  height: auto;
  border-radius: calc(var(--ab-radius) - 4px);
}

.news-item .news-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: .85rem;
  color: var(--ab-muted);
  font-size: .85rem;
}
.news-item .news-meta span {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.news-engage {
  margin-top: 1.25rem;
  padding: 1.1rem 1.2rem;
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  box-shadow: var(--ab-shadow);
}
.news-engage__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--ab-border);
}
.news-like-btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  border: 1px solid var(--ab-border);
  background: #fff;
  color: #5a0606;
  border-radius: 999px;
  padding: .45rem .95rem;
  font-weight: 600;
  transition: .15s ease;
}
.news-like-btn:hover {
  border-color: #f0a0ad;
  color: #c6284a;
}
.news-like-btn.is-liked {
  background: #ffe8ec;
  border-color: #f0a0ad;
  color: #c6284a;
}
.news-like-btn.is-locked,
.news-like-btn:disabled {
  opacity: .72;
  cursor: not-allowed;
}
.news-like-hint {
  flex: 1 0 100%;
  margin-top: .15rem;
  font-size: .85rem;
  color: #c6284a;
}
.news-like-btn .news-engage__count,
.news-engage__meta {
  font-weight: 600;
  color: var(--ab-muted);
}
.news-engage__meta {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.news-comments {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  margin-top: 1.1rem;
  margin-bottom: 0;
  padding-top: 1.15rem;
  border-top: 1px solid var(--ab-border);
}
.news-comments--timeline {
  --tl-rail: 52px;
  --tl-avatar: 44px;
  --tl-gap: .95rem;
  position: relative;
  padding-left: 0;
}
/* เส้น timeline แนวตั้ง */
.news-comments--timeline:not(:has(.news-comments__empty))::before {
  content: '';
  position: absolute;
  top: 1.15rem;
  bottom: .35rem;
  left: calc(var(--tl-avatar) / 2);
  width: 2px;
  background: linear-gradient(180deg, rgba(118, 8, 7, .28), rgba(118, 8, 7, .12));
  border-radius: 2px;
  z-index: 0;
}
.news-comment--new {
  animation: newsCommentIn .35s ease;
}
@keyframes newsCommentIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.news-comments__empty {
  margin: 0;
  color: var(--ab-muted);
  font-size: .95rem;
}
.news-comment {
  display: grid;
  grid-template-columns: var(--tl-rail) minmax(0, 1fr);
  gap: var(--tl-gap);
  align-items: flex-start;
  position: relative;
  z-index: 1;
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.news-comment__rail {
  display: flex;
  justify-content: center;
  padding-top: .15rem;
}
.news-comment__avatar {
  flex: 0 0 var(--tl-avatar);
  width: var(--tl-avatar);
  height: var(--tl-avatar);
  border-radius: 50%;
  overflow: hidden;
  background: #e8f1f5;
  color: #760807;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px rgba(118, 8, 7, .18), 0 2px 8px rgba(90, 6, 6, .12);
  position: relative;
  z-index: 2;
}
.news-comment__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.news-comment__avatar-icon {
  font-size: 1.1rem;
  line-height: 1;
}
.news-comment__card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(118, 8, 7, .1);
  border-radius: 14px;
  padding: .9rem 1rem 1rem;
  box-shadow: 0 6px 18px rgba(90, 6, 6, .06);
  min-width: 0;
}
/* ลูกศรชี้ไปเส้น timeline */
.news-comment__card::before {
  content: '';
  position: absolute;
  top: 16px;
  left: -8px;
  width: 14px;
  height: 14px;
  background: #fff;
  border-left: 1px solid rgba(118, 8, 7, .1);
  border-bottom: 1px solid rgba(118, 8, 7, .1);
  transform: rotate(45deg);
}
.news-comment__head {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  margin-bottom: .45rem;
}
.news-comment__name {
  color: #5a0606;
  font-weight: 700;
  line-height: 1.3;
}
.news-comment__time {
  color: var(--ab-muted);
  font-size: .82rem;
  line-height: 1.3;
}
.news-comment__body {
  white-space: pre-wrap;
  color: #234;
  line-height: 1.55;
}
@media (max-width: 575.98px) {
  .news-comments--timeline {
    --tl-rail: 42px;
    --tl-avatar: 36px;
    --tl-gap: .7rem;
  }
  .news-comment__card {
    padding: .8rem .85rem .9rem;
    border-radius: 12px;
  }
  .news-comment__card::before {
    top: 12px;
  }
}
.news-comment-form .form-label {
  font-size: .85rem;
  margin-bottom: .25rem;
}
.news-comment-form__body {
  min-height: 140px;
  resize: vertical;
}
.news-comment-form__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: .85rem;
}

/* Date / datetime picker — ไอคอนอยู่ใน textbox + รองรับมือถือ */
.ab-date-wrap {
  position: relative;
  display: block;
  width: 100%;
}
.ab-date-wrap .ab-date-field,
.ab-date-wrap .ab-date-alt,
.ab-date-wrap input.form-control.ab-date-alt {
  width: 100% !important;
  max-width: 100%;
  padding-right: 2.85rem !important;
  box-sizing: border-box;
}
/* ซ่อน input จริง (เก็บค่า Y-m-d) — แสดงเฉพาะช่องพิมพ์ */
.ab-date-wrap > input.flatpickr-input:not(.ab-date-alt) {
  position: absolute !important;
  left: 0;
  top: 0;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  clip: rect(0, 0, 0, 0);
}
.ab-date-wrap .flatpickr-input.ab-date-alt,
.ab-date-wrap input.ab-date-alt {
  position: relative !important;
  opacity: 1 !important;
  pointer-events: auto !important;
  height: calc(1.5em + .75rem + 2px) !important;
  flex: none !important;
  min-width: 0;
  border-radius: var(--bs-border-radius, .375rem) !important;
}
.ab-date-wrap .ab-date-toggle {
  position: absolute;
  top: 1px;
  right: 1px;
  bottom: 1px;
  z-index: 20;
  width: 2.55rem;
  min-width: 2.55rem;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 var(--bs-border-radius, .375rem) var(--bs-border-radius, .375rem) 0;
  background: transparent;
  color: #5b6b7a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
  -webkit-tap-highlight-color: transparent;
  pointer-events: auto;
}
.ab-date-wrap .ab-date-toggle:hover,
.ab-date-wrap .ab-date-toggle:focus {
  color: var(--ab-primary);
  background: rgba(118, 8, 7, .06);
  outline: none;
}
.ab-date-wrap .ab-date-toggle:focus-visible {
  box-shadow: inset 0 0 0 2px rgba(118, 8, 7, .25);
}
.ab-date-wrap .ab-date-toggle i {
  font-size: .95rem;
  pointer-events: none;
}
.flatpickr-calendar {
  font-family: inherit;
  box-shadow: 0 12px 32px rgba(118, 8, 7, .18);
  border: 1px solid var(--ab-border);
  z-index: 1100;
}
.flatpickr-calendar.static {
  position: relative;
  top: .35rem !important;
  left: 0 !important;
  right: auto !important;
  margin-bottom: .25rem;
}
.ab-date-wrap .flatpickr-calendar.static {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange,
.flatpickr-day.selected:hover {
  background: var(--ab-primary);
  border-color: var(--ab-primary);
}

/* ปีเป็น dropdown แทนช่องตัวเลข + ลูกศรเล็ก */
.flatpickr-current-month {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  width: auto;
  padding: 0 .25rem;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month select.ab-year-dropdown {
  appearance: auto;
  -webkit-appearance: menulist;
  display: inline-block;
  vertical-align: middle;
  font-size: 1rem;
  font-weight: 600;
  color: inherit;
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: .4rem;
  padding: .35rem 1.6rem .35rem .55rem;
  margin: 0;
  min-height: 2.25rem;
  max-width: 7.5rem;
  cursor: pointer;
  box-shadow: none;
}
.flatpickr-current-month .flatpickr-monthDropdown-months {
  max-width: 8.5rem;
}
.flatpickr-current-month .numInputWrapper.ab-year-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
}
.flatpickr-current-month .numInputWrapper.ab-year-wrap .ab-year-input-hidden,
.flatpickr-current-month .numInputWrapper.ab-year-wrap input.cur-year {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  opacity: 0 !important;
  pointer-events: none !important;
  left: 0;
  top: 0;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.flatpickr-current-month .numInputWrapper.ab-year-wrap .arrowUp,
.flatpickr-current-month .numInputWrapper.ab-year-wrap .arrowDown {
  display: none !important;
}
.flatpickr-current-month select.ab-year-dropdown:focus,
.flatpickr-current-month .flatpickr-monthDropdown-months:focus {
  outline: 2px solid rgba(118, 8, 7, .35);
  outline-offset: 1px;
  border-color: var(--ab-primary);
}

@media (max-width: 767.98px) {
  .ab-date-wrap .ab-date-toggle {
    width: 2.75rem;
    min-width: 2.75rem;
  }
  .ab-date-wrap .ab-date-field,
  .ab-date-wrap .ab-date-alt {
    min-height: 44px;
    font-size: 16px; /* กัน iOS zoom ตอนโฟกัส */
  }
  .flatpickr-calendar {
    width: min(100%, 20.5rem) !important;
    max-width: calc(100vw - 1.5rem);
  }
  .ab-date-wrap .flatpickr-calendar.static {
    width: 100% !important;
    max-width: 100%;
  }
  .flatpickr-day {
    max-width: 14.2857143%;
    height: 42px;
    line-height: 42px;
  }
  .flatpickr-time input {
    font-size: 1.05rem;
    min-height: 40px;
  }
  .flatpickr-months .flatpickr-month,
  .flatpickr-current-month .flatpickr-monthDropdown-months,
  .flatpickr-current-month select.ab-year-dropdown,
  .numInputWrapper {
    font-size: 1rem;
  }
  .flatpickr-current-month {
    gap: .4rem;
    flex-wrap: wrap;
  }
  .flatpickr-current-month .flatpickr-monthDropdown-months,
  .flatpickr-current-month select.ab-year-dropdown {
    min-height: 44px;
    font-size: 16px; /* กัน iOS zoom */
    padding: .45rem 1.75rem .45rem .65rem;
    max-width: none;
    flex: 1 1 auto;
  }
  .flatpickr-prev-month,
  .flatpickr-next-month {
    padding: 12px 10px;
  }
}

/* Cover image preview (admin news form) */
.ab-cover-preview {
  position: relative;
  width: 100%;
  max-width: 640px;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px dashed var(--ab-border);
  background:
    linear-gradient(135deg, rgba(118, 8, 7, .06), rgba(244, 180, 0, .08)),
    repeating-linear-gradient(
      -45deg,
      transparent,
      transparent 8px,
      rgba(118, 8, 7, .03) 8px,
      rgba(118, 8, 7, .03) 16px
    );
}
.ab-cover-preview.has-image {
  border-style: solid;
}
.ab-cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ab-cover-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  color: var(--ab-muted, #6c757d);
  padding: 1rem;
  text-align: center;
  font-size: .9rem;
}
.ab-cover-empty i {
  font-size: 1.75rem;
  opacity: .7;
}
.ab-section h2 {
  color: var(--ab-primary);
}
.pillar h3 {
  color: var(--ab-text);
}

.ab-footer {
  background: #5a0606;
  color: rgba(255,255,255,.85);
  padding: clamp(2rem, 4vw, 3rem) 1.5rem 1.5rem;
  margin-top: auto;
  width: 100%;
  flex-shrink: 0;
}
.ab-footer a { color: #fff; }
.ab-footer a:hover {
  color: #fff;
  opacity: .85;
}
.ab-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.75rem);
  align-items: start;
}
.ab-footer-col h4,
.ab-footer-col h5 {
  margin: 0 0 .85rem;
  font-weight: 700;
  color: var(--ab-accent) !important;
}
.ab-footer-col p {
  margin-bottom: .45rem;
  line-height: 1.55;
}
.ab-footer-col--brand > p:first-of-type {
  color: var(--ab-accent);
  font-weight: 600;
}
.ab-footer-links {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.ab-footer-copy {
  max-width: 1100px;
  margin: 2rem auto 0;
  padding-top: 1.25rem;
  border-top: 1px solid rgba(255,255,255,.14);
  text-align: center;
  font-size: "1.2rem";
  color: var(--ab-accent);
  opacity: 1;
  font-weight: 200;
}

/* Auth */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  background: #fff;
}
.auth-visual {
  background:
    radial-gradient(circle at 18% 20%, rgba(253,192,7,.28), transparent 42%),
    radial-gradient(circle at 85% 75%, rgba(247,179,43,.18), transparent 40%),
    linear-gradient(160deg, #5a0606 0%, #760807 55%, #9a2020 100%);
  color: #fff;
  padding: clamp(2rem, 5vw, 4rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  position: relative;
  overflow: hidden;
}
.auth-visual-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: none;
  animation: fadeUp .6s ease;
}
.auth-visual-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 700;
  font-size: .95rem;
  margin-bottom: 1.25rem;
  color: #fff;
}
.auth-visual-badge i { color: var(--ab-accent); }
.auth-visual-org {
  margin: 0 0 .75rem;
  opacity: .8;
  font-size: .95rem;
}
.auth-visual h1 {
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  margin: 0 0 1rem;
  line-height: 1.35;
  font-weight: 700;
  letter-spacing: -.02em;
  max-width: none;
  white-space: normal;
}
.auth-visual-desc {
  margin: 0;
  opacity: .85;
  font-size: 1.05rem;
  max-width: none;
  line-height: 1.6;
}

/* Right panel — no card frame */
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1.5rem, 4vw, 3rem);
  background:
    radial-gradient(circle at 100% 0%, rgba(118, 8, 7, .05), transparent 42%),
    #fff;
}
.auth-form,
.auth-card {
  width: 100%;
  max-width: 400px;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  animation: fadeUp .55s ease .05s both;
}
/* Auth panel text — theme primary only (unity) */
.auth-panel a { color: var(--ab-primary); }
.auth-panel a:hover { color: var(--ab-primary); opacity: .85; }
.auth-eyebrow {
  margin: 0 0 .35rem;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ab-primary);
}
.auth-title {
  margin: 0 0 .4rem;
  font-size: clamp(1.7rem, 3vw, 2rem);
  font-weight: 700;
  color: var(--ab-primary);
  letter-spacing: -.02em;
}
.auth-subtitle {
  margin: 0 0 1.75rem;
  color: rgba(118, 8, 7, .65);
  font-size: .95rem;
  line-height: 1.5;
}
.auth-fields { margin: 0; }
.auth-field { margin-bottom: 1rem; }
.auth-field .form-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ab-primary);
  margin-bottom: .4rem;
}
.auth-input {
  position: relative;
}
.auth-input > i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(118, 8, 7, .45);
  font-size: .9rem;
  pointer-events: none;
}
.auth-input .form-control,
.auth-form .form-control,
.auth-card .form-control {
  border: 0;
  border-bottom: 1.5px solid rgba(118, 8, 7, .2);
  border-radius: 0;
  padding: .85rem .25rem .85rem 2.4rem;
  background: transparent;
  color: var(--ab-primary);
  box-shadow: none !important;
  transition: border-color .2s ease, background .2s ease;
}
.auth-input .form-control::placeholder,
.auth-form .form-control::placeholder,
.auth-card .form-control::placeholder {
  color: rgba(118, 8, 7, .4);
}
.auth-form .form-control:not(.auth-input .form-control),
.auth-card .form-control:not(.auth-input .form-control) {
  padding-left: .25rem;
}
.auth-input .form-control:focus,
.auth-form .form-control:focus,
.auth-card .form-control:focus {
  border-bottom-color: var(--ab-primary);
  background: rgba(118, 8, 7, .04);
}
.auth-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin: .25rem 0 1.35rem;
  font-size: .9rem;
  color: rgba(118, 8, 7, .75);
}
.auth-meta .form-check-label { color: rgba(118, 8, 7, .75); }
.auth-meta .form-check-input:checked {
  background-color: var(--ab-primary);
  border-color: var(--ab-primary);
}
.auth-meta a { font-weight: 600; color: var(--ab-primary); }
.auth-submit {
  width: 100%;
  justify-content: center;
  padding: .95rem 1.4rem;
  font-size: 1rem;
}
.auth-foot {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  align-items: flex-start;
}
.auth-foot a {
  font-weight: 600;
  font-size: .92rem;
  color: var(--ab-primary);
}
.auth-demo {
  font-size: .78rem;
  color: rgba(118, 8, 7, .55);
}
.auth-demo code {
  color: var(--ab-primary);
  background: rgba(118, 8, 7, .08);
  padding: .1rem .35rem;
  border-radius: 6px;
}

/* Social OAuth — brand colors per provider (enabled from .env / config oauth.*.enabled) */
.login-oauth { margin-top: 1.35rem; }
.login-oauth-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 0 0 .9rem;
  font-size: .75rem;
  color: rgba(118, 8, 7, .5);
}
.login-oauth-divider::before,
.login-oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(118, 8, 7, .15);
}
.login-oauth-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .55rem;
  width: 100%;
}
.login-oauth-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-width: 0;
  width: 100%;
  padding: .8rem .35rem;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .01em;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(15, 40, 60, .08);
  transition: filter .15s ease, transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.login-oauth-btn svg {
  height: 1.4rem;
  width: 1.4rem;
  flex-shrink: 0;
}
.login-oauth-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 40, 60, .14);
  text-decoration: none;
}
.login-oauth-btn:focus-visible {
  outline: 2px solid rgba(118, 8, 7, .35);
  outline-offset: 2px;
}

/* Facebook — official blue */
.login-oauth-btn--facebook,
.login-oauth-btn--facebook.login-oauth-btn--disabled {
  background: #1877f2 !important;
  border-color: #1877f2 !important;
  color: #fff !important;
}
.login-oauth-btn--facebook:hover,
.login-oauth-btn--facebook:focus {
  background: #166fe5 !important;
  color: #fff !important;
}

/* Google — white tile + brand mark */
.login-oauth-btn--google,
.login-oauth-btn--google.login-oauth-btn--disabled {
  background: #ffffff !important;
  color: #3c4043 !important;
  border-color: #dadce0 !important;
}
.login-oauth-btn--google:hover,
.login-oauth-btn--google:focus {
  background: #f8f9fa !important;
  color: #3c4043 !important;
  border-color: #c5c8cc !important;
}

/* LINE — official green */
.login-oauth-btn--line,
.login-oauth-btn--line.login-oauth-btn--disabled {
  background: #06c755 !important;
  border-color: #06c755 !important;
  color: #fff !important;
}
.login-oauth-btn--line:hover,
.login-oauth-btn--line:focus {
  background: #05b34c !important;
  color: #fff !important;
}

.login-oauth-hint {
  margin-top: .6rem;
  text-align: center;
  font-size: .7rem;
  color: rgba(118, 8, 7, .5);
  line-height: 1.45;
}
/* ยังไม่ตั้งค่าใน .env = กดไม่ได้ แต่ยังแสดงสีแบรนด์ */
.login-oauth-btn--disabled {
  opacity: .72;
  cursor: not-allowed;
  pointer-events: none;
  box-shadow: none;
  filter: none !important;
  transform: none !important;
}
.form-control, .form-select {
  border-radius: 10px !important;
  border-color: var(--ab-border) !important;
  padding: .7rem .9rem;
}
.form-label { font-weight: 600; color: var(--ab-text); }

/* Admin shell */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--ab-sidebar-w);
  background: linear-gradient(180deg, var(--ab-sidebar), var(--ab-sidebar-2));
  color: #fff;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  flex-shrink: 0;
  transition: transform .25s ease, margin-left .3s ease-in-out;
  display: flex;
  flex-direction: column;
}
/* Scroll area — AdminLTE OverlayScrollbars style (hide until scroll) */
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  background: var(--ab-sidebar-2);
  /* Native fallback (before / without OverlayScrollbars) */
  scrollbar-width: thin;
  scrollbar-color: transparent var(--ab-sidebar-2);
}
.sidebar-scroll.is-scrolling {
  scrollbar-color: rgba(255,255,255,.35) var(--ab-sidebar-2);
}
.sidebar-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
  background: var(--ab-sidebar-2);
}
.sidebar-scroll::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
.sidebar-scroll::-webkit-scrollbar-track,
.sidebar-scroll::-webkit-scrollbar-corner {
  background: var(--ab-sidebar-2);
}
.sidebar-scroll::-webkit-scrollbar-thumb {
  background-color: transparent;
  border-radius: 999px;
  border: 0;
  min-height: 40px;
}
.sidebar-scroll.is-scrolling::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,.35);
}
.sidebar-scroll.is-scrolling::-webkit-scrollbar-thumb:active,
.sidebar-scroll::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,.5);
}
/* OverlayScrollbars host (AdminLTE) — blend into sidebar */
.sidebar-scroll.os-host,
.sidebar-scroll.os-host > .os-padding,
.sidebar-scroll.os-host > .os-padding > .os-viewport,
.sidebar-scroll.os-host > .os-padding > .os-viewport > .os-content {
  background: var(--ab-sidebar-2) !important;
}
.sidebar .os-theme-light > .os-scrollbar,
.sidebar .os-theme-light > .os-scrollbar > .os-scrollbar-track,
.sidebar .os-theme-light > .os-scrollbar-corner {
  background: transparent !important;
}
.sidebar .os-theme-light > .os-scrollbar-vertical {
  width: 8px;
  right: 0;
  padding: 2px 1px;
}
.sidebar-brand {
  height: var(--ab-header-h);
  min-height: var(--ab-header-h);
  max-height: var(--ab-header-h);
  padding: 0 .9rem;
  border-bottom: 1px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  flex-shrink: 0;
  box-sizing: border-box;
}
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  flex: 1 1 auto;
  color: inherit;
  text-decoration: none;
  line-height: 1.2;
}
.sidebar-brand-link:hover {
  color: #fff;
  text-decoration: none;
}
.sidebar-brand-logo {
  flex: 0 0 2.35rem;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(247, 179, 43, .18);
  color: var(--ab-accent);
  font-size: 1.05rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.18);
}
.sidebar-brand-text { min-width: 0; }
.sidebar-brand .name {
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-brand .name span { color: var(--ab-accent); }
.sidebar-brand .tag {
  font-size: .72rem;
  line-height: 1.2;
  opacity: .75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.08);
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  transition: background .2s ease, transform .15s ease;
}
.sidebar-close:hover {
  background: rgba(255,255,255,.18);
  transform: scale(1.03);
}
.sidebar-backdrop {
  display: none;
}
.sidebar-nav { padding: 1rem .75rem 2rem; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: .7rem;
  color: rgba(255,255,255,.88);
  padding: .7rem .85rem;
  border-radius: 10px;
  margin-bottom: .25rem;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.sidebar-nav a i {
  width: 1.15rem;
  text-align: center;
  opacity: .9;
}
.sidebar-nav a:hover {
  background: rgba(247, 179, 43, .22);
  color: #fff;
  box-shadow: inset 3px 0 0 0 var(--ab-accent);
}
.sidebar-nav a:hover i {
  color: var(--ab-accent);
  opacity: 1;
}
.sidebar-nav a.active {
  background: var(--ab-accent);
  color: #1b2838;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(247, 179, 43, .35);
}
.sidebar-nav a.active i {
  color: #1b2838;
  opacity: 1;
}
.sidebar-nav a.active:hover {
  background: #ffc107;
  color: #1b2838;
  box-shadow: 0 4px 16px rgba(247, 179, 43, .45);
}
.sidebar-nav a.active:hover i {
  color: #1b2838;
}
.sidebar-nav .nav-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  opacity: .55;
  padding: .9rem .85rem .35rem;
}

/* Sidebar submenu (7 มาตรการ) */
.sidebar-nav .nav-group {
  margin-bottom: .25rem;
}
.sidebar-nav .nav-group-toggle {
  display: flex;
  align-items: center;
  gap: .7rem;
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.88);
  padding: .7rem .85rem;
  border-radius: 10px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}
.sidebar-nav .nav-group-toggle i:first-child {
  width: 1.15rem;
  text-align: center;
  opacity: .9;
}
.sidebar-nav .nav-group-toggle .chevron {
  margin-left: auto;
  font-size: .7rem;
  opacity: .7;
  transition: transform .2s ease;
}
.sidebar-nav .nav-group.open .nav-group-toggle .chevron {
  transform: rotate(90deg);
}
.sidebar-nav .nav-group-toggle:hover,
.sidebar-nav .nav-group-toggle.is-current {
  background: rgba(247, 179, 43, .22);
  color: #fff;
  box-shadow: inset 3px 0 0 0 var(--ab-accent);
}
.sidebar-nav .nav-group-toggle:hover i:first-child,
.sidebar-nav .nav-group-toggle.is-current i:first-child {
  color: var(--ab-accent);
  opacity: 1;
}
.sidebar-nav .nav-submenu {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  margin: 0 0 0 .7rem;
  padding: 0 0 0 .55rem;
  border-left: 2px solid rgba(247, 179, 43, .35);
  transition: max-height .28s ease, opacity .2s ease, margin .2s ease, padding .2s ease;
}
.sidebar-nav .nav-group.open .nav-submenu {
  max-height: 520px;
  opacity: 1;
  margin: .1rem 0 .4rem .7rem;
  padding: .2rem 0 .15rem .55rem;
}
.sidebar-nav .nav-submenu a {
  padding: .48rem .7rem;
  font-size: .9rem;
  font-weight: 500;
  gap: .55rem;
  margin-bottom: .15rem;
}
.sidebar-nav .nav-submenu a .nav-sub-num {
  flex: 0 0 1.4rem;
  width: 1.4rem;
  height: 1.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: rgba(255,255,255,.12);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1;
}
.sidebar-nav .nav-submenu a.active .nav-sub-num {
  background: rgba(27,40,56,.18);
  color: #1b2838;
}
.sidebar-nav .nav-submenu a span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--ab-header-h);
  min-height: var(--ab-header-h);
  max-height: var(--ab-header-h);
  background: var(--ab-surface);
  border-bottom: 1px solid var(--ab-border);
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
  box-sizing: border-box;
  flex-shrink: 0;
}
.topbar-title {
  min-width: 0;
  line-height: 1.15;
}
.topbar-title .fw-semibold {
  font-size: 1rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-title small {
  display: block;
  font-size: .75rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar [data-toggle-sidebar] {
  flex: 0 0 auto;
}
.content { padding: 1.25rem; }
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.cases-status-grid {
  grid-template-columns: repeat(4, 1fr);
}
@media (min-width: 1200px) {
  .cases-status-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
.cases-status-grid .stat-card {
  transition: border-color .15s ease, transform .15s ease;
}
.cases-status-grid a.stat-card:hover {
  border-color: var(--ab-primary);
  transform: translateY(-2px);
  color: inherit;
}
.cases-stat-total .value {
  color: var(--ab-primary);
}

/* Role cards — circular icons equal size, never stretched */
.role-icon {
  --role-icon-size: 44px;
  --role-icon-font: 1rem;
  flex: 0 0 var(--role-icon-size);
  width: var(--role-icon-size);
  height: var(--role-icon-size);
  min-width: var(--role-icon-size);
  max-width: var(--role-icon-size);
  min-height: var(--role-icon-size);
  max-height: var(--role-icon-size);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--role-icon-bg, #760807);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  line-height: 1;
  box-sizing: border-box;
}
.role-icon--lg {
  --role-icon-size: 56px;
  --role-icon-font: 1.25rem;
}
.role-icon > i {
  font-size: var(--role-icon-font);
  line-height: 1;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform: none;
  display: inline-block;
}
.stat-card {
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--ab-shadow);
  position: relative;
  overflow: hidden;
  animation: fadeUp .5s ease both;
}
.stat-card:nth-child(2) { animation-delay: .05s; }
.stat-card:nth-child(3) { animation-delay: .1s; }
.stat-card:nth-child(4) { animation-delay: .15s; }
.stat-card .label { color: var(--ab-muted); font-size: .9rem; }
.stat-card .value { font-size: 1.9rem; font-weight: 700; margin-top: .2rem; }
.stat-card .icon {
  position: absolute;
  right: 1rem; top: 1rem;
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: rgba(253,192,7,.12);
  color: var(--ab-primary);
  margin-bottom: 0;
}
.dash-spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(118, 8, 7, .2);
  border-top-color: #760807;
  border-radius: 50%;
  animation: dashSpin .7s linear infinite;
  vertical-align: -2px;
}
.dash-spinner-lg {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}
@keyframes dashSpin {
  to { transform: rotate(360deg); }
}
.dash-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  background: rgba(255, 255, 255, .72);
  color: var(--ab-muted);
  font-size: .9rem;
}
.dash-loading-inline {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--ab-muted);
  min-height: 2rem;
}
.stat-card.dash-skeleton .value {
  min-height: 2rem;
  display: flex;
  align-items: center;
}
.panel-body.position-relative {
  min-height: 280px;
}
.panel {
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  box-shadow: var(--ab-shadow);
  margin-bottom: 1.25rem;
}
.panel-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--ab-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.panel-header h3 { margin: 0; font-size: 1.05rem; }
.panel-body { padding: 1.2rem; }

/* Bootstrap collapse/accordion vs Tailwind .collapse { visibility: collapse } */
.collapse,
.collapsing,
.accordion-collapse {
  visibility: visible !important;
}

/* Filter toolbar — one row */
.filter-toolbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  width: 100%;
  flex-wrap: nowrap;
}
.filter-search {
  position: relative;
  flex: 1 1 auto;
  min-width: 180px;
}
.filter-search i {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ab-muted);
  font-size: .85rem;
  pointer-events: none;
}
.filter-search .form-control {
  padding-left: 2.1rem;
  width: 100%;
}
.filter-select {
  width: 180px;
  flex: 0 0 180px;
}
.filter-toolbar .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Cases filter — กรอง / ล้าง full row */
#cases-filter.filter-toolbar--cases {
  flex-wrap: wrap;
}
#cases-filter .filter-search {
  flex: 1 1 220px;
}
#cases-filter .filter-select {
  flex: 1 1 160px;
  width: auto;
  max-width: none;
}
#cases-filter .filter-actions {
  display: flex;
  gap: .5rem;
  flex: 1 1 100%;
  width: 100%;
}
#cases-filter .filter-actions .btn {
  flex: 1 1 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  min-height: 2.15rem;
}

/* Shared DataTable (same UX as รับเรื่อง) */
.ab-datatable th.col-nowrap,
.ab-datatable td.col-nowrap,
#cases-datatable th.col-nowrap,
#cases-datatable td.col-nowrap {
  white-space: nowrap;
  vertical-align: middle;
}
.ab-datatable td.col-desc,
#cases-datatable td.col-desc {
  min-width: 12rem;
  max-width: 22rem;
  white-space: normal;
  word-break: break-word;
}
.ab-datatable code,
#cases-datatable code {
  color: var(--ab-primary);
  background: rgba(118, 8, 7, .06);
  padding: .1rem .35rem;
  border-radius: 6px;
  font-size: .85em;
  white-space: nowrap;
}

/* Force column collapse on mobile (not text-wrap squash) */
table.ab-datatable th,
table.ab-datatable td,
#cases-datatable th,
#cases-datatable td {
  white-space: nowrap;
  vertical-align: middle;
}
table.ab-datatable td.col-wrap,
table.ab-datatable th.col-wrap,
#cases-datatable td.col-wrap,
#cases-datatable th.col-wrap {
  white-space: normal;
  min-width: 10rem;
  max-width: 18rem;
}
.ab-dt-host {
  width: 100%;
  overflow: visible !important;
}

/* Expand / collapse — show only when Responsive collapses columns (mobile) */
table.ab-datatable.dtr-column > tbody > tr > td.dtr-control:before,
table.ab-datatable.dtr-column > tbody > tr > th.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-column > tbody > tr > th.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > td.dtr-control:before,
table.dataTable.dtr-inline.collapsed > tbody > tr > th.dtr-control:before {
  display: none !important;
  content: none !important;
}
table.ab-datatable td.dt-expand-col,
table.ab-datatable th.dt-expand-col,
#cases-datatable td.dt-expand-col,
#cases-datatable th.dt-expand-col {
  width: 4.75rem;
  min-width: 4.75rem;
  padding: .4rem .35rem !important;
  vertical-align: middle;
  text-align: center;
  background: transparent !important;
  cursor: pointer;
}
/* Desktop: all columns visible → hide expand/collapse */
table.ab-datatable:not(.collapsed) th.dt-expand-col,
table.ab-datatable:not(.collapsed) td.dt-expand-col,
#cases-datatable:not(.collapsed) th.dt-expand-col,
#cases-datatable:not(.collapsed) td.dt-expand-col {
  display: none !important;
}
.btn-dt-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 4.1rem;
  padding: .28rem .45rem;
  border: 1px solid rgba(118, 8, 7, .28);
  border-radius: 8px;
  background: rgba(118, 8, 7, .06);
  color: var(--ab-primary);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-dt-toggle i { font-size: .7rem; }
.btn-dt-toggle:hover {
  background: rgba(118, 8, 7, .12);
  border-color: var(--ab-primary);
  color: var(--ab-primary);
}
.btn-dt-toggle.is-expanded {
  background: var(--ab-primary);
  border-color: var(--ab-primary);
  color: #fff;
}
.btn-dt-toggle.is-expanded:hover {
  background: #5a0606;
  border-color: #5a0606;
  color: #fff;
}
table.dataTable > tbody > tr.child ul.dtr-details {
  width: 100%;
  display: block;
}
table.dataTable > tbody > tr.child span.dtr-title {
  min-width: 6.5rem;
  color: rgba(118, 8, 7, .65);
  font-weight: 600;
}
table.dataTable > tbody > tr.child span.dtr-data {
  color: var(--ab-primary);
}
@media (max-width: 420px) {
  .btn-dt-toggle span { display: none; }
  .btn-dt-toggle { min-width: 2.1rem; padding: .35rem; }
  table.ab-datatable td.dt-expand-col,
  table.ab-datatable th.dt-expand-col,
  #cases-datatable td.dt-expand-col,
  #cases-datatable th.dt-expand-col {
    width: 2.6rem;
    min-width: 2.6rem;
  }
}
div.dataTables_wrapper .dataTables_processing {
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--ab-border);
  border-radius: 12px;
  color: var(--ab-primary);
  box-shadow: 0 8px 24px rgba(118, 8, 7, .08);
}

/* Pagination / tabs — theme primary (not Bootstrap blue) */
.dataTables_wrapper .page-item.active .page-link,
.pagination .page-item.active .page-link {
  background-color: var(--ab-primary);
  border-color: var(--ab-primary);
  color: #fff;
}
.dataTables_wrapper .page-link,
.pagination .page-link {
  color: var(--ab-primary);
}
.dataTables_wrapper .page-link:hover,
.pagination .page-link:hover {
  color: var(--ab-primary);
  background-color: rgba(118, 8, 7, .08);
}
.nav-tabs .nav-link {
  color: var(--ab-primary);
}
.nav-tabs .nav-link.active {
  color: var(--ab-primary);
  border-color: var(--ab-border) var(--ab-border) #fff;
  font-weight: 700;
}
.nav-tabs .nav-link.active {
  box-shadow: inset 0 3px 0 0 var(--ab-primary);
}

/* DataTables toolbar — buttons + search same row */
.dt-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: nowrap;
  margin-bottom: 1rem;
}
.dt-buttons-wrap {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.dt-buttons-wrap .dt-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  float: none !important;
}
.dt-buttons-wrap .dt-buttons .btn {
  margin: 0 !important;
}
.dt-search-wrap {
  flex: 0 0 auto;
  margin-left: auto;
}
.dt-search-wrap .dataTables_filter {
  float: none !important;
  text-align: right;
  margin: 0;
}
.dt-search-wrap .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: 0;
  white-space: nowrap;
}
.dt-search-wrap .dataTables_filter input {
  margin: 0 0 0 .25rem !important;
  width: 200px;
  display: inline-block;
  border-radius: 10px;
  border: 1px solid var(--ab-border);
  padding: .4rem .75rem;
}
.dt-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

/* CRUD action icons — bordered, uniform */
.dt-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: .35rem;
  white-space: nowrap;
}
.dt-actions > form {
  display: inline-flex;
  margin: 0;
}
.dt-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 .45rem;
  border-width: 1px;
  border-radius: .4rem;
  line-height: 1;
}
.dt-actions .btn:has(.dt-btn-label) {
  min-width: auto;
  padding: 0 .55rem;
  gap: .2rem;
}
.dt-actions .btn .dt-btn-label {
  margin-left: .25rem;
  font-size: .8rem;
  font-weight: 600;
}
table.ab-datatable td.col-actions,
table.ab-datatable th.col-actions {
  white-space: nowrap;
  text-align: end;
  vertical-align: middle;
}
table.ab-datatable thead th {
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}

.dt-info .dataTables_info,
.dt-paginate .dataTables_paginate {
  float: none !important;
  padding-top: 0 !important;
}
div.dataTables_wrapper div.dataTables_filter,
div.dataTables_wrapper div.dataTables_length,
div.dataTables_wrapper div.dataTables_info,
div.dataTables_wrapper div.dataTables_paginate {
  float: none;
}

@media (max-width: 768px) {
  .filter-toolbar {
    flex-wrap: wrap;
  }
  .filter-select {
    width: 100%;
    flex: 1 1 100%;
  }
  .dt-toolbar {
    flex-wrap: wrap;
  }
  .dt-search-wrap {
    width: 100%;
  }
  .dt-search-wrap .dataTables_filter,
  .dt-search-wrap .dataTables_filter label {
    width: 100%;
  }
  .dt-search-wrap .dataTables_filter input {
    width: 100%;
    flex: 1;
  }
}
.badge-status {
  display: inline-flex;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 600;
}
.badge-new { background: #e7f5ff; color: #1971c2; }
.badge-reviewing { background: #fff3bf; color: #e67700; }
.badge-protecting,.badge-helping,.badge-following { background: #e6fcf5; color: #087f5b; }
.badge-resolved,.badge-closed { background: #ebfbee; color: #2b8a3e; }
.badge-rejected { background: #ffe3e3; color: #c92a2a; }

.widget-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.widget-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.widget-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
  margin-bottom: 1.25rem;
}
.widget-grid > .panel,
.widget-grid-2 > .panel,
.widget-grid-3 > .panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  margin-bottom: 0;
  min-width: 0;
}
.widget-grid > .panel .panel-body,
.widget-grid-2 > .panel .panel-body,
.widget-grid-3 > .panel .panel-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.chart-box {
  position: relative;
  width: 100%;
  flex: 0 0 auto;
  height: 280px !important;
  min-height: 280px !important;
  max-height: 320px;
}
.chart-box canvas {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100%;
}
.clock-widget {
  font-variant-numeric: tabular-nums;
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ab-primary);
}
.skeleton {
  background: linear-gradient(90deg, #eee, #f7f7f7, #eee);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 8px;
  height: 1rem;
}
.page-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.page-title h1 { margin: 0; font-size: 1.45rem; }
.table thead th {
  background: rgba(118,8,7,.05);
  font-weight: 600;
  white-space: nowrap;
}
.search-box {
  position: relative;
  min-width: 220px;
}
.search-box input { padding-left: 2.2rem; }
.search-box i {
  position: absolute; left: .8rem; top: 50%;
  transform: translateY(-50%);
  color: var(--ab-muted);
}

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(255,255,255,.55);
  display: none;
  place-items: center;
  z-index: 9999;
}
.loading-overlay.show { display: grid; }
.spinner {
  width: 42px; height: 42px;
  border: 3px solid #d0e6f0;
  border-top-color: var(--ab-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
@keyframes float {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 992px) {
  .ab-hero-inner {
    grid-template-columns: 1fr;
    gap: 1.75rem;
    align-items: stretch;
  }
  .ab-hero-slider {
    max-width: 560px;
    margin-left: 0;
    margin-right: auto;
  }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-visual { min-height: 220px; padding: 1.75rem 1.5rem; }
  .auth-visual h1 { font-size: 1.6rem; }
  .auth-panel { padding: 1.75rem 1.35rem 2.5rem; }
  .stat-grid, .pillars, .widget-grid, .widget-grid-2, .widget-grid-3 {
    grid-template-columns: 1fr 1fr;
  }
  .news-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .news-grid.is-list {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    z-index: 1040;
    transform: translateX(-100%);
    box-shadow: 8px 0 28px rgba(0,0,0,.28);
  }
  .sidebar.open { transform: none; }
  .sidebar-close { display: inline-flex; }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(8, 28, 40, .45);
    backdrop-filter: blur(2px);
    z-index: 1035;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }
  body.sidebar-open { overflow: hidden; }
}
@media (min-width: 992px) {
  body.sidebar-collapse .sidebar {
    margin-left: calc(-1 * var(--ab-sidebar-w));
  }
}
@media (max-width: 640px) {
  .ab-hero-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 6rem 1.15rem 2.5rem;
    align-items: stretch;
  }
  .ab-hero-slider {
    max-width: none;
    margin-left: 0;
    order: -1;
  }
  .stat-grid, .pillars, .news-grid, .widget-grid, .widget-grid-2, .widget-grid-3 {
    grid-template-columns: 1fr;
  }
  .news-page-head {
    flex-direction: column;
    align-items: stretch;
  }
  .news-view-toggle {
    align-self: flex-end;
  }
  .news-grid.is-list .news-item {
    grid-template-columns: 1fr;
  }
  .news-grid.is-list .news-item .cover {
    min-height: 160px;
    aspect-ratio: 16 / 9;
  }
  .news-view-btn span { display: none; }
  .news-view-btn { padding: .45rem .7rem; }
  .ab-footer-inner {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .ab-footer-col {
    padding-bottom: 1.15rem;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .ab-footer-col:last-child {
    padding-bottom: 0;
    border-bottom: 0;
  }
  .ab-footer-copy {
    margin-top: 1.5rem;
  }
  .ab-menu-toggle { display: inline-flex; }
  .ab-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: .25rem;
    padding: .75rem 1rem 1rem;
    background: #5a0606;
    box-shadow: 0 12px 24px rgba(0,0,0,.2);
  }
  .ab-menu.open { display: flex; }
  .ab-menu a { padding: .65rem .4rem; }
  body.page-home .ab-nav { background: rgba(90,6,6,.92); }
}

/* People autocomplete (public report form) */
.ab-suggest {
  position: relative;
}
.ab-suggest-list {
  position: absolute;
  z-index: 40;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: 260px;
  overflow: auto;
  background: #fff;
  border: 1px solid rgba(118, 8, 7, .18);
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(118, 8, 7, .12);
  padding: .35rem;
}
.ab-suggest-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .1rem;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: .55rem .7rem;
  color: #163447;
}
.ab-suggest-item:hover,
.ab-suggest-item.is-active {
  background: rgba(253, 192, 7, .12);
}
.ab-suggest-name {
  font-weight: 600;
  font-size: .95rem;
}
.ab-suggest-meta {
  font-size: .78rem;
  color: #6c7a86;
}
.ab-suggest-empty {
  padding: .7rem .8rem;
  color: #6c7a86;
  font-size: .9rem;
}

/* Multi party picker tables (report form) */
.ab-party-picker {
  background: rgba(118, 8, 7, .03);
  border: 1px solid rgba(118, 8, 7, .1);
  border-radius: 12px;
  padding: .9rem 1rem 1rem;
}
.ab-party-table-wrap {
  background: #fff;
  border: 1px solid rgba(118, 8, 7, .12);
  border-radius: 10px;
  overflow: hidden;
}
.ab-party-table {
  margin-bottom: 0;
}
.ab-party-table th {
  font-size: .8rem;
  color: #5a6b76;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(118, 8, 7, .04);
}
.ab-party-table td {
  vertical-align: middle;
  font-size: .92rem;
}
.ab-party-type {
  display: inline-block;
  font-size: .75rem;
  padding: .15rem .45rem;
  border-radius: 6px;
  background: rgba(253, 192, 7, .12);
  color: #760807;
}
.ab-party-empty {
  border-top: 1px dashed rgba(118, 8, 7, .15);
}
.ab-party-status {
  min-height: 1.2em;
  color: #760807;
  font-weight: 600;
}
.ab-party-status.is-error {
  color: #b42318;
}

/* =========================================================
   Safety CYP compatibility aliases (legacy class names)
   ========================================================= */
.card-cyp {
  background: var(--ab-surface);
  border: 1px solid var(--ab-border);
  border-radius: var(--ab-radius);
  box-shadow: var(--ab-shadow);
  margin-bottom: 1.25rem;
}
.card-cyp .card-header {
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--ab-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  background: transparent;
}
.card-cyp .card-header h5 { margin: 0; font-size: 1.05rem; }
.card-cyp .card-body { padding: 1.2rem; }

.btn-cyp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: var(--ab-primary);
  color: #fff !important;
  border: 1px solid var(--ab-primary);
  border-radius: .375rem;
  padding: .375rem .75rem;
  font-weight: 500;
  font-size: .875rem;
  line-height: 1.5;
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.btn-cyp:hover,
.btn-cyp:focus {
  background: #5a0606;
  border-color: #5a0606;
  color: #fff !important;
}
.btn-cyp-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  background: transparent;
  color: var(--ab-primary) !important;
  border: 1px solid var(--ab-primary);
  border-radius: .375rem;
  padding: .375rem .75rem;
  font-weight: 500;
  font-size: .875rem;
}
.btn-cyp-outline:hover {
  background: var(--ab-primary);
  color: #fff !important;
}
.btn-cyp-navy {
  background: var(--ab-sidebar);
  color: #fff !important;
  border: 1px solid var(--ab-sidebar);
  border-radius: .375rem;
  padding: .375rem .75rem;
  font-weight: 500;
}

/* Bootstrap buttons → AntiBully primary palette */
.btn-primary {
  --bs-btn-bg: var(--ab-primary);
  --bs-btn-border-color: var(--ab-primary);
  --bs-btn-hover-bg: #5a0606;
  --bs-btn-hover-border-color: #5a0606;
  --bs-btn-active-bg: #3d0404;
  --bs-btn-active-border-color: #3d0404;
  --bs-btn-disabled-bg: var(--ab-primary);
  --bs-btn-disabled-border-color: var(--ab-primary);
}
.btn-outline-primary {
  --bs-btn-color: var(--ab-primary);
  --bs-btn-border-color: var(--ab-primary);
  --bs-btn-hover-bg: var(--ab-primary);
  --bs-btn-hover-border-color: var(--ab-primary);
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--ab-primary);
  --bs-btn-active-border-color: var(--ab-primary);
  --bs-btn-active-color: #fff;
}

.badge-status {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .3rem .65rem; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-received { background: #dbeafe; color: #1e40af; }
.badge-in_progress { background: #bfdbfe; color: #1e3a8a; }
.badge-waiting { background: #f3e8ff; color: #6b21a8; }
.badge-resolved, .badge-closed, .badge-success { background: #d1fae5; color: #065f46; }
.badge-rejected, .badge-danger { background: #fee2e2; color: #991b1b; }
.badge-urgent { background: #fee2e2; color: #991b1b; }
.badge-high { background: #ffedd5; color: #9a3412; }
.badge-medium { background: #e0f2fe; color: #075985; }
.badge-low { background: #f1f5f9; color: #475569; }

.table-cyp thead th {
  background: rgba(15, 118, 110, .06);
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ab-muted); font-weight: 700; border: none; padding: .85rem 1rem;
}
.table-cyp tbody td { padding: .85rem 1rem; vertical-align: middle; border-color: var(--ab-border); font-size: 14px; }

.auth-page { /* legacy alias */ }
.measure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.measure-card {
  background: var(--ab-surface);
  border-radius: var(--ab-radius);
  padding: 1.35rem;
  border: 1px solid var(--ab-border);
  box-shadow: var(--ab-shadow);
  transition: transform .2s ease, box-shadow .2s ease;
  height: 100%;
}
.measure-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(15, 39, 68, .12); }
.measure-num {
  width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(135deg, var(--ab-primary), var(--ab-sidebar-2));
  color: #fff; display: grid; place-items: center; font-weight: 800; margin-bottom: .85rem;
}
.measure-card h3 { font-size: 1.02rem; margin: 0; color: var(--ab-sidebar-2); line-height: 1.4; }

.font-display { font-family: var(--ab-font); font-weight: 700; }
.section { padding: 4rem 1.5rem; }
.section-title { font-size: clamp(1.6rem, 3vw, 2.2rem); margin: 0 0 .5rem; color: var(--ab-primary); }
.section-sub { color: var(--ab-muted); margin-bottom: 2rem; max-width: 50ch; }

/* Safety CYP brand surfaces (keep AntiBully sidemenu/button behavior) */
.sidebar {
  background: linear-gradient(180deg, var(--ab-sidebar), var(--ab-sidebar-2));
}
/* Force AntiBully active/hover — gold active, gold tint hover */
.sidebar-nav a:hover {
  background: rgba(247, 179, 43, .22) !important;
  color: #fff !important;
  box-shadow: inset 3px 0 0 0 var(--ab-accent) !important;
}
.sidebar-nav a:hover i {
  color: var(--ab-accent) !important;
  opacity: 1 !important;
}
.sidebar-nav a.active {
  background: var(--ab-accent) !important;
  color: #1b2838 !important;
  font-weight: 700 !important;
  box-shadow: 0 4px 14px rgba(247, 179, 43, .35) !important;
}
.sidebar-nav a.active i {
  color: #1b2838 !important;
  opacity: 1 !important;
}
.sidebar-nav a.active:hover {
  background: #ffc107 !important;
  color: #1b2838 !important;
  box-shadow: 0 4px 16px rgba(247, 179, 43, .45) !important;
}
.sidebar-nav a.active:hover i {
  color: #1b2838 !important;
}

.auth-visual {
  background:
    radial-gradient(circle at 18% 20%, rgba(253,192,7,.28), transparent 42%),
    radial-gradient(circle at 85% 75%, rgba(247,179,43,.18), transparent 40%),
    linear-gradient(160deg, #5a0606 0%, #760807 55%, #9a2020 100%);
}
.ab-nav {
  background: linear-gradient(90deg, #5a0606, #760807);
}
body.page-home .ab-nav.is-scrolled {
  background: linear-gradient(90deg, rgba(90,6,6,.96), rgba(118,8,7,.96));
}
.ab-hero {
  background:
    linear-gradient(120deg, rgba(90,6,6,.88), rgba(118,8,7,.55)),
    radial-gradient(circle at 20% 20%, rgba(253,192,7,.35), transparent 40%),
    url('../img/hero-pattern.svg'),
    #760807;
}
.ab-footer { background: #5a0606; }

/* Dashboard polish */
.dash-kpi .stat-card {
  min-height: 108px;
}
.dash-kpi .stat-card .icon {
  background: rgba(118, 8, 7, .1);
  color: var(--ab-primary);
}
.dash-kpi .stat-card.accent-warn .icon {
  background: rgba(245, 158, 11, .15);
  color: #d97706;
}
.dash-kpi .stat-card.accent-gold .icon {
  background: rgba(247, 179, 43, .2);
  color: #b7811a;
}
.dash-clock__time {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ab-primary);
  line-height: 1.1;
}
.dash-chart,
.dash-chart-tall {
  position: relative;
  width: 100%;
}
.dash-chart { height: 260px; }
.dash-chart-tall { height: 300px; }
.dash-scroll {
  max-height: 340px;
  overflow: auto;
}
.dash-scroll::-webkit-scrollbar { width: 6px; }
.dash-scroll::-webkit-scrollbar-thumb {
  background: rgba(118, 8, 7, .25);
  border-radius: 999px;
}
@media (max-width: 991.98px) {
  .dash-chart { height: 220px; }
  .dash-chart-tall { height: 240px; }
}

/* AI assistant widget (admin + frontend) */
.ai-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1050;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--ab-primary);
  color: #fff;
  box-shadow: 0 8px 24px rgba(118, 8, 7, .35);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease;
}
.ai-fab:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 10px 28px rgba(118, 8, 7, .45);
  color: #fff;
}
.ai-panel {
  display: none;
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 1050;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  flex-direction: column;
  overflow: hidden;
  margin: 0 !important;
  background: var(--ab-surface, #fff);
  border: 1px solid var(--ab-border, #e5e7eb);
  border-radius: var(--ab-radius, 14px);
  box-shadow: 0 16px 40px rgba(118, 8, 7, .22);
}
.ai-panel:not([hidden]) {
  display: flex;
}
.ai-panel__header {
  background: linear-gradient(135deg, var(--ab-sidebar, #5a0606), var(--ab-primary, #760807));
  color: #fff;
  border-bottom: 0;
  flex: 0 0 auto;
}
.ai-panel__header small { opacity: .85; }
.ai-panel__body {
  flex: 1 1 auto;
  overflow: auto;
  overflow-x: hidden;
  background: #f7fafc;
  min-width: 0;
}
.ai-panel__body > .p-2.rounded,
.ai-msg-row {
  margin-bottom: .65rem;
  max-width: 100%;
  min-width: 0;
}
.ai-msg-row--user {
  display: flex;
  justify-content: flex-end;
}
.ai-msg {
  display: inline-block;
  max-width: 100%;
  padding: .55rem .75rem;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-sizing: border-box;
}
.ai-msg--user {
  max-width: min(92%, 280px);
  background: var(--ab-primary, #760807);
  color: #fff;
  text-align: left;
  border-bottom-right-radius: 4px;
}
.ai-msg--bot {
  max-width: 100%;
  background: #fff;
  border: 1px solid var(--ab-border, #e5e7eb);
  color: var(--ab-text, #2a181a);
  border-bottom-left-radius: 4px;
}
.ai-panel__form {
  flex: 0 0 auto;
  background: #fff;
}
body.page-home .ai-fab,
body.page-inner .ai-fab {
  bottom: 28px;
}
@media (max-width: 575.98px) {
  .ai-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 84px;
  }
  .ai-fab {
    right: 16px;
    bottom: 16px;
  }
}

/* 7 Measures public/admin cards */
.measure-grid--rich,
.measure-grid--admin {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.measure-card--rich {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: 1.2rem 1.25rem 1.1rem;
  min-height: 210px;
  background: var(--ab-surface, #fff);
  border: 1px solid var(--ab-border, #e5e7eb);
  border-radius: var(--ab-radius, 14px);
  box-shadow: var(--ab-shadow);
  color: inherit;
  transition: transform .2s ease, box-shadow .2s ease;
}
.measure-card--rich:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(118, 8, 7, .12);
  color: inherit;
}
.measure-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .15rem;
}
.measure-card--rich .measure-num {
  margin-bottom: 0;
  flex: 0 0 auto;
}
.measure-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(118, 8, 7, .1);
  color: var(--ab-primary);
  font-size: 1.1rem;
  flex: 0 0 auto;
}
.measure-card__summary {
  margin: 0;
  color: var(--ab-muted);
  font-size: .9rem;
  line-height: 1.45;
  flex: 1;
}
.measure-card__link {
  color: var(--ab-primary);
  font-size: .88rem;
  font-weight: 600;
}
.measure-hero__badge {
  display: inline-block;
  background: rgba(118, 8, 7, .1);
  color: var(--ab-primary);
  border-radius: 999px;
  padding: .25rem .75rem;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .75rem;
}
.measure-hero__icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ab-sidebar, #5a0606), var(--ab-primary));
  color: #fff;
  font-size: 1.35rem;
  flex: 0 0 auto;
}
