@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&family=Mitr:wght@400;500;600&display=swap');

:root {
  /* === PRIMARY PINK PALETTE === */
  --pink-50: #FFF0F5;
  /* พื้นหลังอ่อนมาก, hover state */
  --pink-100: #FFE0EC;
  /* พื้นหลัง card, section tint */
  --pink-200: #FFBDD4;
  /* border, divider */
  --pink-300: #FF8FB5;
  /* accent อ่อน */
  --pink-400: #FF6699;
  /* secondary button, tag */
  --pink-500: #F04E7A;
  /* primary action, active state */
  --pink-600: #D63568;
  /* hover on primary */
  --pink-700: #A8224F;
  /* text on light bg, dark accent */

  /* === NEUTRALS === */
  --white: #FFFFFF;
  --surface: #FDFAFB;
  /* app background — off-white warm */
  --surface-2: #F7F2F5;
  /* sidebar, panel background */
  --border: #EDE0E8;
  /* subtle border */
  --border-mid: #D4C2CC;
  /* form border */
  --text-primary: #2D1A24;
  /* หัวข้อ, body text */
  --text-secondary: #7A5568;
  /* subtext, placeholder */
  --text-muted: #B08FA0;
  /* hint, disabled */

  /* === SEMANTIC COLORS === */
  --success: #2ECC8A;
  --success-bg: #EDFAF4;
  --warning: #F5A623;
  --warning-bg: #FEF7E9;
  --danger: #E8445A;
  --danger-bg: #FDEEF0;
  --info: #5B8DEF;
  --info-bg: #EEF3FE;

  /* === SHADOW === */
  --shadow-xs: 0 1px 3px rgba(240, 78, 122, 0.06);
  --shadow-sm: 0 2px 8px rgba(240, 78, 122, 0.10);
  --shadow-md: 0 4px 20px rgba(240, 78, 122, 0.14);
  --shadow-lg: 0 8px 40px rgba(240, 78, 122, 0.18);

  /* === TYPOGRAPHY === */
  --font-display: 'Mitr', sans-serif;
  --font-body: 'Sarabun', sans-serif;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;

  --leading-tight: 1.3;
  --leading-normal: 1.6;
  --leading-loose: 1.8;

  /* === SPACING === */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* === RADIUS === */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* === LAYOUT === */
  --sidebar-width: 280px;
  --topbar-height: 80px;
  --content-padding: var(--space-6);
}

/* Base Styles */
* {
  box-sizing: border-box;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-primary);
  line-height: var(--leading-loose);
  background-color: var(--surface);
  margin: 0;
  overflow-x: hidden;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--pink-500);
  color: white;
  box-shadow: 0 2px 10px rgba(240, 78, 122, 0.30);
}

.btn-primary:hover {
  background: var(--pink-600);
  box-shadow: 0 4px 16px rgba(240, 78, 122, 0.40);
  transform: translateY(-1px);
}

/* Secondary — ปุ่มรองโทนกลาง (เช่น "ปิดหน้าต่าง" ใน modal) */
.btn-secondary {
  background: var(--surface-2);
  color: var(--text-primary);
  border: none;
}

.btn-secondary:hover {
  background: var(--border);
  color: var(--text-primary);
}

/* Danger — ปุ่มลบ/ยกเลิกถาวร */
.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  filter: brightness(0.93);
  color: white;
}

/* Warning — ปุ่มตีกลับแก้ไข (สีเหลือง) */
.btn-warning {
  background: var(--warning);
  color: white;
}

.btn-warning:hover {
  filter: brightness(0.95);
  color: white;
}

.btn:active {
  transform: scale(0.97);
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* Form Elements */
.form-group {
  margin-bottom: var(--space-5);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  line-height: normal;
  height: 46px;
}

.form-control:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(240, 78, 122, 0.12);
}

.form-select {
  padding: 0.75rem 2.25rem 0.75rem 1rem;
  border: 1.5px solid var(--border-mid);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--text-primary);
  background-color: var(--white);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  height: 46px;
}

.form-select:focus {
  border-color: var(--pink-400);
  box-shadow: 0 0 0 3px rgba(240, 78, 122, 0.12);
}

/* Small variants */
.form-control-sm,
.form-select-sm {
  height: 38px !important;
  font-size: 0.85rem !important;
  padding-top: 0.4rem !important;
  padding-bottom: 0.4rem !important;
}

input[type="date"].form-control,
input[type="date"].form-control-sm {
  appearance: none;
  -webkit-appearance: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

::-webkit-calendar-picker-indicator {
  cursor: pointer;
  padding: 5px;
  filter: invert(0.4) sepia(1) saturate(5) hue-rotate(300deg); /* Style the icon to match theme */
  opacity: 0.6;
  transition: opacity 0.2s;
}

::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

.input-group-text {
  background-color: var(--white);
  border: 1.5px solid var(--border-mid);
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: 0 0.75rem;
}

.input-group .form-control,
.input-group .form-select {
  border-left: none;
}

.input-group *:focus {
  z-index: 3;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeInUp 0.5s ease forwards;
}

/* Login Page Specifics */
.login-container {
  display: flex;
  min-height: 100vh;
}

.login-form-side {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-8);
  background-color: var(--surface);
  z-index: 2;
}

.login-image-side {
  flex: 1.2;
  position: relative;
  overflow: hidden;
  display: none;
  /* Hidden on small screens */
}

@media (min-width: 992px) {
  .login-image-side {
    display: block;
  }
}

.login-bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.login-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(240, 78, 122, 0.3), rgba(168, 34, 79, 0.6));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: var(--space-16);
  color: white;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: var(--space-10);
  background: var(--white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.school-logo {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-6);
}

.login-title {
  margin-bottom: var(--space-2);
  font-weight: 600;
  color: var(--text-primary);
}

.login-subtitle {
  color: var(--text-secondary);
  margin-bottom: var(--space-8);
  font-size: var(--text-sm);
}

/* Specific page tweaks */
.login-card {
  border: none;
}

.image-caption h2 {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-4);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.image-caption p {
  font-size: var(--text-lg);
  opacity: 0.9;
  font-weight: 300;
}

.auth-footer {
  margin-top: var(--space-8);
  text-align: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.btn-login {
  width: 100%;
  height: 48px;
  font-size: var(--text-base);
  margin-top: var(--space-4);
}

/* Float animation for logo */
@keyframes float {
  0% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }

  100% {
    transform: translateY(0px);
  }
}

.school-logo {
  animation: float 4s ease-in-out infinite;
}

/* Utility Classes to replace inline styles */
.text-sm {
  font-size: var(--text-sm) !important;
}

.text-pink-500 {
  color: var(--pink-500) !important;
}

.no-underline {
  text-decoration: none !important;
}

.delay-200 {
  animation-delay: 0.2s !important;
}

/* Stat card (Dashboard) */
.stat-card {
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  height: 100%;
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  background: var(--pink-100);
  color: var(--pink-500);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 600;
  color: var(--text-primary);
}

.stat-card .stat-subtitle {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: -var(--space-2);
}

.stat-card .stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.stat-card .stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: var(--space-3);
}

.stat-item {
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.stat-item .label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
}

.stat-item .value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.badge:hover {
  transform: translateY(-1px);
  filter: brightness(0.95);
  box-shadow: var(--shadow-sm);
}

.badge-draft {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.badge-pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-checking {
  background: var(--info-bg);
  color: var(--info);
}

.badge-approved {
  background: var(--success-bg);
  color: var(--success);
}

.badge-rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.badge-cancelled {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Role Badges */
.badge-admin {
  background: var(--pink-600);
  color: var(--white);
}

.badge-teacher {
  background: var(--info-bg);
  color: var(--info);
}

.badge-staff {
  background: var(--surface-2);
  color: var(--text-secondary);
}

.badge-hr {
  background: var(--success-bg);
  color: var(--success);
}

.badge-vicedir {
  background: var(--warning-bg);
  color: var(--warning);
}

.badge-director {
  background: var(--pink-100);
  color: var(--pink-600);
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: width 0.25s ease;
}

.sidebar-brand {
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-600));
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: var(--space-5) var(--space-5) var(--space-2);
}

.nav-item {
  list-style: none;
  padding: 0;
  margin: 0;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.625rem var(--space-5);
  border-radius: var(--radius-md);
  margin: 1px var(--space-3);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 400;
  transition: all 0.15s ease;
}

.nav-item a:hover {
  background: var(--pink-50);
  color: var(--pink-600);
}

.nav-item a.active {
  background: var(--pink-100);
  color: var(--pink-600);
  font-weight: 500;
}

.nav-item a.active .nav-icon {
  color: var(--pink-500);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  opacity: 0.8;
}

.nav-badge {
  margin-left: auto;
  background: var(--pink-500);
  color: white;
  font-size: 0.65rem;
  padding: 0.1rem 0.45rem;
  border-radius: var(--radius-full);
}

/* Topbar */
.topbar {
  height: var(--topbar-height);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--space-8);
  gap: var(--space-4);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-xs);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.notif-btn:hover {
  background: var(--pink-50);
  color: var(--pink-500);
  border-color: var(--pink-200);
}

.notif-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--pink-500);
  border-radius: 50%;
  border: 2px solid white;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--pink-300), var(--pink-500));
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  text-decoration: none;
}

/* Dropdown Custom Styles */
.dropdown-menu {
  padding: var(--space-2);
  border-radius: var(--radius-md);
  border: none;
  box-shadow: var(--shadow-md);
  margin-top: var(--space-2) !important;
}

.dropdown-item {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.dropdown-item:hover {
  background-color: var(--pink-50);
  color: var(--pink-600);
}

.dropdown-item i {
  width: 16px;
  text-align: center;
  opacity: 0.7;
}

.dropdown-item.text-danger:hover {
  background-color: var(--danger-bg);
  color: var(--danger);
}

.dropdown-divider {
  margin: var(--space-2) 0;
  border-top-color: var(--border);
}

/* Content Area */
.main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  transition: margin-left 0.25s ease;
}

.page-content {
  flex: 1;
  padding: var(--space-8);
}

/* Tables */
.table-wrapper {
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead tr {
  background: var(--surface-2);
}

.data-table thead th {
  padding: 0.875rem var(--space-5);
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  white-space: nowrap;
}

.data-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}

.data-table tbody tr:hover {
  background: var(--pink-50);
}

.data-table tbody td {
  padding: 1rem var(--space-5);
  font-size: var(--text-sm);
  color: var(--text-primary);
  vertical-align: middle;
}

/* Actions utility */
.table-actions {
  display: flex;
  gap: var(--space-2);
}

/* Approval Timeline */
.timeline {
  padding: var(--space-2) 0;
}

.timeline-item {
  display: flex;
  gap: var(--space-4);
  padding-bottom: var(--space-6);
  position: relative;
}

.timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  position: relative;
  z-index: 1;
}

.timeline-icon.approved {
  background: var(--success-bg);
  color: var(--success);
}

.timeline-icon.pending {
  background: var(--warning-bg);
  color: var(--warning);
}

.timeline-icon.rejected {
  background: var(--danger-bg);
  color: var(--danger);
}

.timeline-icon.waiting {
  background: var(--surface-2);
  color: var(--text-muted);
}

/* Timeline แนวนอน (ใช้ในรายละเอียดใบลา) */
.timeline-h {
  display: flex;
  align-items: flex-start;
  gap: 0;
  padding: var(--space-4) 0 var(--space-2);
  overflow-x: auto;
}

.timeline-h .timeline-item {
  flex: 1 1 0;
  min-width: 96px;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-2);
  padding-bottom: 0;
}

/* เส้นเชื่อมแนวนอนระหว่างไอคอน */
.timeline-h .timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 19px;
  bottom: auto;
  width: 100%;
  height: 2px;
  background: var(--border);
}

.timeline-h .timeline-icon {
  margin: 0 auto;
}

.timeline-h .timeline-content h6 {
  font-size: var(--text-xs);
}

.timeline-h .timeline-content p {
  font-size: 0.7rem;
}

.timeline-content h6 {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

.timeline-content p {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin: 0;
}

.timeline-time {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-1);
}

/* Profile Page Components */
.profile-header-card {
  position: relative;
  background: var(--white);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: var(--space-6);
}

.profile-banner {
  height: 100px;
  background: linear-gradient(135deg, var(--pink-100), var(--pink-200));
}

@media (min-width: 768px) {
  .profile-banner {
    height: 100px;
  }
}

.profile-header-content {
  padding: 0 var(--space-8) var(--space-4);
  margin-top: -45px;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
  z-index: 2;
}

@media (min-width: 768px) {
  .profile-header-content {
    flex-direction: row;
    align-items: flex-end;
    gap: var(--space-6);
    text-align: left;
    margin-top: -100px;
  }
}

.profile-avatar-lg {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-lg);
  background: white;
  padding: 6px;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-4);
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .profile-avatar-lg {
    margin-bottom: 0;
  }
}

.avatar-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--pink-400), var(--pink-600));
  border-radius: calc(var(--radius-lg) - 4px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 3rem;
  font-weight: 600;
  font-family: var(--font-display);
}

.profile-summary {
  padding-top: var(--space-2);
}

.profile-summary h2 {
  margin-bottom: var(--space-1);
  font-size: var(--text-2xl);
}

.profile-summary p {
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.35rem 0.85rem;
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
}

/* Custom Tabs */
.nav-tabs-custom {
  display: flex;
  gap: var(--space-8);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-6);
}

.nav-tabs-custom .tab-link {
  padding: var(--space-3) 0;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--text-sm);
  position: relative;
  transition: color 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

.nav-tabs-custom .tab-link:hover {
  color: var(--pink-500);
}

.nav-tabs-custom .tab-link.active {
  color: var(--pink-500);
  font-weight: 600;
}

.nav-tabs-custom .tab-link.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--pink-500);
}

/* Info Grid Layout */
.info-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 992px) {
  .info-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.info-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  border: 1px solid var(--border);
}

.info-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--pink-600);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-2);
  border-bottom: 1px dashed var(--pink-200);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.data-row {
  display: flex;
  justify-content: space-between;
  padding: var(--space-2) 0;
  border-bottom: 1px solid var(--pink-50);
}

.data-row:last-child {
  border-bottom: none;
}

.data-label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
}

.data-value {
  color: var(--text-primary);
  font-weight: 500;
  font-size: var(--text-sm);
  text-align: right;
}

.doc-download-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--info);
  text-decoration: none;
  font-size: var(--text-xs);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}

.doc-download-link:hover {
  background: var(--info-bg);
  text-decoration: underline;
}

/* Responsive Breakpoints */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0 !important;
  }
}

/* Grid helpers override for standard scaling if needed */
.grid-stack {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 768px) {
  .grid-stack-md-2 {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-stack-md-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1200px) {
  .grid-stack-lg-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-stack-lg-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Download Management & Helper Classes */
.bg-pink-100 { background: var(--pink-100); }
.text-pink-600 { color: var(--pink-600); }
.bg-blue-100 { background: #e0f2fe; }
.text-blue-600 { color: #0284c7; }
.btn-pink { background: var(--pink-600); color: white; border: none; }
.btn-pink:hover { background: var(--pink-500); color: white; }
.extra-small { font-size: 0.75rem; }
.uppercase { text-transform: uppercase; letter-spacing: 0.025em; }
.border-dashed { border-style: dashed !important; }
.btn-outline-pink { border-color: var(--pink-600); color: var(--pink-600); }
.btn-outline-pink:hover { background: var(--pink-600); color: white; }
.btn-ghost { color: var(--text-muted); border: none; background: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text-primary); }
.tracking-wider { letter-spacing: 0.05em; }

/* ---------- รายการไฟล์แนบ (modal รายละเอียดเอกสาร) — เรียงแนวนอน ประหยัดพื้นที่ ---------- */
.attachment-list { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.attachment-item {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.35rem 0.625rem;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; color: var(--text-primary); text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.attachment-item:hover { background: #fff; border-color: var(--pink-500); color: var(--pink-500); }
.attachment-icon { font-size: 0.95rem; color: var(--pink-500); flex: 0 0 auto; }
.attachment-name {
  max-width: 200px; font-size: 0.8rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.attachment-open { font-size: 0.72rem; color: var(--text-muted); flex: 0 0 auto; }
.attachment-item:hover .attachment-open { color: var(--pink-500); }