/* CSS GIAO DIỆN CHUẨN V.2 */
    /* CSS BULK ACTIONS & MODALS */
    .modal-divider {
      display: flex;
      align-items: center;
      text-align: center;
      margin: 20px 0;
      color: #adb5bd;
      font-weight: bold;
      font-size: 0.75rem;
      text-transform: uppercase;
      letter-spacing: 1px;
    }

    .modal-divider::before,
    .modal-divider::after {
      content: '';
      flex: 1;
      border-bottom: 1px dashed #dee2e6;
    }

    .modal-divider:not(:empty)::before {
      margin-right: 15px;
    }

    .modal-divider:not(:empty)::after {
      margin-left: 15px;
    }

    .pill-note {
      background: #e7f3ff;
      color: #0c63e4;
      padding: 12px 16px;
      border-radius: 12px;
      font-size: 0.85rem;
      border-left: 4px solid #0d6efd;
    }

    .btn-action {
      width: 32px;
      height: 32px;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 8px;
      transition: all 0.2s;
      cursor: pointer;
    }

    .btn-action:hover {
      background: rgba(13, 110, 253, 0.1);
      transform: translateY(-2px);
    }

    .rule-item-checkbox {
      width: 18px;
      height: 18px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .rule-item-checkbox:checked {
      filter: drop-shadow(0 0 2px rgba(13, 110, 253, 0.5));
      transform: scale(1.1);
    }

    :root {
      --primary-color: #0d6efd;
      --bg-color: #f8f9fc;
      --sidebar-width: 260px;
    }

    * {
      font-family: 'Nunito', sans-serif !important;
    }

    .fas,
    .far,
    .fab,
    .fa {
      font-family: "Font Awesome 6 Free", "Font Awesome 6 Brands" !important;
    }

    /* Khôi phục font cho icon */
    body {
      background-color: var(--bg-color);
      height: 100vh;
      overflow: hidden;
      font-size: 0.95rem;
    }

    ::-webkit-scrollbar {
      width: 8px;
      height: 8px;
    }

    ::-webkit-scrollbar-track {
      background: #f1f1f1;
    }

    ::-webkit-scrollbar-thumb {
      background: #c1c1c1;
      border-radius: 4px;
    }

    /* Timeline styles */
    .timeline-container {
      position: relative;
    }

    .timeline-container::before {
      content: "";
      position: absolute;
      left: 40px;
      top: 0;
      bottom: 0;
      width: 2px;
      background: #e9ecef;
    }

    .timeline-item {
      position: relative;
      padding-left: 20px;
    }

    pre {
      font-family: 'Consolas', 'Monaco', monospace;
      font-size: 0.85rem;
    }

    /* Khung diễn biến không nhảy hàng */
    .progression-wrapper {
      display: flex;
      align-items: center;
      overflow-x: auto;
      white-space: nowrap;
      padding-bottom: 5px;
      scrollbar-width: thin;
      -ms-overflow-style: none;
    }

    .progression-wrapper::-webkit-scrollbar {
      height: 3px;
    }

    .progression-wrapper::-webkit-scrollbar-thumb {
      background: #dee2e6;
      border-radius: 10px;
    }

    #login-screen {
      position: fixed;
      inset: 0;
      background: linear-gradient(135deg, #0d6efd 0%, #0b5ed7 100%);
      z-index: 9999;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .login-card {
      background: white;
      padding: 40px;
      border-radius: 15px;
      width: 380px;
      text-align: center;
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    }

    #app-container {
      display: flex;
      height: 100vh;
      display: none;
    }

    .sidebar {
      position: relative;
      width: var(--sidebar-width);
      background: linear-gradient(180deg, #0d6efd 10%, #0b5ed7 100%);
      color: white;
      display: flex;
      flex-direction: column;
      z-index: 1000;
      transition: width 0.25s ease;
      height: 100vh;
      overflow: hidden;
    }

    /* Scrollable body section for menu links */
    .sidebar-menu {
      flex: 1;
      overflow-y: auto;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
    }
    
    /* Ultra-sleek, premium scrollbar for sidebar menus */
    .sidebar-menu::-webkit-scrollbar {
      width: 4px !important;
    }
    .sidebar-menu::-webkit-scrollbar-track {
      background: transparent !important;
    }
    .sidebar-menu::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15) !important;
      border-radius: 4px !important;
    }
    .sidebar-menu::-webkit-scrollbar-thumb:hover {
      background: rgba(255, 255, 255, 0.35) !important;
    }

    .sidebar-brand {
      padding: 15px 14px;
      font-weight: 800;
      font-size: 1.05rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.15);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
    }

    .brand-main {
      display: flex;
      align-items: center;
      gap: 10px;
      min-width: 0;
    }

    .app-logo {
      width: 34px;
      height: 34px;
      border-radius: 8px;
      object-fit: cover;
      background: #fff;
      padding: 3px;
    }

    .brand-text {
      line-height: 1.2;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .sidebar-toggle {
      border: 1px solid rgba(255, 255, 255, 0.4);
      background: transparent;
      color: #fff;
      border-radius: 8px;
      width: 32px;
      height: 32px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .sidebar-toggle:hover {
      background: rgba(255, 255, 255, 0.15);
    }

    .nav-item {
      padding: 16px 22px;
      cursor: pointer;
      color: rgba(255, 255, 255, 0.8);
      transition: 0.3s;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 10px;
      white-space: nowrap;
      overflow: hidden;
    }

    .nav-label {
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .nav-item:hover,
    .nav-item.active {
      background: white;
      color: var(--primary-color);
      border-left: 5px solid #0dcaf0;
    }

    /* Sidebar Grouping & Accordion */
    .sidebar-group-label {
      padding: 18px 22px 8px 22px;
      font-size: 0.72rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1.5px;
      color: rgba(255, 255, 255, 0.45);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      margin-top: 5px;
    }

    .sidebar-group {
      display: flex;
      flex-direction: column;
    }

    .sidebar-group-header {
      padding: 14px 22px;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      color: rgba(255, 255, 255, 0.85);
      transition: all 0.2s;
      font-weight: 700;
      font-size: 0.9rem;
    }

    .sidebar-group-header:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .sidebar-group-header .group-title {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .sidebar-group-header .chevron {
      transition: transform 0.3s;
      font-size: 0.75rem;
      opacity: 0.5;
    }

    .sidebar-group.expanded .sidebar-group-header {
      background: rgba(0, 0, 0, 0.1);
      color: #fff;
    }

    .sidebar-group.expanded .sidebar-group-header .chevron {
      transform: rotate(90deg);
      opacity: 1;
    }

    .sidebar-group-content {
      max-height: 0;
      overflow: hidden;
      transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
      background: rgba(0, 0, 0, 0.15);
    }

    .sidebar-group.expanded .sidebar-group-content {
      max-height: 500px;
    }

    .sub-nav-item {
      padding: 12px 22px 12px 48px;
      cursor: pointer;
      color: rgba(255, 255, 255, 0.7);
      font-size: 0.88rem;
      font-weight: 600;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 10px;
      border-left: 3px solid transparent;
    }

    .sub-nav-item:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }

    .sub-nav-item.active {
      color: #fff;
      background: rgba(255, 255, 255, 0.2);
      border-left: 3px solid #0dcaf0;
    }

    /* Thu gọn Sidebar */
    #app-container.sidebar-collapsed .sidebar-group-label,
    #app-container.sidebar-collapsed .sidebar-group-header .group-title span,
    #app-container.sidebar-collapsed .sidebar-group-header .chevron,
    #app-container.sidebar-collapsed .sub-nav-item .nav-label {
      display: none !important;
    }

    #app-container.sidebar-collapsed .sidebar-group {
      position: relative;
    }

    #app-container.sidebar-collapsed .sidebar-group-header {
      justify-content: center;
      padding: 16px 0;
    }

    #app-container.sidebar-collapsed .sub-nav-item {
      padding: 16px 0;
      justify-content: center;
    }

    #app-container.sidebar-collapsed .sidebar-group-content {
      display: none;
      max-height: none !important;
      overflow: visible;
    }

    /* Hiển thị menu con dạng hover bay ra ngoài khi thu gọn sidebar */
    #app-container.sidebar-collapsed .sidebar-group:hover .sidebar-group-content {
      display: block !important;
      position: absolute;
      left: 78px;
      top: 0;
      width: 220px;
      background: #0b5ed7;
      box-shadow: 6px 4px 15px rgba(0, 0, 0, 0.25);
      border-radius: 0 8px 8px 0;
      z-index: 1000;
      padding: 6px 0;
    }

    #app-container.sidebar-collapsed .sidebar-group:hover .sub-nav-item {
      padding: 12px 20px;
      justify-content: flex-start;
      width: 100%;
    }

    #app-container.sidebar-collapsed .sidebar-group:hover .sub-nav-item .nav-label {
      display: inline-block !important;
      opacity: 1 !important;
      color: rgba(255, 255, 255, 0.9);
    }

    #app-container.sidebar-collapsed .sidebar-group:hover .sub-nav-item:hover {
      background: rgba(255, 255, 255, 0.15);
      color: #fff;
    }

    #lblUserWrap {
      max-width: calc(var(--sidebar-width) - 22px);
      display: inline-flex;
      align-items: flex-start;
      gap: 6px;
      white-space: normal;
      text-align: left;
    }

    #lblUser {
      line-height: 1.2;
      word-break: break-word;
    }

    #app-container.sidebar-collapsed .sidebar {
      width: 78px;
      overflow: visible !important;
    }

    #app-container.sidebar-collapsed .sidebar-menu {
      overflow: visible !important;
    }

    #app-container.sidebar-collapsed .brand-text,
    #app-container.sidebar-collapsed .nav-label,
    #app-container.sidebar-collapsed #lblUserWrap,
    #app-container.sidebar-collapsed .sidebar-actions,
    #app-container.sidebar-collapsed #socketStatusText {
      display: none !important;
    }

    #app-container.sidebar-collapsed .version-lbl {
      display: none !important;
    }

    #app-container.sidebar-collapsed .version-tag {
      display: block !important;
      font-size: 8px !important;
      white-space: nowrap !important;
      overflow: visible !important;
      text-overflow: clip !important;
      padding: 10px 0 0 0 !important;
      text-align: center !important;
      width: 100% !important;
    }

    #app-container.sidebar-collapsed .sidebar > div.mt-auto {
      padding-left: 2px !important;
      padding-right: 2px !important;
    }

    #app-container.sidebar-collapsed .brand-main {
      justify-content: center;
      width: 100%;
    }

    #app-container.sidebar-collapsed .sidebar-brand {
      justify-content: center;
      padding: 12px 8px;
    }

    #app-container.sidebar-collapsed .nav-item {
      justify-content: center;
      padding: 16px 10px;
    }

    #app-container.sidebar-collapsed .nav-item i {
      margin: 0 !important;
    }

    #sidebarBackdrop {
      display: none;
    }

    .mobile-sidebar-toggle {
      display: none;
    }

    @media (max-width: 992px) {
      body {
        overflow: auto;
      }

      #app-container {
        position: relative;
      }

      .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: var(--sidebar-width);
        transform: translateX(-100%);
        z-index: 1200;
        transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
        box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
      }

      #app-container.mobile-sidebar-open .sidebar {
        transform: translateX(0);
      }

      #app-container.mobile-sidebar-open #sidebarBackdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.35);
        z-index: 1100;
        backdrop-filter: blur(1px);
      }

      .main-content {
        padding: 70px 14px 14px 14px;
      }

      .mobile-sidebar-toggle {
        display: inline-flex;
        position: fixed;
        top: 14px;
        left: 14px;
        z-index: 1300;
        width: 42px;
        height: 42px;
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        padding: 0;
      }

      .card-custom {
        padding: 14px;
        margin-bottom: 14px;
      }

      .card-header-custom {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
      }

      .card-header-custom .form-control,
      .card-header-custom input[type='text'] {
        width: 100% !important;
      }

      .table {
        font-size: 0.86rem;
      }

      .calendar-day {
        min-height: 66px;
        height: auto;
        padding: 6px;
      }

      .calendar-day.selected::after {
        font-size: 0.65rem;
        right: 4px;
      }

      #tab-home .row.align-items-end>div,
      #tab-logs .row.align-items-end>div {
        width: 100%;
      }

      #tab-home .btn,
      #tab-logs .btn {
        width: 100% !important;
      }

      #tab-home .text-end,
      #tab-logs .text-end {
        text-align: left !important;
      }

      #tab-home h5,
      #tab-rules h5,
      #tab-ex h5,
      #tab-calendar h5,
      #tab-admin h5,
      #tab-logs h5 {
        font-size: 1rem;
      }

      #btnSidebarToggle {
        display: none;
      }

      /* Staggered nav-item animation khi sidebar mở trên mobile */
      .sidebar .nav-item {
        opacity: 0;
        transform: translateX(-14px);
        animation: none;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item {
        animation: navSlideIn 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(2) {
        animation-delay: 0.07s;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(3) {
        animation-delay: 0.13s;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(4) {
        animation-delay: 0.19s;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(5) {
        animation-delay: 0.25s;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(6) {
        animation-delay: 0.31s;
      }

      #app-container.mobile-sidebar-open .sidebar .nav-item:nth-child(7) {
        animation-delay: 0.37s;
      }
    }

    @keyframes navSlideIn {
      from {
        opacity: 0;
        transform: translateX(-14px);
      }

      to {
        opacity: 1;
        transform: translateX(0);
      }
    }

    /* Kết quả kiểm tra dạng card layout trên màn hình nhỏ */
    @media (max-width: 640px) {
      #tab-home table.table {
        display: block;
      }

      #tab-home table.table thead {
        display: none;
      }

      #tab-home table.table tbody {
        display: block;
      }

      #tab-home table.table tbody tr {
        display: flex;
        flex-direction: column;
        background: white;
        border: 1px solid #dee2e6;
        border-radius: 10px;
        margin-bottom: 10px;
        padding: 10px 12px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
        position: relative;
      }

      #tab-home tr.fixed-row {
        border-left: 5px solid #198754;
        border-top: none;
      }

      #tab-home tr.auto-resolved {
        border-left: 5px solid #6c757d;
        border-top: none;
      }

      #tab-home table.table tbody td {
        display: block;
        border: none;
        padding: 3px 0;
        font-size: 0.9rem;
      }

      #tab-home table.table tbody td::before {
        content: attr(data-label);
        display: block;
        font-size: 0.7rem;
        font-weight: 700;
        color: #aaa;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 1px;
      }

      #tab-home table.table tbody td[data-label="STT"] {
        position: absolute;
        top: 8px;
        right: 10px;
        width: auto;
        font-size: 0.8rem;
        background: #f0f2ff;
        border: 1px solid #c5cae9;
        border-radius: 6px;
        padding: 1px 8px;
        color: var(--primary-color);
      }

      #tab-home table.table tbody td[data-label="STT"]::before {
        display: none;
      }

      #tab-home table.table tbody td[data-label="Hành động"] {
        text-align: center;
        margin-top: 4px;
      }

      #tab-home table.table tbody td[data-label="Hành động"]::before {
        display: none;
      }
    }

    .main-content {
      flex: 1;
      padding: 25px;
      overflow-y: auto;
    }

    .card-custom {
      background: white;
      border-radius: 12px;
      padding: 25px;
      box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
      margin-bottom: 25px;
    }

    .card-header-custom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 15px;
      border-bottom: 1px solid #e3e6f0;
    }

    thead th {
      background: #f8f9fc !important;
      position: sticky;
      top: 0;
      z-index: 10;
      border-bottom: 2px solid #e3e6f0;
    }

    .form-control {
      border-radius: 20px;
      padding: 8px 15px;
    }

    .btn {
      border-radius: 20px;
      font-weight: 600;
      padding: 6px 20px;
    }

    tr.fixed-row {
      background-color: #d1e7dd !important;
      opacity: 0.9;
      border-left: 5px solid #198754;
    }

    tr.fixed-row td {
      color: #0f5132 !important;
      font-weight: bold;
    }

    tr.auto-resolved {
      background-color: #e2e3e5 !important;
      opacity: 0.7;
      border-left: 5px solid #6c757d;
    }

    tr.auto-resolved td {
      color: #6c757d !important;
      text-decoration: line-through;
    }

    .badge-error {
      background-color: #fff3cd;
      color: #856404;
      border-left: 4px solid #f6c23e;
      padding: 10px;
      border-radius: 4px;
      display: block;
      font-weight: 600;
      font-size: 0.9rem;
    }

    .table-rules input:not(.smart-input),
    .table-rules select {
      border: none;
      background: transparent;
      width: 100%;
      text-align: center;
    }

    .table-rules.editing input:not(.smart-input),
    .table-rules.editing select {
      border: 1px solid #d1d3e2;
      background: white;
      border-radius: 4px;
    }

    /* CUSTOM DROPDOWN */
    .custom-dd-wrapper {
      position: relative;
      width: 100%;
      text-align: left;
    }

    .custom-dd-display {
      min-height: 38px;
      border: 1px solid #d1d3e2;
      border-radius: 4px;
      padding: 5px 10px;
      background: white;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .custom-dd-display.disabled {
      background: transparent;
      border: none;
      cursor: not-allowed;
      padding: 0;
      pointer-events: none;
    }

    .custom-dd-display:after {
      content: '\f0d7';
      font-family: 'Font Awesome 5 Free';
      font-weight: 900;
      color: #858796;
      margin-left: 10px;
    }

    .dd-text {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 90%;
      font-size: 0.9rem;
      color: #333;
    }

    .dd-placeholder {
      color: #888;
      font-style: italic;
    }

    .custom-dd-list {
      position: fixed;
      width: 350px;
      max-height: 300px;
      overflow-y: auto;
      background: white;
      border: 1px solid #b7b9cc;
      border-radius: 4px;
      box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
      z-index: 99999;
      display: none;
    }

    .custom-dd-search {
      position: sticky;
      top: 0;
      background: #fff;
      padding: 8px;
      border-bottom: 1px solid #eee;
      z-index: 10;
    }

    .smart-search {
      width: 100%;
      padding: 5px 10px;
      border: 1px solid #ccc;
      border-radius: 4px;
      outline: none;
    }

    .dd-item {
      padding: 8px 12px;
      cursor: pointer;
      border-bottom: 1px solid #f8f9fc;
      font-size: 0.9rem;
      display: flex;
      align-items: center;
    }

    .dd-item:hover {
      background-color: #eaecf4;
      color: var(--primary-color);
    }

    .dd-item input[type="checkbox"] {
      margin-right: 10px;
      transform: scale(1.3);
      cursor: pointer;
      pointer-events: none;
    }

    .dd-item.all {
      background-color: #e8f0fe;
      font-weight: bold;
      color: #4e73df;
    }

    /* CSS LỊCH */
    .calendar-container {
      background: white;
      border-radius: 10px;
      overflow: hidden;
    }

    .calendar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 15px;
      background-color: #eaecf4;
      height: 60px;
    }

    .calendar-title-wrapper {
      display: flex;
      align-items: center;
      justify-content: center;
      flex: 1;
    }

    .calendar-title {
      font-size: 1.3rem;
      font-weight: 800;
      color: #4e73df;
      cursor: pointer;
      transition: 0.3s;
      padding: 5px 15px;
      border-radius: 20px;
    }

    .calendar-title:hover {
      background-color: #d1d3e2;
      color: #224abe;
    }

    .calendar-picker {
      display: none;
      align-items: center;
      gap: 5px;
    }

    .calendar-grid {
      display: grid;
      grid-template-columns: repeat(7, 1fr);
      gap: 1px;
      background-color: #e3e6f0;
    }

    .calendar-day-header {
      background-color: #f8f9fc;
      text-align: center;
      padding: 10px;
      font-weight: bold;
      color: #5a5c69;
    }

    .calendar-day {
      background-color: white;
      height: 80px;
      padding: 10px;
      cursor: pointer;
      position: relative;
      transition: 0.2s;
    }

    .calendar-day:hover {
      background-color: #f1f3f9;
    }

    .calendar-day.selected {
      background-color: #d1e7dd;
      border: 2px solid #198754;
    }

    .calendar-day.selected::after {
      content: 'trực 24/24';
      position: absolute;
      bottom: 5px;
      right: 5px;
      font-size: 0.75rem;
      color: #198754;
      font-weight: bold;
    }

    .day-number {
      font-weight: bold;
      font-size: 1.1rem;
    }

    /* [FIX] Z-INDEX QUAN TRỌNG, MODAL KHÔNG BỊ ĐEN */
    /* đảm bảo modal luôn nổi trên backdrop */
    /* PAGINATION CUSTOM STYLE */
    .pagination-rules .page-link {
      border: none;
      color: #5a5c69;
      background: transparent;
      font-size: 0.85rem;
      padding: 5px 10px;
      margin: 0 2px;
      transition: 0.2s;
      border-radius: 6px;
    }

    .pagination-rules .page-link:hover {
      background-color: #eaecf4;
      color: var(--primary-color);
    }

    .pagination-rules .page-link:hover {
      background-color: #eaecf4;
      color: var(--primary-color);
    }

    .pagination-rules .page-item.active .page-link {
      border: 1.5px solid var(--primary-color);
      color: var(--primary-color);
      background: white;
      font-weight: bold;
      padding: 4px 9px;
    }

    .pagination-rules .page-item.disabled .page-link {
      color: #d1d3e2;
      pointer-events: none;
    }

    .pagination-rules .page-link i {
      font-size: 0.75rem;
    }

    .table-rules-container {
      max-height: calc(100vh - 200px);
      overflow-y: auto;
      position: relative;
      scrollbar-gutter: stable;
      background: #fff;
    }

    .table-rules {
      border-collapse: separate;
      border-spacing: 0;
    }

    .table-rules thead th {
      position: sticky;
      top: 0;
      z-index: 100;
      background-color: var(--primary-color) !important;
      color: white !important;
      border-bottom: 2px solid #0a58ca !important;
      box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
      padding-top: 10px;
      padding-bottom: 10px;
    }

    .rules-switch {
      transform: scale(1.1);
      cursor: pointer;
    }

    /* PILL TOGGLE - COMPACT */
    .pill-toggle {
      position: relative;
      display: inline-block;
      width: 56px;
      height: 22px;
      vertical-align: middle;
    }

    .pill-toggle input {
      opacity: 0;
      width: 0;
      height: 0;
    }

    .pill-slider {
      position: absolute;
      cursor: pointer;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      background-color: #cbd5e0;
      transition: .3s;
      border-radius: 34px;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 8px;
    }

    .pill-slider:before {
      position: absolute;
      content: "";
      height: 16px;
      width: 16px;
      left: 3px;
      bottom: 3px;
      background-color: white;
      transition: .3s;
      border-radius: 50%;
      z-index: 5;
    }

    .pill-toggle input:checked+.pill-slider {
      background-color: var(--primary-color);
    }

    .pill-toggle input:checked+.pill-slider:before {
      transform: translateX(34px);
    }

    .pill-slider .on-text,
    .pill-slider .off-text {
      font-size: 8px;
      font-weight: 800;
      color: white;
      user-select: none;
      z-index: 1;
    }

    .pill-toggle input:checked+.pill-slider .off-text {
      display: none;
    }

    .pill-toggle input:not(:checked)+.pill-slider .on-text {
      display: none;
    }

    .pill-slider .on-text {
      margin-right: auto;
      margin-left: 2px;
    }

    .pill-slider .off-text {
      margin-left: auto;
      margin-right: 2px;
    }

    /* ACTION BUTTONS HOVER */
    .btn-action {
      transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
      padding: 5px 8px;
      line-height: 1;
    }

    .btn-action:hover {
      transform: scale(1.25);
      box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
      z-index: 5;
    }

    .btn-outline-primary:hover {
      background-color: #0d6efd !important;
      color: #fff !important;
    }

    .btn-outline-danger:hover {
      background-color: #dc3545 !important;
      color: #fff !important;
    }

    /* MODAL DIVIDER */
    .modal-divider {
      display: flex;
      align-items: center;
      gap: 15px;
      margin: 20px 0 15px 0;
    }

    .modal-divider span {
      font-size: 0.8rem;
      font-weight: 800;
      color: #0d6efd;
      white-space: nowrap;
    }

    .modal-divider::after {
      content: "";
      height: 1px;
      flex: 1;
      background: #e3e6f0;
    }

    .modal-label-req::before {
      content: "* ";
      color: #dc3545;
    }

    /* TABLE POLISH */
    .table-rules tr {
      background-color: #fff;
    }

    .table-rules td {
      border-bottom: 1px solid #e3e6f0 !important;
      border-top: none !important;
      color: #444;
      font-size: 0.82rem;
      padding: 4px 6px !important;
      vertical-align: middle;
    }

    .table-rules tr:hover {
      background-color: #f4f7fe !important;
    }

    .table-rules-container {
      height: 720px;
      overflow-y: auto;
      scrollbar-width: thin;
    }

    .table-rules input:not(.smart-input):not(.form-check-input) {
      height: 26px;
      font-size: 0.82rem;
    }

    .rule-select-chk {
      appearance: auto !important;
      -webkit-appearance: checkbox !important;
      width: 17px !important;
      height: 17px !important;
      cursor: pointer;
      accent-color: #0d6efd;
      margin: 0;
      display: block;
    }

    /* NEW PILL INTERFACE STYLES */
    .pill-card-header {
      padding: 20px;
      background: white;
      border-radius: 12px;
      margin-bottom: 20px;
      box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.05);
    }

    .pill-input-wrapper {
      position: relative;
      flex: 1;
      display: flex;
      align-items: center;
      background: white;
      border: 2px solid #b2d7ff;
      border-radius: 50px;
      padding-right: 15px;
      height: 48px;
      transition: 0.3s;
    }

    .pill-input-wrapper:focus-within {
      border-color: var(--primary-color);
      box-shadow: 0 0 10px rgba(13, 110, 253, 0.1);
    }

    .pill-input-wrapper input[type="file"] {
      display: none;
      /* Ẩn hoàn toàn, label sẽ trigger click */
    }

    .pill-input-display {
      display: flex;
      align-items: center;
      width: 100%;
      padding-left: 2px;
    }

    .pill-input-btn {
      background: transparent;
      color: #555;
      padding: 0 20px;
      border-right: 1px solid #dee2e6;
      font-weight: 700;
      font-size: 0.85rem;
      pointer-events: none;
      white-space: nowrap;
    }

    .pill-input-text {
      padding: 0 15px;
      color: #888;
      font-size: 0.9rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .btn-pill {
      border-radius: 50px;
      font-weight: 800;
      padding: 0 25px;
      height: 48px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      transition: 0.3s;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    }

    .btn-pill:hover {
      transform: translateY(-2px);
      box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
    }

    .btn-pill:active {
      transform: translateY(0);
    }

    .btn-pill.btn-active-pill {
      background-color: #e8f4fd;
      border-color: #0d6efd;
      color: #0d6efd !important;
      font-weight: 800;
    }

    .pill-note {
      background: #fff9db;
      border: none;
      border-radius: 10px;
      padding: 8px 15px;
      color: #856404;
      font-size: 0.85rem;
      margin-bottom: 15px;
      line-height: 1.4;
    }

    /* PREMIUM TOAST NOTIFICATION STYLES (Image 2 Style) */
    #toast-container {
      position: fixed;
      top: 20px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 10001;
      pointer-events: none;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .custom-toast {
      background: white;
      padding: 10px 24px;
      border-radius: 50px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 15px;
      pointer-events: auto;
      animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
      border: 1px solid rgba(0, 0, 0, 0.05);
    }

    .toast-icon-circle {
      width: 24px;
      height: 24px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      color: white;
    }

    .toast-msg {
      font-weight: 700;
      color: #2d3436;
      font-size: 0.95rem;
      white-space: nowrap;
    }

    @keyframes toastIn {
      from {
        opacity: 0;
        transform: translateY(-30px);
      }

      to {
        opacity: 1;
        transform: translateY(0);
      }
    }

    @keyframes toastOut {
      from {
        opacity: 1;
        transform: translateY(0);
      }

      to {
        opacity: 0;
        transform: translateY(-10px);
      }
    }

    /* Hiệu ứng dim cho stacked modals */
    .modal-backdrop.stack-backdrop {
      z-index: 1990 !important;
      opacity: 0.6 !important;
    }

    #modalArchiveDetail.modal-dimmed {
      filter: brightness(0.6) blur(1px);
      pointer-events: none;
      transition: filter 0.3s ease;
    }
/* Inline Header Search & Pagination Custom Styles */
.form-control-xs {
    height: 26px !important;
    padding: 2px 8px !important;
    font-size: 0.72rem !important;
    border-radius: 4px !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}
.form-control-xs::placeholder { color: rgba(255, 255, 255, 0.6); }
.form-control-xs:focus {
    background-color: white !important;
    color: #333 !important;
    border-color: white !important;
    outline: none !important;
    box-shadow: 0 0 0 0.2rem rgba(255,255,255,0.25) !important;
}

.page-item-custom {
    min-width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    color: #555;
    transition: all 0.2s;
    user-select: none;
}
.page-item-custom:hover { background: #f0f2f5; }
.page-item-custom.active {
    border: 1px solid #0d6efd;
    color: #0d6efd;
    font-weight: bold;
}
.page-item-custom.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.table-bordered th, .table-bordered td {
    border: 1px solid #dee2e6 !important;
}


/* Custom Checkbox & Table Row Polish */
.machine-check {
    width: 16px !important;
    height: 16px !important;
    margin-top: 0 !important;
    cursor: pointer;
    border-color: #ced4da !important;
}
.table-hover tbody tr:hover {
    background-color: #f8faff !important;
}
.table td {
    padding: 8px 10px !important;
    vertical-align: middle !important;
    color: #444;
}
.header-search {
    background-color: white !important;
    color: #333 !important;
    border: 1px solid #dee2e6 !important;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.05) !important;
}
.header-search::placeholder {
    color: #bbb !important;
}

/* Custom premium Ant Design Style Pagination controls */
.custom-pagination-controls {
  display: flex;
  align-items: center;
  user-select: none;
  gap: 8px;
}

.pagination-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  cursor: pointer;
  color: rgba(0, 0, 0, 0.45);
  transition: all 0.2s;
  border-radius: 8px;
}

.pagination-arrow:hover:not(.disabled) {
  color: #1890ff;
  background-color: rgba(24, 144, 255, 0.05);
}

.pagination-arrow.disabled {
  color: rgba(0, 0, 0, 0.25);
  cursor: not-allowed;
}

.pagination-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 6px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid #d9d9d9;
  color: rgba(0, 0, 0, 0.85);
  transition: all 0.2s;
  background-color: #fff;
  font-weight: 500;
}

.pagination-number:hover {
  border-color: #1890ff;
  color: #1890ff;
}

.pagination-number.active {
  border-color: #1890ff;
  color: #1890ff;
  font-weight: 600;
  background-color: #fff;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: rgba(0, 0, 0, 0.25);
}

.custom-limit-selector {
  border-radius: 8px !important;
  font-size: 13px !important;
  height: 32px !important;
  cursor: pointer !important;
  border: 1px solid #d9d9d9 !important;
  padding: 4px 24px 4px 12px !important;
  background-color: #fff !important;
  color: rgba(0, 0, 0, 0.85) !important;
}

.custom-limit-selector:hover {
  border-color: #1890ff !important;
}

/* ACTION BUTTONS PREMIUM STYLING */
.btn-action-purple {
  border: 2px solid #6f42c1 !important;
  color: #6f42c1 !important;
  background-color: transparent !important;
}
.btn-action-purple:hover:not(:disabled) {
  background-color: #6f42c1 !important;
  color: #ffffff !important;
}

.btn-action-success {
  border: 2px solid #198754 !important;
  color: #198754 !important;
  background-color: transparent !important;
}
.btn-action-success:hover:not(:disabled) {
  background-color: #198754 !important;
  color: #ffffff !important;
}

.btn-action-primary {
  border: 2px solid #0d6efd !important;
  color: #0d6efd !important;
  background-color: transparent !important;
}
.btn-action-primary:hover:not(:disabled) {
  background-color: #0d6efd !important;
  color: #ffffff !important;
}

.btn-action-purple:disabled,
.btn-action-success:disabled,
.btn-action-primary:disabled {
  opacity: 0.55 !important;
  cursor: not-allowed !important;
  border-color: #d9d9d9 !important;
  color: #bfbfbf !important;
  background-color: #f5f5f5 !important;
}

/* ACTION BUTTONS RECTANGULAR COMPACT STYLING */
.btn-rect {
  border-radius: 6px !important;
  font-weight: 700 !important;
  padding: 0 16px !important;
  height: 38px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  transition: all 0.2s !important;
  box-shadow: none !important;
}

.btn-rect:hover:not(:disabled) {
  transform: translateY(-1px) !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

.btn-rect:active:not(:disabled) {
  transform: translateY(0) !important;
}

/* File input wrapper override to match rectangular compact layout */
.rect-input-wrapper {
  position: relative !important;
  flex: 2 !important;
  display: flex !important;
  align-items: center !important;
  background: white !important;
  border: 1px solid #ced4da !important;
  border-radius: 6px !important;
  padding-right: 12px !important;
  height: 38px !important;
  transition: 0.2s !important;
}

.rect-input-wrapper:focus-within {
  border-color: #0d6efd !important;
  box-shadow: 0 0 5px rgba(13, 110, 253, 0.15) !important;
}

.rect-input-display {
  display: flex !important;
  align-items: center !important;
  width: 100% !important;
  padding-left: 2px !important;
}

.rect-input-btn {
  background: #f8f9fa !important;
  color: #495057 !important;
  padding: 0 15px !important;
  border-right: 1px solid #ced4da !important;
  font-weight: 700 !important;
  font-size: 13px !important;
  pointer-events: none !important;
  white-space: nowrap !important;
  height: 36px !important;
  display: flex !important;
  align-items: center !important;
  border-top-left-radius: 5px !important;
  border-bottom-left-radius: 5px !important;
}

.rect-input-text {
  padding: 0 12px !important;
  color: #6c757d !important;
  font-size: 13px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Khắc phục lỗi cuộn chuột của thẻ tiêu đề trong bảng Modal (Kho lưu trữ) */
.sticky-header th {
  position: sticky;
  top: -1px;
  z-index: 10;
  background-color: inherit;
  box-shadow: inset 0 -1px 0 #dee2e6, inset 0 1px 0 #dee2e6;
  background-clip: padding-box;
}

.bg-purple {
  background-color: #6f42c1 !important;
}
.text-purple {
  color: #6f42c1 !important;
}
