    .online-dot {
      position: absolute;
      bottom: 0;
      right: 0;
      width: 10px;
      height: 10px;
      background: #10b981;
      border: 2px solid var(--card);
      border-radius: 50%;
      z-index: 2;
    }

    /* VIDEO CALL UI */
    .video-call-container {
      position: fixed;
      bottom: 20px;
      right: 20px;
      width: 320px;
      background: rgba(15, 23, 42, 0.95);
      backdrop-filter: blur(20px);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: 24px;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      z-index: 9999;
      display: none;
      flex-direction: column;
      overflow: hidden;
    }

    .video-call-header {
      padding: 14px 20px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(255, 255, 255, 0.05);
      cursor: move;
    }

    .video-area {
      position: relative;
      width: 100%;
      aspect-ratio: 4/3;
      background: #000;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    #remote-video {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    #vc-avatar-area {
      display: none;
      flex-direction: column;
      align-items: center;
      gap: 15px;
      color: #fff;
    }

    .vc-avatar {
      width: 100px;
      height: 100px;
      border-radius: 50%;
      background: var(--p);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 40px;
      border: 4px solid rgba(255, 255, 255, 0.2);
    }

    #local-video {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 90px;
      aspect-ratio: 4/3;
      border-radius: 12px;
      border: 2px solid rgba(255, 255, 255, 0.2);
      object-fit: cover;
      background: #1e293b;
      z-index: 10;
    }

    .video-controls {
      padding: 20px;
      display: flex;
      justify-content: center;
      gap: 15px;
    }

    .vc-btn {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      border: none;
      cursor: pointer;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px;
    }

    .vc-btn-hangup {
      background: #ef4444;
    }

    .vc-btn-toggle {
      background: rgba(255, 255, 255, 0.1);
    }

    .vc-btn-toggle.off {
      background: #64748b;
    }

    .incoming-call-toast {
      position: fixed;
      top: 30px;
      left: 50%;
      transform: translateX(-50%);
      background: #fff;
      padding: 15px 25px;
      border-radius: 100px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
      display: none;
      align-items: center;
      gap: 15px;
      z-index: 10000;
      border: 1px solid #ddd;
    }

    .ic-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      border: none;
      cursor: pointer;
      color: #fff;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .notif-dropdown {
      position: absolute;
      top: 50px;
      right: 0;
      width: 320px;
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 12px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
      display: none;
      z-index: 1000;
      overflow: hidden;
    }

    .notif-header {
      padding: 12px 15px;
      border-bottom: 1px solid var(--bdr);
      font-weight: 700;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--bg);
    }

    .notif-list {
      max-height: 400px;
      overflow-y: auto;
    }

    .notif-item {
      padding: 12px 15px;
      border-bottom: 1px solid var(--bdr);
      cursor: pointer;
      transition: background 0.2s;
      display: flex;
      gap: 12px;
    }

    .notif-item:hover {
      background: var(--bg);
    }

    .notif-item.unread {
      background: rgba(var(--p-rgb, 37, 99, 235), 0.1);
    }

    [data-theme='dark'] .notif-item.unread {
      background: rgba(var(--p-rgb, 37, 99, 235), 0.15);
    }

    .notif-icon {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--pl);
      color: var(--p);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      flex-shrink: 0;
    }

    .notif-content {
      flex: 1;
    }

    .notif-title {
      font-weight: 600;
      font-size: 13px;
      margin-bottom: 2px;
      color: var(--tx1);
    }

    .notif-desc {
      font-size: 12px;
      color: var(--tx2);
      line-height: 1.4;
    }

    .notif-time {
      font-size: 10px;
      color: var(--tx3);
      margin-top: 4px;
    }

    .notif-empty {
      padding: 40px 20px;
      text-align: center;
      color: var(--tx3);
      font-size: 13px;
    }

    .notif-dropdown {
      position: absolute;
      top: 50px;
      right: 0;
      width: 320px;
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 12px;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
      display: none;
      z-index: 1000;
      overflow: hidden;
    }

    .notif-header {
      padding: 12px 15px;
      border-bottom: 1px solid var(--bdr);
      font-weight: 700;
      font-size: 14px;
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: var(--bg);
    }

    .notif-list {
      max-height: 400px;
      overflow-y: auto;
    }

    .notif-item {
      padding: 12px 15px;
      border-bottom: 1px solid var(--bdr);
      cursor: pointer;
      transition: background 0.2s;
      display: flex;
      gap: 12px;
    }

    .notif-item:hover {
      background: var(--card);
    }

    .notif-item.unread {
      background: rgba(var(--p-rgb, 37, 99, 235), 0.1);
    }

    [data-theme='dark'] .notif-item.unread {
      background: rgba(var(--p-rgb, 37, 99, 235), 0.15);
    }

    .notif-icon {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--pl);
      color: var(--p);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      flex-shrink: 0;
    }

    .notif-content {
      flex: 1;
    }

    .notif-title {
      font-weight: 600;
      font-size: 13px;
      margin-bottom: 2px;
      color: var(--tx1);
    }

    .notif-desc {
      font-size: 12px;
      color: var(--tx2);
      line-height: 1.4;
    }

    .notif-time {
      font-size: 10px;
      color: var(--tx3);
      margin-top: 4px;
    }

    .notif-empty {
      padding: 40px 20px;
      text-align: center;
      color: var(--tx3);
      font-size: 13px;
    }

    :root {
      --bg: #f1f5f9;
      --sb: #064e3b;
      --sh: #065f46;
      --sa: #059669;
      --p: #059669;
      --pl: #ecfdf5;
      --pd: #047857;
      --acc: #10b981;
      --ok: #10b981;
      --warn: #f59e0b;
      --err: #ef4444;
      --pur: #8b5cf6;
      --w: #fff;
      --card: #fff;
      --bdr: #e2e8f0;
      --tx: #1e293b;
      --tx1: #1e293b;
      --tx2: #475569;
      --tx3: #94a3b8;
      --shd: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
      --r: 12px;
      --sw: 260px;
    }

    /* DARK MODE VARIABLES */
    html[data-theme='dark'],
    [data-theme='dark'] {
      color-scheme: dark;
      --bg: #0f172a;
      --card: #1e293b;
      --bdr: #334155;
      --tx: #f8fafc;
      --tx1: #ffffff;
      --tx2: #cbd5e1;
      --tx3: #94a3b8;
      --pl: #1e293b;
      --w: #1e293b;
      --sb: #0f172a; /* Darker sidebar in dark mode */
      --sh: #1e293b;
      --sa: #334155;
      --shd: 0 10px 25px rgba(0, 0, 0, 0.3);
    }
    
    * {
      transition: background-color 0.25s ease, border-color 0.25s ease, color 0.2s ease;
    }

    [data-theme='dark'] .b-blue {
      background: #1e293b;
      color: #3b82f6;
      border: 1px solid #334155;
    }

    [data-theme='dark'] .b-green {
      background: #064e3b;
      color: #10b981;
      border: 1px solid #065f46;
    }

    [data-theme='dark'] .b-yellow {
      background: #451a03;
      color: #f59e0b;
      border: 1px solid #78350f;
    }

    [data-theme='dark'] .b-red {
      background: #450a0a;
      color: #ef4444;
      border: 1px solid #7f1d1d;
    }

    [data-theme='dark'] .b-purple {
      background: #2e1065;
      color: #a78bfa;
      border: 1px solid #4c1d95;
    }

    [data-theme='dark'] .b-gray {
      background: #0f172a;
      color: #94a3b8;
      border: 1px solid #1e293b;
    }

    [data-theme='dark'] .b-cyan {
      background: #083344;
      color: #22d3ee;
      border: 1px solid #164e63;
    }

    [data-theme='dark'] .b-orange {
      background: #431407;
      color: #fb923c;
      border: 1px solid #7c2d12;
    }

    [data-theme='dark'] .b-teal {
      background: #042f2e;
      color: #2dd4bf;
      border: 1px solid #115e59;
    }

    [data-theme='dark'] .badge-blue {
      background: #1e3a8a;
      color: #bfdbfe;
    }

    [data-theme='dark'] .badge-green {
      background: #064e3b;
      color: #6ee7b7;
    }

    [data-theme='dark'] .badge-orange {
      background: #431407;
      color: #fdba74;
    }

    [data-theme='dark'] .badge-red {
      background: #450a0a;
      color: #fca5a5;
    }

    [data-theme='dark'] .badge-gray {
      background: #1e293b;
      color: #94a3b8;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0
    }

    /* PERMISSIONS TREE */
    .perm-group {
      margin-bottom: 12px;
      border: 1px solid var(--bdr);
      border-radius: 8px;
      background: var(--card);
      overflow: hidden;
    }

    .perm-group-hdr {
      background: var(--bg);
      padding: 8px 12px;
      display: flex;
      align-items: center;
      gap: 10px;
      font-weight: 700;
      font-size: 13px;
      color: var(--tx);
      border-bottom: 1px solid var(--bdr);
      cursor: pointer;
    }

    .perm-group-hdr i {
      width: 20px;
      text-align: center;
      color: var(--p);
    }

    .perm-list {
      padding: 10px 12px;
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 6px;
    }

    .perm-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 12px;
      color: var(--tx2);
      cursor: pointer;
    }

    .perm-item input {
      cursor: pointer;
    }

    html,
    body {
      margin: 0;
      padding: 0;
      width: 100%;
      height: 100%;
      background: var(--sb);
      font-family: 'Inter', 'Be Vietnam Pro', sans-serif;
      color: var(--tx);
      display: flex;
      overflow: hidden;
      font-size: 14px;
      -webkit-tap-highlight-color: transparent;
    }

    /* MODULE BAR (Base Style) */
    .mod-badge {
      position: absolute;
      top: 4px;
      right: 4px;
      background: #ef4444;
      color: #fff;
      font-size: 9px;
      font-weight: 800;
      min-width: 16px;
      height: 16px;
      border-radius: 80px;
      display: flex;
      align-items: center;
      justify-content: center;
      border: 2px solid #1e293b;
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
      pointer-events: none;
      z-index: 10;
    }

    #module-bar {
      width: 68px;
      background: #1e293b;
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: calc(20px + env(safe-area-inset-top)) 0 calc(20px + env(safe-area-inset-bottom)) 0;
      gap: 16px;
      z-index: 100;
      border-right: 1px solid rgba(255, 255, 255, 0.05);
      flex-shrink: 0;
    }

    .mod-i {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 22px;
      color: #fff;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
    }

    .mod-i:hover {
      background: rgba(255, 255, 255, 0.1);
      color: #fff;
      transform: scale(1.05);
    }

    .mod-i.active {
      background: var(--p);
      color: #fff;
      box-shadow: 0 4px 12px rgba(var(--p-rgb), 0.4);
    }

    .mod-i.active::after {
      content: '';
      position: absolute;
      left: -20px;
      top: 12px;
      bottom: 12px;
      width: 4px;
      background: #fff;
      border-radius: 0 4px 4px 0;
    }

    .mod-label {
      position: absolute;
      left: 78px;
      background: #334155;
      color: #fff;
      padding: 6px 12px;
      border-radius: 6px;
      font-size: 12px;
      white-space: nowrap;
      pointer-events: none;
      opacity: 0;
      transform: translateX(-10px);
      transition: all 0.2s;
      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
      font-weight: 600;
      z-index: 1000;
    }

    .mod-i:hover .mod-label {
      opacity: 1;
      transform: translateX(0);
    }

    @keyframes slideUp {
      from { transform: translateY(20px); opacity: 0; }
      to { transform: translateY(0); opacity: 1; }
    }

    /* ADMIN DASHBOARD */
    .admin-nav-item {
      padding: 14px 20px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 12px;
      font-size: 14px;
      color: rgba(255,255,255,0.5);
      transition: all 0.2s;
      white-space: nowrap;
      overflow: hidden;
    }
    .admin-nav-item:hover { background: rgba(255,255,255,0.05); color: #fff; }
    .admin-nav-item.active { background: var(--p); color: #fff; font-weight: 700; border-left: 4px solid #fff; }
    .admin-nav-item i { width: 20px; text-align: center; font-size: 18px; }
    .admin-nav-item span { transition: opacity 0.3s; }
    
    #admin-sidebar.collapsed { width: 68px; }
    #admin-sidebar.collapsed span, #admin-sidebar.collapsed #admin-title-text { opacity: 0; pointer-events: none; }
    #admin-sidebar.collapsed .admin-nav-item { justify-content: center; padding: 14px 0; border-left: none; }
    #admin-sidebar.collapsed .admin-nav-item.active { background: var(--p); }

    .admin-tab-content { animation: fadeIn 0.4s ease; }
    @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

    /* LOGIN */
    #login-screen {
      position: fixed;
      inset: 0;
      z-index: 11000;
      display: flex;
      align-items: center;
      justify-content: center;
      padding-top: env(safe-area-inset-top);
      padding-bottom: env(safe-area-inset-bottom);
      background-color: #0d1526;
      background-image: var(--app-wallpaper, none);
      background-size: cover;
      background-position: center;
    }

    #login-screen.hidden {
      display: none
    }

    .lb {
      background: rgba(255, 255, 255, 0.92);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      border-radius: 24px;
      padding: 40px;
      width: 440px;
      max-width: 92vw;
      box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.3);
    }

    .lb-logo {
      display: flex;
      align-items: center;
      gap: 16px;
      margin-bottom: 32px
    }

    .lb-logo .ic {
      width: 44px;
      height: 44px;
      background: var(--p);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      color: #fff;
      font-size: 20px
    }

    .lb-logo .tx {
      font-size: 16px;
      font-weight: 700;
      white-space: nowrap;
    }

    .lb-logo .sx {
      font-size: 11px;
      color: var(--tx2);
      white-space: nowrap;
    }

    .lb-err {
      background: #fef2f2;
      border: 1px solid #fecaca;
      color: var(--err);
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 13px;
      margin-bottom: 14px;
      display: none
    }

    .lb-err.show {
      display: block
    }

    .lb-btn {
      width: 100%;
      padding: 12px;
      background: var(--p);
      color: #fff;
      border: none;
      border-radius: 10px;
      font-family: inherit;
      font-size: 15px;
      font-weight: 700;
      cursor: pointer;
      transition: .15s;
      margin-top: 6px;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px
    }

    .lb-btn:hover:not(:disabled) {
      background: var(--pd)
    }

    .lb-btn:disabled {
      opacity: .6;
      cursor: not-allowed
    }

    .lb-hint {
      margin-top: 14px;
      font-size: 12px;
      color: var(--tx3);
      text-align: center
    }

    .lb-hint b {
      color: var(--p)
    }

    /* API CONFIG notice */
    .api-cfg {
      background: #fffbeb;
      border: 1px solid #fde68a;
      border-radius: 8px;
      padding: 10px 14px;
      font-size: 12px;
      color: #92400e;
      margin-bottom: 14px;
      display: none
    }

    .api-cfg.show {
      display: block
    }

    .api-cfg input {
      width: 100%;
      margin-top: 6px;
      padding: 6px 10px;
      border: 1px solid #fde68a;
      border-radius: 6px;
      font-family: inherit;
      font-size: 12px;
      outline: none
    }

    /* LOADING OVERLAY */
    #loading {
      position: fixed;
      inset: 0;
      background: rgba(13, 21, 38, .65);
      z-index: 8888;
      display: none;
      align-items: center;
      justify-content: center;
      flex-direction: column;
      gap: 14px
    }

    #loading.show {
      display: flex
    }

    .spinner {
      width: 40px;
      height: 40px;
      border: 3px solid rgba(255, 255, 255, .2);
      border-top-color: #fff;
      border-radius: 50%;
      animation: spin .7s linear infinite
    }

    @keyframes spin {
      to {
        transform: rotate(360deg)
      }
    }

    .loading-msg {
      color: #fff;
      font-size: 14px;
      font-weight: 500
    }

    /* SIDEBAR */
    #sidebar {
      width: var(--sw);
      background: var(--sb);
      display: flex;
      flex-direction: column;
      z-index: 90;
      overflow: hidden;
      /* Prevent double scroll */
      border-right: 1px solid var(--bdr);
      padding-bottom: env(safe-area-inset-bottom);
      height: 100vh;
    }

    .sb-content {
      flex: 1;
      overflow-y: auto;
      padding: 10px 0;
      display: flex;
      flex-direction: column;
    }

    .sb-close-btn {
      display: none;
    }

    .sb-logo {
      padding: 18px 8px 14px;
      /* Đẩy sát ra mép trái */
      display: flex;
      align-items: center;
      gap: 10px;
      border-top: 1px solid rgba(255, 255, 255, 0.1);
    }

    .sb-logo .lt {
      color: #fff;
      font-weight: 800;
      font-size: 13px;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      /* Cho phép tối đa 2 dòng */
      line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 170px;
      line-height: 1.3;
    }

    .sb-logo .ls {
      color: #fff;
      font-size: 10px;
      opacity: 0.8;
      display: -webkit-box;
      -webkit-line-clamp: 1;
      line-clamp: 1;
      -webkit-box-orient: vertical;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 170px;
    }

    .co-sw {
      margin: 10px 12px;
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 12px;
      padding: 12px;
      cursor: pointer;
      transition: all 0.2s;
    }

    .co-sw:hover {
      background: rgba(255, 255, 255, 0.2);
    }

    .co-nm {
      color: #fff;
      font-size: 12px;
      font-weight: 700;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis
    }

    .co-tp {
      color: #fff;
      font-size: 11px;
      margin-top: 2px;
      opacity: 0.8;
    }

    .sb-sec {
      padding: 12px 12px 2px
    }

    .sb-sec-lbl {
      display: none !important;
    }

    .sb-i {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 15px;
      border-radius: 10px;
      cursor: pointer;
      color: #fff;
      font-size: 15px;
      font-weight: 600;
      transition: all 0.2s;
      margin-bottom: 2px;
    }

    .sb-i:hover {
      background: var(--sh);
      color: #fff;
    }

    .sb-i.active {
      background: var(--sa);
      color: #fff;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    }

    .sb-i .ic {
      font-size: 15px;
      width: 20px;
      text-align: center;
      flex-shrink: 0
    }

    .sb-badge {
      margin-left: auto;
      background: var(--err);
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      padding: 1px 6px;
      border-radius: 10px;
      min-width: 18px;
      text-align: center
    }

    .sb-i.active .sb-badge {
      background: rgba(255, 255, 255, .25)
    }

    .sb-u {
      margin-top: auto;
      padding: 15px;
      background: rgba(0, 0, 0, 0.15);
      border-top: 1px solid rgba(255, 255, 255, 0.1);
      cursor: pointer;
      position: relative;
      /* CRITICAL FIX */
      transition: background 0.2s;
    }

    .sb-u:hover {
      background: rgba(0, 0, 0, 0.25);
    }

    .sb-u-row {
      display: flex;
      align-items: center;
      gap: 12px;
    }

    .sb-u .av {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      background: var(--p);
      display: flex;
      align-items: center;
      justify-content: center;
      color: #fff;
      font-weight: 800;
      font-size: 14px;
      flex-shrink: 0;
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    }

    .unm {
      color: #fff;
      font-size: 14px;
      font-weight: 700;
    }

    .url {
      color: rgba(255, 255, 255, 0.6);
      font-size: 11px;
    }

    .u-menu {
      display: none;
      position: absolute;
      bottom: 75px;
      left: 10px;
      right: 10px;
      background: var(--card);
      border-radius: 12px;
      overflow: hidden;
      border: 1px solid var(--bdr);
      box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
    }

    .u-menu.open {
      display: block
    }

    .u-mi {
      padding: 12px 16px;
      color: var(--tx);
      font-size: 14px;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 10px;
      transition: all 0.15s;
      font-weight: 500;
    }

    .u-mi:hover {
      background: var(--bg);
      color: var(--p);
    }

    .u-mi.danger {
      color: #ef4444;
    }

    .u-mi.danger:hover {
      background: var(--sh);
    }

    /* MAIN */
    #main {
      flex: 1;
      display: flex;
      flex-direction: column;
      min-width: 0;
      position: relative;
      overflow: hidden;
      background: var(--bg);
    }

    #main::before {
      content: "";
      position: absolute;
      top: -10px;
      left: -10px;
      right: -10px;
      bottom: -10px;
      background-image: var(--app-wallpaper, none);
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      filter: blur(var(--app-wallpaper-blur, 0px));
      z-index: 0;
      pointer-events: none;
      transition: filter 0.3s ease;
    }

    #topbar,
    #content {
      position: relative;
      z-index: 1;
    }


    #topbar {
      height: calc(60px + env(safe-area-inset-top));
      background: linear-gradient(90deg, #064e3b 0%, #059669 100%);
      display: flex;
      align-items: center;
      padding: env(safe-area-inset-top) 24px 0 24px;
      position: sticky;
      top: 0;
      z-index: 90;
      color: #fff;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    #tb-title {
      color: #ffffff !important;
      font-weight: 700 !important;
      text-shadow: none !important;
      -webkit-text-fill-color: #ffffff !important;
      /* Force for some browsers */
    }

    #co-badge {
      background: rgba(255, 255, 255, 0.15) !important;
      color: #fff !important;
      border-color: rgba(255, 255, 255, 0.3) !important;
    }

    .tb-right {
      display: flex;
      align-items: center;
      gap: 15px;
    }

    .btn {
      padding: 7px 14px;
      border-radius: 8px;
      font-family: inherit;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      border: none;
      transition: .15s;
      display: inline-flex;
      align-items: center;
      gap: 6px;
      white-space: nowrap
    }

    .btn-p {
      background: var(--p);
      color: #fff
    }

    .btn-p:hover {
      background: var(--pd)
    }

    .btn-g {
      background: transparent;
      color: var(--tx2);
      border: 1px solid var(--bdr)
    }

    .btn-g:hover {
      background: var(--bg)
    }

    .btn-ok {
      background: var(--bg);
      color: var(--ok);
      border: 1px solid var(--bdr)
    }

    .btn-ok:hover {
      background: #d1fae5
    }

    .btn-err {
      background: var(--bg);
      color: var(--err);
      border: 1px solid var(--bdr)
    }

    .btn-err:hover {
      background: #dc2626;
    }

    .btn-warn {
      background: var(--bg);
      color: var(--warn);
      border: 1px solid var(--bdr)
    }

    .search-bar {
      display: flex;
      align-items: center;
      gap: 7px;
      background: var(--bg);
      border: 1px solid var(--bdr);
      border-radius: 8px;
      padding: 5px 12px;
      width: 200px
    }

    .search-bar input {
      border: none;
      background: transparent;
      font-family: inherit;
      font-size: 13px;
      color: var(--tx1);
      outline: none;
      width: 100%;
    }

    .search-bar span {
      color: rgba(255, 255, 255, 0.95);
      font-size: 14px;
    }

    .search-bar input::placeholder {
      color: rgba(255, 255, 255, 0.9);
    }

    #content {
      padding: 22px 24px;
      flex: 1;
      overflow-y: auto;
      position: relative;
    }

    .page {
      display: none
    }

    .page.active {
      display: block
    }

    .ph {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 20px;
      flex-wrap: wrap;
      gap: 10px
    }

    .pt {
      font-size: 19px;
      font-weight: 800
    }

    .ps {
      color: var(--tx2);
      font-size: 13px;
      margin-top: 2px
    }

    .card {
      background: var(--card);
      border-radius: var(--r);
      border: 1px solid var(--bdr);
      padding: 18px;
      overflow-x: auto;
    }

    .sg {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 14px;
      margin-bottom: 20px
    }

    .sc {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: var(--r);
      padding: 18px;
      overflow-x: auto;
    }

    .sc .lbl {
      font-size: 11px;
      font-weight: 700;
      color: var(--tx2);
      text-transform: uppercase;
      letter-spacing: .7px;
      margin-bottom: 8px
    }

    .sc .val {
      font-size: 26px;
      font-weight: 800;
      line-height: 1
    }

    .sc .ch {
      font-size: 12px;
      margin-top: 5px
    }

    .sc .ch.up {
      color: var(--ok)
    }

    .sc .ch.dn {
      color: var(--err)
    }

    .sc .ib {
      float: right;
      width: 42px;
      height: 42px;
      border-radius: 10px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 18px
    }

    /* TABLE */
    .tw {
      overflow-x: auto
    }

    table {
      width: 100%;
      border-collapse: collapse
    }

    thead th {
      background: var(--bg);
      padding: 9px 13px;
      text-align: left;
      font-size: 11px;
      font-weight: 700;
      color: var(--tx);
      text-transform: uppercase;
      letter-spacing: .8px;
      border-bottom: 1px solid var(--bdr)
    }

    tbody td {
      padding: 11px 13px;
      border-bottom: 1px solid var(--bdr);
      font-size: 13px;
      vertical-align: middle
    }

    tbody tr:last-child td {
      border-bottom: none
    }

    tbody tr:hover td {
      background: var(--bg)
    }

    /* BADGES */
    .badge {
      padding: 2px 9px;
      border-radius: 20px;
      font-size: 11px;
      font-weight: 600;
      display: inline-block
    }

    .b-blue {
      background: var(--pl);
      color: var(--p)
    }

    .b-green {
      background: #065f46;
      color: #34d399;
    }

    .b-yellow {
      background: #92400e;
      color: #fbbf24;
    }

    .b-red {
      background: #7f1d1d;
      color: #f87171;
    }

    .b-purple {
      background: #4c1d95;
      color: #a78bfa;
    }

    .b-gray {
      background: var(--sh);
      color: var(--tx2)
    }

    .b-cyan {
      background: #164e63;
      color: #22d3ee;
    }

    .b-orange {
      background: #7c2d12;
      color: #fb923c;
      border: 1px solid #9a3412
    }

    .b-teal {
      background: #134e4a;
      color: #2dd4bf;
      border: 1px solid #115e59
    }

    /* AVATAR */
    .av {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 11px;
      color: #fff;
      flex-shrink: 0
    }

    .av-1 {
      background: #1a56db
    }

    .av-2 {
      background: #10b981
    }

    .av-3 {
      background: #f59e0b
    }

    .av-4 {
      background: #ef4444
    }

    .av-5 {
      background: #8b5cf6
    }

    .av-6 {
      background: #06b6d4
    }

    .av-7 {
      background: #ec4899
    }

    .av-8 {
      background: #f97316
    }

    .prog {
      background: var(--bdr);
      border-radius: 99px;
      height: 6px;
      overflow: hidden
    }

    .prog-b {
      height: 100%;
      transition: width .3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Cải thiện hiển thị các phần Pháp lý, Tiến độ, Gói thầu, Hạng mục */
    #hydro-view-legal,
    #hydro-view-tenders,
    #hydro-view-implementation,
    #hydro-view-budget,
    #hydro-view-fund,
    #hydro-view-cash {
      font-family: 'Be Vietnam Pro', sans-serif !important;
    }

    /* Bảng trong chi tiết dự án */
    #project-detail table,
    .rpt-table,
    .tbl {
      width: 100%;
      border-collapse: separate;
      border-spacing: 0;
      border: 1px solid var(--bdr);
      border-radius: 12px;
      overflow: hidden;
      margin-top: 10px;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    }

    #project-detail th,
    .rpt-table th,
    .tbl th {
      background: var(--bg);
      color: var(--tx);
      font-weight: 800;
      font-size: 13px;
      padding: 14px 16px;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      border-bottom: 2px solid var(--bdr);
    }

    #project-detail td,
    .rpt-table td,
    .tbl td {
      padding: 14px 16px;
      font-size: 14px;
      color: var(--tx);
      border-bottom: 1px solid var(--bdr);
      line-height: 1.6;
    }

    #project-detail tr:hover td {
      background: var(--card);
    }

    /* Các tiêu đề phần trong tab */
    .hydro-phase-header,
    .hydro-step-header {
      font-family: 'Be Vietnam Pro', sans-serif !important;
      font-weight: 800 !important;
      font-size: 15px !important;
      color: var(--p) !important;
      padding: 12px 0;
    }

    .hydro-task-name,
    .hydro-task-item div {
      font-family: 'Be Vietnam Pro', sans-serif !important;
      font-size: 14px !important;
      line-height: 1.5;
    }

    .hydro-task-meta span {
      font-size: 12px !important;
      color: #64748b !important;
    }

    .hydro-stat-card b,
    .hydro-stat-card div {
      font-family: 'Be Vietnam Pro', sans-serif !important;
    }

    /* Badge cho trạng thái */
    .badge,
    .hydro-badge,
    .status-badge {
      font-weight: 700 !important;
      font-size: 11px !important;
      padding: 3px 10px !important;
      border-radius: 20px !important;
    }


    .hydro-timeline-step {
      display: flex;
      flex-direction: column;
      align-items: center;
      z-index: 1;
      cursor: pointer;
      flex: 1;
      position: relative;
    }

    .hydro-timeline-node {
      width: 32px;
      height: 32px;
      border-radius: 50%;
      background: var(--card);
      border: 2px solid var(--bdr);
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 14px;
      margin-bottom: 8px;
      transition: all .2s;
    }

    .hydro-timeline-step.active .hydro-timeline-node {
      border-color: var(--p);
      color: var(--p);
      box-shadow: 0 0 0 4px var(--pl);
    }

    .hydro-timeline-step.done .hydro-timeline-node {
      border-color: var(--ok);
      background: var(--ok);
      color: #fff;
    }

    .hydro-timeline-lbl {
      font-size: 11px;
      font-weight: 700;
      color: var(--tx3);
      text-align: center;
      max-width: 80px;
    }

    .hydro-phase-sec {
      margin-bottom: 24px;
      border: 1px solid var(--bdr);
      border-radius: 12px;
      overflow: hidden;
    }

    .hydro-phase-header {
      padding: 12px 16px;
      background: var(--bg);
      display: flex;
      align-items: center;
      justify-content: space-between;
      cursor: pointer;
    }

    .hydro-step-item {
      border-top: 1px solid var(--bdr);
      background: var(--card);
    }

    .hydro-step-header {
      padding: 10px 16px;
      font-weight: 700;
      font-size: 13px;
      color: var(--tx2);
      background: var(--bg);
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .hydro-task-item {
      padding: 12px 16px 12px 42px;
      border-top: 1px solid var(--bg);
      display: flex;
      align-items: center;
      justify-content: space-between;
      transition: background .2s;
    }

    .hydro-task-item:hover {
      background: var(--card);
    }

    .hydro-task-main {
      flex: 1;
    }

    .hydro-task-name {
      font-size: 13px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 6px;
    }

    .hydro-task-meta {
      font-size: 11px;
      color: var(--tx3);
      margin-top: 3px;
      display: flex;
      gap: 12px;
    }

    .hydro-status-badge {
      padding: 2px 8px;
      border-radius: 12px;
      font-size: 10px;
      font-weight: 700;
      text-transform: uppercase;
    }

    .st-todo {
      background: var(--bg);
      color: #64748b;
    }

    /* Implementation Tasks inside Modal */
    .impl-tasks-container {
      margin-top: 14px;
      padding-top: 14px;
      border-top: 1px dashed var(--bdr);
    }

    .impl-task-row {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 10px;
      background: var(--card);
      border-radius: 8px;
      margin-bottom: 6px;
      border: 1px solid var(--bg);
    }

    .impl-task-row.done {
      opacity: 0.6;
    }

    .impl-task-row.done .impl-task-name {
      text-decoration: line-through;
    }

    .impl-task-name {
      flex: 1;
      font-size: 13px;
      color: var(--tx1);
      font-weight: 500;
    }

    .impl-task-del {
      color: var(--err);
      cursor: pointer;
      font-size: 16px;
      padding: 2px 6px;
      border-radius: 4px;
    }

    .impl-task-del:hover {
      background: #fee2e2;
    }

    .st-inprogress {
      background: #92400e;
      color: #fbbf24;
    }

    .st-blocked {
      background: #7f1d1d;
      color: #f87171;
    }

    .st-done {
      background: #065f46;
      color: #34d399;
    }

    .hydro-subtasks {
      margin-top: 8px;
      padding-left: 20px;
      border-left: 1px dashed #cbd5e1;
    }

    .hydro-subtask {
      font-size: 12px;
      color: var(--tx2);
      margin-bottom: 4px;
      display: flex;
      align-items: center;
      gap: 8px;
    }

    .hydro-subtask i {
      font-size: 10px;
    }

    .tabs-nav {
      display: flex;
      gap: 20px;
      padding: 0 16px;
      border-bottom: 1px solid var(--bdr);
      background: var(--bg);
    }

    .tab-btn {
      padding: 12px 4px;
      font-size: 13px;
      font-weight: 700;
      color: var(--tx2);
      background: none;
      border: none;
      border-bottom: 2px solid transparent;
      cursor: pointer;
      transition: all .2s;
    }

    .tab-btn:hover {
      color: var(--p);
    }

    .tab-btn.active {
      color: var(--p);
      border-bottom-color: var(--p);
    }

    .fin-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 16px;
      margin-bottom: 20px;
    }

    .fin-card {
      padding: 16px;
      border-radius: 12px;
      background: var(--card);
      border: 1px solid var(--bdr);
      display: flex;
      flex-direction: column;
      gap: 4px;
    }

    .fin-card.in {
      border-left: 4px solid var(--ok);
    }

    .fin-card.out {
      border-left: 4px solid var(--err);
    }

    .fin-card.bal {
      border-left: 4px solid var(--p);
    }

    .fin-label {
      font-size: 11px;
      font-weight: 700;
      color: var(--tx3);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    /* GLOBAL 3D Bold Titles - All Pages */
    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    .ph .pt,
    .card-header,
    .modal-header .pt,
    .section-title,
    .tb-title,
    .acc-header-3d,
    .tab-btn {
      font-weight: 900 !important;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--tx) !important;
      /* Ultra Sharp */
      text-shadow: 1px 1px 0px var(--card), 1.5px 1.5px 0.5px rgba(0, 0, 0, 0.1), 2.5px 2.5px 5px rgba(0, 0, 0, 0.2);
    }

    .ph .pt {
      font-size: 24px !important;
      margin-bottom: 5px;
    }

    .tab-btn {
      font-size: 15px !important;
    }

    .modal-header .pt {
      font-size: 20px !important;
    }

    .card-header {
      font-size: 16px !important;
    }

    /* Deeper 3D Sunken Selectors with Border */
    .fc {
      width: 100%;
      border: 1.5px solid #cbd5e1;
      border-radius: 10px;
      padding: 10px 14px;
      font-family: inherit;
      font-size: 14px;
      color: var(--tx);
      background: var(--card);
      transition: all 0.2s;
      outline: none;
    }

    .fc:focus {
      border-color: var(--p);
      box-shadow: 0 0 0 4px var(--pl);
    }

    select.fc {
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23475569'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 12px center;
      background-size: 16px;
      padding-right: 40px !important;
    }

    select.fc:focus {
      box-shadow: inset 2px 2px 6px rgba(0, 0, 0, 0.2), 0 0 0 4px rgba(59, 130, 246, 0.15);
      border-color: var(--p) !important;
    }

    /* Table Header 3D Effect */
    table thead th {
      background: var(--bg);
      font-weight: 700;
      text-transform: uppercase;
      font-size: 11px;
      color: var(--tx);
      border-bottom: 2px solid #e2e8f0;
      /* text-shadow: 0.5px 0.5px 0px #fff; */
      box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.05);
    }

    .fin-val {
      font-size: 20px;
      font-weight: 800;
    }

    .fin-sub {
      font-size: 11px;
      color: var(--tx2);
    }

    .cur-tag {
      padding: 2px 6px;
      border-radius: 4px;
      font-size: 10px;
      font-weight: 800;
      color: #fff;
      margin-left: 6px;
    }

    .cur-vnd {
      background: #64748b;
    }

    .cur-usd {
      background: #10b981;
    }

    .cur-eur {
      background: #3b82f6;
    }

    .g2 {
      display: grid;
      grid-template-columns: 2fr 1fr;
      gap: 20px;
      overflow-x: auto;
    }

    .g3 {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 14px;
      overflow-x: auto;
    }

    /* --- PREMIUM HYDRO DESIGN SYSTEM --- */
    .hydro-section {
      margin-bottom: 32px;
    }

    .hydro-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 20px;
      padding-bottom: 12px;
      border-bottom: 2px solid var(--bg);
    }

    .hydro-title {
      font-size: 18px;
      font-weight: 800;
      color: var(--tx);
      display: flex;
      align-items: center;
      gap: 10px;
    }

    .hydro-title i {
      color: var(--p);
      font-size: 20px;
    }

    .hydro-card {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 16px;
      padding: 20px;
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
      position: relative;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .hydro-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 12px 25px rgba(0, 0, 0, 0.06);
      border-color: var(--p);
    }

    .hydro-badge {
      padding: 4px 10px;
      border-radius: 99px;
      font-size: 11px;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .badge-blue {
      background: #eff6ff;
      color: #2563eb;
    }

    .badge-green {
      background: #f0fdf4;
      color: #16a34a;
    }

    .badge-orange {
      background: #fff7ed;
      color: #ea580c;
    }

    .badge-red {
      background: #fef2f2;
      color: #dc2626;
    }

    .badge-gray {
      background: var(--card);
      color: #64748b;
    }

    /* TAG SELECTOR UI */
    .tag-input-container {
      border: 1.5px solid #94a3b8;
      border-radius: 12px;
      padding: 10px 14px;
      background: var(--bg);
      display: flex;
      flex-wrap: wrap;
      gap: 8px;
      min-height: 48px;
      cursor: text;
      position: relative;
      transition: all 0.2s ease;
      box-shadow: inset 0 4px 8px 0 rgba(0, 0, 0, 0.1);
    }

    .tag-input-container:focus-within {
      background: var(--card);
      border-color: var(--p);
      box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.15), inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
      outline: none;
    }

    .tag-item {
      background: var(--bg);
      color: var(--tx);
      padding: 5px 12px;
      border-radius: 8px;
      font-size: 12px;
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 8px;
      border: 1px solid var(--bdr);
      box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
      transition: all 0.2s;
    }

    .tag-item:hover {
      background: #e2e8f0;
      transform: translateY(-1px);
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .tag-remove {
      cursor: pointer;
      color: #93c5fd;
    }

    .tag-remove:hover {
      color: var(--err)
    }

    .tag-search {
      border: none;
      outline: none;
      background: transparent;
      color: inherit;
      background: transparent;
      color: inherit;
      font-size: 13px;
      padding: 4px;
      flex: 1;
      min-width: 60px;
    }

    .tag-search::placeholder {
      color: var(--tx2);
      opacity: 0.8;
    }

    .tag-dropdown {
      position: absolute;
      top: 110%;
      left: 0;
      right: 0;
      background: var(--card);
      border: 1px solid rgba(0, 0, 0, 0.1);
      border-radius: 16px;
      max-height: 280px;
      overflow-y: auto;
      z-index: 2000;
      box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
      display: none;
      animation: tagSlideIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
      padding: 8px 0;
    }

    @keyframes tagSlideIn {
      from {
        opacity: 0;
        transform: translateY(15px) scale(0.98);
      }

      to {
        opacity: 1;
        transform: translateY(0) scale(1);
      }
    }

    /* DROPDOWN MULTI-SELECT */
    .ms-container {
      position: relative;
    }

    .ms-trigger {
      cursor: pointer;
      display: flex;
      justify-content: space-between;
      align-items: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      padding-right: 30px !important;
    }

    .ms-trigger::after {
      content: '▼';
      position: absolute;
      right: 15px;
      font-size: 10px;
      color: var(--tx3);
    }

    .ms-dropdown {
      position: fixed;
      background: var(--card);
      border: 1.5px solid var(--p);
      border-radius: 12px;
      max-height: 250px;
      overflow-y: auto;
      z-index: 9999;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
      display: none;
      padding: 8px;
      animation: tagSlideIn 0.2s ease;
      width: inherit;
      min-width: 200px;
    }

    .ms-option {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 8px 12px;
      border-radius: 8px;
      cursor: pointer;
      font-size: 13px;
      transition: background 0.2s;
      color: var(--tx1);
    }

    .ms-option:hover {
      background: var(--bg);
    }

    .ms-option input {
      cursor: pointer;
      width: 16px;
      height: 16px;
    }

    .ms-option b {
      font-weight: 600;
    }

    .tag-option {
      padding: 10px 14px;
      font-size: 13px;
      cursor: pointer;
      border-bottom: 1px solid var(--card);
      transition: all 0.2s;
    }

    .tag-option:last-child {
      border-bottom: none;
    }

    .tag-option:hover {
      background: var(--bg);
      padding-left: 18px;
      color: var(--p);
    }

    .tag-option b {
      color: var(--tx1);
    }

    .hydro-stat-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 16px;
      margin-bottom: 24px;
      overflow-x: auto;
    }

    .hydro-stat-card {
      background: var(--card);
      padding: 20px;
      border-radius: 16px;
      border: 1px solid var(--bdr);
      display: flex;
      align-items: center;
      gap: 16px;
    }

    .hydro-card-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
      gap: 20px;
      overflow-x: auto;
    }

    .hydro-items-bar {
      display: flex;
      flex-direction: column;
      gap: 12px;
      margin-bottom: 24px;
      overflow-x: auto;
    }

    .hydro-grid-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 20px;
      overflow-x: auto;
    }

    .hydro-grid-3 {
      display: grid;
      grid-template-columns: 1fr 1fr 1fr;
      gap: 20px;
      overflow-x: auto;
    }

    @media (max-width: 768px) {

      .hydro-grid-2,
      .hydro-grid-3 {
        grid-template-columns: 1fr;
      }
    }

    ::-webkit-scrollbar {
      width: 10px;
      height: 10px
    }

    ::-webkit-scrollbar-track {
      background: var(--bg);
      border-radius: 10px
    }

    ::-webkit-scrollbar-thumb {
      background: linear-gradient(180deg, #cbd5e1 0%, #94a3b8 100%);
      border-radius: 10px;
      border: 2px solid var(--bg);
      box-shadow: inset 1px 1px 2px rgba(255, 255, 255, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.1);
    }

    ::-webkit-scrollbar-thumb:hover {
      background: linear-gradient(180deg, #94a3b8 0%, #64748b 100%);
    }

    .hydro-list-group {
      background: var(--card);
      border-radius: 16px;
      border: 1px solid var(--bdr);
      overflow: hidden;
      margin-bottom: 24px;
      box-shadow: var(--shd);
    }

    .hydro-list-header {
      background: var(--card);
      padding: 14px 20px;
      border-bottom: 1px solid var(--bdr);
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .hydro-list-row {
      display: flex;
      align-items: center;
      padding: 12px 20px;
      border-bottom: 1px solid var(--bg);
      gap: 12px;
      transition: background 0.2s;
    }

    .hydro-list-row:hover {
      background: var(--sh);
    }

    .hydro-list-row:last-child {
      border-bottom: none;
    }

    .hydro-action-bar {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 16px;
      padding: 0 20px;
      margin-bottom: 24px;
    }

    .hydro-action-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 16px 0;
      border-bottom: 1px solid var(--bdr);
    }

    .hydro-action-row:last-child {
      border-bottom: none;
    }

    .hydro-horizontal-list {
      display: flex;
      overflow-x: auto;
      gap: 16px;
      padding: 4px 4px 16px;
      scrollbar-width: thin;
      scroll-behavior: smooth;
    }

    .hydro-horizontal-list::-webkit-scrollbar {
      height: 6px;
    }

    .hydro-horizontal-list::-webkit-scrollbar-thumb {
      background: var(--bdr);
      border-radius: 10px;
    }

    .hydro-stat-card-v2 {
      min-width: 280px;
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 16px;
      padding: 20px;
      flex-shrink: 0;
      transition: all 0.3s;
    }

    .hydro-stat-card-v2:hover {
      border-color: var(--p);
      box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    }

    .btn-icon {
      background: none;
      border: none;
      cursor: pointer;
      padding: 6px;
      border-radius: 8px;
      transition: all 0.2s;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      color: #64748b;
    }

    .btn-icon:hover {
      background: var(--bg);
      color: var(--p);
    }

    /* MODAL */
    .mo {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, .5);
      z-index: 3000;
      align-items: center;
      justify-content: center;
      padding: 16px
    }

    .mo.open {
      display: flex
    }

    .mbox {
      background: var(--card);
      border-radius: 16px;
      width: 560px;
      max-width: 100%;
      max-height: 92vh;
      overflow-y: auto;
      overflow-x: auto;
      box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
      animation: slideUp .2s ease
    }

    .mbox-lg {
      width: 700px
    }

    .mbox-xl {
      width: 860px
    }

    @keyframes slideUp {
      from {
        transform: translateY(18px);
        opacity: 0
      }

      to {
        transform: translateY(0);
        opacity: 1
      }
    }



    .mh {
      padding: 18px 22px 14px;
      border-bottom: 1px solid var(--bdr);
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .mt {
      font-size: 15px;
      font-weight: 700
    }

    .mc {
      background: none;
      border: none;
      font-size: 20px;
      cursor: pointer;
      color: var(--tx2);
      padding: 2px 6px;
      border-radius: 6px
    }

    .mc:hover {
      background: var(--bg)
    }

    .mb {
      padding: 18px 22px
    }

    .mf {
      padding: 14px 22px;
      border-top: 1px solid var(--bdr);
      display: flex;
      gap: 8px;
      justify-content: flex-end
    }

    /* FORM */
    .fg {
      margin-bottom: 14px
    }

    .fg label {
      display: block;
      font-size: 11px;
      font-weight: 700;
      color: var(--tx2);
      margin-bottom: 5px;
      text-transform: uppercase;
      letter-spacing: .5px
    }

    .fc {
      width: 100%;
      padding: 8px 11px;
      border: 1px solid var(--bdr);
      border-radius: 8px;
      font-family: inherit;
      font-size: 13px;
      color: var(--tx);
      background: var(--card);
      outline: none;
      transition: border .15s
    }

    .fc:focus {
      border-color: var(--p);
      box-shadow: 0 0 0 3px rgba(26, 86, 219, .1)
    }

    select.fc {
      appearance: none;
      background-color: var(--card);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 10px center;
    }

    [data-theme='dark'] option {
      background: #1e293b;
      color: var(--tx);
    }

    .fhint {
      font-size: 11px;
      color: var(--tx3);
      margin-top: 3px
    }

    .pw {
      position: relative
    }

    .pw input {
      padding-right: 38px
    }

    .pwt {
      position: absolute;
      right: 9px;
      top: 50%;
      transform: translateY(-50%);
      background: none;
      border: none;
      cursor: pointer;
      font-size: 13px;
      color: var(--tx3)
    }

    /* KANBAN */
    .kanban {
      display: flex;
      gap: 14px;
      overflow-x: auto;
      padding-bottom: 14px
    }

    .kc {
      background: var(--bg);
      border-radius: 12px;
      padding: 12px;
      min-width: 270px;
      flex-shrink: 0;
      border: 1px solid var(--bdr)
    }

    .kch {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 10px
    }

    .kct {
      font-size: 13px;
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 7px
    }

    .kcc {
      background: var(--bdr);
      color: var(--tx2);
      font-size: 11px;
      font-weight: 700;
      padding: 1px 7px;
      border-radius: 10px
    }

    .kcard {
      background: var(--card);
      border-radius: 10px;
      padding: 12px;
      margin-bottom: 8px;
      border: 1px solid var(--bdr);
      cursor: pointer;
      transition: .15s;
      box-shadow: var(--shd)
    }

    .kcard:hover {
      border-color: var(--p);
      box-shadow: 0 4px 16px rgba(26, 86, 219, .12);
      transform: translateY(-1px)
    }

    .kcard-t {
      font-size: 13px;
      font-weight: 600;
      margin-bottom: 7px
    }

    .kcard-tags {
      display: flex;
      gap: 3px;
      flex-wrap: wrap;
      margin-bottom: 6px
    }

    .kadd {
      width: 100%;
      background: none;
      border: 1px dashed var(--bdr);
      border-radius: 8px;
      padding: 7px;
      color: var(--tx2);
      font-size: 13px;
      cursor: pointer;
      transition: .15s
    }

    .kadd:hover {
      background: var(--card);
      border-color: var(--p);
      color: var(--p)
    }

    .pr {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      display: inline-block
    }

    .pr-h {
      background: var(--err)
    }

    .pr-m {
      background: var(--warn)
    }

    .pr-l {
      background: var(--ok)
    }

    /* APPROVAL */
    .ap-card {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 10px;
      transition: .15s
    }

    .ap-card:hover {
      border-color: var(--pl);
      box-shadow: var(--shd)
    }

    .ap-card.pending {
      border-left: 3px solid var(--warn)
    }

    .ap-card.approved {
      border-left: 3px solid var(--ok)
    }

    .ap-card.rejected {
      border-left: 3px solid var(--err)
    }

    .ap-card.cancelled {
      border-left: 3px solid var(--tx3)
    }

    /* FILE UPLOAD */
    .file-drop {
      border: 2px dashed var(--bdr);
      border-radius: 10px;
      padding: 20px;
      text-align: center;
      cursor: pointer;
      transition: .15s;
      background: var(--bg)
    }

    .file-drop:hover,
    .file-drop.drag {
      border-color: var(--p);
      background: var(--pl)
    }

    .file-drop input {
      display: none
    }

    .file-list {
      margin-top: 10px;
      display: flex;
      flex-direction: column;
      gap: 6px
    }

    .file-item {
      display: flex;
      align-items: center;
      gap: 8px;
      background: var(--bg);
      border: 1px solid var(--bdr);
      border-radius: 8px;
      padding: 7px 10px
    }

    .file-item .fname {
      flex: 1;
      font-size: 12px;
      font-weight: 500;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap
    }

    .file-item .fsize {
      font-size: 11px;
      color: var(--tx3)
    }

    .file-item .fdel {
      background: none;
      border: none;
      color: var(--err);
      cursor: pointer;
      font-size: 14px
    }

    /* WF STEPS */
    .wf-steps {
      display: flex;
      align-items: center;
      gap: 0;
      margin: 14px 0;
      flex-wrap: wrap
    }

    .wf-step {
      display: flex;
      align-items: center;
      gap: 0
    }

    .wf-node {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 4px;
      min-width: 90px
    }

    .wf-circle {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 2px solid var(--bdr);
      background: var(--card);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 14px;
      transition: .2s
    }

    .wf-circle.done,
    .wf-circle.approved {
      background: var(--ok);
      border-color: var(--ok);
      color: #fff
    }

    .wf-circle.active,
    .wf-circle.pending {
      background: var(--p);
      border-color: var(--p);
      color: #fff;
      box-shadow: 0 0 0 4px rgba(26, 86, 219, .15)
    }

    .wf-circle.rejected {
      background: var(--err);
      border-color: var(--err);
      color: #fff
    }

    .wf-circle.waiting {
      background: var(--card);
      border-color: var(--bdr);
      color: var(--tx3)
    }

    .wf-label {
      font-size: 10px;
      font-weight: 600;
      color: var(--tx2);
      text-align: center;
      max-width: 80px;
      line-height: 1.3
    }

    .wf-arrow {
      width: 28px;
      height: 2px;
      background: var(--bdr);
      flex-shrink: 0;
      margin-bottom: 20px
    }

    .wf-arrow.done {
      background: var(--ok)
    }

    /* TABS */
    .tabs {
      display: flex;
      gap: 3px;
      background: var(--bg);
      padding: 3px;
      border-radius: 10px;
      width: fit-content;
      margin-bottom: 18px
    }

    .tab {
      padding: 6px 14px;
      border-radius: 7px;
      font-size: 13px;
      font-weight: 600;
      cursor: pointer;
      color: var(--tx2);
      border: none;
      background: none;
      font-family: inherit;
      transition: .15s
    }

    .tab.active {
      background: #fff;
      color: var(--p);
      box-shadow: 0 1px 4px rgba(0, 0, 0, .1)
    }

    /* TIMELINE */
    .tl {
      position: relative;
      padding-left: 22px
    }

    .tl::before {
      content: '';
      position: absolute;
      left: 7px;
      top: 4px;
      bottom: 0;
      width: 2px;
      background: var(--bdr)
    }

    .tli {
      position: relative;
      margin-bottom: 16px
    }

    .tli::before {
      content: '';
      position: absolute;
      left: -19px;
      top: 4px;
      width: 9px;
      height: 9px;
      border-radius: 50%;
      background: var(--p);
      border: 2px solid #fff;
      box-shadow: 0 0 0 2px var(--p)
    }

    .tlt {
      font-size: 10px;
      color: var(--tx3);
      margin-bottom: 1px
    }

    .tlx {
      font-size: 13px
    }

    /* SETTINGS */
    .settings-grid {
      display: grid;
      grid-template-columns: 220px 1fr;
      gap: 20px
    }

    .sn {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 12px;
      padding: 10px;
      height: fit-content
    }

    .sn-group {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 16px;
      margin-bottom: 20px;
      overflow: hidden;
      box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .sn-i {
      padding: 12px 16px;
      cursor: pointer;
      font-size: 13px;
      font-weight: 600;
      color: var(--tx2);
      transition: all 0.2s;
      display: flex;
      align-items: center;
      gap: 10px;
      border-bottom: 1px solid var(--bdr);
    }

    .sn-i:last-child {
      border-bottom: none;
    }

    .sn-i:hover {
      background: var(--bg);
      color: var(--tx1);
    }

    .sn-i.active {
      background: var(--pl);
      color: var(--p);
      font-weight: 700;
      position: relative;
    }

    .sn-i.active::before {
      content: '';
      position: absolute;
      left: 0;
      top: 8px;
      bottom: 8px;
      width: 4px;
      background: var(--p);
      border-radius: 0 4px 4px 0;
    }

    .sp {
      display: none
    }

    .sp.active {
      display: block
    }

    /* CO TREE */
    .co-node {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 12px;
      padding: 16px;
      margin-bottom: 10px
    }

    .co-node.parent {
      border-left: 4px solid var(--p)
    }

    .co-node.child {
      border-left: 4px solid var(--ok);
      margin-left: 28px
    }

    .co-node-head {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px
    }

    /* TOAST */
    #toast-box {
      position: fixed;
      bottom: 22px;
      right: 22px;
      z-index: 99999;
      display: flex;
      flex-direction: column;
      gap: 7px
    }

    .toast {
      background: #1a1f36;
      color: #fff;
      padding: 11px 16px;
      border-radius: 10px;
      font-size: 13px;
      font-weight: 500;
      display: flex;
      align-items: center;
      gap: 9px;
      box-shadow: 0 8px 24px rgba(0, 0, 0, .2);
      animation: tIn .2s ease;
      min-width: 250px
    }

    .toast.ok {
      border-left: 3px solid var(--ok)
    }

    .toast.err {
      border-left: 3px solid var(--err)
    }

    .toast.info {
      border-left: 3px solid var(--acc)
    }

    @keyframes tIn {
      from {
        transform: translateX(36px);
        opacity: 0
      }

      to {
        transform: translateX(0);
        opacity: 1
      }
    }

    .empty {
      text-align: center;
      padding: 50px 20px;
      color: var(--tx2)
    }

    .empty .ei {
      font-size: 44px;
      margin-bottom: 10px;
      opacity: .35
    }

    .empty h3 {
      font-size: 14px;
      font-weight: 700;
      color: var(--tx3);
      margin-bottom: 3px
    }

    .sdiv {
      height: 1px;
      background: var(--bdr);
      margin: 16px 0
    }

    .detail-row {
      display: flex;
      gap: 8px;
      margin-bottom: 8px
    }

    .dl {
      font-size: 12px;
      font-weight: 600;
      color: var(--tx2);
      min-width: 130px;
      flex-shrink: 0
    }

    .dv {
      font-size: 13px
    }

    .ib {
      background: var(--pl);
      border: 1px solid #bfdbfe;
      border-radius: 8px;
      padding: 10px 13px;
      font-size: 13px;
      color: var(--p);
      display: flex;
      align-items: flex-start;
      gap: 7px;
      margin-bottom: 14px
    }

    .phase-1 {
      background: #fef3c7;
      color: #92400e;
      border: 1px solid #fde68a
    }

    .phase-2 {
      background: #d1fae5;
      color: #065f46;
      border: 1px solid #a7f3d0
    }

    .chart-container {
      position: relative;
      height: 240px
    }


    /* ═══ MOBILE TOGGLE BUTTON ═══ */
    .mobile-menu-btn {
      display: none;
      position: fixed;
      top: 12px;
      left: 12px;
      z-index: 200;
      width: 40px;
      height: 40px;
      border-radius: 10px;
      background: var(--sb);
      color: #fff;
      border: none;
      font-size: 20px;
      cursor: pointer;
      align-items: center;
      justify-content: center;
      box-shadow: 0 2px 10px rgba(0, 0, 0, .3)
    }

    .mobile-back-chat {
      display: none
    }

    /* ═══ RESPONSIVE: TABLET (max-width: 1200px) ═══ */
    @media(max-width:1200px) {
      .sg {
        grid-template-columns: repeat(2, 1fr)
      }

      .g3 {
        grid-template-columns: 1fr 1fr
      }
    }

    /* ═══ RESPONSIVE: SMALL TABLET (max-width: 900px) ═══ */
    @media(max-width:900px) {
      .settings-grid {
        grid-template-columns: 1fr
      }

      .g2,
      .g3 {
        grid-template-columns: 1fr
      }

      .sg {
        grid-template-columns: repeat(2, 1fr)
      }
    }

    /* ═══ RESPONSIVE: MOBILE (max-width: 768px) ═══ */
    @media(max-width:768px) {
      body {
        flex-direction: column;
        overflow: hidden;
        height: 100vh;
      }

      /* --- Sidebar: full overlay --- */
      #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
        z-index: 1100;
        box-shadow: 4px 0 24px rgba(0, 0, 0, .3);
        padding-top: calc(10px + env(safe-area-inset-top));
        padding-bottom: env(safe-area-inset-bottom);
      }

      .sb-close-btn {
        display: flex;
        position: absolute;
        top: calc(8px + env(safe-area-inset-top));
        right: 12px;
        width: 34px;
        height: 34px;
        background: rgba(255, 255, 255, 0.15);
        color: #fff;
        border: none;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        z-index: 310;
        backdrop-filter: blur(4px);
      }

      #sidebar.open {
        transform: translateX(0)
      }

      .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, .45);
        z-index: 299;
        animation: fadeIn .2s ease;
      }

      .sidebar-overlay.show {
        display: block
      }

      @keyframes fadeIn {
        from {
          opacity: 0
        }

        to {
          opacity: 1
        }
      }

      /* --- Module Bar: Bottom Navigation on mobile --- */
      #module-bar {
        display: flex !important;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: calc(60px + env(safe-area-inset-bottom));
        flex-direction: row;
        justify-content: space-around;
        padding: 0 10px env(safe-area-inset-bottom) 10px;
        background: #1e293b;
        z-index: 1000;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        border-right: none;
        gap: 0;
      }

      #module-bar .mod-i {
        width: 50px;
        height: 50px;
        margin-top: 0 !important;
      }

      #module-bar .mod-label {
        display: none !important;
      }

      #module-bar .mod-i.active::after {
        display: none;
      }

      /* --- Mobile menu toggle --- */
      .mobile-menu-btn {
        display: flex;
        position: fixed;
        top: calc(8px + env(safe-area-inset-top));
        left: 12px;
        z-index: 1000;
        width: 56px;
        height: 56px;
        border-radius: 14px;
        background: linear-gradient(145deg, #ffffff, #e2e8f0);
        color: #1e293b;
        border: 2.5px solid #fff;
        font-size: 28px;
        align-items: center;
        justify-content: center;
        box-shadow: 6px 6px 15px rgba(0, 0, 0, 0.25), -3px -3px 8px rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(4px);
        cursor: pointer;
        transition: transform 0.1s;
      }

      .mobile-menu-btn:active {
        transform: scale(0.92);
      }

      /* --- Main: full width --- */
      #main {
        margin-left: 0 !important;
        width: 100vw;
        height: 100%;
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        padding-bottom: calc(60px + env(safe-area-inset-bottom)) !important;
      }

      #topbar {
        padding: 0 12px 0 76px;
        /* Increased padding for larger menu button */
        height: calc(56px + env(safe-area-inset-top));
        justify-content: flex-start;
        align-items: flex-start;
      }

      /* --- Global Bell Fix --- */
      .notif-wrapper {
        position: fixed;
        top: calc(8px + env(safe-area-inset-top));
        right: 12px;
        z-index: 1000;
        display: flex !important;
        gap: 15px !important;
      }

      #bell-btn,
      #top-chat-btn,
      #top-theme-btn {
        width: 56px !important;
        height: 56px !important;
        border-radius: 50% !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        background: linear-gradient(145deg, #ffffff, #e2e8f0) !important;
        border: 2.5px solid #fff !important;
        padding: 0 !important;
        font-size: 28px !important;
        box-shadow: 6px 6px 15px rgba(0, 0, 0, 0.25), -3px -3px 8px rgba(255, 255, 255, 0.9) !important;
        color: #0f172a !important;
        transition: transform 0.1s active !important;
      }

      #bell-btn:active,
      #top-chat-btn:active,
      #top-theme-btn:active {
        transform: scale(0.92) !important;
        box-shadow: inset 2px 2px 5px rgba(0, 0, 0, 0.2) !important;
      }

      #mod-chat,
      .mod-i[onclick*="chat"],
      div[onclick*="nav('chat')"] {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        opacity: 0 !important;
        pointer-events: none !important;
      }

      #topbar .tb-right {
        display: none !important;
        /* Hide the old container on mobile */
      }

      .tb-title {
        font-size: 16px;
        margin-top: calc(18px + env(safe-area-inset-top));
        color: #fff !important;
        opacity: 1 !important;
      }

      /* --- AI Button: Move up to avoid bottom nav --- */
      #floating-ai-btn {
        bottom: calc(85px + env(safe-area-inset-bottom)) !important;
        right: 15px !important;
        width: 50px !important;
        height: 50px !important;
        font-size: 24px !important;
      }

      #ai-chat-widget {
        bottom: calc(85px + env(safe-area-inset-bottom)) !important;
        right: 10px !important;
        width: calc(100vw - 20px) !important;
        height: calc(100vh - 180px) !important;
      }

      .tb-right .search-bar {
        display: none
      }

      #content {
        padding: 12px
      }

      /* --- Grids full width --- */
      .sg {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        margin-bottom: 12px
      }

      .sc .val {
        font-size: 20px
      }

      .sc {
        padding: 12px
      }

      .g2,
      .g3 {
        grid-template-columns: 1fr;
        gap: 10px
      }

      /* --- Page header --- */
      .ph {
        margin-bottom: 14px;
        gap: 8px
      }

      .pt {
        font-size: 16px
      }

      .ph .btn {
        font-size: 12px;
        padding: 6px 10px
      }

      /* --- Cards --- */
      .card {
        padding: 14px;
        border-radius: 10px
      }

      /* --- Tables: horizontal scroll + compact --- */
      .tw {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px
      }

      table {
        min-width: 600px
      }

      thead th {
        padding: 7px 10px;
        font-size: 10px
      }

      tbody td {
        padding: 8px 10px;
        font-size: 12px
      }

      /* --- Modals: nearly full-screen on mobile --- */
      .mbox {
        width: 95vw !important;
        max-width: 95vw !important;
        max-height: 90vh;
        border-radius: 14px
      }

      .mh {
        padding: 14px 16px
      }

      .mb {
        padding: 14px 16px
      }

      .mf {
        padding: 10px 16px
      }

      /* --- Buttons: bigger touch targets --- */
      .btn {
        padding: 8px 12px;
        font-size: 13px;
        min-height: 36px
      }

      .btn-p {
        min-height: 40px
      }

      /* --- Forms --- */
      .fc {
        font-size: 14px !important;
        padding: 10px 12px !important
      }

      select.fc {
        padding: 10px 12px !important
      }

      .fg {
        margin-bottom: 12px
      }

      .fg label {
        font-size: 12px
      }

      /* --- Chat layout: stacked on mobile --- */
      .chat-layout {
        height: calc(100vh - 130px);
        flex-direction: column
      }

      .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--bdr)
      }

      .chat-main {
        display: none
      }

      .chat-layout.has-active .chat-sidebar {
        display: none
      }

      .chat-layout.has-active .chat-main {
        display: flex;
        height: 100%
      }

      .chat-input-area {
        padding: 8px 10px
      }

      .chat-input-area input[type=text] {
        padding: 8px 12px;
        font-size: 14px
      }

      .chat-messages {
        padding: 12px
      }

      .msg-row {
        max-width: 88%
      }

      .mobile-back-chat {
        display: inline-flex
      }

      /* --- Settings --- */
      .settings-grid {
        grid-template-columns: 1fr
      }

      .sn {
        display: flex;
        flex-wrap: wrap;
        gap: 4px;
        margin-bottom: 12px
      }

      .sn-i {
        padding: 6px 10px;
        font-size: 11px;
        flex: none
      }

      /* --- Chart --- */
      .chart-container {
        height: 200px
      }

      /* --- Co switcher --- */
      .co-sw {
        margin: 6px 8px;
        padding: 8px 10px
      }

      /* --- Login responsive --- */
      .lb {
        padding: 28px 20px;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center
      }

      /* --- Toast --- */
      #toast-box {
        bottom: 8px;
        right: 8px;
        left: 8px;
        max-width: none
      }

      /* --- Badge --- */
      #co-badge {
        display: none !important
      }

      /* --- Hydro timeline compact --- */
      .hydro-timeline-node {
        width: 24px;
        height: 24px;
        font-size: 11px
      }

      .hydro-timeline-lbl {
        font-size: 9px;
        max-width: 50px
      }

      /* --- User menu --- */
      .u-menu {
        position: fixed;
        bottom: calc(60px + env(safe-area-inset-bottom));
        left: 0;
        right: 0;
        border-radius: 14px 14px 0 0;
        border: none;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, .3);
        z-index: 2000;
      }

      .u-mi {
        padding: 14px 20px;
        font-size: 14px
      }

      /* --- Kanban mobile --- */
      .kanban {
        gap: 10px;
        padding-bottom: 10px;
        -webkit-overflow-scrolling: touch
      }

      .kc {
        min-width: 240px;
        padding: 10px
      }

      .kcard {
        padding: 10px
      }

      .kcard-t {
        font-size: 12px
      }

      /* --- Tabs scrollable --- */
      .tabs {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        gap: 0;
        white-space: nowrap;
        border-bottom: 1px solid var(--bdr);
        margin-bottom: 14px
      }

      .tab {
        padding: 8px 12px;
        font-size: 12px;
        flex-shrink: 0
      }

      /* --- Workflow steps compact --- */
      .wf-steps {
        flex-wrap: wrap;
        gap: 4px
      }

      .wf-node {
        min-width: 60px
      }

      .wf-circle {
        width: 28px;
        height: 28px;
        font-size: 12px
      }

      .wf-lbl {
        font-size: 9px
      }

      .wf-arr {
        font-size: 10px
      }

      /* --- Approval cards --- */
      .ap-card {
        padding: 12px
      }

      /* --- Sidebar labels hidden on small screens --- */
      .sb-sec-lbl {
        font-size: 9px;
        letter-spacing: 1px
      }

      /* --- Proposal filters wrap --- */
      #prop-filters {
        gap: 6px
      }

      #prop-filters select.fc {
        width: 100% !important;
        max-width: 100% !important
      }

      /* --- Finance grid --- */
      .fin-grid {
        grid-template-columns: 1fr 1fr
      }

      .fin-val {
        font-size: 16px
      }

      /* --- PDF viewer mobile --- */
      #pdf-viewer-container {
        padding: 8px
      }

      .viewer-tools {
        flex-wrap: wrap;
        gap: 8px;
        padding: 6px 10px
      }
    }

    /* ═══ RESPONSIVE: VERY SMALL (max-width: 480px) ═══ */
    @media(max-width:480px) {
      .sg {
        grid-template-columns: 1fr
      }

      .sc .val {
        font-size: 18px
      }

      .sc .lbl {
        font-size: 10px
      }

      .sc .ib {
        width: 32px;
        height: 32px;
        font-size: 14px;
        border-radius: 8px
      }

      .ph {
        flex-direction: column;
        align-items: flex-start
      }

      .pt {
        font-size: 15px
      }

      .chat-tab {
        font-size: 11px;
        padding: 8px 4px
      }

      .ci-name {
        font-size: 12px
      }

      .ci-msg {
        font-size: 11px
      }

      .msg-bubble {
        font-size: 13px;
        padding: 8px 12px
      }

      table {
        min-width: 500px
      }

      .badge {
        font-size: 10px;
        padding: 2px 6px
      }

      #topbar {
        padding-left: 50px
      }

      .tb-right .btn span {
        display: none
      }
    }

    /* Visual E-Sign */
    #pdf-viewer-container {
      position: relative;
      flex: 1;
      overflow: auto;
      background: #525659;
      display: flex;
      justify-content: center;
      padding: 20px;
    }

    #pdf-canvas-wrapper {
      position: relative;
      box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
      background: #fff;
    }

    #pdf-canvas {
      display: block;
    }

    .sig-overlay {
      position: absolute;
      border: 2px dashed var(--p);
      cursor: move;
      user-select: none;
      z-index: 100;
      box-sizing: border-box;
      background: rgba(26, 86, 219, 0.05);
    }

    .sig-overlay img {
      width: 100%;
      height: 100%;
      pointer-events: none;
    }

    .sig-handle {
      position: absolute;
      width: 12px;
      height: 12px;
      background: var(--p);
      border: 2px solid #fff;
      border-radius: 50%;
      bottom: -6px;
      right: -6px;
      cursor: nwse-resize;
      z-index: 101;
    }

    .lb {
      width: 100%;
      max-width: 460px;
      background: var(--card);
      padding: 40px 32px;
      border-radius: 24px;
      box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
      position: relative;
      z-index: 1;
    }

    .viewer-tools {
      display: flex;
      align-items: center;
      gap: 15px;
      background: var(--card);
      padding: 8px 20px;
      border-bottom: 1px solid var(--bdr);
    }

    .v-btn {
      background: none;
      border: none;
      padding: 4px 8px;
      cursor: pointer;
      border-radius: 4px;
      color: var(--tx);
      display: flex;
      align-items: center;
      gap: 5px;
      font-weight: 500;
      font-size: 14px;
    }

    .v-btn:hover {
      background: var(--bg);
    }

    .page-num {
      font-size: 14px;
      color: var(--tx2);
      min-width: 80px;
      text-align: center;
    }

    /* CHAT */
    .chat-layout {
      display: flex;
      height: calc(100vh - 140px);
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: var(--r);
      overflow: hidden
    }



    .chat-sidebar {
      width: 320px;
      border-right: 1px solid var(--bdr);
      display: flex;
      flex-direction: column;
      background: var(--card)
    }

    .chat-sidebar-head {
      padding: 14px 16px;
      border-bottom: 1px solid var(--bdr);
      display: flex;
      align-items: center;
      justify-content: space-between
    }

    .chat-search {
      padding: 8px 12px;
      border-bottom: 1px solid var(--bdr)
    }

    .chat-search input {
      width: 100%;
      padding: 8px 12px;
      border: 1px solid var(--bdr);
      border-radius: 8px;
      font-family: inherit;
      font-size: 13px;
      outline: none;
      background: var(--bg)
    }

    .chat-search input:focus {
      border-color: var(--p)
    }

    .chat-tabs {
      display: flex;
      border-bottom: 1px solid var(--bdr)
    }

    .chat-tab {
      flex: 1;
      padding: 10px 8px;
      text-align: center;
      font-size: 12px;
      font-weight: 700;
      color: var(--tx2);
      cursor: pointer;
      border-bottom: 2px solid transparent;
      transition: .15s;
      background: none;
      border-top: none;
      border-left: none;
      border-right: none;
      font-family: inherit
    }

    .chat-tab:hover {
      color: var(--p);
      background: var(--pl)
    }

    .chat-tab.active {
      color: var(--p);
      border-bottom-color: var(--p);
      background: var(--pl)
    }

    .chat-list {
      flex: 1;
      overflow-y: auto
    }

    .chat-item {
      position: relative;
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 12px 16px;
      cursor: pointer;
      transition: .12s;
      border-bottom: 1px solid var(--bdr)
    }

    .chat-item:hover {
      background: var(--pl)
    }

    .chat-item.active {
      background: var(--pl);
      border-left: 3px solid var(--p)
    }

    .btn-chat-item-del {
      position: absolute;
      right: 10px;
      top: 50%;
      transform: translateY(-50%);
      background: #fee2e2;
      color: var(--err);
      border: none;
      border-radius: 4px;
      width: 28px;
      height: 28px;
      display: none;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      font-size: 12px;
      z-index: 5
    }

    .chat-item:hover .btn-chat-item-del {
      display: flex
    }

    .btn-chat-item-del:hover {
      background: #fecaca
    }

    .chat-item .ci-av {
      position: relative;
      width: 40px;
      height: 40px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 700;
      font-size: 13px;
      color: #fff;
      flex-shrink: 0
    }

    .chat-item .ci-info {
      flex: 1;
      min-width: 0
    }

    .chat-item .ci-name {
      font-size: 13px;
      font-weight: 600;
      display: flex;
      justify-content: space-between
    }

    .chat-item .ci-name .ci-time {
      font-size: 10px;
      color: var(--tx3);
      font-weight: 400
    }

    .chat-item .ci-msg {
      font-size: 12px;
      color: var(--tx2);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      margin-top: 2px
    }

    .chat-item .ci-unread {
      background: var(--err);
      color: #fff;
      font-size: 10px;
      font-weight: 700;
      padding: 1px 6px;
      border-radius: 10px;
      min-width: 18px;
      text-align: center;
      flex-shrink: 0
    }

    .chat-item-group .ci-av {
      border-radius: 12px;
      background: linear-gradient(135deg, var(--p), var(--pur))
    }

    .chat-main {
      flex: 1;
      display: flex;
      flex-direction: column;
      background: var(--bg)
    }

    .chat-main-head {
      padding: 14px 20px;
      border-bottom: 1px solid var(--bdr);
      display: flex;
      align-items: center;
      gap: 12px;
      background: var(--card)
    }

    .chat-main-head .cm-name {
      font-size: 15px;
      font-weight: 700
    }

    .chat-main-head .cm-status {
      font-size: 11px;
      color: var(--tx3)
    }

    .chat-main-actions {
      margin-left: auto;
      display: flex;
      gap: 6px
    }

    .chat-messages {
      flex: 1;
      overflow-y: auto;
      padding: 20px;
      display: flex;
      flex-direction: column;
      gap: 4px;
      background: var(--bg)
    }

    .chat-empty {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      color: var(--tx3);
      gap: 8px
    }

    .chat-empty .ce-icon {
      font-size: 56px;
      opacity: .3
    }

    .msg-row {
      display: flex;
      align-items: flex-end;
      gap: 8px;
      max-width: 75%;
      animation: msgIn .2s ease
    }

    .msg-row.sent {
      align-self: flex-end;
      flex-direction: row-reverse
    }

    .msg-row .msg-av {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 10px;
      font-weight: 700;
      color: #fff;
      flex-shrink: 0
    }

    .msg-bubble {
      padding: 10px 14px;
      border-radius: 16px;
      font-size: 13px;
      line-height: 1.5;
      word-wrap: break-word;
      max-width: 100%;
      position: relative
    }

    .msg-row.received .msg-bubble {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-bottom-left-radius: 4px
    }

    .msg-row.sent .msg-bubble {
      background: var(--p);
      color: #fff;
      border-bottom-right-radius: 4px
    }

    .msg-meta {
      font-size: 10px;
      color: var(--tx3);
      margin-top: 3px;
      display: flex;
      align-items: center;
      gap: 4px
    }

    .msg-row.sent .msg-meta {
      justify-content: flex-end;
      color: rgba(255, 255, 255, .55)
    }

    .msg-sender-name {
      font-size: 11px;
      font-weight: 600;
      color: var(--p);
      margin-bottom: 2px
    }

    .msg-date-sep {
      text-align: center;
      padding: 10px 0;
      font-size: 11px;
      color: var(--tx3);
      font-weight: 600
    }

    .msg-file {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: rgba(255, 255, 255, .1);
      border-radius: 8px;
      margin-top: 4px;
      font-size: 12px;
      cursor: pointer;
      text-decoration: none
    }

    .msg-row.received .msg-file {
      background: var(--bg);
      color: var(--p)
    }

    .msg-row.sent .msg-file {
      background: rgba(255, 255, 255, .15);
      color: #fff
    }

    .chat-input-area {
      padding: 12px 16px;
      border-top: 1px solid var(--bdr);
      display: flex;
      align-items: center;
      gap: 10px;
      background: var(--card)
    }

    .chat-input-area input[type=text] {
      flex: 1;
      padding: 10px 14px;
      border: 1px solid var(--bdr);
      border-radius: 24px;
      font-family: inherit;
      font-size: 13px;
      outline: none;
      transition: .15s
    }

    .chat-input-area input[type=text]:focus {
      border-color: var(--p);
      box-shadow: 0 0 0 3px rgba(26, 86, 219, .1)
    }

    .chat-send-btn {
      width: 40px;
      height: 40px;
      border-radius: 50%;
      background: var(--p);
      color: #fff;
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 16px;
      transition: .15s;
      flex-shrink: 0
    }

    .chat-send-btn:hover {
      background: var(--pd);
      transform: scale(1.05)
    }

    .chat-send-btn:disabled {
      opacity: .4;
      cursor: not-allowed;
      transform: none
    }

    .chat-file-btn {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      background: var(--bg);
      border: 1px solid var(--bdr);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 15px;
      transition: .15s;
      flex-shrink: 0
    }

    .chat-file-btn:hover {
      background: var(--pl);
      border-color: var(--p)
    }

    @keyframes msgIn {
      from {
        opacity: 0;
        transform: translateY(8px)
      }

      to {
        opacity: 1;
        transform: translateY(0)
      }
    }

    .typing-indicator {
      display: flex;
      gap: 3px;
      padding: 8px 14px
    }

    .typing-indicator span {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--tx3);
      animation: typing 1.4s infinite ease-in-out
    }

    .typing-indicator span:nth-child(2) {
      animation-delay: .2s
    }

    .typing-indicator span:nth-child(3) {
      animation-delay: .4s
    }

    @keyframes typing {

      0%,
      60%,
      100% {
        transform: translateY(0)
      }

      30% {
        transform: translateY(-6px)
      }
    }

    .sb-logo-img {
      width: 36px;
      height: 36px;
      border-radius: 10px;
      object-fit: cover;
      flex-shrink: 0
    }

    .lb-logo-img {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      object-fit: cover
    }

    .brand-preview {
      display: flex;
      align-items: center;
      gap: 12px;
      padding: 16px;
      background: var(--bg);
      border-radius: 12px;
      margin-bottom: 16px
    }

    .brand-preview .bp-icon {
      width: 48px;
      height: 48px;
      background: var(--p);
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      color: #fff;
      font-size: 20px;
      flex-shrink: 0;
      overflow: hidden
    }

    .brand-preview .bp-icon img {
      width: 100%;
      height: 100%;
      object-fit: cover
    }

    /* Comments Styles */
    .comments-sec {
      margin-top: 24px;
      border-top: 1px solid var(--bdr);
      padding-top: 18px;
    }

    .comment-item {
      display: flex;
      gap: 12px;
      margin-bottom: 16px;
      animation: msgIn .3s ease;
    }

    .comment-main {
      flex: 1;
      background: var(--bg);
      padding: 10px 14px;
      border-radius: 12px;
      font-size: 13px;
    }

    .comment-hdr {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 4px;
    }

    .comment-user {
      font-weight: 700;
      color: var(--tx1);
    }

    .comment-time {
      font-size: 10px;
      color: var(--tx3);
    }

    .comment-box {
      margin-top: 16px;
      display: flex;
      gap: 10px;
    }

    .comment-box textarea {
      flex: 1;
      min-height: 40px;
      max-height: 120px;
      resize: vertical;
      border-radius: 20px;
      padding: 10px 16px;
    }

    @media(max-width:768px) {
      .chat-sidebar {
        width: 100%
      }

      .chat-main {
        display: none
      }

      .chat-layout.has-active .chat-sidebar {
        display: none
      }

      .chat-layout.has-active .chat-main {
        display: flex
      }
    }

    /* NEW: Proposal Comments & Followers Premium Styling */
    .comments-sec {
      margin-top: 24px;
      padding-top: 20px;
      border-top: 1px dashed var(--bdr);
    }

    #prop-comments-list {
      max-height: 380px;
      overflow-y: auto;
      margin-bottom: 16px;
      padding-right: 5px;
    }

    .comment-item {
      display: flex;
      gap: 10px;
      margin-bottom: 14px;
      animation: slideUp 0.3s ease;
    }

    .comment-main {
      flex: 1;
      background: #fff;
      padding: 10px 14px;
      border-radius: 12px;
      border: 1px solid var(--bdr);
      box-shadow: 0 2px 5px rgba(0, 0, 0, 0.02);
    }

    .comment-hdr {
      display: flex;
      justify-content: space-between;
      margin-bottom: 4px;
      align-items: center;
    }

    .comment-user {
      font-weight: 700;
      font-size: 13px;
      color: var(--p);
    }

    .comment-time {
      font-size: 10px;
      color: var(--tx3);
      font-weight: 500;
    }

    .comment-text {
      font-size: 13px;
      line-height: 1.5;
      color: var(--tx);
      white-space: pre-wrap;
    }

    .comment-box {
      display: flex;
      gap: 10px;
      align-items: flex-start;
      margin-top: 16px;
      background: var(--pl);
      padding: 10px;
      border-radius: 12px;
      border: 1px solid var(--pl);
    }

    .comment-box .av {
      flex-shrink: 0;
    }

    .comment-box textarea {
      background: #fff;
      border: 1px solid var(--bdr);
      border-radius: 10px;
      padding: 8px 11px;
      font-size: 13px;
      resize: none;
      flex: 1;
      transition: 0.2s;
      min-height: 38px;
    }

    .comment-box textarea:focus {
      border-color: var(--p);
      box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
    }

    .comment-box .btn-p {
      height: 38px;
      align-self: flex-end;
    }

    .msg-bubble {
      position: relative;
    }

    .msg-del {
      position: absolute;
      top: 0px;
      right: -25px;
      background: none;
      border: none;
      color: var(--tx3);
      cursor: pointer;
      font-size: 14px;
      opacity: 0;
      transition: 0.2s;
    }

    .msg-bubble:hover .msg-del {
      opacity: 1;
    }

    .msg-del:hover {
      color: var(--err);
    }

    /* MENTIONS */
    .mention {
      font-weight: 700;
      color: var(--p);
      background: var(--pl);
      padding: 1px 4px;
      border-radius: 4px;
    }

    .mention-dropdown {
      position: fixed;
      background: #fff;
      border: 1px solid var(--bdr);
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
      z-index: 10000;
      width: 220px;
      max-height: 200px;
      overflow-y: auto;
      display: none;
    }

    .mention-item {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      cursor: pointer;
      font-size: 13px;
      border-bottom: 1px solid var(--bg);
    }

    .mention-item:last-child {
      border-bottom: none;
    }

    .mention-item:hover,
    .mention-item.active {
      background: var(--pl);
      color: var(--p);
    }

    .mention-item .av {
      width: 24px;
      height: 24px;
      font-size: 9px;
    }

    .mention-item .mi-name {
      font-weight: 600;
      flex: 1;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .comment-del {
      background: none;
      border: none;
      color: var(--tx3);
      cursor: pointer;
      font-size: 12px;
      opacity: 0;
      transition: 0.2s;
    }

    .comment-item:hover .comment-del {
      opacity: 1;
    }

    .comment-del:hover {
      color: var(--err);
    }

    /* CEO REPORT STYLES */
    .ceo-kpi {
      background: var(--card);
      border: 1px solid var(--bdr);
      border-radius: 20px;
      padding: 24px;
      text-align: left;
      position: relative;
      overflow: hidden;
      box-shadow: var(--shd)
    }

    .ceo-kpi::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: #22c55e;
    }

    .ceo-kpi-val {
      font-size: 32px;
      font-weight: 900;
      margin-bottom: 4px;
      letter-spacing: -1px
    }

    .ceo-kpi-lbl {
      font-size: 12px;
      color: var(--tx2);
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px
    }

    .ceo-kpi-sub {
      font-size: 11px;
      color: var(--tx3);
      margin-top: 8px;
      display: flex;
      align-items: center;
      gap: 4px
    }

    .ceo-health-table {
      width: 100%;
      border-collapse: collapse;
      margin-top: 10px
    }

    .ceo-health-table th {
      text-align: left;
      padding: 12px;
      color: var(--tx3);
      font-size: 11px;
      text-transform: uppercase;
      border-bottom: 1px solid var(--bdr)
    }

    .ceo-health-table td {
      padding: 14px 12px;
      border-bottom: 1px solid rgba(0, 0, 0, 0.03);
      font-size: 13px
    }

    @media (min-width: 901px) {
      #top-chat-btn {
        display: none !important;
      }
    }
