/* CSS สำหรับระบบคลังวัสดุซ่อมแซมและสต็อกหอพักนักศึกษา มรธ */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary: #0f766e;
  --secondary-light: #ccfbf1;
  --success: #15803d;
  --success-light: #dcfce7;
  --warning: #b45309;
  --warning-light: #fef3c7;
  --danger: #b91c1c;
  --danger-light: #fee2e2;
  --dark: #0f172a;
  --gray-700: #334155;
  --gray-500: #64748b;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  --sidebar-width: 275px;
  --border-radius: 10px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
  background-color: var(--gray-100);
  color: var(--dark);
  font-size: 14.5px;
  line-height: 1.5;
  overflow-x: hidden;
}

/* App Container */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 2px 0 8px rgba(0,0,0,0.15);
}

.sidebar-header {
  padding: 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar-header .logo-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  color: white;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.5);
}

.sidebar-header .logo-text h1 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: #f8fafc;
}

.sidebar-header .logo-text p {
  font-size: 11.5px;
  color: #94a3b8;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 10px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.active {
  background: linear-gradient(90deg, #2563eb, #1d4ed8);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 10px rgba(37, 99, 235, 0.35);
}

.nav-item .icon {
  font-size: 18px;
  width: 22px;
  text-align: center;
}

/* Sidebar Group, Submenu & Divider */
.sidebar-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 12px 6px 8px;
}

.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #94a3b8;
  padding: 4px 14px 6px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-sub-menu {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-left: 18px;
  padding-left: 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin-top: 2px;
  margin-bottom: 4px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  color: #94a3b8;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
}

.nav-sub-item:hover {
  background-color: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.nav-sub-item.active {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
  font-weight: 600;
}

.nav-sub-item .sub-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
}

/* Settings Top Nav Bar & Tabs */
.settings-nav-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  background: #ffffff;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.settings-subtab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
}

.settings-subtab-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.settings-subtab-btn.active {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-color: #3b82f6;
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
}

.settings-subtab-btn .subtab-icon {
  font-size: 24px;
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.settings-subtab-btn.active .subtab-icon {
  background: #2563eb;
  color: #ffffff;
}

.settings-subtab-btn .subtab-text {
  display: flex;
  flex-direction: column;
}

.settings-subtab-btn .subtab-text strong {
  font-size: 14.5px;
  color: #1e293b;
}

.settings-subtab-btn.active .subtab-text strong {
  color: #1d4ed8;
}

.settings-subtab-btn .subtab-text small {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 2px;
}

.settings-subpane {
  display: none;
}

.settings-subpane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 12px;
  color: #94a3b8;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Main Content */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Navbar */
.topbar {
  height: 64px;
  background-color: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow-sm);
}

.topbar-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--dark);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.badge-live {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-live::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

/* Page Content View */
.content-body {
  padding: 24px 28px;
  flex: 1;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--border-radius);
  padding: 20px;
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.kpi-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.kpi-icon.blue { background-color: #dbeafe; color: #1d4ed8; }
.kpi-icon.emerald { background-color: #d1fae5; color: #047857; }
.kpi-icon.amber { background-color: #fef3c7; color: #b45309; }
.kpi-icon.rose { background-color: #ffe4e6; color: #be123c; }

.kpi-info h4 {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
  margin-bottom: 4px;
}

.kpi-info .kpi-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--dark);
}

.kpi-info .kpi-sub {
  font-size: 11.5px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* Segmented Control Buttons */
.btn-segment {
  border: none;
  background: transparent;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-segment:hover {
  color: #1e293b;
}
.btn-segment.active {
  background: white;
  color: #1e40af;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Card Sections */
.card {
  background: var(--white);
  border-radius: var(--border-radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  background-color: #fafbfc;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.3);
}

.btn-secondary {
  background-color: var(--white);
  color: var(--gray-700);
  border-color: var(--gray-200);
}

.btn-secondary:hover {
  background-color: var(--gray-50);
  border-color: #cbd5e1;
}

.btn-success {
  background-color: var(--success);
  color: var(--white);
}

.btn-success:hover {
  background-color: #166534;
}

.btn-danger {
  background-color: #ef4444;
  color: var(--white);
}

.btn-danger:hover {
  background-color: #dc2626;
}

.btn-warning {
  background-color: #f59e0b;
  color: var(--white);
}

.btn-warning:hover {
  background-color: #d97706;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 6px;
}

/* Toolbar & Filters */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 6px 12px;
  gap: 8px;
  min-width: 260px;
}

.search-box input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 13.5px;
  color: var(--dark);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.select-custom, .input-custom {
  padding: 7px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--gray-700);
  background-color: var(--white);
  outline: none;
  transition: border-color 0.15s ease;
}

.select-custom:focus, .input-custom:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Data Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
}

.table-custom {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  background-color: var(--white);
}

.table-custom th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  font-size: 13px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}

.table-custom td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  color: var(--gray-700);
  font-size: 13.5px;
  vertical-align: middle;
}

.table-custom tbody tr:hover {
  background-color: #f8fafc;
}

.table-custom tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background-color: var(--success-light); color: var(--success); }
.badge-warning { background-color: var(--warning-light); color: var(--warning); }
.badge-danger { background-color: var(--danger-light); color: var(--danger); }
.badge-info { background-color: var(--primary-light); color: var(--primary); }
.badge-neutral { background-color: var(--gray-100); color: var(--gray-700); }

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.active {
  display: flex;
}

#modal-room-picker {
  z-index: 1010;
}
#modal-room-detail-viewer {
  z-index: 1020;
}
#modal-room-appliances,
#modal-student-report,
#modal-student,
#modal-transfer,
#modal-checkout {
  z-index: 1030;
}

.modal-container {
  background: var(--white);
  border-radius: 12px;
  width: 100%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalScale 0.2s ease-out;
}

.modal-container.modal-lg {
  max-width: 850px;
}

@keyframes modalScale {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #f8fafc;
}

.modal-header h3 {
  font-size: 17px;
  font-weight: 700;
  color: var(--dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 4px;
  line-height: 1;
}

.modal-close:hover {
  color: var(--dark);
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #f8fafc;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group.col-span-2 {
  grid-column: span 2;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
}

.form-control {
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 7px;
  font-size: 14px;
  color: var(--dark);
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Notification Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  padding: 12px 18px;
  background-color: #1e293b;
  color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.25s ease;
}

.toast.success { background-color: #065f46; border-left: 4px solid #10b981; }
.toast.error { background-color: #881337; border-left: 4px solid #f43f5e; }
.toast.info { background-color: #1e3a8a; border-left: 4px solid #3b82f6; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Print Invoice & Statement Styling */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm 8mm 10mm;
  }

  html, body {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .app-layout {
    min-height: auto !important;
    height: auto !important;
  }

  .sidebar, .topbar, .btn, .toolbar, .search-box, .filter-group, #toast-container, .modal-close, .modal-footer,
  #login-screen, #disbursement-form-card, .no-print, .no-print-section {
    display: none !important;
  }
  #disbursement-form-card, .no-print, .no-print-section {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .print-area {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 15px !important;
  }

  /* จัดการพิมพ์หน้าต่างรายงานสรุปนักศึกษา */
  body.printing-report {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body.printing-report .app-layout,
  body.printing-report .sidebar,
  body.printing-report .topbar,
  body.printing-report .main-wrapper,
  body.printing-report #toast-container,
  body.printing-report .modal-overlay:not(#modal-student-report),
  body.printing-report #modal-student-report .modal-header,
  body.printing-report #modal-student-report .report-controls-bar,
  body.printing-report #modal-student-report #student-report-controls-bar,
  body.printing-report #modal-student-report .modal-footer {
    display: none !important;
  }
  body.printing-report #modal-student-report {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.printing-report #modal-student-report .modal-container {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.printing-report #modal-student-report .modal-body {
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-report #student-report-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  body.printing-report table {
    page-break-inside: auto !important;
  }
  body.printing-report tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  body.printing-report thead {
    display: table-header-group !important;
  }
  body.printing-report tfoot {
    display: table-footer-group !important;
  }

  /* จัดการพิมพ์หน้าต่างรายงานสรุปสต็อกคงเหลือและทะเบียนคุมพัสดุ */
  body.printing-stock-report {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body.printing-stock-report .app-layout,
  body.printing-stock-report .sidebar,
  body.printing-stock-report .topbar,
  body.printing-stock-report .main-wrapper,
  body.printing-stock-report #toast-container,
  body.printing-stock-report .modal-overlay:not(#modal-stock-print-report),
  body.printing-stock-report #modal-stock-print-report .modal-header,
  body.printing-stock-report #modal-stock-print-report .report-controls-bar,
  body.printing-stock-report #modal-stock-print-report #stock-report-controls-bar,
  body.printing-stock-report #modal-stock-print-report .modal-footer {
    display: none !important;
  }
  body.printing-stock-report #modal-stock-print-report {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.printing-stock-report #modal-stock-print-report .modal-container {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.printing-stock-report #modal-stock-print-report .modal-body {
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-stock-report #stock-print-report-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  body.printing-stock-report table {
    page-break-inside: auto !important;
  }
  body.printing-stock-report tr {
    page-break-inside: avoid !important;
    page-break-after: auto !important;
  }
  body.printing-stock-report thead {
    display: table-header-group !important;
  }
  body.printing-stock-report tfoot {
    display: table-footer-group !important;
  }

  /* จัดการพิมพ์ใบส่งมอบห้องและตรวจสภาพการย้ายออก RTU-OUT-01 */
  body.printing-clearance {
    background: #ffffff !important;
    color: #000000 !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
  }
  body.printing-clearance .app-layout,
  body.printing-clearance .sidebar,
  body.printing-clearance .topbar,
  body.printing-clearance .main-wrapper,
  body.printing-clearance #toast-container,
  body.printing-clearance .modal-overlay:not(#modal-movement-clearance),
  body.printing-clearance #modal-movement-clearance .modal-header,
  body.printing-clearance #modal-movement-clearance .modal-footer,
  body.printing-clearance #modal-movement-clearance button {
    display: none !important;
  }
  body.printing-clearance #modal-movement-clearance {
    position: static !important;
    display: block !important;
    background: #ffffff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }
  body.printing-clearance #modal-movement-clearance .modal-container {
    max-width: 100% !important;
    width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    border-radius: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.printing-clearance #modal-movement-clearance .modal-body {
    padding: 0 !important;
    margin: 0 !important;
  }
  body.printing-clearance #movement-clearance-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  body.printing-clearance table {
    page-break-inside: auto !important;
  }
  body.printing-clearance tr {
    page-break-inside: avoid !important;
  }

  /* จัดการพิมพ์หน้ารายงานสรุปการจ่ายออก/เบิกพัสดุ (Repairs / Disbursements) */
  body.printing-disbursement-report #disbursement-form-card,
  body.printing-disbursement-report .card-header.no-print,
  body.printing-disbursement-report .toolbar,
  body.printing-disbursement-report .modal-overlay {
    display: none !important;
  }
  body.printing-disbursement-report #disbursements-report-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.printing-disbursement-report #disbursement-print-header,
  body.printing-disbursement-report #disbursement-print-signatures {
    display: block !important;
  }
  body.printing-disbursement-report #disbursements-table th:last-child,
  body.printing-disbursement-report #disbursements-table td:last-child {
    display: none !important;
  }
  body.printing-disbursement-report #disbursements-table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 11.5px !important;
  }
  body.printing-disbursement-report #disbursements-table th,
  body.printing-disbursement-report #disbursements-table td {
    border: 1px solid #94a3b8 !important;
    padding: 5px 6px !important;
  }
  body.printing-disbursement-report #disbursements-table thead th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
  }
  body.printing-disbursement-report #disbursements-table tfoot td {
    background-color: #f8fafc !important;
    font-weight: 700 !important;
  }

  /* จัดการพิมพ์หน้ารายงานสรุปประวัติความเคลื่อนไหวการย้ายเข้า-ออก (Movements Report) */
  body.printing-movements-report #movements-stats-bar,
  body.printing-movements-report #movements-quick-filters,
  body.printing-movements-report #tab-movements .toolbar,
  body.printing-movements-report #tab-movements .card-header,
  body.printing-movements-report .sidebar,
  body.printing-movements-report .topbar,
  body.printing-movements-report .modal-overlay,
  body.printing-movements-report #toast-container {
    display: none !important;
  }
  body.printing-movements-report #movements-report-card {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
  }
  body.printing-movements-report #movements-print-header,
  body.printing-movements-report #movements-print-signatures {
    display: block !important;
  }
  /* ซ่อนคอลัมน์: ประเภทรายการ, ความจุห้องปลายทาง, และการจัดการ เมื่อสั่งพิมพ์รายงาน */
  body.printing-movements-report .col-mtype,
  body.printing-movements-report .col-mcapacity,
  body.printing-movements-report .col-mactions,
  body.printing-movements-report #movements-table th.col-mtype,
  body.printing-movements-report #movements-table td.col-mtype,
  body.printing-movements-report #movements-table th.col-mcapacity,
  body.printing-movements-report #movements-table td.col-mcapacity,
  body.printing-movements-report #movements-table th.col-mactions,
  body.printing-movements-report #movements-table td.col-mactions,
  body.printing-movements-report #movements-table th:last-child,
  body.printing-movements-report #movements-table td:last-child {
    display: none !important;
  }
  body.printing-movements-report #movements-tfoot td.only-print {
    display: table-cell !important;
  }
  body.printing-movements-report #movements-tfoot td.no-print {
    display: none !important;
  }
  body.printing-movements-report #movements-table {
    border-collapse: collapse !important;
    width: 100% !important;
    font-size: 11.5px !important;
  }
  body.printing-movements-report #movements-table th,
  body.printing-movements-report #movements-table td {
    border: 1px solid #94a3b8 !important;
    padding: 6px 8px !important;
  }
  body.printing-movements-report #movements-table thead th {
    background-color: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 700 !important;
  }
  body.printing-movements-report #movements-table tfoot td {
    background-color: #f8fafc !important;
    font-weight: 700 !important;
  }
}

/* ========================================================
   Kanban Board Styles for Students / Dormitory Rooms
   ======================================================== */
.kanban-wrapper {
  display: grid;
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  gap: 20px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 20px;
}

@media (max-width: 1024px) {
  .kanban-wrapper {
    grid-template-columns: 1fr;
  }
}

.kanban-column {
  background: #f8fafc;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
  transition: all 0.2s ease;
}

.kanban-column:hover {
  border-color: #cbd5e1;
}

.kanban-column-header {
  padding: 16px 18px;
  background: #ffffff;
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
  border-bottom: 3px solid;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.kanban-column-header.bld-a { border-bottom-color: #2563eb; }
.kanban-column-header.bld-b { border-bottom-color: #059669; }
.kanban-column-header.bld-c { border-bottom-color: #d97706; }

.kanban-column-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-column-stats {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
}

.kanban-cards-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 250px;
}

.kanban-card {
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
}

.kanban-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.08);
  border-color: #93c5fd;
}

.kanban-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}

.kanban-room-badge {
  font-size: 14px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.kanban-student-row {
  margin-bottom: 12px;
}

.kanban-student-name {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kanban-student-code {
  font-size: 12.5px;
  color: #64748b;
  margin-top: 2px;
}

.kanban-repair-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
}

.kanban-repair-section.has-repairs {
  background: #fffbeb;
  border-color: #fde68a;
}

.kanban-repair-item {
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px dashed #e2e8f0;
}

.kanban-repair-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.kanban-materials-section {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.kanban-materials-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
}

.kanban-materials-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  padding: 3px 0;
  color: #166534;
  border-bottom: 1px dashed #dcfce7;
}

.kanban-materials-list li:last-child {
  border-bottom: none;
}

.kanban-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  gap: 8px;
}

/* Room Electrical Appliances Section */
.kanban-appliances-section {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.kanban-appliances-list {
  list-style: none;
  padding: 0;
  margin: 6px 0;
}

.kanban-appliances-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  padding: 3px 0;
  color: #92400e;
  border-bottom: 1px dashed #fef3c7;
}

.kanban-appliances-list li:last-child {
  border-bottom: none;
}

/* Room Combined Total Billing Section */
.kanban-total-section {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 0;
}

/* Room Students Pills List */
.room-students-pills {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin: 6px 0 10px;
}

.room-student-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 13px;
}

/* Checklist items in Appliance Selector Modal */
.room-app-checklist-item {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px;
  transition: all 0.15s ease;
}

.room-app-checklist-item:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.room-app-checklist-item.selected {
  background: #fffbeb;
  border-color: #f59e0b;
}

.btn-outline-warning {
  background: transparent;
  border: 1px solid #d97706;
  color: #b45309;
}
.btn-outline-warning:hover {
  background: #fef3c7;
  color: #92400e;
}

/* =======================================================
   Room Selector & Room Picker (ระบบผังห้องพักและค่าใช้จ่ายหอพัก)
   ======================================================= */
.room-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.room-picker-card {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 13px 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 9px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.04);
  position: relative;
}

.room-picker-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

/* 🟢 สถานะ: ห้องว่างทั้งหมด (2 เตียง) */
.room-picker-card.is-vacant {
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 80%);
  border: 2px solid #86efac;
  border-top: 5px solid #16a34a;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.08);
}
.room-picker-card.is-vacant:hover {
  border-color: #16a34a;
  box-shadow: 0 10px 22px rgba(22, 163, 74, 0.22);
}

/* 🟡 สถานะ: ห้องว่าง 1 ที่ (มีผู้พัก 1 คน) */
.room-picker-card.is-partially-vacant {
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 80%);
  border: 2px solid #fcd34d;
  border-top: 5px solid #d97706;
  box-shadow: 0 2px 6px rgba(217, 119, 6, 0.08);
}
.room-picker-card.is-partially-vacant:hover {
  border-color: #d97706;
  box-shadow: 0 10px 22px rgba(217, 119, 6, 0.22);
}

/* 🔴 สถานะ: ห้องเต็ม (พักครบ 2/2 คน) */
.room-picker-card.is-full {
  background: linear-gradient(180deg, #fef2f2 0%, #ffffff 80%);
  border: 2px solid #fca5a5;
  border-top: 5px solid #dc2626;
  box-shadow: 0 2px 6px rgba(220, 38, 38, 0.08);
}
.room-picker-card.is-full:hover {
  border-color: #dc2626;
  box-shadow: 0 10px 22px rgba(220, 38, 38, 0.22);
}

/* ห้องที่มีค่าบริการ */
.room-picker-card.has-charge .room-picker-card-footer {
  border-top: 1px solid #cbd5e1;
}

.room-picker-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.room-picker-card-body {
  font-size: 12.5px;
  color: #334155;
  min-height: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.room-picker-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #e2e8f0;
  padding-top: 8px;
  margin-top: 4px;
}

