
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    --bg: #f5f4f0; --surface: #ffffff; --surface2: #f1f0ec;
    --border: rgba(0,0,0,0.1); --border2: rgba(0,0,0,0.18);
    --text: #1a1917; --text2: #6b6a66; --text3: #9e9c97;
    --blue: #185FA5; --blue-bg: #E6F1FB; --blue-text: #0C447C;
    --green: #3B6D11; --green-bg: #EAF3DE; --green-text: #27500A;
    --amber: #854F0B; --amber-bg: #FAEEDA; --amber-text: #633806;
    --red: #A32D2D; --red-bg: #FCEBEB; --red-text: #791F1F;
    --purple: #534AB7; --purple-bg: #EEEDFE; --purple-text: #3C3489;
    --teal: #0F6E56; --teal-bg: #E1F5EE; --teal-text: #085041;
    --gray-bg: #F1EFE8; --gray-text: #5F5E5A;
    --font: -apple-system, 'Segoe UI', sans-serif;
    --r: 6px; --r-lg: 10px;
    --sidebar-w: 190px;
  }
  html, body { height: 100%; font-family: var(--font); font-size: 13px; background: var(--bg); color: var(--text); overflow: hidden; }

  /* ── Layout ── */
  .shell { display: flex; flex-direction: column; height: 100vh; }
  .topbar { height: 42px; background: var(--surface); border-bottom: 0.5px solid var(--border2); display: flex; align-items: center; gap: 10px; padding: 0 14px; flex-shrink: 0; z-index: 100; }
  .analytics-strip { background: var(--surface); border-bottom: 0.5px solid var(--border2); padding: 8px 14px; display: grid; grid-template-columns: repeat(6,1fr); gap: 8px; flex-shrink: 0; }
  .workspace { display: flex; flex: 1; overflow: hidden; }
  .sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 0.5px solid var(--border2); display: flex; flex-direction: column; overflow-y: auto; flex-shrink: 0; }
  .content-area { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
  .content-toolbar { padding: 8px 12px; background: var(--surface); border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .content-body { flex: 1; overflow-y: auto; padding: 10px 12px; }
  .right-panel { width: 210px; background: var(--surface); border-left: 0.5px solid var(--border2); overflow-y: auto; flex-shrink: 0; padding: 10px; }

  /* ── Topbar ── */
  .logo { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 14px; color: var(--text); }
  .logo-icon { width: 26px; height: 26px; background: var(--blue); border-radius: 5px; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 14px; }
  .breadcrumb { font-size: 11px; color: var(--text3); }
  .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
  .badge-proj { background: var(--blue-bg); color: var(--blue-text); font-size: 10px; font-weight: 500; padding: 2px 8px; border-radius: 20px; }
  .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--blue-bg); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; color: var(--blue-text); cursor: pointer; position: relative; }
  .icon-btn { border: none; background: none; cursor: pointer; color: var(--text2); padding: 4px; border-radius: var(--r); font-size: 15px; display: flex; align-items: center; position: relative; }
  .icon-btn:hover { background: var(--surface2); }
  .notif-dot { position: absolute; top: 2px; right: 2px; width: 6px; height: 6px; border-radius: 50%; background: var(--red); border: 1.5px solid var(--surface); }

  /* ── Analytics Cards ── */
  .acard { background: var(--surface2); border-radius: var(--r); padding: 8px 10px; position: relative; overflow: hidden; cursor: pointer; transition: filter .15s; border: 0.5px solid transparent; }
  .acard:hover { border-color: var(--border2); filter: brightness(0.97); }
  .acard.active-filter { border: 1.5px solid var(--blue); background: var(--blue-bg); }
  .acard-label { font-size: 10px; color: var(--text3); margin-bottom: 3px; display: flex; align-items: center; gap: 4px; }
  .acard-val { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1; }
  .acard-sub { font-size: 10px; margin-top: 2px; }
  .acard-bar { position: absolute; bottom: 0; left: 0; height: 2.5px; border-radius: 0 2px 2px 0; }
  .up { color: var(--green); } .down { color: var(--red); } .warn { color: var(--amber); }

  /* ── Sidebar ── */
  .nav-section { font-size: 9px; font-weight: 600; color: var(--text3); letter-spacing: 0.07em; padding: 10px 12px 4px; text-transform: uppercase; }
  .nav-item { display: flex; align-items: center; gap: 8px; padding: 6px 12px; font-size: 12px; color: var(--text2); cursor: pointer; border-left: 2px solid transparent; user-select: none; }
  .nav-item:hover { background: var(--surface2); color: var(--text); }
  .nav-item.active { color: var(--blue); background: var(--blue-bg); border-left: 2px solid var(--blue); font-weight: 500; }
  .nav-item i { font-size: 14px; }
  .count-pill { margin-left: auto; font-size: 9px; background: var(--blue-bg); color: var(--blue); padding: 1px 6px; border-radius: 10px; font-weight: 600; }

  /* ── Toolbar ── */
  .search-box { display: flex; align-items: center; gap: 6px; background: var(--surface2); border: 0.5px solid var(--border); border-radius: var(--r); padding: 4px 8px; flex: 1; max-width: 280px; }
  .search-box input { border: none; background: none; outline: none; font-size: 12px; color: var(--text); width: 100%; }
  .search-box input::placeholder { color: var(--text3); }
  .btn { border: 0.5px solid var(--border2); background: var(--surface); border-radius: var(--r); padding: 4px 10px; font-size: 11px; color: var(--text2); cursor: pointer; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
  .btn:hover { background: var(--surface2); color: var(--text); }
  .btn.primary { background: var(--blue); color: #fff; border-color: var(--blue); }
  .btn.primary:hover { background: var(--blue-text); }
  .select-sm { border: 0.5px solid var(--border2); background: var(--surface); border-radius: var(--r); padding: 4px 6px; font-size: 11px; color: var(--text2); outline: none; cursor: pointer; }
  .toolbar-sep { width: 0.5px; height: 18px; background: var(--border2); margin: 0 2px; }
  .view-toggle { display: flex; gap: 2px; }
  .view-btn { border: 0.5px solid var(--border); background: var(--surface); border-radius: var(--r); padding: 4px 7px; font-size: 13px; color: var(--text3); cursor: pointer; }
  .view-btn.active { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }

  /* ── Doc Table ── */
  .doc-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--r-lg); border: 0.5px solid var(--border2); overflow: hidden; font-size: 11.5px; }
  .doc-table th { background: var(--surface2); font-size: 10px; font-weight: 600; color: var(--text3); text-align: left; padding: 6px 10px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 0.5px solid var(--border2); white-space: nowrap; }
  .doc-table td { padding: 7px 10px; color: var(--text); border-bottom: 0.5px solid var(--border); vertical-align: middle; }
  .doc-table tr:last-child td { border-bottom: none; }
  .doc-table tr:hover td { background: var(--surface2); }
  .doc-table tr.selected td { background: var(--blue-bg); }
  .doc-table th input[type=checkbox], .doc-table td input[type=checkbox] { cursor: pointer; accent-color: var(--blue); }
  .doc-name { font-weight: 500; font-size: 12px; color: var(--text); }
  .doc-id { font-size: 10px; color: var(--text3); }
  .doc-icon { width: 22px; height: 22px; border-radius: 4px; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
  .di-blue { background: var(--blue-bg); color: var(--blue); }
  .di-amber { background: var(--amber-bg); color: var(--amber); }
  .di-green { background: var(--green-bg); color: var(--green); }
  .di-purple { background: var(--purple-bg); color: var(--purple); }
  .di-teal { background: var(--teal-bg); color: var(--teal); }
  .status-pill { font-size: 10px; font-weight: 500; padding: 2px 7px; border-radius: 10px; display: inline-block; white-space: nowrap; }
  .s-approved { background: var(--green-bg); color: var(--green-text); }
  .s-review { background: var(--amber-bg); color: var(--amber-text); }
  .s-pending { background: var(--red-bg); color: var(--red-text); }
  .s-draft { background: var(--gray-bg); color: var(--gray-text); }
  .s-superseded { background: var(--purple-bg); color: var(--purple-text); }
  .action-btns { display: flex; gap: 4px; opacity: 0; transition: opacity .1s; }
  .doc-table tr:hover .action-btns { opacity: 1; }
  .act-btn { border: none; background: none; cursor: pointer; color: var(--text3); font-size: 13px; padding: 2px 3px; border-radius: 3px; }
  .act-btn:hover { background: var(--border); color: var(--text); }
  .sort-icon { cursor: pointer; color: var(--text3); font-size: 10px; }
  th.sortable { cursor: pointer; user-select: none; }
  th.sortable:hover { color: var(--text2); }
  th.sort-asc::after { content: ' ↑'; font-size: 9px; }
  th.sort-desc::after { content: ' ↓'; font-size: 9px; }

  /* ── Card Grid View ── */
  .card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
  .doc-card { background: var(--surface); border: 0.5px solid var(--border2); border-radius: var(--r-lg); padding: 10px; cursor: pointer; transition: border-color .15s; }
  .doc-card:hover { border-color: var(--blue); }
  .doc-card-header { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; }
  .doc-card h4 { font-size: 11.5px; font-weight: 500; color: var(--text); line-height: 1.3; margin-bottom: 3px; }
  .doc-card p { font-size: 10px; color: var(--text3); }

  /* ── Right Panel ── */
  .panel-section { margin-bottom: 14px; }
  .panel-title { font-size: 9px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 7px; display: flex; align-items: center; justify-content: space-between; }
  .progress-item { margin-bottom: 6px; }
  .progress-label { display: flex; justify-content: space-between; font-size: 10px; color: var(--text2); margin-bottom: 2px; }
  .progress-track { height: 4px; background: var(--surface2); border-radius: 10px; overflow: hidden; }
  .progress-fill { height: 100%; border-radius: 10px; transition: width .4s ease; }
  .activity-item { display: flex; gap: 7px; margin-bottom: 8px; align-items: flex-start; }
  .act-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 3px; flex-shrink: 0; }
  .act-text { font-size: 10.5px; color: var(--text2); line-height: 1.4; }
  .act-time { font-size: 9px; color: var(--text3); }
  .team-row { display: flex; align-items: center; gap: 7px; margin-bottom: 6px; }
  .online-dot { width: 5px; height: 5px; border-radius: 50%; margin-left: auto; }
  .mini-avatar { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; flex-shrink: 0; }

  /* ── Modal ── */
  .modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
  .modal-overlay.open { opacity: 1; pointer-events: all; }
  .modal { background: var(--surface); border-radius: var(--r-lg); border: 0.5px solid var(--border2); width: 520px; max-height: 80vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
  .modal-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 0.5px solid var(--border); }
  .modal-header h3 { font-size: 14px; font-weight: 600; }
  .modal-body { padding: 14px 16px; }
  .modal-footer { padding: 10px 16px; border-top: 0.5px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
  .form-group { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
  .form-group label { font-size: 11px; font-weight: 500; color: var(--text2); }
  .form-group input, .form-group select, .form-group textarea { border: 0.5px solid var(--border2); background: var(--surface2); border-radius: var(--r); padding: 6px 8px; font-size: 12px; color: var(--text); outline: none; font-family: var(--font); }
  .form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--blue); background: #fff; }
  .form-group textarea { resize: vertical; min-height: 60px; }
  .drop-zone { border: 1.5px dashed var(--border2); border-radius: var(--r); padding: 20px; text-align: center; color: var(--text3); font-size: 11px; cursor: pointer; transition: border-color .15s, background .15s; }
  .drop-zone:hover { border-color: var(--blue); background: var(--blue-bg); color: var(--blue); }

  /* ── Detail Panel ── */
  .detail-panel { position: fixed; right: 0; top: 0; bottom: 0; width: 340px; background: var(--surface); border-left: 0.5px solid var(--border2); z-index: 500; transform: translateX(100%); transition: transform .2s; overflow-y: auto; }
  .detail-panel.open { transform: translateX(0); }
  .dp-header { padding: 12px 14px; border-bottom: 0.5px solid var(--border); display: flex; align-items: center; gap: 8px; }
  .dp-body { padding: 12px 14px; }
  .dp-field { margin-bottom: 10px; }
  .dp-field label { font-size: 10px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: 0.05em; display: block; margin-bottom: 2px; }
  .dp-field span { font-size: 12px; color: var(--text); }
  .dp-section { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 0 5px; border-top: 0.5px solid var(--border); margin-top: 6px; }
  .rev-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 0.5px solid var(--border); font-size: 11px; }
  .rev-row:last-child { border-bottom: none; }

  /* ── Toast ── */
  .toast-container { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
  .toast { background: #1a1917; color: #fff; padding: 7px 14px; border-radius: var(--r); font-size: 12px; opacity: 0; transform: translateY(8px); transition: all .2s; display: flex; align-items: center; gap: 7px; }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast.success i { color: #97C459; } .toast.error i { color: #F09595; } .toast.info i { color: #85B7EB; }

  /* ── Tabs ── */
  .tabs { display: flex; gap: 0; border-bottom: 0.5px solid var(--border); padding: 0 12px; background: var(--surface); flex-shrink: 0; }
  .tab { padding: 7px 12px; font-size: 12px; color: var(--text3); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -0.5px; white-space: nowrap; }
  .tab:hover { color: var(--text2); }
  .tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 500; }
  .tab-count { font-size: 9px; background: var(--surface2); color: var(--text3); padding: 1px 5px; border-radius: 8px; margin-left: 4px; }
  .tab.active .tab-count { background: var(--blue-bg); color: var(--blue); }

  /* ── Empty state ── */
  .empty-state { text-align: center; padding: 40px 20px; color: var(--text3); }
  .empty-state i { font-size: 32px; display: block; margin-bottom: 8px; }
  .empty-state p { font-size: 12px; }

  /* ── Scrollbar ── */
  ::-webkit-scrollbar { width: 5px; height: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 10px; }

  /* ── Confirm dialog ── */
  .confirm-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); z-index: 1100; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity .15s; }
  .confirm-overlay.open { opacity: 1; pointer-events: all; }
  .confirm-box { background: var(--surface); border-radius: var(--r-lg); padding: 20px; width: 320px; border: 0.5px solid var(--border2); }
  .confirm-box h4 { font-size: 14px; font-weight: 600; margin-bottom: 8px; }
  .confirm-box p { font-size: 12px; color: var(--text2); margin-bottom: 16px; line-height: 1.5; }
  .confirm-btns { display: flex; justify-content: flex-end; gap: 8px; }


    /* USER DROPDOWN CSS */
    .user-menu-container {
      position: relative;
      display: inline-block;
      margin-left: 8px;
    }
    
    .user-dropdown-btn {
      background: transparent;
      border: 1px solid transparent;
      display: flex;
      align-items: center;
      gap: 8px;
      cursor: pointer;
      padding: 4px 8px;
      border-radius: 8px;
      transition: all 0.2s ease;
    }
    
    .user-dropdown-btn:hover, 
    .user-dropdown-btn.active {
      background: var(--surface2, #f1f3f5);
      border-color: var(--border, #e5e7eb);
    }
    
    .user-name {
      font-size: 13px;
      font-weight: 500;
      color: var(--text, #1f2937);
      white-space: nowrap;
    }
    
    .dropdown-icon {
      color: var(--text3, #9ca3af);
      font-size: 14px;
      transition: transform 0.2s ease;
    }
    
    .user-dropdown-btn.active .dropdown-icon {
      transform: rotate(180deg);
    }

    .user-dropdown-menu {
      position: absolute;
      top: calc(100% + 8px);
      right: 0;
      background: #ffffff;
      border: 1px solid var(--border, #e5e7eb);
      border-radius: 8px;
      box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
      width: 220px;
      display: none;
      flex-direction: column;
      z-index: 1000;
      overflow: hidden;
    }

    .user-dropdown-menu.show {
      display: flex;
    }

    .dropdown-header {
      padding: 12px 16px;
      background: var(--surface, #fafafa);
    }

    .dropdown-header strong {
      font-size: 13px;
      color: var(--text, #1f2937);
      display: block;
    }

    .dropdown-header span {
      font-size: 11px;
      color: var(--text3, #6b7280);
      margin-top: 2px;
      display: block;
    }

    .dropdown-divider {
      border: none;
      border-top: 1px solid var(--border2, #f3f4f6);
      margin: 0;
    }

    .dropdown-item {
      padding: 10px 16px;
      display: flex;
      align-items: center;
      gap: 10px;
      text-decoration: none;
      color: var(--text2, #4b5563);
      font-size: 13px;
      transition: background 0.2s, color 0.2s;
    }

    .dropdown-item i {
      font-size: 16px;
      color: var(--text3, #9ca3af);
    }

    .dropdown-item:hover {
      background: var(--surface2, #f1f3f5);
      color: var(--blue, #2563eb);
    }

    .dropdown-item:hover i {
      color: var(--blue, #2563eb);
    }

    .dropdown-item.text-red {
      color: var(--red, #dc2626);
    }

    .dropdown-item.text-red i {
      color: var(--red, #dc2626);
    }

    .dropdown-item.text-red:hover {
      background: #fef2f2;
    }
