/* Reset và font cơ bản */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #1f2a44;
  background-color: #f5f7fa;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Header */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 64px;
  background: #ffffff !important;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
  display: flex;
  align-items: center;
  padding: 0 16px;
  z-index: 1000;
}

.sidebar-toggle-btn {
  background: none !important;
  border: none !important;
  font-size: 24px !important;
  color: #1f2a44 !important;
  cursor: pointer !important;
  margin-right: 16px !important;
  padding: 8px !important;
  border-radius: 6px !important;
  transition: background 0.2s, transform 0.1s !important;
}

.sidebar-toggle-btn:hover {
  background: #e5e7eb !important;
  transform: scale(1.05) !important;
}

.header-title {
  font-size: 20px !important;
  font-weight: 600 !important;
  color: #1f2a44 !important;
}

/* Admin Branch Selector */
.admin-branch-selector {
  margin-left: auto;
  margin-right: 16px;
}

.admin-branch-selector .branch-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f3f4f6;
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
}

.admin-branch-selector .branch-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  white-space: nowrap;
}

.admin-branch-selector .branch-select {
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #ffffff;
  color: #374151;
  min-width: 180px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-branch-selector .branch-select:hover {
  border-color: #9ca3af;
}

.admin-branch-selector .branch-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Responsive - Hide label on mobile */
@media (max-width: 768px) {
  .admin-branch-selector .branch-label {
    display: none;
  }

  .admin-branch-selector .branch-select {
    min-width: 140px;
  }

  .admin-branch-selector .branch-selector-wrapper {
    padding: 4px 8px;
  }
}

@media (max-width: 480px) {
  .admin-branch-selector {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px 16px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    z-index: 998;
  }

  .admin-branch-selector .branch-select {
    flex: 1;
    min-width: unset;
  }
}

/* Sidebar */
.sidebar {
  position: fixed;
  top: 64px;
  left: -240px;
  width: 240px;
  height: 90vh;
  background: #ffffff !important;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.15) !important;
  transition: left 0.3s ease, width 0.3s ease !important;
  z-index: 999;
  overflow-y: auto;
}

.sidebar.active {
  left: 0 !important;
}

.sidebar.collapsed {
  width: 80px !important;
}

.sidebar.collapsed .sidebar-header h4 {
  display: none !important;
}

.sidebar.collapsed .sidebar-menu span {
  display: none !important;
}

.sidebar-header {
  padding: 10px !important;
  border-bottom: 1px solid #e5e7eb !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-collapse-btn {
  background: none !important;
  border: none !important;
  font-weight: bold;
  font-size: 20px !important;
  color: #6b7280 !important;
  cursor: pointer !important;
  padding: 8px !important;
  border-radius: 6px !important;
  transition: background 0.2s, color 0.2s !important;
}

.sidebar-collapse-btn:hover {
  background: #e5e7eb !important;
  color: #1f2a44 !important;
}

.sidebar-menu a {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #4b5563;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s, color 0.2s;
}

.sidebar-menu a i {
  margin-right: 8px !important;
  color: #9ca3af !important;
  font-size: 14px !important;
  width: 20px;
  text-align: center;
}

.sidebar.collapsed .sidebar-menu a {
  justify-content: center !important;
}

.sidebar-menu a.active {
  background: #6c9bf93b !important;
  color: #1850cb !important;
  font-weight: bold;
}

/* Main Content */
.main-content {
  margin-left: 0;
  width: 100%;
  padding: 10px;
  transition: margin-left 0.3s ease, width 0.3s ease !important;
}

.main-content.sidebar-collapsed {
  margin-left: 80px;
  width: calc(100% - 80px);
}

/* Ẩn hamburger trên desktop và điều chỉnh sidebar */
@media (min-width: 1024px) {
  .desktop-hidden {
    display: none !important;
  }

  .sidebar {
    left: 0 !important;
    width: 250px !important;
  }

  .main-content {
    margin-left: 250px;
    width: calc(100% - 250px);
  }

  .sidebar-close-btn {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

/* Console không che main-content */
@media (min-width: 1024px) {
  .main-content {
    z-index: 1 !important;
  }
}

/* Overlay */
.sidebar-overlay {
  position: fixed;
  top: 64px;
  left: 0;
  width: 100%;
  height: calc(100vh - 64px);
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 998;
  opacity: 0 !important;
  visibility: hidden !important;
  transition: opacity 0.3s ease, visibility 0.3s ease !important;
}

.sidebar-overlay.active {
  opacity: 1 !important;
  visibility: visible !important;
}

/* Responsive */
@media (max-width: 767px) {
  .sidebar {
    width: 240px !important;
    left: -240px !important;
  }

  .sidebar-menu a {
    padding: 8px 12px;
    font-size: small;
  }

  .sidebar.active {
    left: 0 !important;
  }

  .sidebar.collapsed {
    width: 80px !important;
  }

  .settings-section.active {
    margin-left: 0;
    width: 100%;
  }

  .main-content {
    width: 100%;
    margin-left: 0;
  }

  .main-content.sidebar-open-mobile {
    margin-left: 0 !important;
    width: 100% !important;
  }
}

/* Settings Section */
.settings-section {
  background: #ffffff !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
  padding: 12px !important;
  margin-bottom: 24px !important;
  display: none;
}

.settings-section.active {
  display: inline-block;
}

.settings-section h3 {
  font-size: 18px !important;
  font-weight: 600 !important;
  color: #1f2a44 !important;
  margin-bottom: 16px !important;
  text-align: left !important;
}

/* Buttons */
.btn {
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  text-align: center !important;
}

.btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
}

.btn:active {
  transform: translateY(0) !important;
  box-shadow: none !important;
}

.btn-primary {
  background: #2563eb !important;
  color: #ffffff !important;
}

.btn-primary:hover {
  background: #1d4ed8 !important;
}

.btn-primary:disabled {
  background: #93c5fd !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-secondary {
  background: #e5e7eb !important;
  color: #1f2a44 !important;
}

.btn-secondary:hover {
  background: #d1d5db !important;
}

.btn-secondary:disabled {
  background: #f3f4f6 !important;
  color: #9ca3af !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-danger {
  background: #ef4444 !important;
  color: #ffffff !important;
}

.btn-danger:hover {
  background: #dc2626 !important;
}

.btn-danger:disabled {
  background: #f87171 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-success {
  background: #10b981 !important;
  color: #ffffff !important;
}

.btn-success:hover {
  background: #059669 !important;
}

.btn-success:disabled {
  background: #6ee7b7 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

.btn-icon {
  padding: 8px !important;
  font-size: 16px !important;
  line-height: 1 !important;
  border-radius: 50% !important;
  width: 32px !important;
  height: 32px !important;
  display: inline-flex !important;
  justify-content: center !important;
  align-items: center !important;
}

.btn-icon:hover {
  transform: scale(1.05) !important;
}

.btn-icon:active {
  transform: scale(1) !important;
}

/* Tab Buttons */
.tab-btn {
  padding: 10px 20px !important;
  font-size: 14px !important;
  font-weight: 500 !important;
  background: #e5e7eb !important;
  color: #4b5563 !important;
  border: none !important;
  border-radius: 6px 6px 0 0 !important;
  cursor: pointer !important;
  transition: background 0.2s, color 0.2s !important;
  margin-right: 4px !important;
}

.tab-btn:hover {
  background: #d1d5db !important;
}

.tab-btn.active {
  background: #ffffff !important;
  color: #2563eb !important;
  box-shadow: inset 0 -2px 0 #2563eb !important;
}

/* Action Buttons in Tables */
.actions .btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

.actions .btn-icon {
  padding: 6px !important;
  width: 30px !important;
  height: 28px !important;
  color: #ffffff !important;
}

.actions .btn-icon:hover {
  background: #3e7bffb0 !important;
}

/* Table */
.table-wrapper {
  margin-bottom: 16px !important;
}

/* Table actions alignment (e.g., Add Role button above table) */
.table-actions.top-right {
  display: flex !important;
  justify-content: flex-end !important;
  margin-bottom: 8px !important;
}

.modern-table {
  border-collapse: collapse !important;
  font-size: 14px !important;
  background: #ffffff !important;
  border-radius: 8px !important;
  overflow: auto;
  table-layout: fixed !important;
}

.modern-table th,
.modern-table td {
  padding: 12px !important;
  text-align: left !important;
  border-bottom: 1px solid #e5e7eb !important;
  vertical-align: middle !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}

.modern-table th {
  background: #f5f7fa !important;
  font-weight: 600 !important;
  color: #4b5563 !important;
  text-transform: uppercase !important;
  font-size: 12px !important;
}

.modern-table td {
  background: #f9f9f9 !important;
  color: #1f2a44 !important;
}

.modern-table input,
.modern-table select {
  width: 100% !important;
  min-width: 0 !important;
  padding: 6px 8px !important;
  font-size: 13px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 4px !important;
}

.modern-table input:focus,
.modern-table select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
}

/* Column Widths */
.modern-table .fit-content {
  width: fit-content !important;
  min-width: 0 !important;
  max-width: 100px !important;
}

.modern-table .col-id {
  width: 40px !important;
  min-width: 40px !important;
}

.modern-table .col-shiftgroup {
  width: 100px !important;
  min-width: 100px !important;
}

.modern-table .col-shiftname {
  width: 110px !important;
  min-width: 110px !important;
}

.modern-table .col-start,
.modern-table .col-end {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-early,
.modern-table .col-early-out,
.modern-table .col-late-out {
  width: 80px !important;
  min-width: 80px !important;
}

.modern-table .col-late-allowed,
.modern-table .col-late-max {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-actions {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-avatar {
  width: 60px !important;
  min-width: 60px !important;
}

.modern-table .col-emp-id {
  width: 80px !important;
  min-width: 80px !important;
}

.modern-table .col-username,
.modern-table .col-display {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-email {
  width: 170px !important;
  min-width: 170px !important;
}

.modern-table .col-role {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-staff-id {
  display: none;
}

.modern-table .col-salary-name,
.modern-table .col-base-salary,
.modern-table .col-service-salary,
.modern-table .col-chemical-salary,
.modern-table .col-hourly-salary,
.modern-table .col-video-salary {
  width: 150px !important;
  min-width: 150px !important;
}

.modern-table .col-status {
  width: 120px !important;
  min-width: 120px !important;
}

.modern-table .col-condition {
  width: 150px !important;
  min-width: 150px !important;
}

.modern-table .col-range {
  width: 100px !important;
  min-width: 100px !important;
}

.modern-table .col-amount {
  width: 100px !important;
  min-width: 100px !important;
}

.role-select-additional {
  display: grid;
}

/* Toggle Switch */
.switch {
  position: relative !important;
  display: inline-block !important;
  width: 40px !important;
  height: 20px !important;
}

.switch input {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.slider {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: #d1d5db !important;
  border-radius: 10px !important;
  transition: background 0.3s !important;
}

.slider:before {
  position: absolute !important;
  content: '' !important;
  height: 16px !important;
  width: 16px !important;
  left: 2px !important;
  bottom: 2px !important;
  background: #ffffff !important;
  border-radius: 50% !important;
  transition: transform 0.3s !important;
}

input:checked + .slider {
  background: #2563eb !important;
}

input:checked + .slider:before {
  transform: translateX(20px) !important;
}

/* Toggle label for branch mode */
.toggle-label {
  margin-left: 10px !important;
  font-size: 14px !important;
  color: #6b7280 !important;
  font-weight: 500 !important;
}

/* Location Settings */
.location-settings {
  display: flex !important;
  flex-direction: column !important;
  gap: 16px !important;
}

#branch-management-section {
  display: none;
  margin-top: 16px !important;
  padding: 16px !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 8px !important;
  background: #f9fafb !important;
}

#common-address-group {
  margin-bottom: 16px !important;
}

.location-coordinates {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
  gap: 16px !important;
}

/* Popup */
.checkin-mkt-popup {
  display: none;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 1001 !important;
  overflow: auto !important;
}

.checkin-mkt-popup-content {
  background: #ffffff !important;
  margin: 15% auto !important;
  padding: 24px !important;
  max-width: 600px !important;
  max-height: 700px;
  border-radius: 8px !important;
  position: relative !important;
  overflow-y: auto;
}

.checkin-mkt-popup-close {
  position: absolute !important;
  top: 16px !important;
  right: 16px !important;
  font-size: 20px !important;
  cursor: pointer !important;
  color: #4b5563 !important;
  padding: 8px !important;
  border-radius: 50% !important;
  transition: background 0.2s, color 0.2s !important;
}

.checkin-mkt-popup-close:hover {
  background: #e5e7eb !important;
  color: #1f2a44 !important;
}

.checkin-card {
  background: #f9fafb !important;
  border: 1px solid #e5e7eb !important;
  border-radius: 6px !important;
  padding: 16px !important;
  margin-bottom: 12px !important;
  font-size: small;
}

.checkin-card div {
  display: flex !important;
  justify-content: space-between !important;
  padding: 4px 0 !important;
}

.checkin-card .label {
  font-weight: 500 !important;
  color: #4b5563 !important;
}

.checkin-card .value {
  color: #1f2a44 !important;
}

/* Responsive */
@media (min-width: 1024px) {
  .sidebar {
    left: 0 !important;
  }

  .sidebar-close-btn {
    display: none !important;
  }

  .sidebar-overlay {
    display: none !important;
  }
}

@media (max-width: 768px) {
  .location-coordinates {
    grid-template-columns: 1fr !important;
  }

  .salary-cards {
    grid-template-columns: 1fr !important;
  }

  .sidebar-close-btn {
    display: block !important;
  }

  /* Table */
  .table-wrapper {
    margin-bottom: 16px !important;
  }

  .modern-table {
    border-collapse: collapse !important;
    font-size: 12px !important;
    background: #ffffff !important;
    border-radius: 8px !important;
    table-layout: fixed !important;
  }

  .modern-table th,
  .modern-table td {
    padding: 8px !important;
    text-align: left !important;
    border-bottom: 1px solid #e5e7eb !important;
    vertical-align: middle !important;
    white-space: nowrap !important;
    text-overflow: ellipsis !important;
    font-size: 10px !important;
  }

  .modern-table th {
    background: #f5f7fa !important;
    font-weight: 600 !important;
    color: #4b5563 !important;
    text-transform: uppercase !important;
  }

  .modern-table td {
    background: #f9f9f9 !important;
    color: #1f2a44 !important;
  }

  .modern-table input,
  .modern-table select {
    width: 100% !important;
    min-width: 0 !important;
    padding: 6px 8px !important;
    font-size: 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 4px !important;
  }

  .modern-table input:focus,
  .modern-table select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1) !important;
  }

  /* Column Widths */
  .modern-table .fit-content {
    width: fit-content !important;
    min-width: 0 !important;
    max-width: 100px !important;
  }

  .modern-table .col-id {
    width: 30px !important;
    min-width: 30px !important;
  }

  .modern-table .col-shiftgroup {
    width: 90px !important;
    min-width: 80px !important;
  }

  .modern-table .col-shiftname {
    width: 100px !important;
    min-width: 100px !important;
  }

  .modern-table .col-start,
  .modern-table .col-end {
    width: 120px !important;
    min-width: 120px !important;
  }

  .modern-table .col-late-out,
  .modern-table .col-early,
  .modern-table .col-early-out {
    width: 80px !important;
    min-width: 80px !important;
  }

  .modern-table .col-late-max {
    width: 100px !important;
    min-width: 100px !important;
  }

  .modern-table .col-late-allowed {
    width: 120px !important;
    min-width: 120px !important;
  }

  .modern-table .col-actions {
    width: 120px !important;
    min-width: 120px !important;
  }

  .modern-table .col-avatar {
    width: 80px !important;
    min-width: 80px !important;
  }

  .modern-table .col-emp-id {
    width: 90px !important;
    min-width: 90px !important;
  }

  .modern-table .col-username,
  .modern-table .col-display {
    width: 150px !important;
    min-width: 150px !important;
  }

  .modern-table .col-email {
    width: 220px !important;
    min-width: 220px !important;
  }

  .modern-table .col-role {
    width: 110px !important;
    min-width: 110px !important;
  }

  .modern-table .col-salary-name,
  .modern-table .col-base-salary,
  .modern-table .col-service-salary,
  .modern-table .col-chemical-salary,
  .modern-table .col-hourly-salary,
  .modern-table .col-video-salary {
    width: 130px !important;
    min-width: 130px !important;
  }

  .modern-table .col-status {
    width: 120px !important;
    min-width: 120px !important;
  }

  .modern-table .col-condition {
    width: 150px !important;
    min-width: 150px !important;
  }

  .modern-table .col-range {
    width: 100px !important;
    min-width: 100px !important;
  }

  .modern-table .col-amount {
    width: 100px !important;
    min-width: 100px !important;
  }
}

h3 {
  color: #1e3a8a !important;
  margin-bottom: 20px !important;
  font-size: 24px !important;
  font-weight: 600 !important;
}

.tab-container {
  display: flex !important;
  border-bottom: 2px solid #e5e7eb !important;
  margin-bottom: 20px !important;
}

.tab-button {
  padding: 12px 24px !important;
  background: none !important;
  border: none !important;
  font-size: 16px !important;
  cursor: pointer !important;
  transition: all 0.3s ease !important;
  color: #6b7280 !important;
  white-space: nowrap !important;
  box-shadow: none !important;
}

.tab-button.active,
.tab-button:hover {
  color: #1e40af !important;
  border-bottom: 3px solid #1e40af !important;
  font-weight: 500 !important;
}

.tab-content {
  display: none !important;
  background: #ffffff !important;
  border-radius: 8px !important;
}

.tab-content.active {
  display: block !important;
}

/* Form Elements */
.form-wraper {
  display: grid;
  grid-auto-flow: column;
  gap: 50px;
  padding: 20px;
}

.form-group {
  display: flex;
  flex-direction: column !important;
  gap: 8px !important;
  margin-bottom: 20px !important;
}

input[type='text'],
input[type='number'],
input[type='email'],
input[type='time'],
input[type='date'],
select {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
select:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
  outline: none !important;
}

input[type='file'] {
  padding: 8px 0 !important;
}

.form-title {
  margin-top: 20px;
  margin-bottom: 20px;
  padding: 10px 20px;
  width: fit-content;
  text-align: center;
  background-color: #eff6ff;
  color: #1f60dd;
  border-radius: 5px;
}

.form-group input,
.form-group select {
  width: 100% !important;
  padding: 10px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  transition: border-color 0.3s ease, box-shadow 0.3s ease !important;
  background: #f9fafb !important;
}

.form-group input:focus,
.form-group select:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
  outline: none !important;
}

.form-group input:disabled,
.form-group select:disabled {
  background: #f3f4f6 !important;
  cursor: not-allowed !important;
  opacity: 0.7 !important;
}

.btn-icon {
  align-items: center !important;
  gap: 8px !important;
  padding: 10px 40px !important;
  border: none !important;
  border-radius: 6px !important;
  font-size: 14px !important;
  cursor: pointer !important;
  transition: background 0.3s ease, transform 0.2s ease !important;
  font-weight: 500 !important;
}

.edit-btn,
.edit-kpi-btn {
  padding: 4px 12px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  text-decoration: auto;
}

.edit-btn,
.edit-kpi-btn,
.btn-icon.edit {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

.edit-kpi-btn:hover,
.btn-icon.edit:hover {
  background: #2563eb !important;
  transform: translateY(-1px) !important;
}

.save-schedule-btn {
  background: #45d9a95c !important;
  color: #10b92e !important;
  padding: 4px 12px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
}

.save-schedule-btn {
  background: #45d9a95c !important;
  color: #10b92e !important;
  padding: 4px 12px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
}

.delete-btn,
.delete-kpi-btn,
.delete-schedule-btn {
  background: #d945455c !important;
  color: #b91010 !important;
  padding: 4px 12px;
  border: none;
  border-radius: 5px;
  font-weight: bold;
  text-decoration: auto;
}

.btn-icon.save {
  background: #45d9a95c !important;
  color: #10b92e !important;
}

.btn-icon.save:hover {
  background: #059669 !important;
  transform: translateY(-1px) !important;
}

.btn-icon.delete {
  background: #d945455c !important;
  color: #b91010 !important;
}

.btn-icon.delete:hover {
  background: #dc2626 !important;
  transform: translateY(-1px) !important;
}

.section-actions {
  margin-top: 20px !important;
  text-align: right !important;
}

.btn {
  padding: 10px 20px !important;
  border: none !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  font-size: 14px !important;
  transition: background 0.3s ease, transform 0.2s ease !important;
  font-weight: 500 !important;
}

.btn-secondary {
  background: #6b7280 !important;
  color: #ffffff !important;
}

.btn-secondary:hover {
  background: #4b5563 !important;
  transform: translateY(-1px) !important;
}

.btn-primary {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

.btn-primary:hover {
  background: #2563eb !important;
  transform: translateY(-1px) !important;
}

.modal-content h4 {
  margin-bottom: 15px !important;
  color: #1e3a8a !important;
  font-weight: 600 !important;
}

.filter-wrapper {
  display: flex;
  gap: 5px;
  width: 100%;
}

.filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.filter-tab {
  padding: 8px 8px !important;
  background: #e5e7eb !important;
  border-radius: 6px !important;
  cursor: pointer !important;
  transition: background 0.3s ease !important;
}

.filter-tab.active {
  background: #3b82f6 !important;
  color: #ffffff !important;
}

.filter-tab:hover {
  background: #d1d5db !important;
}

.filter-options {
  margin-bottom: 15px !important;
}

.filter-input {
  margin-bottom: 10px !important;
}

.filter-input label {
  margin-right: 10px !important;
  font-weight: 500 !important;
  color: #4b5563 !important;
}

.filter-input select {
  padding: 8px !important;
  border: 1px solid #d1d5db !important;
  border-radius: 6px !important;
  font-size: 14px !important;
}

.close-modal {
  float: right !important;
  font-size: 24px !important;
  cursor: pointer !important;
  color: #6b7280 !important;
  transition: color 0.3s ease !important;
}

.close-modal:hover {
  color: #1e40af !important;
}

@media (max-width: 768px) {
  .tab-container {
    flex-direction: column !important;
  }

  .tab-button {
    width: 100% !important;
    text-align: left !important;
    border-bottom: 1px solid #e5e7eb !important;
  }

  .tab-button.active {
    border-bottom: 3px solid #1e40af !important;
  }

  .form-title {
    margin-top: unset;
    margin-bottom: 5px;
    padding: 8px 12px;
  }

  .form-wraper {
    grid-auto-flow: unset;
    padding: 10px;
    gap: 20px;
  }

  .form-group input,
  .form-group select {
    font-size: 13px !important;
  }

  .btn-icon {
    font-size: 13px !important;
  }

  .btn {
    padding: 8px 16px !important;
    font-size: 13px !important;
  }
}

/* Thêm CSS cho switch toggle */
.switch {
  position: relative !important;
  display: inline-block !important;
  width: 40px !important;
  height: 20px !important;
}

.switch input {
  opacity: 0 !important;
  width: 0 !important;
  height: 0 !important;
}

.slider {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  background: #d1d5db !important;
  border-radius: 10px !important;
  transition: background 0.3s !important;
}

.slider:before {
  position: absolute !important;
  content: '' !important;
  height: 16px !important;
  width: 16px !important;
  left: 2px !important;
  bottom: 2px !important;
  background: #ffffff !important;
  border-radius: 50% !important;
  transition: transform 0.3s !important;
}

input:checked + .slider {
  background: #10b981 !important;
  /* Màu xanh khi bật */
}

input:checked + .slider:before {
  transform: translateX(20px) !important;
}

#calculate-salary {
  margin-left: 10px;
  padding: 8px 16px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  pointer-events: auto;
}

#calculate-salary:hover {
  background-color: #218838;
}

#calculate-salary:focus {
  box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.5);
}

/* Zalo Info Card */
.zalo-info-card {
  background: #f0f7ff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.zalo-info-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.zalo-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  border-bottom: 1px solid #afc9f1;
  padding-bottom: 10px;
}

.zalo-title {
  font-size: 20px;
  font-weight: 600;
  color: #06145f;
  margin: 0;
}

.verification-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

#verification-icon {
  font-size: 20px;
  color: #10b981;
  margin-bottom: 4px;
}

.status-text {
  font-size: 14px;
  color: #065f46;
  background: #f0fff4;
  font-weight: 500;
  border-radius: 5px;
  padding: 4px 8px;
}

.info-grid {
  display: grid;
  gap: 15px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.info-label {
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-label i {
  color: #6b7280;
}

.info-value {
  font-size: 16px;
  color: #061d5f;
  font-weight: 600;
  word-wrap: break-word;
  padding: 4px 8px;
  background: #ffffff;
  border-radius: 4px;
  border: 1px solid #d1e7dd;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .zalo-info-card {
    padding: 15px;
  }

  .zalo-header {
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }

  .zalo-title {
    font-size: 18px;
  }

  .info-label {
    font-size: 13px;
  }

  .info-value {
    font-size: 14px;
  }
}

/* General Table Styling */
.services-section,
.products-section {
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 20px;
}

.services-section h2,
.products-section h2 {
  font-size: 24px;
  margin-bottom: 20px;
  color: #333;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  overflow-x: auto;
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

th {
  background: #f8f9fa;
  font-weight: 600;
  color: #333;
}

td input,
td textarea,
td select {
  width: 100%;
  padding: 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

td textarea {
  resize: vertical;
  min-height: 60px;
}

td .group-input {
  margin-top: 5px;
  display: flex;
  gap: 10px;
}

td .group-input input {
  flex: 1;
}

td .group-input button {
  padding: 8px 12px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

td .group-input button:hover {
  background: #0056b3;
}

td .actions a {
  margin-right: 10px;
  text-decoration: none;
  font-size: 18px;
}

td .actions .edit {
  color: #007bff;
}

td .actions .delete {
  color: #dc3545;
}

td .actions .save {
  color: #28a745;
}

.no-data {
  text-align: center;
  padding: 20px;
  color: #666;
}

.no-data button {
  padding: 10px 20px;
  background: #007bff;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 10px;
}

.no-data button:hover {
  background: #0056b3;
}

/* Responsive Design */
@media (max-width: 768px) {
  table {
    display: block;
    white-space: nowrap;
  }

  .services-section,
  .products-section {
    margin: 10px;
    padding: 15px;
  }

  th,
  td {
    padding: 8px;
    font-size: small;
  }

  td input,
  td textarea,
  td select {
    font-size: small;
    padding: 6px;
  }

  .version-info {
    margin-top: 5px;
  }
}

.footer {
  text-align: center;
}

.version-info {
  font-size: 12px;
  color: #6b7280;
  padding: 10px;
  margin-top: 10px;
  text-align: center;
}

/* User Menu Styles */
.user-menu-container {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.user-avatar:hover {
  transform: scale(1.1);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.2);
}

.user-menu {
  position: absolute;
  top: 50px;
  right: 0;
  padding: 10px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  min-width: 200px;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.user-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.user-menu-item {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  color: #1f2a44;
  text-decoration: none;
  font-size: 14px;
  transition: background 0.2s ease, color 0.2s ease;
  cursor: pointer;
}

.user-menu-item:hover {
  background: #f5f7fa;
  color: #2563eb;
}

.user-menu-item i {
  margin-right: 8px;
  color: #6b7280;
  font-size: 16px;
}

.user-menu-item:hover i {
  color: #2563eb;
}

.user-menu-item#headerLogoutButton {
  border: none;
  /* Đảm bảo không có viền cho nút Đăng xuất */
  background: none;
  /* Đảm bảo không có nền cho nút Đăng xuất */
}

.user-menu-item#headerLogoutButton:hover {
  background: #f5f7fa;
  /* Giữ hiệu ứng hover */
  color: #dc2626;
  /* Màu đỏ để nhấn mạnh Đăng xuất */
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  .user-avatar {
    width: 36px;
    height: 36px;
  }

  .user-menu {
    top: 45px;
    right: 10px;
    min-width: 180px;
  }

  .user-menu-item {
    font-size: 13px;
    padding: 10px 14px;
  }
}

.kpi-form {
  display: grid;
  gap: 15px;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.kpi-input-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-input-group label {
  font-weight: 500;
  color: #1f2a44;
  font-size: 14px;
}

.kpi-input-group input,
.kpi-input-group select {
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.kpi-input-group input:focus,
.kpi-input-group select:focus {
  border-color: #2563eb;
  outline: none;
}

/* Thêm cho cột Loại mục tiêu */
.kpi-table th:nth-child(2),
.kpi-table td:nth-child(2) {
  min-width: 120px; /* Điều chỉnh độ rộng cột */
}

/* Style cho select Loại mục tiêu trong modal */
.kpi-input-group select.kpi-product-type {
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  width: 100%;
}

.checkbox-group {
  display: flex;
  align-items: center;
  margin: 5px 0;
}

.checkbox-group input[type='checkbox'] {
  margin-right: 8px;
}

.kpi-input-group .kpi-start-date,
.kpi-input-group .kpi-end-date {
  width: 48%;
}

.kpi-input-group .kpi-start-date + .kpi-end-date {
  margin-left: 4%;
}

.save-kpi {
  width: fit-content;
  padding: 10px 20px;
  margin-top: 10px;
}

.modal-kpi {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content-kpi {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  position: relative;
  animation: slideIn 0.3s ease;
  margin: auto;
  top: 50px;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.filter-tab {
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 6px;
  background: #e5e7eb;
  transition: background 0.2s ease;
}

.filter-tab.active {
  background: #2563eb;
  color: #fff;
}

.filter-tab:hover {
  background: #d1d5db;
}

.filter-options {
  margin-bottom: 15px;
}

.filter-input {
  margin-top: 10px;
}

.filter-input label {
  font-weight: 500;
  color: #1f2a44;
}

.filter-input select {
  width: 100%;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.kpi-list {
  max-height: 300px;
  overflow-y: auto;
  margin-top: 10px;
}

.kpi-list-item {
  display: grid;
  grid-template-columns: 2fr 1fr 2fr 2fr 1fr;
  gap: 10px;
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  align-items: center;
}

.kpi-list-item:last-child {
  border-bottom: none;
}

@media (max-width: 768px) {
  .kpi-form {
    padding: 15px;
  }

  .kpi-input-group .kpi-start-date,
  .kpi-input-group .kpi-end-date {
    width: 100%;
    margin-left: 0;
  }

  .kpi-input-group .kpi-start-date + .kpi-end-date {
    margin-left: 0;
    margin-top: 10px;
  }

  .modal-content-kpi {
    width: 95%;
  }

  .kpi-list-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

.kpi-table-container {
  margin-top: 20px;
}

.kpi-table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
}

.kpi-table th,
.kpi-table td {
  padding: 10px;
  border: 1px solid #e5e7eb;
  text-align: left;
}

.kpi-table th {
  background-color: #f3f4f6;
  font-weight: 500;
}

.kpi-table tr:hover {
  background-color: #f9fafb;
  cursor: pointer;
}

.modal-kpi {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content-kpi {
  background: #fff;
  padding: 20px;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 600px;
  overflow-y: auto;
  position: relative;
  animation: slideIn 0.3s ease;
}

.close-modal {
  position: absolute;
  top: 10px;
  right: 15px;
  font-size: 24px;
  cursor: pointer;
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Leave Requests Section */
#leave-requests {
  padding: 20px;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

#leave-requests h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1f2a44;
  margin-bottom: 16px;
}

#leave-requests .filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#leave-requests .filter-tab {
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 6px;
  background: #e5e7eb;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  transition: background 0.2s ease, color 0.2s ease;
}

#leave-requests .filter-tab.active {
  background: #2563eb;
  color: #ffffff;
}

#leave-requests .filter-tab:hover {
  background: #d1d5db;
}

#leave-requests .time-filter-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

#leave-requests .time-tab {
  padding: 8px 15px;
  cursor: pointer;
  border-radius: 6px;
  background: #e5e7eb;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  transition: background 0.2s ease, color 0.2s ease;
}

#leave-requests .time-tab.active {
  background: #2563eb;
  color: #ffffff;
}

#leave-requests .time-tab:hover {
  background: #d1d5db;
}

#leave-requests .filter-options {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
  align-items: center;
}

#leave-requests .filter-input {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#leave-requests .time-filter-input {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

#leave-requests .sort-wrapper label,
#leave-requests .filter-options label,
#leave-requests .filter-input label {
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
}

#leave-requests .filter-input select,
#leave-requests .filter-input input[type='date'] {
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  width: 150px;
}

#leave-requests .filter-input input[type='date'] + input[type='date'] {
  margin-left: 10px;
}

#leave-requests .btn-primary {
  padding: 8px 16px;
  font-size: 14px;
  background: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s ease;
}

#leave-requests .btn-primary:hover {
  background: #1d4ed8;
}

#leave-requests .modern-table th,
#leave-requests .modern-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

#leave-requests .modern-table th {
  background: #f5f7fa;
  font-weight: 600;
  color: #4b5563;
  text-transform: uppercase;
  font-size: 12px;
}

#leave-requests .modern-table td {
  background: #f9f9f9;
  color: #1f2a44;
}

#leave-requests .status {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

#leave-requests .status-pending {
  background: #fef3c7;
  color: #d97706;
}

#leave-requests .status-approved {
  background: #d1fae5;
  color: #065f46;
}

#leave-requests .status-rejected {
  background: #fee2e2;
  color: #dc2626;
}

#leave-requests .status-unknown {
  background: #e5e7eb;
  color: #6b7280;
}

.sort-wrapper {
  display: flex;
  gap: 10px;
  align-items: baseline;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
  #leave-requests {
    padding: 15px;
  }

  #leave-requests .filter-tabs,
  #leave-requests .time-filter-tabs {
    gap: 2px;
  }

  #leave-requests .filter-tab,
  #leave-requests .time-tab {
    text-align: center;
    font-size: x-small;
    padding: 4px;
  }

  #leave-requests .filter-options {
    gap: 10px;
  }

  #leave-requests .filter-input,
  #leave-requests .time-filter-input {
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
  }

  #leave-requests .filter-input select,
  #leave-requests .filter-input input[type='date'] {
    width: 100%;
    font-size: 13px;
  }

  #leave-requests .filter-input input[type='date'] + input[type='date'] {
    margin-left: 0;
    margin-top: 5px;
  }

  #leave-requests .btn-primary {
    font-size: 13px;
  }

  #leave-requests .modern-table {
    font-size: 12px;
  }

  #leave-requests .modern-table th,
  #leave-requests .modern-table td {
    padding: 8px;
    font-size: 10px;
  }

  #leave-requests .status {
    font-size: 10px;
    padding: 3px 6px;
  }
}

/* Permissions Section */
.permissions-section {
  margin-top: 20px;
}

.permissions-section h5 {
  font-size: 16px;
  font-weight: 600;
  color: #1f2a44;
  margin-bottom: 16px;
}

.permissions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}

.permission-item {
  display: grid;
  grid-template-columns: 150px 1fr; /* Tên quyền hẹp hơn, pills bên phải */
  align-items: center;
  padding: 12px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  column-gap: 12px;
}

.permission-name {
  font-weight: 500;
  color: #1f2a44;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.permission-selector {
  width: auto; /* tránh chiếm full chiều ngang */
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: end;
}

.permission-btn {
  display: none; /* Ẩn thanh select, dùng hàng pills làm trigger */
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  color: #4b5563;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.permission-btn:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.permission-btn i {
  font-size: 12px;
  transition: transform 0.2s;
}

.permission-btn.active i {
  transform: rotate(180deg);
}

.permission-dropdown {
  position: absolute;
  right: 20px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.12); /* đổ bóng nhẹ hơn nhưng rộng hơn */
  z-index: 1000;
  max-height: 260px;
  overflow-y: auto;
  min-width: 200px; /* đủ rộng cho Toàn quyền & Không có quyền */
  max-width: 100%;
  display: block; /* luôn chiếm chỗ để transition mượt */
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.permission-dropdown.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(160px);
  pointer-events: auto;
}

.permission-dropdown label {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: #1f2a44;
  cursor: pointer;
}

.permission-dropdown label:last-child {
  border-bottom: none;
}

.permission-dropdown label:hover {
  background: #f9fafb;
}

.permission-dropdown input[type='checkbox'] {
  margin-right: 8px;
}

/* Phân tách khu vực 'Không có quyền' xuống cuối */
.permission-sep {
  border-top: 1px solid #e5e7eb;
  margin: 6px 0;
}

/* Responsive for permissions */
@media (max-width: 768px) {
  .permissions-grid {
    grid-template-columns: 1fr;
  }

  .permission-item {
    display: grid;
    grid-template-columns: minmax(110px, 5%) 1fr;
    align-items: center;
    column-gap: 8px;
  }

  .permission-selector {
    width: 100%;
    min-width: unset; /* Trên mobile, dùng toàn bộ chiều ngang */
  }

  .permission-name {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
  }

  .permission-btn {
    width: 100%;
    justify-content: space-between;
  }

  .permission-dropdown {
    right: 0;
    top: 40px;
    transform: none;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    box-shadow: none;
    border: 1px solid #e5e7eb;
  }

  .permission-dropdown label {
    font-size: 12px;
  }

  .permission-pills {
    min-height: 32px;
    gap: 4px;
    padding: 6px 10px;
  }

  .permission-pill {
    font-size: 9px;
  }

  .full-access-label,
  .no-access-label {
    font-size: 11px;
    gap: 4px;
  }
}

/* Permission Badges */
.permission-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
}

.permission-badge.permission-none {
  background-color: #f3f4f6;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.permission-badge.permission-full {
  background-color: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.permission-badge.permission-limited {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.permissions-cell {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Roles table specific column widths */
#roles .modern-table .col-id {
  width: 60px !important;
  min-width: 60px !important;
}

#roles .modern-table .col-display {
  width: 180px !important;
  min-width: 160px !important;
}

#roles .modern-table .col-permissions {
  width: 240px !important;
  min-width: 200px !important;
}

#roles .modern-table .col-actions {
  width: 240px !important;
  min-width: 200px !important;
}

/* Action buttons styling refinement in roles table */
#roles .modern-table .actions .btn {
  padding: 6px 10px !important;
  font-size: 12px !important;
  gap: 6px !important;
}

#roles .modern-table .actions .btn i {
  font-size: 12px !important;
}

/* Mobile tweaks for Roles table: shrink ID and Name to give more space to Description and Access */
@media (max-width: 768px) {
  /* ID */
  #roles .modern-table th.col-id,
  #roles .modern-table td:nth-child(1) {
    width: 36px !important;
    min-width: 36px !important;
  }
  /* Tên vai trò */
  #roles .modern-table th.col-display,
  #roles .modern-table td:nth-child(2) {
    width: 90px !important;
    min-width: 90px !important;
  }
  /* Mô tả + Quyền truy cập: allow wrapping and more space */
  #roles .modern-table th.col-description,
  #roles .modern-table td:nth-child(3),
  #roles .modern-table th.col-access,
  #roles .modern-table td:nth-child(4) {
    white-space: normal !important;
    word-break: break-word !important;
  }
  /* Trạng thái */
  #roles .modern-table th.col-status,
  #roles .modern-table td:nth-child(5) {
    width: 90px !important;
    min-width: 90px !important;
  }
  /* Hành động */
  #roles .modern-table th.col-actions,
  #roles .modern-table td:nth-child(6) {
    width: 140px !important;
    min-width: 120px !important;
  }
  /* Access permissions cell (if used) */
  #roles .modern-table .permissions-cell {
    max-width: none !important;
    white-space: normal !important;
  }
}

/* Permission Pills (làm trigger mở menu) */
.permission-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  cursor: pointer;
  min-height: 34px;
  align-items: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.permission-pills:hover {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.permission-pill {
  display: inline-flex;
  align-items: center;
  background: #e0f2fe;
  color: #0369a1;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid #bae6fd;
}

/* Biến thể cho trạng thái đặc biệt */
.permission-pill--full {
  background: #dcfce7;
  color: #166534;
  border-color: #bbf7d0;
}

.permission-pill--none {
  background: #f3f4f6;
  color: #6b7280;
  border-color: #d1d5db;
}

.pill-remove {
  margin-left: 4px;
  cursor: pointer;
  color: #0369a1;
  font-weight: bold;
  font-size: 12px;
}

.pill-remove:hover {
  color: #dc2626;
}

/* Permission Controls */
.permission-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap; /* giữ 2 mục trên 1 hàng */
}

.full-access-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #1f2a44;
  font-size: 12px;
  white-space: nowrap;
}

.no-access-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
  color: #b91c1c; /* red tone to indicate no access */
  font-size: 12px;
  white-space: nowrap;
}

/* Access Permissions */
.access-permissions {
  display: flex;
  gap: 20px;
  text-align: center;
}

.access-permissions label {
  display: flow;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
}

.access-permissions input[type='checkbox'] {
  width: 16px;
  height: 16px;
  accent-color: #2563eb;
}

/* Switch Label */
.switch-label {
  margin-left: 12px;
  font-weight: 500;
  color: #4b5563;
}

/* Role Modal Enhancements */
.role-form-container textarea {
  width: 100%;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.role-form-container textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
  outline: none;
}

/* Role Description Row - Description and Active Toggle on same line */
.role-description-row {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.role-description-row textarea {
  flex: 1;
  min-width: 0; /* Allow flex shrinking */
}

.active-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  margin-top: 20px;
  margin-bottom: 20px;
}

.active-toggle label {
  font-weight: 500;
  color: #374151;
  font-size: 14px;
}

/* Status and Access Cells */
.status-active {
  color: #10b981;
  font-weight: 500;
}

.status-inactive {
  color: #ef4444;
  font-weight: 500;
}

.description-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Status and Access Cells */
.status-active {
  color: #10b981;
  font-weight: 500;
}

.status-inactive {
  color: #ef4444;
  font-weight: 500;
}

.description-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-cell {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   MODERN ROLE MODAL STYLES
   ============================================ */

/* Modern Form Group */
.modern-form-group {
  margin-bottom: 30px;
  animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Modern Label */
.modern-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
  transition: color 0.2s ease;
}

.modern-label i {
  font-size: 16px;
  color: #6366f1;
  transition: transform 0.2s ease;
}

.modern-form-group:hover .modern-label i {
  transform: scale(1.1);
}

.required-mark {
  color: #ef4444;
  font-weight: 700;
  font-size: 16px;
}

/* Modern Input Wrapper */
.modern-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

/* Modern Input Base */
.modern-input,
.modern-textarea {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: inherit;
  color: #1f2937;
  background: #ffffff;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  transition: all 0.3s ease;
  outline: none;
}

.modern-input:hover,
.modern-textarea:hover {
  border-color: #c7d2fe;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.modern-input:focus,
.modern-textarea:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
  background: #fefefe;
}

.modern-input::placeholder,
.modern-textarea::placeholder {
  color: #9ca3af;
  font-style: italic;
}

/* Textarea specific */
.modern-textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.6;
}

/* Character Counter */
.char-count {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 12px;
  color: #9ca3af;
  background: rgba(255, 255, 255, 0.9);
  padding: 2px 8px;
  border-radius: 6px;
  pointer-events: none;
  transition: color 0.2s ease;
}

.char-count.warning {
  color: #f59e0b;
  font-weight: 600;
}

.char-count.danger {
  color: #ef4444;
  font-weight: 700;
}

/* Modern Toggle Group */
.modern-toggle-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 12px;
  margin-bottom: 24px;
  border: 2px solid #e2e8f0;
  transition: all 0.3s ease;
}

.modern-toggle-group:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* Modern Switch */
.modern-switch {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.modern-switch input[type='checkbox'] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.modern-slider {
  position: relative;
  background: #cbd5e1;
  border-radius: 34px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.modern-slider::before {
  content: '';
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.modern-switch input:checked + .modern-slider {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.modern-switch input:checked + .modern-slider::before {
  transform: translateX(24px);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.3);
}

.switch-label {
  font-size: 14px;
  font-weight: 600;
  color: #64748b;
  transition: color 0.3s ease;
}

.modern-switch input:checked ~ .switch-label {
  color: #6366f1;
}

/* Modern Number Input */
.modern-number-input {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}

.modern-number-input .modern-input {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 16px;
  padding: 10px;
  min-width: 80px;
}

.number-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  box-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.number-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.number-btn:active {
  transform: scale(0.95);
}

.number-btn i {
  pointer-events: none;
}

.input-suffix {
  font-size: 14px;
  font-weight: 600;
  color: #6366f1;
  white-space: nowrap;
  padding: 0 8px;
}

.toggle-container {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Input Hint */
.input-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.input-hint i {
  color: #6b7280;
  font-size: 14px;
}

/* Input States */
.modern-input:disabled,
.modern-textarea:disabled {
  background: #f3f4f6;
  color: #9ca3af;
  cursor: not-allowed;
  border-color: #e5e7eb;
}

.modern-input.error,
.modern-textarea.error {
  border-color: #ef4444;
  background: #fef2f2;
}

.modern-input.error:focus,
.modern-textarea.error:focus {
  box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15);
}

.modern-input.success,
.modern-textarea.success {
  border-color: #10b981;
  background: #f0fdf4;
}

/* Responsive Design */
@media (max-width: 768px) {
  .modern-form-group {
    margin-bottom: 20px;
  }

  .modern-input,
  .modern-textarea {
    padding: 10px 14px;
    font-size: 16px;
  }

  .modern-toggle-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .modern-number-input {
    max-width: 100%;
  }

  .modern-number-input .modern-input {
    min-width: 60px;
  }

  .number-btn {
    width: 42px;
    height: 42px;
    font-size: 16px;
  }

  .input-suffix {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .modern-label {
    font-size: 13px;
  }

  .modern-label i {
    font-size: 14px;
  }

  .char-count {
    font-size: 11px;
    bottom: 6px;
    right: 8px;
  }

  .input-hint {
    font-size: 11px;
  }

  .number-btn {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
}

/* Focus Within Enhancement */
.modern-form-group:focus-within .modern-label {
  color: #6366f1;
}

.modern-form-group:focus-within .modern-label i {
  color: #8b5cf6;
  transform: scale(1.15);
}

/* Animation for validation states */
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  10%,
  30%,
  50%,
  70%,
  90% {
    transform: translateX(-5px);
  }
  20%,
  40%,
  60%,
  80% {
    transform: translateX(5px);
  }
}

.modern-input.shake,
.modern-textarea.shake {
  animation: shake 0.5s ease-in-out;
}

/* ============================================
   PERMISSIONS SECTION HEADER STYLING
   ============================================ */

/* H5 Header with Icon */
.permissions-section h5 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid #e5e7eb;
  transition: color 0.3s ease;
}

.permissions-section h5 i {
  font-size: 18px;
  color: #6366f1;
  transition: transform 0.3s ease;
}

.permissions-section h5:hover {
  color: #6366f1;
}

.permissions-section h5:hover i {
  transform: rotate(15deg) scale(1.1);
}

/* ============================================
   SALARY ACTION BAR - SEND NOTIFICATION BUTTON
   ============================================ */

.salary-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin: 20px 0 15px;
  padding: 0 10px;
}

.send-salary-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
  position: relative;
  overflow: hidden;
}

.send-salary-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

.send-salary-btn:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.send-salary-btn i {
  font-size: 16px;
  animation: none;
}

.send-salary-btn:disabled {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  cursor: not-allowed;
  opacity: 0.7;
}

.send-salary-btn.sent {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.send-salary-btn.sent i {
  animation: checkBounce 0.6s ease;
}

@keyframes checkBounce {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
  }
}

/* Loading state */
.send-salary-btn.loading {
  pointer-events: none;
}

.send-salary-btn.loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* Ripple effect */
.send-salary-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.send-salary-btn:active:not(:disabled)::before {
  width: 300px;
  height: 300px;
}

/* Responsive */
@media (max-width: 768px) {
  .salary-action-bar {
    margin: 15px 0 10px;
  }

  .send-salary-btn {
    padding: 10px 20px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .send-salary-btn .btn-text {
    display: none;
  }

  .send-salary-btn {
    padding: 10px 16px;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    justify-content: center;
  }

  .send-salary-btn i {
    margin: 0;
  }
}

/* Branch Pill Select Styles */
.branch-pill-select {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 220px;
}

.branch-pills-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  padding: 4px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
}

.branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  animation: pillFadeIn 0.2s ease;
}

@keyframes pillFadeIn {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.branch-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  margin-left: 2px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
  line-height: 1;
}

.branch-pill-remove:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.4);
}

.branch-pill-remove:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.branch-add-select {
  padding: 6px 10px;
  border: 1px dashed #d1d5db;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.branch-add-select:hover:not(:disabled) {
  border-color: #3b82f6;
  color: #3b82f6;
}

.branch-add-select:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.no-branch-selected {
  color: #9ca3af;
  font-style: italic;
  font-size: 12px;
  padding: 2px 0;
}

.branch-pill-select .no-branch {
  color: #9ca3af;
  font-style: italic;
  font-size: 12px;
}

/* Responsive cho branch pill select */
@media (max-width: 768px) {
  .branch-pill-select {
    max-width: 160px;
  }

  .branch-pill {
    padding: 3px 6px;
    font-size: 10px;
  }

  .branch-add-select {
    padding: 4px 8px;
    font-size: 11px;
  }
}
