:root {
  --brand-navy: #0f2d52;
  --brand-blue: #1d4ed8;
  --brand-cyan: #06b6d4;
  --brand-gold: #f59e0b;
  --brand-bg: #f4f7fb;
  --brand-surface: #ffffff;
  --brand-text: #16324f;
  --brand-muted: #5f7084;
  --brand-border: #d9e2ec;
  --brand-shadow: 0 18px 40px rgba(15, 45, 82, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Sarabun', sans-serif;
  background:
    radial-gradient(circle at top right, rgba(6, 182, 212, 0.12), transparent 24%),
    radial-gradient(circle at bottom left, rgba(29, 78, 216, 0.12), transparent 28%),
    var(--brand-bg);
  color: var(--brand-text);
}

a {
  color: var(--brand-blue);
}

a:hover {
  color: #143ea9;
}

#wrapper {
  background: transparent;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(15, 45, 82, 0.98) 0%, rgba(15, 60, 120, 0.96) 52%, rgba(8, 99, 149, 0.94) 100%);
  box-shadow: 18px 0 40px rgba(15, 45, 82, 0.15);
}

.sidebar .sidebar-brand {
  height: 4.75rem;
  padding: 1rem 1.2rem;
  gap: 0.85rem;
}

.sidebar .sidebar-brand .sidebar-brand-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.sidebar .sidebar-brand .sidebar-brand-text {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar hr.sidebar-divider {
  border-top-color: rgba(255, 255, 255, 0.12);
}

.sidebar .sidebar-heading {
  font-size: 0.72rem;
  color: rgba(255, 255, 255, 0.72);
  letter-spacing: 0.08em;
}

.sidebar .nav-item .nav-link {
  margin: 0.2rem 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar .nav-item .nav-link i {
  opacity: 0.92;
}

.sidebar .nav-item .nav-link:hover,
.sidebar .nav-item.active > .nav-link {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.sidebar .collapse-inner {
  border-radius: 1rem;
  box-shadow: 0 14px 34px rgba(15, 45, 82, 0.14);
  margin: 0.35rem 1rem 0.75rem;
}

.sidebar .collapse-item {
  border-radius: 0.8rem;
  margin: 0.15rem 0.55rem;
  transition: all 0.2s ease;
}

.sidebar .collapse-item:hover,
.sidebar .collapse-item.active {
  background: rgba(29, 78, 216, 0.1);
  color: var(--brand-blue);
}

#content-wrapper {
  background: transparent;
}

.topbar {
  background: rgba(255, 255, 255, 0.88) !important;
  backdrop-filter: blur(12px);
  border: 1px solid rgba(217, 226, 236, 0.8);
  border-radius: 1.25rem;
  box-shadow: 0 10px 30px rgba(15, 45, 82, 0.08);
  margin: 1rem 1rem 1.5rem;
}

.topbar .dropdown-list .dropdown-header,
.bg-primary {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan)) !important;
}

.card,
.modal-content,
.dropdown-list,
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid rgba(217, 226, 236, 0.88);
  box-shadow: var(--brand-shadow);
}

.card,
.modal-content {
  border-radius: 1.2rem;
  overflow: hidden;
}

.card .card-header,
.modal-header {
  background: linear-gradient(180deg, rgba(244, 247, 251, 0.9), rgba(255, 255, 255, 0.98));
  border-bottom: 1px solid var(--brand-border);
}

.card .card-header h6,
.modal-title {
  color: var(--brand-navy);
  font-weight: 700;
}

.shadow,
.shadow-sm,
.shadow-lg {
  box-shadow: var(--brand-shadow) !important;
}

.btn {
  border-radius: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-blue), #2563eb);
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(29, 78, 216, 0.22);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #143ea9, var(--brand-blue));
  border-color: transparent;
}

.btn-success {
  box-shadow: 0 10px 24px rgba(22, 163, 74, 0.18);
}

.btn-danger {
  box-shadow: 0 10px 24px rgba(220, 38, 38, 0.16);
}

.btn-warning {
  color: #fff;
  box-shadow: 0 10px 24px rgba(245, 158, 11, 0.18);
}

.form-control,
.custom-select,
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
  min-height: calc(1.6em + 1rem + 2px);
  border-radius: 0.9rem;
  border: 1px solid var(--brand-border);
  box-shadow: none;
}

.form-control:focus,
.custom-select:focus,
.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--multiple {
  border-color: rgba(29, 78, 216, 0.55);
  box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.12);
}

.select2-container .select2-selection--single {
  height: calc(1.6em + 1rem + 2px);
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: calc(1.6em + 1rem);
  padding-left: 0.95rem;
  padding-right: 2.4rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1rem;
  font-weight: normal;
  font-family: 'Sarabun', sans-serif;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
  height: calc(1.6em + 1rem + 2px);
  right: 0.5rem;
}

select.form-control,
select.custom-select {
  padding-right: 2.35rem;
  width: 100%;
  min-width: 200px;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

select.form-control option,
select.custom-select option,
.select2-results__option {
  white-space: normal;
  word-break: break-word;
  padding: 5px 10px;
  line-height: 1.5;
}

.select2-container--default .select2-results__option {
  line-height: 1.45;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.select2-option-wrap {
  display: block;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.select2-container--default .select2-selection--multiple {
  padding: 0.35rem 0.45rem 0.2rem;
}

.select2-container--default .select2-selection--multiple .select2-selection__rendered {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0;
}

.select2-container--default .select2-selection--multiple .select2-selection__choice {
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  line-height: 1.3;
  padding-right: 0.5rem;
}

.select2-container--default .select2-selection--multiple .select2-search--inline {
  flex: 1 1 12rem;
}

.select2-container--default .select2-selection--multiple .select2-search__field {
  width: 100% !important;
}

.select2-dropdown {
  border: 1px solid var(--brand-border);
  border-radius: 1rem;
  box-shadow: var(--brand-shadow);
  overflow: hidden;
}

.table {
  color: var(--brand-text);
}

.table thead th {
  border-bottom: 1px solid var(--brand-border);
  color: var(--brand-navy);
  font-weight: 700;
  background: rgba(244, 247, 251, 0.95);
}

.table td,
.table th {
  vertical-align: middle;
}

.table-bordered {
  border-color: rgba(217, 226, 236, 0.95);
}

.table-bordered td,
.table-bordered th {
  border-color: rgba(217, 226, 236, 0.95);
}

.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
  border-radius: 0.8rem;
  border: 1px solid var(--brand-border);
  padding: 0.45rem 0.75rem;
}

.page-item.active .page-link {
  background: linear-gradient(135deg, var(--brand-blue), var(--brand-cyan));
  border-color: transparent;
}

.page-link {
  border-radius: 0.75rem !important;
  margin: 0 0.1rem;
  color: var(--brand-blue);
}

.badge-primary,
.badge-info,
.badge-success,
.badge-warning,
.badge-danger {
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  font-weight: 600;
}

.swal2-popup {
  border-radius: 1.25rem !important;
}

.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(6, 182, 212, 0.22), transparent 28%),
    radial-gradient(circle at bottom right, rgba(29, 78, 216, 0.2), transparent 35%),
    linear-gradient(160deg, #eef5ff 0%, #f7fbff 40%, #f1f5f9 100%);
}

.login-shell {
  width: 100%;
  max-width: 1080px;
  padding: 2rem 1rem;
}

.login-card {
  border: 0;
  border-radius: 1.75rem;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 60px rgba(15, 45, 82, 0.16);
  overflow: hidden;
}

.login-card .card-body {
  padding: 0;
}

.login-brand {
  padding: 3rem 2.4rem;
}

.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.1);
  color: var(--brand-blue);
  font-weight: 700;
  margin-bottom: 1rem;
}

.login-brand h1 {
  font-size: 2rem;
  line-height: 1.35;
  color: var(--brand-navy);
  font-weight: 700;
  margin-bottom: 0.85rem;
}

.login-brand p {
  color: var(--brand-muted);
  font-size: 1rem;
  margin-bottom: 0;
}

.login-form-wrap {
  padding: 3rem 2.4rem;
  background:
    linear-gradient(180deg, rgba(244, 247, 251, 0.65), rgba(255, 255, 255, 0.96));
}

.login-error {
  font-size: 0.92rem;
  color: #dc2626;
  font-weight: 600;
  margin-top: 1rem;
}

.form-control-user {
  border-radius: 0.95rem !important;
  min-height: 3.15rem;
  padding: 0.85rem 1rem;
}

.btn-user {
  border-radius: 0.95rem !important;
  min-height: 3.15rem;
  font-size: 1rem;
}

.text-gray-900 {
  color: var(--brand-navy) !important;
}

.text-muted,
.text-gray-600 {
  color: var(--brand-muted) !important;
}

.page-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.page-hero-content {
  max-width: 760px;
}

.page-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(29, 78, 216, 0.08);
  color: var(--brand-blue);
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.8rem;
}

.page-hero h1 {
  color: var(--brand-navy);
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.page-hero p {
  margin-bottom: 0;
  color: var(--brand-muted);
  font-size: 1rem;
  line-height: 1.65;
}

.page-action {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
}

.filter-panel {
  border: 1px solid rgba(217, 226, 236, 0.88);
  border-radius: 1.2rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(244, 247, 251, 0.9));
  box-shadow: var(--brand-shadow);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.filter-panel-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--brand-navy);
  font-weight: 700;
  margin-bottom: 1rem;
}

.filter-field-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-blue);
  margin-bottom: 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.25rem;
  padding: 1.2rem 1.25rem;
  background: linear-gradient(135deg, rgba(15, 45, 82, 0.98), rgba(29, 78, 216, 0.95));
  color: #fff;
  box-shadow: var(--brand-shadow);
}

.summary-card:before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.summary-card:nth-child(2) {
  background: linear-gradient(135deg, rgba(8, 99, 149, 0.96), rgba(6, 182, 212, 0.92));
}

.summary-card:nth-child(3) {
  background: linear-gradient(135deg, rgba(180, 83, 9, 0.94), rgba(245, 158, 11, 0.9));
}

.summary-card-label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
  margin-bottom: 0.5rem;
}

.summary-card-value {
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1.45;
}

.empty-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1.25rem 1rem;
  border-radius: 1rem;
  background: rgba(244, 247, 251, 0.95);
  color: var(--brand-muted);
  font-weight: 600;
}

.form-page-hero {
  margin-bottom: 1.25rem;
}

.form-page-hero p {
  max-width: 760px;
}

.form-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1.25rem 0 2rem;
}

.form-actions .btn {
  min-width: 170px;
}

.form-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand-navy);
  margin-bottom: 0.35rem;
}

.form-section-copy {
  color: var(--brand-muted);
  margin-bottom: 1.15rem;
  line-height: 1.6;
}

tr.hide-table-padding td {
  padding: 0;
}

.expand-button {
  position: relative;
}

.accordion-toggle .expand-button:after {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translate(0, -50%);
  content: '-';
}

.accordion-toggle.collapsed .expand-button:after {
  content: '+';
}

@media (max-width: 991.98px) {
  .topbar {
    margin: 0.75rem 0.75rem 1.25rem;
    border-radius: 1rem;
  }

  .page-hero {
    flex-direction: column;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .login-brand,
  .login-form-wrap {
    padding: 2rem 1.5rem;
  }

  .login-brand h1 {
    font-size: 1.65rem;
  }
}

@media (max-width: 767.98px) {
  .sidebar .nav-item .nav-link {
    margin: 0.15rem 0.5rem;
    padding: 0.75rem 0.9rem;
  }

  .login-shell {
    padding: 1rem;
  }

  .login-card {
    border-radius: 1.25rem;
  }
}
