
    /* ===== CSS VARIABLES ===== */
    :root {
      --primary: #1e3a5f;
      --primary-light: #2c5282;
      --primary-dark: #152d4a;
      --accent: #3b82f6;
      --accent-hover: #2563eb;
      --success: #10b981;
      --warning: #f59e0b;
      --danger: #ef4444;
      --info: #06b6d4;
      --bg: #f0f4f8;
      --bg-card: #ffffff;
      --text: #1e293b;
      --text-muted: #64748b;
      --border: #e2e8f0;
      --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
      --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
      --sidebar-w: 240px;
      --radius: 12px;
    }

    /* ===== RESET & BASE ===== */
    *,
    *::before,
    *::after {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html,
    body {
      height: 100%;
      font-family: 'Inter', sans-serif;
      background: var(--bg);
      color: var(--text);
      font-size: 14px;
    }

    a {
      color: inherit;
      text-decoration: none;
    }

    /* ===== LAYOUT ===== */
    #app {
      display: flex;
      height: 100vh;
      overflow: hidden;
    }

    #sidebar {
      width: var(--sidebar-w);
      background: var(--primary);
      display: flex;
      flex-direction: column;
      transition: width 0.3s ease;
      flex-shrink: 0;
      z-index: 100;
    }

    #main-content {
      flex: 1;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }

    #topbar {
      height: 60px;
      background: var(--bg-card);
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 24px;
      box-shadow: var(--shadow);
      flex-shrink: 0;
    }

    #content-area {
      flex: 1;
      overflow-y: auto;
      padding: 24px;
    }

    /* ===== SIDEBAR ===== */
    .sidebar-logo {
      padding: 20px 16px;
      display: flex;
      align-items: center;
      gap: 10px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .logo-icon {
      width: 36px;
      height: 36px;
      background: var(--accent);
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
      color: #fff;
      font-weight: 700;
      flex-shrink: 0;
    }

    .logo-text {
      color: #fff;
      font-weight: 600;
      font-size: 14px;
      line-height: 1.3;
    }

    .logo-sub {
      color: rgba(255, 255, 255, 0.6);
      font-size: 11px;
    }

    .sidebar-user {
      padding: 16px;
      border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .user-avatar {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: linear-gradient(135deg, var(--accent), #7c3aed);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-weight: 600;
      font-size: 16px;
      flex-shrink: 0;
    }

    .user-info-text {
      flex: 1;
      min-width: 0;
    }

    .user-name {
      color: #fff;
      font-weight: 600;
      font-size: 13px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .user-role-badge {
      display: inline-block;
      padding: 2px 8px;
      border-radius: 20px;
      font-size: 10px;
      font-weight: 600;
      margin-top: 2px;
    }

    .role-admin {
      background: rgba(239, 68, 68, 0.25);
      color: #fca5a5;
    }

    .role-manager {
      background: rgba(245, 158, 11, 0.25);
      color: #fcd34d;
    }

    .role-leader {
      background: rgba(16, 185, 129, 0.25);
      color: #6ee7b7;
    }

    .role-staff {
      background: rgba(59, 130, 246, 0.25);
      color: #93c5fd;
    }

    .sidebar-nav {
      flex: 1;
      overflow-y: auto;
      padding: 8px 0;
    }

    .nav-section-title {
      padding: 8px 16px 4px;
      font-size: 10px;
      font-weight: 600;
      color: rgba(255, 255, 255, 0.4);
      text-transform: uppercase;
      letter-spacing: 0.1em;
    }

    .nav-item {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 10px 16px;
      color: rgba(255, 255, 255, 0.7);
      cursor: pointer;
      border-radius: 0;
      transition: all 0.2s;
      margin: 1px 8px;
      border-radius: 8px;
    }

    .nav-item:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
    }

    .nav-item.active {
      background: var(--accent);
      color: #fff;
      box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    }

    .nav-item .material-icons {
      font-size: 18px;
    }

    .nav-item-label {
      font-size: 13px;
      font-weight: 500;
    }

    .nav-badge {
      margin-left: auto;
      background: var(--danger);
      color: #fff;
      border-radius: 20px;
      padding: 1px 6px;
      font-size: 10px;
      font-weight: 700;
    }

    /* ===== SUBNAV ===== */
    .sub-nav-list {
      padding-left: 20px;
      margin-bottom: 4px;
      display: none;
    }

    .sub-nav-list.expanded {
      display: block;
    }

    .sub-nav-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 16px;
      color: rgba(255, 255, 255, 0.6);
      cursor: pointer;
      border-radius: 8px;
      margin: 1px 8px 1px 0;
      font-size: 12px;
      transition: all 0.2s;
    }

    .sub-nav-item:hover {
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
    }

    .sub-nav-item.active {
      background: rgba(255, 255, 255, 0.15);
      color: #fff;
      font-weight: 600;
    }

    .sub-nav-dot {
      font-size: 14px;
      line-height: 1;
      color: rgba(255, 255, 255, 0.4);
    }

    .sub-nav-item.active .sub-nav-dot {
      color: var(--accent);
    }

    .nav-item-with-arrow {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .nav-arrow {
      font-size: 16px !important;
      transition: transform 0.2s ease;
      color: rgba(255, 255, 255, 0.5);
    }

    .nav-arrow.rotated {
      transform: rotate(90deg);
    }

    /* ===== TOPBAR ===== */
    .topbar-title {
      font-size: 16px;
      font-weight: 600;
      color: var(--text);
    }

    .topbar-period {
      font-size: 12px;
      margin-top: 2px;
      display: inline-flex;
      align-items: center;
    }

    .topbar-period-btn {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      background: #eff6ff;
      border: 1px solid #bfdbfe;
      border-radius: 16px;
      padding: 3px 12px;
      font-size: 12px;
      font-weight: 700;
      color: #1d4ed8;
      cursor: pointer;
      transition: all 0.2s ease;
      margin-top: 2px;
      box-shadow: 0 1px 2px rgba(37, 99, 235, 0.1);
    }

    .topbar-period-btn:hover {
      background: #dbeafe;
      border-color: #2563eb;
      color: #1e40af;
      transform: translateY(-1px);
      box-shadow: 0 3px 8px rgba(37, 99, 235, 0.2);
    }

    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .btn-icon {
      width: 36px;
      height: 36px;
      border-radius: 8px;
      border: 1px solid var(--border);
      background: transparent;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      color: var(--text-muted);
      transition: all 0.2s;
    }

    .btn-icon:hover {
      background: var(--bg);
      color: var(--text);
    }

    .btn-icon .material-icons {
      font-size: 18px;
    }

    /* ===== CARDS ===== */
    .card {
      background: var(--bg-card);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      border: 1px solid var(--border);
      margin-bottom: 20px;
    }

    .card-header {
      padding: 16px 20px;
      border-bottom: 1px solid var(--border);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .card-header h3 {
      font-size: 15px;
      font-weight: 600;
    }

    .card-header .material-icons {
      color: var(--accent);
      font-size: 20px;
    }

    .card-body {
      padding: 20px;
    }

    /* ===== STAT CARDS ===== */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
    }

    .stat-card {
      background: var(--bg-card);
      border-radius: var(--radius);
      border: 1px solid var(--border);
      padding: 20px;
      box-shadow: var(--shadow);
      transition: transform 0.2s;
    }

    .stat-card:hover {
      transform: translateY(-2px);
      box-shadow: var(--shadow-lg);
    }

    .stat-icon {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 22px;
      margin-bottom: 12px;
    }

    .stat-icon.blue {
      background: rgba(59, 130, 246, 0.12);
      color: var(--accent);
    }

    .stat-icon.green {
      background: rgba(16, 185, 129, 0.12);
      color: var(--success);
    }

    .stat-icon.yellow {
      background: rgba(245, 158, 11, 0.12);
      color: var(--warning);
    }

    .stat-icon.red {
      background: rgba(239, 68, 68, 0.12);
      color: var(--danger);
    }

    .stat-icon.purple {
      background: rgba(124, 58, 237, 0.12);
      color: #7c3aed;
    }

    .stat-value {
      font-size: 28px;
      font-weight: 700;
      color: var(--text);
      line-height: 1;
    }

    .stat-label {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    /* ===== FORMS ===== */
    .form-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
      gap: 16px;
    }

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 6px;
      margin-bottom: 16px;
    }

    .form-group label {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
    }

    .form-control {
      padding: 10px 14px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      color: var(--text);
      background: #fff;
      transition: border-color 0.2s, box-shadow 0.2s;
      outline: none;
    }

    .form-control:focus {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    }

    .form-control::placeholder {
      color: #adb5bd;
    }

    select.form-control {
      cursor: pointer;
    }

    /* ===== SEARCHABLE SELECT COMPONENT (INLINE TYPEABLE) ===== */
    .searchable-select-wrapper {
      position: relative;
      width: 100%;
      box-sizing: border-box;
    }
    .searchable-select-input-container {
      position: relative;
      width: 100%;
      display: flex;
      align-items: center;
    }
    .searchable-select-main-input {
      width: 100%;
      padding: 10px 36px 10px 14px;
      border: 1px solid var(--border);
      border-radius: 8px;
      font-family: 'Inter', sans-serif;
      font-size: 14px;
      color: var(--text);
      background: #fff;
      outline: none;
      box-sizing: border-box;
      transition: border-color 0.2s, box-shadow 0.2s;
      min-height: 42px;
      cursor: text;
    }
    .searchable-select-main-input:focus,
    .searchable-select-wrapper.open .searchable-select-main-input {
      border-color: var(--accent);
      box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
      border-bottom-left-radius: 0;
      border-bottom-right-radius: 0;
    }
    .searchable-select-input-container .arrow {
      position: absolute;
      right: 10px;
      font-size: 20px;
      color: var(--text-muted);
      pointer-events: none;
      transition: transform 0.2s ease;
    }
    .searchable-select-wrapper.open .searchable-select-input-container .arrow {
      transform: rotate(180deg);
    }
    .searchable-select-dropdown {
      position: absolute;
      top: 100%;
      left: 0;
      right: 0;
      z-index: 9999;
      background: #ffffff;
      border: 1px solid var(--accent);
      border-top: none;
      border-bottom-left-radius: 8px;
      border-bottom-right-radius: 8px;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
      display: none;
      overflow: hidden;
    }
    .searchable-select-wrapper.open .searchable-select-dropdown {
      display: block;
      animation: dropdownFadeIn 0.15s ease-out;
    }
    @keyframes dropdownFadeIn {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .searchable-select-options {
      max-height: 240px;
      overflow-y: auto;
      padding: 4px 0;
      margin: 0;
    }
    .searchable-select-option {
      padding: 9px 12px;
      font-size: 13px;
      color: var(--text);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: background 0.12s;
    }
    .searchable-select-option:hover,
    .searchable-select-option.highlighted {
      background: #f1f5f9;
      color: var(--accent);
    }
    .searchable-select-option.selected {
      background: #eff6ff;
      color: var(--accent);
      font-weight: 600;
    }
    .searchable-select-no-results {
      padding: 14px;
      text-align: center;
      font-size: 13px;
      color: var(--text-muted);
    }

    textarea.form-control {
      resize: vertical;
      min-height: 80px;
    }

    /* ===== BUTTONS ===== */
    .btn {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 9px 18px;
      border-radius: 8px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: all 0.2s;
      font-family: 'Inter', sans-serif;
    }

    .btn .material-icons {
      font-size: 16px;
    }

    .btn-primary {
      background: var(--accent);
      color: #fff;
    }

    .btn-primary:hover {
      background: var(--accent-hover);
      box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
    }

    .btn-success {
      background: var(--success);
      color: #fff;
    }

    .btn-success:hover {
      background: #059669;
    }

    .btn-danger {
      background: var(--danger);
      color: #fff;
    }

    .btn-danger:hover {
      background: #dc2626;
    }

    .btn-warning {
      background: var(--warning);
      color: #fff;
    }

    .btn-warning:hover {
      background: #d97706;
    }

    .btn-outline {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-muted);
    }

    .btn-outline:hover {
      background: var(--bg);
      color: var(--text);
    }

    .btn:disabled {
      opacity: 0.5;
      cursor: not-allowed;
    }

    .btn-sm {
      padding: 6px 12px;
      font-size: 12px;
    }

    /* ===== TABLES ===== */
    .table-wrapper,
    .table-responsive {
      overflow-x: auto;
      max-height: 75vh;
      overflow-y: auto;
      border: 1px solid var(--border);
      border-radius: 6px;
    }

    #summary-tables-container .table-wrapper,
    .tonghop-table-wrapper {
      max-height: calc(100vh - 260px);
      min-height: 520px;
    }

    /* Custom premium scrollbars */
    .table-wrapper::-webkit-scrollbar,
    .table-responsive::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    .table-wrapper::-webkit-scrollbar-track,
    .table-responsive::-webkit-scrollbar-track {
      background: transparent;
    }

    .table-wrapper::-webkit-scrollbar-thumb,
    .table-responsive::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }

    .table-wrapper::-webkit-scrollbar-thumb:hover,
    .table-responsive::-webkit-scrollbar-thumb:hover {
      background: var(--text-muted);
    }

    table {
      width: 100%;
      border-collapse: collapse;
      font-size: 13px;
    }

    thead th {
      background: var(--bg);
      padding: 10px 14px;
      font-size: 11px;
      font-weight: 600;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      border-bottom: 1px solid var(--border);
      text-align: left;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    tbody td {
      padding: 11px 14px;
      border-bottom: 1px solid #f1f5f9;
      vertical-align: middle;
    }

    tbody tr:hover {
      background: #f8faff;
    }

    tbody tr:last-child td {
      border-bottom: none;
    }

    /* ===== BADGES ===== */
    .badge {
      display: inline-block;
      padding: 3px 10px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 600;
    }

    .badge-success {
      background: rgba(16, 185, 129, 0.12);
      color: var(--success);
    }

    .badge-warning {
      background: rgba(245, 158, 11, 0.12);
      color: var(--warning);
    }

    .badge-danger {
      background: rgba(239, 68, 68, 0.12);
      color: var(--danger);
    }

    .badge-info {
      background: rgba(6, 182, 212, 0.12);
      color: var(--info);
    }

    .badge-neutral {
      background: rgba(100, 116, 139, 0.12);
      color: var(--text-muted);
    }

    /* ===== ALERTS ===== */
    .alert {
      padding: 12px 16px;
      border-radius: 8px;
      font-size: 13px;
      display: flex;
      align-items: flex-start;
      gap: 10px;
      margin-bottom: 16px;
    }

    .alert .material-icons {
      font-size: 18px;
      margin-top: 1px;
      flex-shrink: 0;
    }

    .alert-success {
      background: rgba(16, 185, 129, 0.1);
      border: 1px solid rgba(16, 185, 129, 0.2);
      color: #065f46;
    }

    .alert-error {
      background: rgba(239, 68, 68, 0.1);
      border: 1px solid rgba(239, 68, 68, 0.2);
      color: #7f1d1d;
    }

    .alert-info {
      background: rgba(59, 130, 246, 0.1);
      border: 1px solid rgba(59, 130, 246, 0.2);
      color: #1e3a8a;
    }

    .alert-warning {
      background: rgba(245, 158, 11, 0.1);
      border: 1px solid rgba(245, 158, 11, 0.2);
      color: #78350f;
    }

    /* ===== TABS ===== */
    .tabs {
      display: flex;
      gap: 4px;
      border-bottom: 2px solid var(--border);
      margin-bottom: 20px;
    }

    .tab-btn {
      padding: 10px 16px;
      border: none;
      background: transparent;
      cursor: pointer;
      font-size: 13px;
      font-weight: 500;
      color: var(--text-muted);
      border-bottom: 2px solid transparent;
      margin-bottom: -2px;
      transition: all 0.2s;
      font-family: 'Inter', sans-serif;
      border-radius: 4px 4px 0 0;
    }

    .tab-btn:hover {
      color: var(--accent);
      background: rgba(59, 130, 246, 0.05);
    }

    .tab-btn.active {
      color: var(--accent);
      border-bottom-color: var(--accent);
      font-weight: 600;
    }

    .tab-content {
      display: none;
    }
    .tab-content.active {
      display: block;
    }

    /* ===== LOGIN PAGE ===== */
    #login-page {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 100vh;
      background: linear-gradient(135deg, #1e3a5f 0%, #1e40af 50%, #1e3a5f 100%);
      position: fixed;
      inset: 0;
      z-index: 1000;
      transition: all 0.35s ease;
      box-sizing: border-box;
      padding: 16px;
    }

    .login-card {
      background: #fff;
      border-radius: 20px;
      padding: 36px 32px;
      width: 400px;
      max-width: calc(100vw - 32px);
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
      transition: all 0.35s ease;
      position: relative;
      z-index: 10;
    }

    /* Theme Quốc Khánh 2/9 Hài Hòa (Champagne Frosted Glassmorphism) */
    #login-page.theme-quoc-khanh-2-9 {
      background-size: cover;
      background-position: center center;
      background-repeat: no-repeat;
      background-attachment: fixed;
    }

    #login-page.theme-quoc-khanh-2-9 .login-card {
      background: linear-gradient(145deg, rgba(255, 255, 255, 0.88) 0%, rgba(254, 249, 235, 0.80) 50%, rgba(254, 243, 199, 0.75) 100%);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1.5px solid rgba(255, 255, 255, 0.75);
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(251, 191, 36, 0.35), 0 10px 25px rgba(245, 158, 11, 0.15);
      width: 380px;
      max-width: calc(100vw - 32px);
      border-radius: 22px;
      padding: 36px 30px;
    }

    #login-page.theme-quoc-khanh-2-9 .login-title {
      color: #0f172a;
      font-weight: 800;
      letter-spacing: -0.3px;
    }

    #login-page.theme-quoc-khanh-2-9 .login-subtitle {
      color: #334155;
      font-weight: 500;
    }

    #login-page.theme-quoc-khanh-2-9 .form-group label {
      color: #334155;
      font-weight: 700;
      font-size: 11.5px;
      letter-spacing: 0.5px;
      text-transform: uppercase;
    }

    #login-page.theme-quoc-khanh-2-9 .form-control {
      background: rgba(255, 255, 255, 0.75);
      border: 1.5px solid rgba(148, 163, 184, 0.5);
      border-radius: 10px;
      color: #0f172a;
      font-weight: 500;
      transition: all 0.2s ease;
    }

    #login-page.theme-quoc-khanh-2-9 .form-control:focus {
      background: rgba(255, 255, 255, 0.98);
      border-color: #2563eb;
      box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
    }

    #login-page.theme-quoc-khanh-2-9 .login-btn {
      background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
      color: #ffffff;
      box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
      border: none;
      border-radius: 10px;
      font-weight: 700;
      letter-spacing: 0.2px;
      transition: all 0.2s ease;
    }

    #login-page.theme-quoc-khanh-2-9 .login-btn:hover {
      background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
      box-shadow: 0 8px 25px rgba(37, 99, 235, 0.55);
      transform: translateY(-1px);
    }

    /* Mobile Responsive Optimizations */
    @media (max-width: 640px) {
      .login-card {
        padding: 24px 20px !important;
        border-radius: 16px !important;
      }
      .login-logo {
        margin-bottom: 20px !important;
      }
      .login-logo img {
        width: 48px !important;
        height: 48px !important;
        margin-bottom: 8px !important;
      }
      .login-title {
        font-size: 19px !important;
      }
      .login-subtitle {
        font-size: 11.5px !important;
      }
      .login-btn {
        padding: 12px !important;
        font-size: 14px !important;
      }
    }

    .login-logo {
      text-align: center;
      margin-bottom: 32px;
    }

    .login-logo-icon {
      width: 64px;
      height: 64px;
      background: linear-gradient(135deg, var(--accent), #1d4ed8);
      border-radius: 16px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto 16px;
      box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
    }

    .login-logo-icon .material-icons {
      font-size: 32px;
      color: #fff;
    }

    .login-title {
      font-size: 22px;
      font-weight: 700;
      color: var(--text);
    }

    .login-subtitle {
      font-size: 13px;
      color: var(--text-muted);
      margin-top: 4px;
    }

    .login-btn {
      width: 100%;
      padding: 13px;
      background: linear-gradient(135deg, var(--accent), #1d4ed8);
      color: #fff;
      border: none;
      border-radius: 10px;
      font-size: 15px;
      font-weight: 600;
      cursor: pointer;
      margin-top: 8px;
      transition: all 0.2s;
      font-family: 'Inter', sans-serif;
    }

    .login-btn:hover {
      transform: translateY(-1px);
      box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    }

    .login-btn:active {
      transform: translateY(0);
    }

    .login-btn:disabled {
      opacity: 0.7;
      cursor: not-allowed;
      transform: none;
    }

    /* ===== LOADING ===== */
    .loading-overlay {
      position: fixed;
      inset: 0;
      background: rgba(255, 255, 255, 0.9);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }

    .spinner {
      width: 40px;
      height: 40px;
      border: 3px solid var(--border);
      border-top-color: var(--accent);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
    }

    @keyframes spin {
      to {
        transform: rotate(360deg);
      }
    }

    .hidden {
      display: none !important;
    }

    .flex {
      display: flex;
    }

    .items-center {
      align-items: center;
    }

    .gap-8 {
      gap: 8px;
    }

    .gap-12 {
      gap: 12px;
    }

    .mb-16 {
      margin-bottom: 16px;
    }

    .ml-auto {
      margin-left: auto;
    }

    .text-right {
      text-align: right;
    }

    .font-bold {
      font-weight: 700;
    }

    .text-muted {
      color: var(--text-muted);
      font-size: 12px;
    }

    /* ===== MODAL ===== */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 500;
    }

    .modal {
      background: #fff;
      border-radius: var(--radius);
      padding: 28px;
      width: 520px;
      max-width: 95vw;
      max-height: 90vh;
      overflow-y: auto;
      box-shadow: var(--shadow-lg);
      animation: modalIn 0.2s ease;
    }

    @keyframes modalIn {
      from {
        transform: scale(0.95);
        opacity: 0;
      }

      to {
        transform: scale(1);
        opacity: 1;
      }
    }

    .modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
    }

    .modal-title {
      font-size: 16px;
      font-weight: 700;
    }

    .modal-close {
      background: none;
      border: none;
      cursor: pointer;
      color: var(--text-muted);
      font-size: 20px;
    }

    .modal-footer {
      display: flex;
      gap: 10px;
      justify-content: flex-end;
      margin-top: 20px;
      padding-top: 16px;
      border-top: 1px solid var(--border);
    }

    /* ===== PAGE HEADER ===== */
    .page-header {
      margin-bottom: 24px;
    }

    .page-header h2 {
      font-size: 20px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .page-header h2 .material-icons {
      color: var(--accent);
    }

    .page-header p {
      color: var(--text-muted);
      font-size: 13px;
      margin-top: 4px;
    }

    .page-header-actions {
      display: flex;
      gap: 8px;
      margin-top: 12px;
    }

    /* ===== KPI PROGRESS ===== */
    .kpi-bar-container {
      margin-top: 8px;
    }

    .kpi-bar-bg {
      height: 8px;
      background: var(--bg);
      border-radius: 4px;
      overflow: hidden;
    }

    .kpi-bar-fill {
      height: 100%;
      border-radius: 4px;
      transition: width 0.5s ease;
    }

    .kpi-bar-fill.good {
      background: var(--success);
    }

    .kpi-bar-fill.ok {
      background: var(--warning);
    }

    .kpi-bar-fill.low {
      background: var(--danger);
    }

    /* ===== SCROLLBAR ===== */
    ::-webkit-scrollbar {
      width: 6px;
      height: 6px;
    }

    ::-webkit-scrollbar-track {
      background: transparent;
    }

    ::-webkit-scrollbar-thumb {
      background: var(--border);
      border-radius: 3px;
    }

    ::-webkit-scrollbar-thumb:hover {
      background: #94a3b8;
    }

    /* ===== COLLAPSED SIDEBAR (DESKTOP) ===== */
    @media (min-width: 768px) {
      #app.sidebar-collapsed #sidebar {
        width: 64px;
      }

      #app.sidebar-collapsed #sidebar .logo-text,
      #app.sidebar-collapsed #sidebar .user-info-text,
      #app.sidebar-collapsed #sidebar .nav-item-label,
      #app.sidebar-collapsed #sidebar .nav-arrow,
      #app.sidebar-collapsed #sidebar .nav-badge,
      #app.sidebar-collapsed #sidebar .nav-section-title,
      #app.sidebar-collapsed #sidebar .sub-nav-list {
        display: none !important;
      }

      #app.sidebar-collapsed #sidebar .sidebar-logo {
        justify-content: center;
        padding: 20px 0;
      }

      #app.sidebar-collapsed #sidebar .sidebar-user {
        justify-content: center;
        padding: 16px 0;
      }

      #app.sidebar-collapsed #sidebar .user-avatar {
        margin: 0 auto;
      }

      #app.sidebar-collapsed #sidebar .nav-item {
        justify-content: center;
        margin: 2px 8px;
        padding: 10px 0;
      }

      #app.sidebar-collapsed #sidebar .nav-item .flex {
        justify-content: center;
        width: 100%;
      }

      #app.sidebar-collapsed #sidebar .nav-item .material-icons {
        margin: 0;
      }
    }

    /* ===== MANAGEMENT OVERVIEW GRID ===== */
    .mgmt-stat-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 16px;
      margin-bottom: 24px;
    }

    .mgmt-stat-card {
      background: var(--bg-card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 16px 20px;
      box-shadow: var(--shadow);
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .mgmt-stat-card.blue {
      border-left: 4px solid var(--accent);
    }

    .mgmt-stat-card.green {
      border-left: 4px solid var(--success);
    }

    .mgmt-stat-card.orange {
      border-left: 4px solid var(--warning);
    }

    .mgmt-stat-card.red {
      border-left: 4px solid var(--danger);
    }

    .stat-icon-bg {
      position: absolute;
      right: 12px;
      top: 12px;
      font-size: 36px;
      opacity: 0.12;
      pointer-events: none;
    }

    .stat-num {
      font-size: 24px;
      font-weight: 700;
      line-height: 1.1;
      color: var(--text);
    }

    .stat-lbl {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 4px;
      font-weight: 500;
    }

    .topbar-period-btn {
      display: inline-flex;
      align-items: center;
      background: #e0e7ff;
      color: #3730a3;
      border: 1px solid #c7d2fe;
      border-radius: 14px;
      padding: 3px 10px;
      font-size: 12px;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s ease;
      margin-top: 2px;
      box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .topbar-period-btn:hover {
      background: #c7d2fe;
      color: #1e1b4b;
    }

    /* ===== RESPONSIVE MEDIA QUERIES (MOBILE iOS & ANDROID) ===== */
    @media (max-width: 1024px) {
      .mgmt-stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
      }
    }

    @media (max-width: 767px) {

      /* Prevent iOS Safari Auto-Zoom on form input focus */
      input[type="text"],
      input[type="password"],
      input[type="number"],
      input[type="date"],
      input[type="time"],
      select,
      textarea,
      .form-control {
        font-size: 16px !important;
      }

      /* Prevent accidental double-tap zoom */
      button,
      select,
      input,
      a,
      .nav-item,
      .sub-nav-item,
      .tab-btn {
        touch-action: manipulation;
      }

      #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 270px;
        max-width: 84vw;
        transform: translateX(-100%);
        z-index: 1000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
      }

      #sidebar.mobile-open {
        transform: translateX(0);
      }

      #sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(2px);
        z-index: 999;
      }

      #sidebar-overlay.active {
        display: block;
      }

      #topbar {
        padding: 0 12px !important;
        height: 56px !important;
      }

      .topbar-title {
        font-size: 14px !important;
        max-width: 160px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #content-area {
        padding: 12px 12px 60px 12px !important;
      }

      .mgmt-stat-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }

      .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
      }

      .form-grid,
      #di-ca-fields,
      #ot-fields,
      .grid-4,
      .grid-3,
      .grid-2,
      .responsive-2col-grid {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
      }

      .tabs {
        display: flex;
        gap: 6px;
        border-bottom: 2px solid var(--border);
        margin-bottom: 16px;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
      }

      .tabs::-webkit-scrollbar {
        display: none;
      }

      .tab-btn {
        flex-shrink: 0;
        padding: 8px 12px;
        font-size: 12px;
      }

      .table-wrapper,
      .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
        max-width: 100%;
        border-radius: 8px;
      }

      .table-wrapper table,
      .table-responsive table {
        min-width: 600px;
      }

      .card-body {
        padding: 14px !important;
      }

      .card-header {
        padding: 12px 14px !important;
      }

      .page-header h2 {
        font-size: 17px !important;
      }

      /* Custom Mobile Compliance Form Card Rows */
      .tt-table-wrapper {
        overflow-x: visible !important;
        width: 100% !important;
        max-width: 100% !important;
      }

      .tt-entry-table {
        min-width: 0 !important;
        width: 100% !important;
      }

      .tt-entry-table thead {
        display: none !important;
      }

      .tt-entry-table,
      .tt-entry-table tbody {
        display: block !important;
        width: 100% !important;
      }

      .tt-entry-table tr.tt-row-item {
        display: block !important;
        background: var(--bg-card, #ffffff);
        border: 1px solid var(--border-color, #e2e8f0) !important;
        border-radius: 12px !important;
        padding: 14px 16px !important;
        margin-bottom: 16px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
        position: relative !important;
        box-sizing: border-box !important;
      }

      .tt-entry-table td {
        display: block !important;
        width: 100% !important;
        min-width: 100% !important;
        padding: 6px 0 !important;
        border: none !important;
        text-align: left !important;
        box-sizing: border-box !important;
      }

      .tt-entry-table td::before {
        content: attr(data-label);
        display: block;
        font-size: 11px;
        font-weight: 700;
        text-transform: uppercase;
        color: #64748b;
        margin-bottom: 4px;
        letter-spacing: 0.3px;
      }

      .tt-entry-table td.td-stt-header {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px dashed var(--border-color, #e2e8f0) !important;
        padding-bottom: 10px !important;
        margin-bottom: 10px;
      }

      .tt-entry-table td.td-stt-header::before {
        display: none !important;
      }

      .stt-desktop-val {
        display: none !important;
      }

      .stt-mobile-val {
        display: inline-flex !important;
        align-items: center;
        font-weight: 700;
        color: var(--text-dark, #1e293b);
      }

      .tt-entry-table td.td-actions {
        position: absolute;
        top: 12px;
        right: 14px;
        width: auto !important;
        min-width: auto !important;
        padding: 0 !important;
      }

      .tt-entry-table td.td-actions::before {
        display: none !important;
      }
    }

    .stt-desktop-val {
      display: inline-block;
      font-weight: 700;
    }

    .stt-mobile-val {
      display: none;
    }

    /* Custom Employee Autocomplete Dropdown (Viewport Fixed) */
    .tt-emp-autocomplete-menu {
      position: fixed;
      z-index: 999999;
      background: var(--bg-card, #ffffff);
      border: 1px solid var(--border-color, #cbd5e1);
      border-radius: 10px;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.22), 0 4px 12px rgba(0, 0, 0, 0.12);
      max-height: 280px;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      white-space: normal;
    }

    .tt-emp-item {
      padding: 11px 14px;
      border-bottom: 1px solid #f1f5f9;
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 13.5px;
      color: var(--text-dark, #0f172a);
      transition: background 0.15s ease;
    }

    .tt-emp-item:hover,
    .tt-emp-item:active {
      background: #eff6ff;
      color: #2563eb;
    }

    /* Tuân thủ Entry Form - Responsive Hybrid Layout */
    .tt-table-scroll-container {
      padding: 16px 16px 12px;
      background: #ffffff;
      width: 100%;
      box-sizing: border-box;
      overflow-x: auto;
    }
    .tt-rows-container,
    #tt-rows-body {
      min-width: 100% !important;
      width: max-content !important;
      box-sizing: border-box !important;
    }

    /* Desktop View (>= 900px): Clean 1-line Edge-to-Edge Grid Table Row */
    @media (min-width: 900px) {
      .tt-header-labels {
        display: grid !important;
        grid-template-columns: var(--row-grid-cols) !important;
        gap: 5px !important;
        padding: 4px 8px 6px !important;
        border-bottom: 2px solid var(--border-color, #cbd5e1) !important;
        margin-bottom: 6px !important;
        min-width: 100% !important;
        width: max-content !important;
        box-sizing: border-box !important;
      }
      .tt-row-item {
        display: grid !important;
        grid-template-columns: var(--row-grid-cols) !important;
        gap: 5px !important;
        align-items: center !important;
        padding: 5px 8px !important;
        border-radius: 9px !important;
        background: var(--bg-main, #f8fafc) !important;
        border: 1px solid var(--border-color, #e2e8f0) !important;
        min-width: 100% !important;
        width: max-content !important;
        box-sizing: border-box !important;
      }
      .tt-row-header-mobile,
      .tt-field-label-mobile,
      .tt-row-subgrid-mobile,
      .tt-row-footer-mobile {
        display: none !important;
      }
      .tt-col-desktop {
        display: block !important;
      }
    }

    /* Mobile & Tablet View (< 900px): Clean Spacious Field Card Layout */
    @media (max-width: 899px) {
      .tt-table-scroll-container {
        padding: 10px 8px 8px !important;
        overflow-x: visible !important;
      }
      .tt-header-labels {
        display: none !important;
      }
      .tt-col-desktop {
        display: none !important;
      }
      .tt-row-header-mobile {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding-bottom: 8px !important;
        border-bottom: 1px solid #e2e8f0 !important;
        margin-bottom: 8px !important;
      }
      .tt-field-label-mobile {
        display: block !important;
        font-size: 11.5px !important;
        font-weight: 600 !important;
        color: #475569 !important;
        margin-bottom: 4px !important;
      }
      .tt-row-subgrid-mobile {
        display: grid !important;
        grid-template-columns: 1fr 1fr 1fr !important;
        gap: 8px !important;
        margin-top: 4px !important;
      }
      .tt-row-footer-mobile {
        display: flex !important;
        gap: 10px !important;
        align-items: flex-end !important;
        margin-top: 4px !important;
      }
      .tt-row-item {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        padding: 12px 14px !important;
        background: #ffffff !important;
        border: 1px solid var(--border-color, #cbd5e1) !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
        position: relative !important;
        width: 100% !important;
        box-sizing: border-box !important;
      }
      .tt-emp-autocomplete-menu {
        left: 10px !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        max-width: none !important;
      }
    }

    @media (max-width: 640px) {
      .modal-overlay {
        align-items: flex-end;
        padding: 0;
      }

      .modal {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
        padding: 20px 16px 28px 16px !important;
        max-height: 85vh !important;
        box-shadow: 0 -10px 25px rgba(0, 0, 0, 0.2) !important;
      }

      .modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
      }

      .modal-footer .btn {
        width: 100%;
        justify-content: center;
        padding: 12px;
      }

      .stats-grid {
        grid-template-columns: 1fr !important;
      }
    }
  
/* ============================================================ */
/* ===== QC-KPI V2 ENHANCEMENTS: OFFLINE BANNER & STICKY UI === */
/* ============================================================ */
#offline-indicator {
  display: none;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999999;
  box-shadow: 0 2px 10px rgba(239, 68, 68, 0.3);
  animation: slideDown 0.3s ease-out;
}
#offline-indicator.active {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.shortcut-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 4px;
  font-size: 11px;
  font-family: monospace;
  color: var(--text-muted);
  margin-left: 6px;
}

.table-responsive {
  max-height: 72vh;
  overflow: auto;
  position: relative;
}

.table-responsive table thead th {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 var(--border);
}

.sticky-col-left {
  position: sticky;
  left: 0;
  z-index: 15;
  background: inherit;
}

.sticky-col-right {
  position: sticky;
  right: 0;
  z-index: 15;
  background: inherit;
}

@keyframes slideDown {
  from { transform: translateY(-100%); }
  to { transform: translateY(0); }
}
